mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 21:03:42 -07:00
Merge branch 'HarbourMasters:develop' into develop
This commit is contained in:
commit
38a12d1689
9 changed files with 89 additions and 28 deletions
|
@ -92,6 +92,9 @@ namespace Game {
|
|||
|
||||
Settings.controller.dpad_pause_name = stob(Conf[ControllerSection]["dpad_pause_name"]);
|
||||
CVar_SetS32("gDpadPauseName", Settings.controller.dpad_pause_name);
|
||||
|
||||
Settings.controller.dpad_ocarina_text = stob(Conf[ControllerSection]["dpad_ocarina_text"]);
|
||||
CVar_SetS32("gDpadOcarinaText", Settings.controller.dpad_ocarina_text);
|
||||
|
||||
// Cheats
|
||||
Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]);
|
||||
|
@ -153,6 +156,7 @@ namespace Game {
|
|||
Conf[ControllerSection]["input_scale"] = std::to_string(Settings.controller.input_scale);
|
||||
Conf[ControllerSection]["input_enabled"] = std::to_string(Settings.controller.input_enabled);
|
||||
Conf[ControllerSection]["dpad_pause_name"] = std::to_string(Settings.controller.dpad_pause_name);
|
||||
Conf[ControllerSection]["dpad_ocarina_text"] = std::to_string(Settings.controller.dpad_ocarina_text);
|
||||
|
||||
// Cheats
|
||||
Conf[CheatSection]["debug_mode"] = std::to_string(Settings.cheats.debug_mode);
|
||||
|
|
|
@ -35,6 +35,7 @@ struct SoHConfigType {
|
|||
float gyroDriftY = 0.0f;
|
||||
bool input_enabled = false;
|
||||
bool dpad_pause_name = false;
|
||||
bool dpad_ocarina_text = false;
|
||||
} controller;
|
||||
|
||||
// Cheats
|
||||
|
|
|
@ -360,6 +360,11 @@ namespace SohImGui {
|
|||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("DPad Support in Ocarina and Text Choice", &Game::Settings.controller.dpad_ocarina_text)) {
|
||||
CVar_SetS32("gDpadOcarinaText", Game::Settings.controller.dpad_ocarina_text);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
|
|
@ -2397,6 +2397,9 @@ void FileChoose_Destroy(GameState* thisx);
|
|||
|
||||
char* SetQuote();
|
||||
|
||||
void Heaps_Alloc(void);
|
||||
void Heaps_Free(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -237,8 +237,8 @@ extern void(*D_801755D0)(void);
|
|||
extern u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE]; // 0xC00 bytes
|
||||
extern u8 gGfxSPTaskStack[0x400]; // 0x400 bytes
|
||||
extern GfxPool gGfxPools[2]; // 0x24820 bytes
|
||||
extern u8 gAudioHeap[0x38000]; // 0x38000 bytes
|
||||
extern u8 gSystemHeap[];
|
||||
extern u8* gAudioHeap;
|
||||
extern u8* gSystemHeap;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
|
|
@ -1,7 +1,43 @@
|
|||
#include "z64.h"
|
||||
#include <assert.h>
|
||||
#include <malloc.h>
|
||||
|
||||
// 0x38000 bytes
|
||||
u8 gAudioHeap[0x38000];
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
//u8 gSystemHeap[UNK_SIZE];
|
||||
u8 gSystemHeap[1024 * 1024 * 128];
|
||||
#define AUDIO_HEAP_SIZE 0x38000
|
||||
#define SYSTEM_HEAP_SIZE (1024 * 1024 * 128)
|
||||
|
||||
u8* gAudioHeap;
|
||||
u8* gSystemHeap;
|
||||
|
||||
void Heaps_Alloc(void)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
gAudioHeap = (u8*)_aligned_malloc(AUDIO_HEAP_SIZE, 0x10);
|
||||
gSystemHeap = (u8*)_aligned_malloc(SYSTEM_HEAP_SIZE, 0x10);
|
||||
#elif defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200112L)
|
||||
if (posix_memalign((void**)&gAudioHeap, 0x10, AUDIO_HEAP_SIZE) != 0)
|
||||
gAudioHeap = NULL;
|
||||
if (posix_memalign((void**)&gSystemHeap, 0x10, SYSTEM_HEAP_SIZE) != 0)
|
||||
gSystemHeap = NULL;
|
||||
#else
|
||||
gAudioHeap = (u8*)memalign(0x10, AUDIO_HEAP_SIZE);
|
||||
gSystemHeap = (u8*)memalign(0x10, SYSTEM_HEAP_SIZE);
|
||||
#endif
|
||||
|
||||
assert(gAudioHeap != NULL);
|
||||
assert(gSystemHeap != NULL);
|
||||
}
|
||||
|
||||
void Heaps_Free(void)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
_aligned_free(gAudioHeap);
|
||||
_aligned_free(gSystemHeap);
|
||||
#else
|
||||
free(gAudioHeap);
|
||||
free(gSystemHeap);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -824,10 +824,12 @@ NatureAmbienceDataIO sNatureAmbienceDataIO[20] = {
|
|||
},
|
||||
};
|
||||
|
||||
u32 sOcarinaAllowedBtnMask = 0x800F;
|
||||
s32 sOcarinaABtnMap = 0x8000;
|
||||
s32 sOcarinaCUPBtnMap = 8;
|
||||
s32 sOcarinaCDownBtnMap = 4;
|
||||
u32 sOcarinaAllowedBtnMask = (BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT);
|
||||
s32 sOcarinaABtnMap = BTN_A;
|
||||
s32 sOcarinaCUPBtnMap = BTN_CUP;
|
||||
s32 sOcarinaCDownBtnMap = BTN_CDOWN;
|
||||
s32 sOcarinaCLeftBtnMap = BTN_CLEFT;
|
||||
s32 sOcarinaCRightBtnMap = BTN_CRIGHT;
|
||||
u8 sOcarinaInpEnabled = 0;
|
||||
s8 D_80130F10 = 0; // "OCA", ocarina active?
|
||||
u8 sCurOcarinaBtnVal = 0xFF;
|
||||
|
@ -1245,19 +1247,23 @@ void func_800F56A8(void);
|
|||
void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId);
|
||||
s32 Audio_SetGanonDistVol(u8 targetVol);
|
||||
|
||||
void func_800EC960(u8 custom) {
|
||||
if (!custom) {
|
||||
osSyncPrintf("AUDIO : Ocarina Control Assign Normal\n");
|
||||
// Function originally not called, so repurposing for DPad input
|
||||
void func_800EC960(u8 dpad) {
|
||||
if (dpad) {
|
||||
sOcarinaAllowedBtnMask =
|
||||
(BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT | BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT);
|
||||
sOcarinaABtnMap = BTN_A;
|
||||
sOcarinaCUPBtnMap = BTN_CUP | BTN_DUP;
|
||||
sOcarinaCDownBtnMap = BTN_CDOWN | BTN_DDOWN;
|
||||
sOcarinaCLeftBtnMap = BTN_CLEFT | BTN_DLEFT;
|
||||
sOcarinaCRightBtnMap = BTN_CRIGHT | BTN_DRIGHT;
|
||||
} else {
|
||||
sOcarinaAllowedBtnMask = (BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT);
|
||||
sOcarinaABtnMap = BTN_A;
|
||||
sOcarinaCUPBtnMap = BTN_CUP;
|
||||
sOcarinaCDownBtnMap = BTN_CDOWN;
|
||||
} else {
|
||||
osSyncPrintf("AUDIO : Ocarina Control Assign Custom\n");
|
||||
sOcarinaAllowedBtnMask = (BTN_A | BTN_B | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT);
|
||||
sOcarinaABtnMap = BTN_B;
|
||||
sOcarinaCUPBtnMap = BTN_CDOWN;
|
||||
sOcarinaCDownBtnMap = BTN_A;
|
||||
sOcarinaCLeftBtnMap = BTN_CLEFT;
|
||||
sOcarinaCRightBtnMap = BTN_CRIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1542,6 +1548,7 @@ void func_800ED200(void) {
|
|||
|
||||
void func_800ED458(s32 arg0) {
|
||||
u32 phi_v1_2;
|
||||
bool dpad = CVar_GetS32("gDpadOcarinaText", 0);
|
||||
|
||||
if (D_80130F3C != 0 && D_80131880 != 0) {
|
||||
D_80131880--;
|
||||
|
@ -1561,6 +1568,7 @@ void func_800ED458(s32 arg0) {
|
|||
D_8016BA18 &= phi_v1_2;
|
||||
}
|
||||
|
||||
func_800EC960(dpad);
|
||||
if (D_8016BA18 & sOcarinaABtnMap) {
|
||||
osSyncPrintf("Presss NA_KEY_D4 %08x\n", sOcarinaABtnMap);
|
||||
sCurOcarinaBtnVal = 2;
|
||||
|
@ -1569,12 +1577,12 @@ void func_800ED458(s32 arg0) {
|
|||
osSyncPrintf("Presss NA_KEY_F4 %08x\n", sOcarinaCDownBtnMap);
|
||||
sCurOcarinaBtnVal = 5;
|
||||
sCurOcarinaBtnIdx = 1;
|
||||
} else if (D_8016BA18 & 1) {
|
||||
osSyncPrintf("Presss NA_KEY_A4 %08x\n", 1);
|
||||
} else if (D_8016BA18 & sOcarinaCRightBtnMap) {
|
||||
osSyncPrintf("Presss NA_KEY_A4 %08x\n", sOcarinaCRightBtnMap);
|
||||
sCurOcarinaBtnVal = 9;
|
||||
sCurOcarinaBtnIdx = 2;
|
||||
} else if (D_8016BA18 & 2) {
|
||||
osSyncPrintf("Presss NA_KEY_B4 %08x\n", 2);
|
||||
} else if (D_8016BA18 & sOcarinaCLeftBtnMap) {
|
||||
osSyncPrintf("Presss NA_KEY_B4 %08x\n", sOcarinaCRightBtnMap);
|
||||
sCurOcarinaBtnVal = 0xB;
|
||||
sCurOcarinaBtnIdx = 3;
|
||||
} else if (D_8016BA18 & sOcarinaCUPBtnMap) {
|
||||
|
@ -1671,7 +1679,7 @@ void Audio_OcaSetSongPlayback(s8 songIdxPlusOne, s8 playbackState) {
|
|||
|
||||
void Audio_OcaPlayback(void) {
|
||||
u32 noteTimerStep;
|
||||
u32 nextNoteTimerStep;
|
||||
u32 nextNoteTimerStep = 0;
|
||||
|
||||
if (sPlaybackState != 0) {
|
||||
if (sStaffPlaybackPos == 0) {
|
||||
|
@ -4772,7 +4780,7 @@ void Audio_SetCodeReverb(s8 reverb) {
|
|||
}
|
||||
|
||||
void func_800F6700(s8 arg0) {
|
||||
s8 sp1F;
|
||||
s8 sp1F = 0;
|
||||
|
||||
switch (arg0) {
|
||||
case 0:
|
||||
|
|
|
@ -63,6 +63,7 @@ void Main(void* arg) {
|
|||
PreNmiBuff_Init(gAppNmiBufferPtr);
|
||||
Fault_Init();
|
||||
SysCfb_Init(0);
|
||||
Heaps_Alloc();
|
||||
sysHeap = gSystemHeap;
|
||||
fb = SysCfb_GetFbPtr(0);
|
||||
gSystemHeapSize = 1024 * 1024 * 4;
|
||||
|
@ -131,4 +132,6 @@ void Main(void* arg) {
|
|||
osDestroyThread(&sGraphThread);
|
||||
func_800FBFD8();
|
||||
osSyncPrintf("mainproc 実行終了\n"); // "End of execution"
|
||||
|
||||
Heaps_Free();
|
||||
}
|
||||
|
|
|
@ -203,8 +203,9 @@ void Message_HandleChoiceSelection(GlobalContext* globalCtx, u8 numChoices) {
|
|||
static s16 sAnalogStickHeld = false;
|
||||
MessageContext* msgCtx = &globalCtx->msgCtx;
|
||||
Input* input = &globalCtx->state.input[0];
|
||||
bool dpad = CVar_GetS32("gDpadOcarinaText", 0);
|
||||
|
||||
if (input->rel.stick_y >= 30 && !sAnalogStickHeld) {
|
||||
if ((input->rel.stick_y >= 30 && !sAnalogStickHeld) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) {
|
||||
sAnalogStickHeld = true;
|
||||
msgCtx->choiceIndex--;
|
||||
if (msgCtx->choiceIndex > 128) {
|
||||
|
@ -212,7 +213,7 @@ void Message_HandleChoiceSelection(GlobalContext* globalCtx, u8 numChoices) {
|
|||
} else {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
} else if (input->rel.stick_y <= -30 && !sAnalogStickHeld) {
|
||||
} else if ((input->rel.stick_y <= -30 && !sAnalogStickHeld) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) {
|
||||
sAnalogStickHeld = true;
|
||||
msgCtx->choiceIndex++;
|
||||
if (msgCtx->choiceIndex > numChoices) {
|
||||
|
@ -3032,7 +3033,7 @@ void Message_Update(GlobalContext* globalCtx) {
|
|||
Input* input = &globalCtx->state.input[0];
|
||||
s16 var;
|
||||
s16 focusScreenPosX;
|
||||
s16 averageY;
|
||||
s16 averageY = 0;
|
||||
s16 playerFocusScreenPosY;
|
||||
s16 actorFocusScreenPosY;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue