Skip to content

Commit

Permalink
Merge pull request #96 from JCog/small-changes
Browse files Browse the repository at this point in the history
Various Smaller Changes Pt. 2
  • Loading branch information
JCog authored Oct 9, 2024
2 parents 559ac10 + b2039ee commit 48f6538
Show file tree
Hide file tree
Showing 18 changed files with 193 additions and 179 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Contributions are welcome! If you want to fix a bug or implement a feature yours

## Dependencies

Apart from glank's n64 toolchain, you will need to install clang-format and clang-tidy of at least version 16.
Apart from glank's n64 toolchain, you will need to install `clang-format` and `clang-tidy` of at least version 16.

Instuctions for adding the llvm apt repository for Ubuntu and Debian can be found [here](https://apt.llvm.org/).

If the only clang-format or clang-tidy versions available for you are older than 16, you will have to build clang from source. You can find everything you need for this at the [LLVM GitHub repository](https://github.com/llvm/llvm-project)
If the only `clang-format` or `clang-tidy` versions available for you are older than 16, you will have to build clang from source. You can find everything you need for this at the [LLVM GitHub repository](https://github.com/llvm/llvm-project)

## Pull Requests

Before you create a pull request with your changes, make sure your code actually builds and anything you changed works. Next, run the `format.py` script to ensure that everything matches fp's code style. Once you've done that, you're ready to create a pull request! When creating a pull request, make sure that it is to the `develop` branch and that any commit and pull request names accurately describe what your changes are.
Before you create a pull request with your changes, make sure your code actually builds and anything you changed works. Next, run the `format.py` script to ensure that everything matches fp's code style. Once you've done that, you're ready to create a pull request! Just be sure that any commit messages and pull request names/descriptions accurately describe what your changes are to help us out while we're reviewing.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# About
This is practice tool for Paper Mario 64 intended for use on N64 with an Everdrive and Wii/Wii U through the Virtual Console. It's also known informally as "the practice rom".
This is practice tool for Paper Mario 64 intended for use on N64 with an EverDrive and Wii/Wii U through the Virtual Console. It's also known informally as "the practice rom".

# Download
The latest release can be downloaded using the [web patcher](https://fp-patcher.starhaven.dev/).
Expand All @@ -8,20 +8,20 @@ The latest release can be downloaded using the [web patcher](https://fp-patcher.
See the [user manual](https://fp-docs.starhaven.dev/) for information on how to use fp.

# Building
To build from source, refer to [this guide](https://github.com/jcog/fp/blob/develop/BUILDING.md).
To build from source, refer to [this guide](BUILDING.md).

# Feedback
If you found a bug or have an idea for an enhancement or feature, please [create an issue](https://github.com/JCog/fp/issues).

For bugs, be sure to include all necessary steps to reproduce the bug, and describe the expected and observed behavior in detail. For enhancements or features, include a detailed description of your proposed changes, how they should be designed, how they will fit in with the current design, and possibly how they should be implemented. Do not submit suggestions that are too subjective to be considered improvements.

# Contributing
For instructions on how to contribute, follow [this guide](https://github.com/jcog/fp/blob/develop/CONTRIBUTING.md).
For instructions on how to contribute, follow [this guide](CONTRIBUTING.md).

# Thanks
First and foremost, this project wouldn't be possible without [glank](https://github.com/glankk) and the Ocarina of Time practice ROM, [gz](https://github.com/glankk/gz). The same toolchain is used for fp, and many parts of the code are lifted straight from gz.

Second, a big thank you goes to [fig02](https://github.com/fig02) and [krimtonz](https://github.com/krimtonz). Fig was the one to initially setup the fp repo and get the project started, and krim was instrumental in getting the project working in the first place.
Second, a big thank-you goes to [fig02](https://github.com/fig02) and [krimtonz](https://github.com/krimtonz). Fig was the one to initially set up the fp repo and get the project started, and krim was instrumental in getting the project working in the first place.

The work that the [Paper Mario decompilation](https://github.com/pmret/papermario) team has put in has also been incredibly useful. Many of the features in fp would have either been much harder, or even downright impossible to get working without the insight into Paper Mario's code that decomp has provided.

Expand Down
77 changes: 39 additions & 38 deletions lib/libpm-jp.a
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
osMemSize = 0x80000318;
pm_gGameStatus = 0x80074004;
pm_gCurrentCameraID = 0x800773E0;
pm_gItemTable = 0x800878B0;
pm_gItemHudScripts = 0x8008A650;
pm_gAreas = 0x800934C0;
nuScRetraceCounter = 0x80093B64;
pm_gEncounterSubState = 0x8009A5B0;
pm_timeFreezeMode = 0x8009A5B8;
pm_gEncounterState = 0x8009A5E0;
pm_gSoundManager = 0x8009A620;
nuGfxCfb_ptr = 0x8009A62C;
pm_gOverrideFlags = 0x8009A630;
pm_gMainGfxPos = 0x8009A64C;
pm_LogicalSaveInfo = 0x8009BA10;
pm_CurGameMode = 0x8009E700;
pm_gMapTransitionAlpha = 0x8009E750;
pm_gMapTransitionState = 0x8009E754;
pm_gCurrentEncounter = 0x800B0EF0;
pm_gCameras = 0x800B1D60;
pm_gEffectInstances = 0x800B4378;
pm_gSaveGlobals = 0x800D95C8;
__osEventStateTab = 0x800D9F60;
pm_gCurrentSaveFile = 0x800DACA0;
pm_gBattleState = 0x800DC048;
pm_gBattleStatus = 0x800DC050;
pm_gBattleSubState = 0x800DC4BC;
pm_PlayerActionsTable = 0x800F7E1C;
pm_gPopupState = 0x8010D800;
pm_gPartnerActionStatus = 0x8010ED70;
pm_gUiStatus = 0x8010F118;
pm_gPlayerStatus = 0x8010F188;
pm_gHudElementSizes = 0x8015406C;
pm_MusicCurrentVolume = 0x8015EA66;
pm_gActionCommandStatus = 0x8029FED0;
pm_gNumScripts = 0x802DA488;
pm_gCurrentScriptListPtr = 0x802DA890;
pm_gScriptIndexList = 0x802DA898;
osMemSize = 0x80000318;
pm_gGameStatus = 0x80074004;
pm_gCurrentCameraID = 0x800773E0;
pm_gItemTable = 0x800878B0;
pm_gItemHudScripts = 0x8008A650;
pm_gAreas = 0x800934C0;
nuScRetraceCounter = 0x80093B64;
pm_gEncounterSubState = 0x8009A5B0;
pm_timeFreezeMode = 0x8009A5B8;
pm_gEncounterState = 0x8009A5E0;
pm_gSoundManager = 0x8009A620;
nuGfxCfb_ptr = 0x8009A62C;
pm_gOverrideFlags = 0x8009A630;
pm_gMainGfxPos = 0x8009A64C;
pm_LogicalSaveInfo = 0x8009BA10;
pm_CurGameMode = 0x8009E700;
pm_gMapTransitionAlpha = 0x8009E750;
pm_gMapTransitionState = 0x8009E754;
pm_gCurrentEncounter = 0x800B0EF0;
pm_gCameras = 0x800B1D60;
pm_gEffectInstances = 0x800B4378;
pm_gSaveGlobals = 0x800D95C8;
__osEventStateTab = 0x800D9F60;
pm_gCurrentSaveFile = 0x800DACA0;
pm_gBattleState = 0x800DC048;
pm_gBattleStatus = 0x800DC050;
pm_gBattleSubState = 0x800DC4BC;
pm_PlayerActionsTable = 0x800F7E1C;
pm_gPopupState = 0x8010D800;
pm_gPartnerStatus = 0x8010ED70;
pm_gUiStatus = 0x8010F118;
pm_gPlayerStatus = 0x8010F188;
pm_gHudElementSizes = 0x8015406C;
pm_MusicCurrentVolume = 0x8015EA66;
pm_gActionCommandStatus = 0x8029FED0;
pm_battle_move_power_bounce_BaseHitChance = 0x802A2730;
pm_gNumScripts = 0x802DA488;
pm_gCurrentScriptListPtr = 0x802DA890;
pm_gScriptIndexList = 0x802DA898;

osSyncPrintf = 0x80025CFC;
pm_step_game_loop = 0x80026710;
Expand Down
77 changes: 39 additions & 38 deletions lib/libpm-us.a
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
osMemSize = 0x80000318;
pm_gGameStatus = 0x80074024;
pm_gCurrentCameraID = 0x80077410;
pm_gItemTable = 0x800878E0;
pm_gItemHudScripts = 0x8008A680;
pm_gAreas = 0x800934F0;
nuScRetraceCounter = 0x80093B94;
pm_gEncounterSubState = 0x8009A5D0;
pm_timeFreezeMode = 0x8009A5D8;
pm_gEncounterState = 0x8009A600;
pm_gSoundManager = 0x8009A640;
nuGfxCfb_ptr = 0x8009A64C;
pm_gOverrideFlags = 0x8009A650;
pm_gMainGfxPos = 0x8009A66C;
pm_LogicalSaveInfo = 0x8009BA30;
pm_CurGameMode = 0x800A08F0;
pm_gMapTransitionAlpha = 0x800A0940;
pm_gMapTransitionState = 0x800A0944;
pm_gCurrentEncounter = 0x800B0F10;
pm_gCameras = 0x800B1D80;
pm_gEffectInstances = 0x800B4398;
pm_gSaveGlobals = 0x800D95E8;
__osEventStateTab = 0x800D9F80;
pm_gCurrentSaveFile = 0x800DACC0;
pm_gBattleState = 0x800DC068;
pm_gBattleStatus = 0x800DC070;
pm_gBattleSubState = 0x800DC4DC;
pm_PlayerActionsTable = 0x800F7C8C;
pm_gPopupState = 0x8010D640;
pm_gPartnerActionStatus = 0x8010EBB0;
pm_gUiStatus = 0x8010EF58;
pm_gPlayerStatus = 0x8010EFC8;
pm_gHudElementSizes = 0x8014EFCC;
pm_MusicCurrentVolume = 0x80159AE6;
pm_gActionCommandStatus = 0x8029FBE0;
pm_gNumScripts = 0x802DA488;
pm_gCurrentScriptListPtr = 0x802DA890;
pm_gScriptIndexList = 0x802DA898;
osMemSize = 0x80000318;
pm_gGameStatus = 0x80074024;
pm_gCurrentCameraID = 0x80077410;
pm_gItemTable = 0x800878E0;
pm_gItemHudScripts = 0x8008A680;
pm_gAreas = 0x800934F0;
nuScRetraceCounter = 0x80093B94;
pm_gEncounterSubState = 0x8009A5D0;
pm_timeFreezeMode = 0x8009A5D8;
pm_gEncounterState = 0x8009A600;
pm_gSoundManager = 0x8009A640;
nuGfxCfb_ptr = 0x8009A64C;
pm_gOverrideFlags = 0x8009A650;
pm_gMainGfxPos = 0x8009A66C;
pm_LogicalSaveInfo = 0x8009BA30;
pm_CurGameMode = 0x800A08F0;
pm_gMapTransitionAlpha = 0x800A0940;
pm_gMapTransitionState = 0x800A0944;
pm_gCurrentEncounter = 0x800B0F10;
pm_gCameras = 0x800B1D80;
pm_gEffectInstances = 0x800B4398;
pm_gSaveGlobals = 0x800D95E8;
__osEventStateTab = 0x800D9F80;
pm_gCurrentSaveFile = 0x800DACC0;
pm_gBattleState = 0x800DC068;
pm_gBattleStatus = 0x800DC070;
pm_gBattleSubState = 0x800DC4DC;
pm_PlayerActionsTable = 0x800F7C8C;
pm_gPopupState = 0x8010D640;
pm_gPartnerStatus = 0x8010EBB0;
pm_gUiStatus = 0x8010EF58;
pm_gPlayerStatus = 0x8010EFC8;
pm_gHudElementSizes = 0x8014EFCC;
pm_MusicCurrentVolume = 0x80159AE6;
pm_gActionCommandStatus = 0x8029FBE0;
pm_battle_move_power_bounce_BaseHitChance = 0x802A2730;
pm_gNumScripts = 0x802DA488;
pm_gCurrentScriptListPtr = 0x802DA890;
pm_gScriptIndexList = 0x802DA898;

osSyncPrintf = 0x80025CFC;
pm_step_game_loop = 0x80026740;
Expand Down
48 changes: 34 additions & 14 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct Command fpCommands[COMMAND_MAX] = {
{"break free", COMMAND_PRESS_ONCE, 0, commandBreakFreeProc },
{"toggle in. disp.", COMMAND_PRESS_ONCE, 0, commandToggleInpDispProc },
{"clippy", COMMAND_PRESS_ONCE, 0, commandClippyProc },
{"store ability", COMMAND_PRESS_ONCE, 0, commandStoreAbility },
};

void showMenu(void) {
Expand Down Expand Up @@ -228,19 +229,13 @@ void commandSaveGameProc(void) {
fpLog("saved to slot %d", pm_gGameStatus.saveSlot);
}

void commandStartStopTimerProc(void) {
timerStartStop();
}

void commandResetTimerProc(void) {
timerReset();
}

void commandShowHideTimerProc(void) {
settings->timerShow = !settings->timerShow;
}

void commandLoadGameProc(void) {
// prevent loading before being in game
if (pm_CurGameMode < 4 || pm_CurGameMode >= 12 || pm_gGameStatus.demoState) {
fpLog("can't load right now");
return;
}

pm_SaveData *file = malloc(sizeof(*file));
pm_fio_fetch_saved_file_info();
pm_fio_read_flash(pm_LogicalSaveInfo[pm_gGameStatus.saveSlot][0], file, sizeof(*file));
Expand All @@ -255,6 +250,18 @@ void commandLoadGameProc(void) {
free(file);
}

void commandStartStopTimerProc(void) {
timerStartStop();
}

void commandResetTimerProc(void) {
timerReset();
}

void commandShowHideTimerProc(void) {
settings->timerShow = !settings->timerShow;
}

void commandBreakFreeProc(void) {
s32 thirdByteMask = 0xFFFF00FF;
s32 checkMask = 0x0000FF00;
Expand All @@ -272,11 +279,24 @@ void commandToggleInpDispProc(void) {
void commandClippyProc(void) {
if (pm_gPlayerStatus.enableCollisionOverlapsCheck) {
pm_gPlayerStatus.enableCollisionOverlapsCheck = 0;
pm_gPartnerActionStatus.shouldResumeAbility = 0;
pm_gPartnerStatus.shouldResumeAbility = 0;
fpLog("clippy disabled");
} else {
pm_gPlayerStatus.enableCollisionOverlapsCheck = 1;
pm_gPartnerActionStatus.shouldResumeAbility = 1;
pm_gPartnerStatus.shouldResumeAbility = 1;
fpLog("clippy enabled");
}
}

void commandStoreAbility(void) {
// useful for getting sushie glitch and warping to entrances over lava with laki
if (pm_gGameStatus.keepUsingPartnerOnMapChange) {
pm_gPartnerStatus.partnerActionState = 0;
pm_gGameStatus.keepUsingPartnerOnMapChange = 0;
fpLog("partner ability disabled");
} else {
pm_gPartnerStatus.partnerActionState = 1;
pm_gGameStatus.keepUsingPartnerOnMapChange = 1;
fpLog("partner ability stored");
}
}
2 changes: 2 additions & 0 deletions src/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum Commands {
COMMAND_BREAK_FREE,
COMMAND_TOGGLE_INPUT_DISPLAY,
COMMAND_CLIPPY,
COMMAND_STORE_ABILITY,
COMMAND_MAX
};

Expand Down Expand Up @@ -57,6 +58,7 @@ void commandShowHideTimerProc(void);
void commandBreakFreeProc(void);
void commandToggleInpDispProc(void);
void commandClippyProc(void);
void commandStoreAbility(void);

extern struct Command fpCommands[COMMAND_MAX];

Expand Down
17 changes: 15 additions & 2 deletions src/fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <stdlib.h>
#include <string.h>

FpCtxt fp = {.savedArea = 0x1c, .camDistMin = 100, .camDistMax = 1000};
FpCtxt fp = {.savedArea = 0x1c, .camDistMin = 100, .camDistMax = 1000, .freeCamMoveSpeed = 250, .freeCamPanSpeed = 70};

// Initializes and uses new stack instead of using games main thread stack.
static void initStack(void (*func)(void)) {
Expand Down Expand Up @@ -320,7 +320,7 @@ void fpUpdateCheats(void) {
pm_gPlayerStatus.playerData.curHP = 1;
}
if (CHEAT_ACTIVE(CHEAT_AUTO_MASH)) {
if (pm_gGameStatus.isBattle) {
if (pm_gGameStatus.isBattle == 1) {
pm_gActionCommandStatus.barFillLevel = 10000;
}
}
Expand All @@ -329,6 +329,11 @@ void fpUpdateCheats(void) {
pm_gActionCommandStatus.autoSucceed =
pm_gActionCommandStatus.actionCommandID != 23 || pm_gActionCommandStatus.unk_5D < 14;
}
if (CHEAT_ACTIVE(CHEAT_POWER_BOUNCE)) {
if (pm_gBattleStatus.selectedMoveID == 0x20) {
pm_battle_move_power_bounce_BaseHitChance = 200;
}
}
if (CHEAT_ACTIVE(CHEAT_BRIGHTEN_ROOM)) {
pm_set_screen_overlay_alpha(1, 0);
}
Expand Down Expand Up @@ -442,6 +447,14 @@ void fpUpdate(void) {

if (pm_CurGameMode == 0) { // GAME_MODE_STARTUP
pm_fio_load_globals();
// normally set during GAME_MODE_STARTUP
pm_gGameStatus.soundOutputMode = !pm_gSaveGlobals.useMonoSound;
if (pm_gSaveGlobals.useMonoSound) {
pm_audio_set_mono();
} else {
pm_audio_set_stereo();
}

if (settings->quickLaunch && pm_fio_load_game(pm_gSaveGlobals.lastFileSelected)) {
// quick launch
pm_set_game_mode(7); // GAME_MODE_ENTER_WORLD
Expand Down
6 changes: 2 additions & 4 deletions src/fp.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ typedef struct {
FpControllerMask inputMask;
bool camEnabledBefore;
pm_Camera savedCam;
s8 freeCamMoveSpeed;
s8 freeCamPanSpeed;
u16 freeCamMoveSpeed;
u16 freeCamPanSpeed;
} FpCtxt;

extern FpCtxt fp;
Expand All @@ -82,8 +82,6 @@ s32 fpImportFile(const char *path, void *data);
void fpSetInputMask(u32 pad, s8 x, s8 y);
void fpUpdateCam(void);
void fpSaveSettingsProc(struct MenuItem *item, void *data);
void setFreeCamMoveSpeed(s8 s);
void setFreeCamPanSpeed(s8 s);

struct Menu *createWarpsMenu(void);
struct Menu *createCheatsMenu(void);
Expand Down
Loading

0 comments on commit 48f6538

Please sign in to comment.