More TU Matching in PAL (#469)

* Fix w20Dll linking

* Match some more TUs in PAL

* Fix NTSC Build
This commit is contained in:
Liam Coleman 2024-11-16 21:02:31 -06:00 committed by GitHub
parent 76ad3ea249
commit 42a72ba07f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 138 additions and 22 deletions

View file

@ -373,13 +373,13 @@ config.libs = [
"cflags": cflags_game,
"host": False,
"objects": [
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "game/main.c"),
Object(Matching, "game/main.c"),
Object(Matching, "game/pad.c"),
Object(Matching, "game/dvd.c"),
Object(Matching, "game/data.c"),
Object(Matching, "game/decode.c"),
Object(Matching, "game/font.c"),
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "game/init.c"),
Object(Matching, "game/init.c"),
Object(Matching, "game/jmp.c"),
Object(Matching, "game/malloc.c"),
Object(Matching, "game/memory.c"),
@ -400,7 +400,7 @@ config.libs = [
Object(Matching, "game/objsysobj.c"),
Object(Matching, "game/objdll.c"),
Object(Matching, "game/frand.c"),
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "game/audio.c"),
Object(Matching, "game/audio.c"),
Object(Matching, "game/EnvelopeExec.c"),
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "game/minigame_seq.c"),
Object(Matching, "game/ovllist.c"),
@ -411,7 +411,7 @@ config.libs = [
Object(Matching, "game/wipe.c"),
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "game/window.c"),
Object(Matching, "game/messdata.c"),
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "game/card.c"),
Object(Matching, "game/card.c"),
Object(Matching, "game/armem.c"),
Object(Matching, "game/chrman.c"),
Object(Matching, "game/mapspace.c"),
@ -420,7 +420,7 @@ config.libs = [
Object(Matching, "game/thpmain.c"),
Object(Matching, "game/objsub.c"),
Object(Matching, "game/flag.c"),
Object(MatchingFor("GMPE01_00", "GMPE01_01"), "game/saveload.c"),
Object(Matching, "game/saveload.c"),
Object(Matching, "game/sreset.c"),
Object(Matching, "game/board/main.c"),
Object(Matching, "game/board/player.c"),

View file

@ -47,6 +47,7 @@ void GXCopyDisp(void* dest, GXBool clear);
void GXSetDispCopyGamma(GXGamma gamma);
void GXSetDispCopySrc(u16 left, u16 top, u16 wd, u16 ht);
void GXSetDispCopyDst(u16 wd, u16 ht);
f32 GXGetYScaleFactor(u16 efbHeight, u16 xfbHeight);
u32 GXSetDispCopyYScale(f32 vscale);
void GXSetCopyFilter(GXBool aa, u8 sample_pattern[12][2], GXBool vf, u8 vfilter[7]);
void GXSetPixelFmt(GXPixelFmt pix_fmt, GXZFmt16 z_fmt);

View file

@ -555,10 +555,11 @@ void HuAudAUXVolSet(s8 arg0, s8 arg1) {
void HuAudVoiceInit(s16 ovl) {
SNDGRPTBL *var_r29;
OSTick temp_r23;
s16 var_r27;
s16 temp_r26;
s16 temp_r25;
s16 temp_r30;
s16 var_r27;
void *temp_r3;
s16 i;
@ -602,7 +603,11 @@ void HuAudVoiceInit(s16 ovl) {
charVoiceGroupStat[temp_r30] = 1;
temp_r26 = temp_r30 + 0xA;
temp_r3 = HuMemDirectMalloc(HEAP_DATA, msmSysGetSampSize(temp_r26));
#if VERSION_NTSC
msmSysLoadGroupBase(temp_r26, temp_r3);
#else
temp_r25 = msmSysLoadGroupBase(temp_r26, temp_r3);
#endif
HuMemDirectFree(temp_r3);
}
}

View file

@ -1,6 +1,7 @@
#include "dolphin.h"
#include "game/memory.h"
#include "game/card.h"
#include "version.h"
static void *cardWork;
u8 UnMountCnt;
@ -98,7 +99,11 @@ s32 HuCardFormat(s16 slot)
static void MountCallBack(s32 chan, s32 result)
{
#if VERSION_ENG
UnMountCnt = (1 << chan);
#else
UnMountCnt |= (1 << chan);
#endif
}
s32 HuCardOpen(s16 slot, const char *fileName, CARDFileInfo *fileInfo)

View file

@ -39,6 +39,8 @@ static void InitVI();
static void SwapBuffers();
static void LoadMemInfo();
#define ASSERT_LINE(ntsc, pal) ((VERSION_NTSC) ? (ntsc) : (pal))
void HuSysInit(GXRenderModeObj *mode)
{
u32 rnd_temp;
@ -46,13 +48,19 @@ void HuSysInit(GXRenderModeObj *mode)
DVDInit();
VIInit();
PADInit();
#if VERSION_NTSC
if(OSGetProgressiveMode() == 1 && VIGetDTVStatus() == 1) {
mode = &GXNtsc480Prog;
}
#else
mode->efbHeight = 480;
#endif
InitRenderMode(mode);
InitMem();
VIConfigure(RenderMode);
#if VERSION_NTSC
VIConfigurePan(0, 0, 640, 480);
#endif
DefaultFifo = OSAlloc(0x100000);
DefaultFifoObj = GXInit(DefaultFifo, 0x100000);
InitGX();
@ -91,7 +99,7 @@ static void InitRenderMode(GXRenderModeObj *mode)
break;
default:
OSPanic("init.c", 169, "DEMOInit: invalid TV format\n");
OSPanic("init.c", ASSERT_LINE(169, 167), "DEMOInit: invalid TV format\n");
break;
}
GXAdjustForOverscan(RenderMode, &rmodeobj, 0, 16);
@ -104,7 +112,12 @@ static void InitGX()
GXSetScissor(0, 0, RenderMode->fbWidth, RenderMode->efbHeight);
GXSetDispCopySrc(0, 0, RenderMode->fbWidth, RenderMode->efbHeight);
GXSetDispCopyDst(RenderMode->fbWidth, RenderMode->xfbHeight);
#if VERSION_NTSC
GXSetDispCopyYScale((float)RenderMode->xfbHeight/(float)RenderMode->efbHeight);
#else
OSReport("%D\n", RenderMode->xfbHeight);
GXSetDispCopyYScale(GXGetYScaleFactor(RenderMode->efbHeight, RenderMode->xfbHeight));
#endif
GXSetCopyFilter(RenderMode->aa, RenderMode->sample_pattern, GX_TRUE, RenderMode->vfilter);
if(RenderMode->aa) {
GXSetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);
@ -120,9 +133,21 @@ static void InitMem()
void *arena_lo = OSGetArenaLo();
void *arena_hi = OSGetArenaHi();
u32 fb_size = (u16)(((u16)RenderMode->fbWidth+15) & ~15)*RenderMode->xfbHeight*2;
u32 *fb1;
u32 *fb2;
u32 i;
DemoFrameBuffer1 = (void *)OSRoundUp32B((u32)arena_lo);
DemoFrameBuffer2 = (void *)OSRoundUp32B((u32)DemoFrameBuffer1+fb_size);
DemoCurrentBuffer = DemoFrameBuffer2;
#if VERSION_PAL
fb1 = DemoFrameBuffer1;
fb2 = DemoFrameBuffer2;
for(i=0; i<fb_size/4; i++, fb1++, fb2++) {
*fb1 = *fb2 = 0x800080;
}
DCStoreRangeNoSync(DemoFrameBuffer1, fb_size);
DCStoreRangeNoSync(DemoFrameBuffer2, fb_size);
#endif
arena_lo = (void *)OSRoundUp32B((u32)DemoFrameBuffer2+fb_size);
OSSetArenaLo(arena_lo);
if(OSGetConsoleType() == OS_CONSOLE_DEVHW1 && OSGetPhysicalMemSize() != 0x400000 && OSGetConsoleSimulatedMemSize() < 0x1800000) {
@ -256,7 +281,7 @@ static void LoadMemInfo()
OSReport("loop\n");
copy_size = (size < 32) ? size : 32;
if(DVDRead(&file, buf_ptr, OSRoundUp32B(copy_size), offset) < 0) {
OSPanic("init.c", 576, "An error occurred when issuing read to /meminfo.bin\n");
OSPanic("init.c", ASSERT_LINE(576, 586), "An error occurred when issuing read to /meminfo.bin\n");
}
entries = copy_size/sizeof(struct memory_info);
for(i=0; i<entries; i++) {

View file

@ -43,10 +43,17 @@ void main(void)
u32 met1;
s16 i;
s32 retrace;
#if VERSION_PAL
s16 temp = 0;
#endif
HuDvdErrWait = 0;
SystemInitF = 0;
#if VERSION_NTSC
HuSysInit(&GXNtsc480IntDf);
#else
HuSysInit(&GXPal528IntDf);
#endif
HuPrcInit();
HuPadInit();
GWInit();

View file

@ -11,6 +11,14 @@
#include "string.h"
#include "stddef.h"
#if VERSION_ENG
#define SAVE_WRITE_BEGIN _SetFlag(FLAG_ID_MAKE(3, 0));
#define SAVE_WRITE_END _ClearFlag(FLAG_ID_MAKE(3, 0));
#else
#define SAVE_WRITE_BEGIN
#define SAVE_WRITE_END
#endif
#define SAVE_GET_PLAYER(player_idx) &saveBuf.buf[((player_idx)*sizeof(PlayerState))+offsetof(SaveBufData, player)]
#define SAVE_GET_PLAYER_STORY(player_idx) &saveBuf.buf[((player_idx)*sizeof(PlayerState))+offsetof(SaveBufData, playerStory)]
@ -135,9 +143,9 @@ s32 SLFileCreate(char *fileName, u32 size, void *addr) {
HuWinExAnimIn(window);
HuWinMesSet(window, MAKE_MESSID(16, 11));
HuWinMesWait(window);
_SetFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_BEGIN
result = HuCardCreate(curSlotNo, fileName, size, &curFileInfo);
_ClearFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_END
if (result < 0) {
HuWinExAnimOut(window);
HuWinExCleanup(window);
@ -150,9 +158,9 @@ s32 SLFileCreate(char *fileName, u32 size, void *addr) {
SLMessOut(1);
return CARD_RESULT_FATAL_ERROR;
}
_SetFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_BEGIN
result = HuCardWrite(&curFileInfo, addr, size, 0);
_ClearFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_END
if (result < 0) {
HuWinExAnimOut(window);
HuWinExCleanup(window);
@ -165,9 +173,9 @@ s32 SLFileCreate(char *fileName, u32 size, void *addr) {
SLMessOut(1);
return CARD_RESULT_FATAL_ERROR;
}
_SetFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_BEGIN
result = SLStatSet(1);
_ClearFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_END
HuWinExAnimOut(window);
HuWinExCleanup(window);
if (result < 0) {
@ -191,12 +199,12 @@ s32 SLFileWrite(s32 length, void *addr) {
HuWinMesSet(window, MAKE_MESSID(16, 11));
HuWinMesWait(window);
HuPrcSleep(60);
_SetFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_BEGIN
result = HuCardWrite(&curFileInfo, addr, length, 0);
if (result == 0) {
result = SLStatSet(1);
}
_ClearFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_END
HuWinExAnimOut(window);
HuWinExCleanup(window);
return result;
@ -278,6 +286,7 @@ void SLSaveDataInfoSet(OSTime *time) {
s16 digit;
OSCalendarTime sp8;
#if VERSION_ENG
OSTicksToCalendarTime(*time, &sp8);
saveBuf.data.comment[37] = curBoxNo + '1';
digit = (sp8.mon + 1) / 10;
@ -299,6 +308,52 @@ void SLSaveDataInfoSet(OSTime *time) {
saveBuf.data.comment[48] = digit + '0';
year -= digit * 10;
saveBuf.data.comment[49] = year + '0';
#elif VERSION_PAL
OSTicksToCalendarTime(*time, &sp8);
saveBuf.data.comment[37] = curBoxNo + '1';
digit = sp8.mday / 10;
saveBuf.data.comment[40] = digit + '0';
digit = sp8.mday % 10;
saveBuf.data.comment[41] = digit + '0';
digit = (sp8.mon + 1) / 10;
saveBuf.data.comment[43] = digit + '0';
digit = (sp8.mon + 1) % 10;
saveBuf.data.comment[44] = digit + '0';
year = sp8.year;
digit = year / 1000;
saveBuf.data.comment[46] = digit + '0';
year -= digit * 1000;
digit = year / 100;
saveBuf.data.comment[47] = digit + '0';
year -= digit * 100;
digit = year / 10;
saveBuf.data.comment[48] = digit + '0';
year -= digit * 10;
saveBuf.data.comment[49] = year + '0';
#else
//TODO: Japanese Version
OSTicksToCalendarTime(*time, &sp8);
saveBuf.data.comment[37] = curBoxNo + '1';
digit = sp8.mday / 10;
saveBuf.data.comment[40] = digit + '0';
digit = sp8.mday % 10;
saveBuf.data.comment[41] = digit + '0';
digit = (sp8.mon + 1) / 10;
saveBuf.data.comment[43] = digit + '0';
digit = (sp8.mon + 1) % 10;
saveBuf.data.comment[44] = digit + '0';
year = sp8.year;
digit = year / 1000;
saveBuf.data.comment[46] = digit + '0';
year -= digit * 1000;
digit = year / 100;
saveBuf.data.comment[47] = digit + '0';
year -= digit * 100;
digit = year / 10;
saveBuf.data.comment[48] = digit + '0';
year -= digit * 10;
saveBuf.data.comment[49] = year + '0';
#endif
}
void SLCommonSet(void) {
@ -409,6 +464,12 @@ block_36:
return 0;
}
#if VERSION_NTSC
#define SAVEWIN_POS 150
#else
#define SAVEWIN_POS 120
#endif
static s16 SLCreateSaveWin(void) {
float size[2];
s16 window;
@ -416,7 +477,7 @@ static s16 SLCreateSaveWin(void) {
HuWinInit(1);
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
HuWinMesMaxSizeGet(1, size, MAKE_MESSID(16, 68));
window = HuWinExCreateStyled(-10000.0f, 150.0f, size[0], size[1], -1, 2);
window = HuWinExCreateStyled(-10000.0f, SAVEWIN_POS, size[0], size[1], -1, 2);
saveMessWin = window;
HuWinExAnimIn(window);
HuWinInsertMesSet(window, MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
@ -641,7 +702,7 @@ s32 SLFormat(s16 slotNo) {
HuWinInit(1);
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
HuWinMesMaxSizeGet(1, winSize, MAKE_MESSID(16, 56));
window1 = HuWinExCreateStyled(-10000.0f, 150.0f, winSize[0], winSize[1], -1, 2);
window1 = HuWinExCreateStyled(-10000.0f, SAVEWIN_POS, winSize[0], winSize[1], -1, 2);
HuWinExAnimIn(window1);
HuWinInsertMesSet(window1, MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
HuWinMesSet(window1, MAKE_MESSID(16, 56));
@ -659,9 +720,9 @@ s32 SLFormat(s16 slotNo) {
SLMessOut(12);
return 0;
}
_SetFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_BEGIN
result = HuCardFormat(curSlotNo);
_ClearFlag(FLAG_ID_MAKE(3, 0));
SAVE_WRITE_END
if (result < 0) {
HuWinExAnimOut(window1);
HuWinExCleanup(window1);
@ -721,11 +782,19 @@ s16 SLMessOut(s16 mess) {
case 2:
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
slot_mess = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
#if VERSION_NTSC
save_mess = MAKE_MESSID(16, 74);
#else
save_mess = MAKE_MESSID(16, 72);
#endif
break;
case 3:
#if VERSION_NTSC
save_mess = MAKE_MESSID(16, 74);
#else
save_mess = MAKE_MESSID(16, 72);
#endif
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
slot_mess = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
break;
@ -772,7 +841,11 @@ s16 SLMessOut(s16 mess) {
case 11:
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
slot_mess = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
#if VERSION_NTSC
save_mess = MAKE_MESSID(16, 72);
#else
save_mess = MAKE_MESSID(16, 76);
#endif
break;
case 12: