Add more stubs
This commit is contained in:
parent
670a2c4c62
commit
69ff202bae
6 changed files with 220 additions and 137 deletions
|
|
@ -21,6 +21,7 @@ set(DOLPHIN_FILES
|
|||
)
|
||||
|
||||
set(GAME_FILES
|
||||
src/game/card.c
|
||||
src/game/fault.c
|
||||
src/game/frand.c
|
||||
src/game/main.c
|
||||
|
|
|
|||
|
|
@ -2,8 +2,13 @@
|
|||
#define _GAME_PROCESS_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "game/jmp.h"
|
||||
|
||||
#ifdef TARGET_PC
|
||||
#include <setjmp.h>
|
||||
typedef int JMPBUF;
|
||||
#else
|
||||
#include "game/jmp.h"
|
||||
#endif
|
||||
|
||||
#define PROCESS_STAT_PAUSE 0x1
|
||||
#define PROCESS_STAT_UPAUSE 0x2
|
||||
|
|
|
|||
|
|
@ -79,12 +79,12 @@ void HuSysInit(GXRenderModeObj *mode)
|
|||
HuDvdErrDispInit(RenderMode, DemoFrameBuffer1, DemoFrameBuffer2);
|
||||
rnd_temp = frand();
|
||||
HuMemInitAll();
|
||||
// HuAudInit();
|
||||
//HuARInit();
|
||||
// minimumVcount = minimumVcountf = 1.0f;
|
||||
// worstVcount = 0;
|
||||
// OSInitFastCast();
|
||||
// HuCardInit();
|
||||
HuAudInit();
|
||||
HuARInit();
|
||||
minimumVcount = minimumVcountf = 1.0f;
|
||||
worstVcount = 0;
|
||||
OSInitFastCast();
|
||||
HuCardInit();
|
||||
}
|
||||
|
||||
static void InitRenderMode(GXRenderModeObj *mode)
|
||||
|
|
@ -199,44 +199,44 @@ void HuSysBeforeRender()
|
|||
|
||||
void HuSysDoneRender(s32 retrace_count)
|
||||
{
|
||||
// s32 retrace_dist;
|
||||
// if(DemoStatEnable) {
|
||||
// GXDrawDone();
|
||||
// DEMOUpdateStats(1);
|
||||
// DEMOPrintStats();
|
||||
// GXDrawDone();
|
||||
// DEMOUpdateStats(0);
|
||||
// }
|
||||
// GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
// GXSetColorUpdate(GX_TRUE);
|
||||
// GXDrawDone();
|
||||
// GXCopyDisp(DemoCurrentBuffer, GX_TRUE);
|
||||
// if(minimumVcount != 0) {
|
||||
// retrace_dist = VIGetRetraceCount()-retrace_count;
|
||||
// if(worstVcount < retrace_dist) {
|
||||
// worstVcount = retrace_dist;
|
||||
// }
|
||||
// while(VIGetRetraceCount()-retrace_count < minimumVcount-1) {
|
||||
// VIWaitForRetrace();
|
||||
// }
|
||||
// }
|
||||
// SwapBuffers();
|
||||
s32 retrace_dist;
|
||||
if(DemoStatEnable) {
|
||||
GXDrawDone();
|
||||
DEMOUpdateStats(1);
|
||||
DEMOPrintStats();
|
||||
GXDrawDone();
|
||||
DEMOUpdateStats(0);
|
||||
}
|
||||
GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GXSetColorUpdate(GX_TRUE);
|
||||
GXDrawDone();
|
||||
GXCopyDisp(DemoCurrentBuffer, GX_TRUE);
|
||||
if(minimumVcount != 0) {
|
||||
retrace_dist = VIGetRetraceCount()-retrace_count;
|
||||
if(worstVcount < retrace_dist) {
|
||||
worstVcount = retrace_dist;
|
||||
}
|
||||
while(VIGetRetraceCount()-retrace_count < minimumVcount-1) {
|
||||
VIWaitForRetrace();
|
||||
}
|
||||
}
|
||||
SwapBuffers();
|
||||
}
|
||||
|
||||
static void SwapBuffers()
|
||||
{
|
||||
// VISetNextFrameBuffer(DemoCurrentBuffer);
|
||||
// if(FirstFrame) {
|
||||
// VISetBlack(GX_FALSE);
|
||||
// FirstFrame = FALSE;
|
||||
// }
|
||||
// VIFlush();
|
||||
// VIWaitForRetrace();
|
||||
// if(DemoCurrentBuffer == DemoFrameBuffer1) {
|
||||
// DemoCurrentBuffer = DemoFrameBuffer2;
|
||||
// } else {
|
||||
// DemoCurrentBuffer = DemoFrameBuffer1;
|
||||
// }
|
||||
VISetNextFrameBuffer(DemoCurrentBuffer);
|
||||
if(FirstFrame) {
|
||||
VISetBlack(GX_FALSE);
|
||||
FirstFrame = FALSE;
|
||||
}
|
||||
VIFlush();
|
||||
VIWaitForRetrace();
|
||||
if(DemoCurrentBuffer == DemoFrameBuffer1) {
|
||||
DemoCurrentBuffer = DemoFrameBuffer2;
|
||||
} else {
|
||||
DemoCurrentBuffer = DemoFrameBuffer1;
|
||||
}
|
||||
}
|
||||
|
||||
static void LoadMemInfo()
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
#include "game/gamework_data.h"
|
||||
#include "game/dvd.h"
|
||||
#include "game/printfunc.h"
|
||||
#include "game/object.h"
|
||||
#include "game/wipe.h"
|
||||
#include "game/init.h"
|
||||
#include "game/process.h"
|
||||
#include "game/pad.h"
|
||||
#include "game/data.h"
|
||||
#include "game/sprite.h"
|
||||
#include "game/dvd.h"
|
||||
#include "game/gamework.h"
|
||||
#include "game/gamework_data.h"
|
||||
#include "game/hsfformat.h"
|
||||
#include "game/hsfman.h"
|
||||
#include "game/init.h"
|
||||
#include "game/minigame_seq.h"
|
||||
#include "game/msm.h"
|
||||
#include "game/object.h"
|
||||
#include "game/pad.h"
|
||||
#include "game/perf.h"
|
||||
#include "game/gamework.h"
|
||||
#include "game/printfunc.h"
|
||||
#include "game/process.h"
|
||||
#include "game/sprite.h"
|
||||
#include "game/sreset.h"
|
||||
#include "game/wipe.h"
|
||||
|
||||
#ifdef TARGET_PC
|
||||
#include "port/imgui.h"
|
||||
|
|
@ -53,8 +53,7 @@ void aurora_log_callback(AuroraLogLevel level, const char *message, unsigned int
|
|||
{
|
||||
const char *levelStr = "??";
|
||||
FILE *out = stdout;
|
||||
switch (level)
|
||||
{
|
||||
switch (level) {
|
||||
case LOG_DEBUG:
|
||||
levelStr = "DEBUG";
|
||||
break;
|
||||
|
|
@ -74,8 +73,7 @@ void aurora_log_callback(AuroraLogLevel level, const char *message, unsigned int
|
|||
break;
|
||||
}
|
||||
fprintf(out, "[%s: %s]\n", levelStr, message);
|
||||
if (level == LOG_FATAL)
|
||||
{
|
||||
if (level == LOG_FATAL) {
|
||||
fflush(out);
|
||||
abort();
|
||||
}
|
||||
|
|
@ -110,45 +108,42 @@ void main(void)
|
|||
#else
|
||||
HuSysInit(&GXPal528IntDf);
|
||||
#endif
|
||||
/*HuPrcInit();
|
||||
HuPadInit();
|
||||
GWInit();
|
||||
pfInit();
|
||||
GlobalCounter = 0;
|
||||
HuSprInit();
|
||||
Hu3DInit();
|
||||
HuDataInit();
|
||||
HuPerfInit();
|
||||
HuPerfCreate("USR0", 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
HuPerfCreate("USR1", 0, 0xFF, 0xFF, 0xFF);
|
||||
WipeInit(RenderMode);
|
||||
//HuPrcInit();
|
||||
// HuPadInit();
|
||||
// GWInit();
|
||||
// pfInit();
|
||||
// GlobalCounter = 0;
|
||||
// HuSprInit();
|
||||
// Hu3DInit();
|
||||
// HuDataInit();
|
||||
// HuPerfInit();
|
||||
// HuPerfCreate("USR0", 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
// HuPerfCreate("USR1", 0, 0xFF, 0xFF, 0xFF);
|
||||
// WipeInit(RenderMode);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
GWPlayerCfg[i].character = -1;
|
||||
// GWPlayerCfg[i].character = -1;
|
||||
}
|
||||
|
||||
omMasterInit(0, _ovltbl, OVL_COUNT, OVL_BOOT);
|
||||
//omMasterInit(0, _ovltbl, OVL_COUNT, OVL_BOOT);
|
||||
VIWaitForRetrace();
|
||||
|
||||
if (VIGetNextField() == 0) {
|
||||
OSReport("VI_FIELD_BELOW\n");
|
||||
VIWaitForRetrace();
|
||||
}*/
|
||||
}
|
||||
while (1) {
|
||||
#ifdef TARGET_PC
|
||||
const AuroraEvent *event = aurora_update();
|
||||
bool exiting = false;
|
||||
while (event != NULL && event->type != AURORA_NONE)
|
||||
{
|
||||
if (event->type == AURORA_EXIT)
|
||||
{
|
||||
while (event != NULL && event->type != AURORA_NONE) {
|
||||
if (event->type == AURORA_EXIT) {
|
||||
exiting = true;
|
||||
break;
|
||||
}
|
||||
++event;
|
||||
}
|
||||
if (exiting)
|
||||
{
|
||||
if (exiting) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
#include "game/process.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "game/jmp.h"
|
||||
#include "game/memory.h"
|
||||
|
||||
|
||||
#define FAKE_RETADDR 0xA5A5A5A5
|
||||
|
||||
#ifdef TARGET_PC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define EXEC_NORMAL 0
|
||||
#define EXEC_SLEEP 1
|
||||
#define EXEC_CHILDWATCH 2
|
||||
|
|
@ -81,9 +85,12 @@ Process *HuPrcCreate(void (*func)(void), u16 prio, u32 stack_size, s32 extra_siz
|
|||
process->prio = prio;
|
||||
process->sleep_time = 0;
|
||||
process->base_sp = ((u32)HuMemMemoryAlloc(heap, stack_size, FAKE_RETADDR)) + stack_size - 8;
|
||||
#ifdef TARGET_PC
|
||||
#else
|
||||
gcsetjmp(&process->jump);
|
||||
process->jump.lr = (u32)func;
|
||||
process->jump.sp = process->base_sp;
|
||||
#endif
|
||||
process->dtor = NULL;
|
||||
process->user_data = NULL;
|
||||
LinkProcess(&processtop, process);
|
||||
|
|
@ -133,9 +140,12 @@ void HuPrcChildWatch()
|
|||
Process *curr = HuPrcCurrentGet();
|
||||
if (curr->child) {
|
||||
curr->exec = EXEC_CHILDWATCH;
|
||||
#ifdef TARGET_PC
|
||||
#else
|
||||
if (!gcsetjmp(&curr->jump)) {
|
||||
gclongjmp(&processjmpbuf, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +196,10 @@ static void gcTerminateProcess(Process *process)
|
|||
}
|
||||
UnlinkProcess(&processtop, process);
|
||||
processcnt--;
|
||||
#ifdef TARGET_PC
|
||||
#else
|
||||
gclongjmp(&processjmpbuf, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
void HuPrcEnd()
|
||||
|
|
@ -204,9 +217,12 @@ void HuPrcSleep(s32 time)
|
|||
process->exec = EXEC_SLEEP;
|
||||
process->sleep_time = time;
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
#else
|
||||
if (!gcsetjmp(&process->jump)) {
|
||||
gclongjmp(&processjmpbuf, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void HuPrcVSleep()
|
||||
|
|
@ -235,7 +251,10 @@ void HuPrcCall(s32 tick)
|
|||
Process *process;
|
||||
s32 ret;
|
||||
processcur = processtop;
|
||||
#ifdef TARGET_PC
|
||||
#else
|
||||
ret = gcsetjmp(&processjmpbuf);
|
||||
#endif
|
||||
while (1) {
|
||||
switch (ret) {
|
||||
case 2:
|
||||
|
|
@ -255,7 +274,10 @@ void HuPrcCall(s32 tick)
|
|||
if (!process) {
|
||||
return;
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
#else
|
||||
procfunc = process->jump.lr;
|
||||
#endif
|
||||
if ((process->stat & (PROCESS_STAT_PAUSE | PROCESS_STAT_UPAUSE)) && process->exec != EXEC_KILLED) {
|
||||
ret = 1;
|
||||
continue;
|
||||
|
|
@ -283,9 +305,15 @@ void HuPrcCall(s32 tick)
|
|||
break;
|
||||
|
||||
case EXEC_KILLED:
|
||||
#ifdef TARGET_PC
|
||||
#else
|
||||
process->jump.lr = (u32)HuPrcEnd;
|
||||
#endif
|
||||
case EXEC_NORMAL:
|
||||
#ifdef TARGET_PC
|
||||
#else
|
||||
gclongjmp(&process->jump, 1);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,12 @@ s32 CARDCancel(CARDFileInfo *fileInfo)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCheck(s32 chan)
|
||||
{
|
||||
puts("CARDCheck is a stub");
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCheckAsync(s32 chan, CARDCallback callback)
|
||||
{
|
||||
puts("CARDCheckAsync is a stub");
|
||||
|
|
@ -36,6 +42,12 @@ s32 CARDClose(CARDFileInfo *fileInfo)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCreate(s32 chan, const char *fileName, u32 size, CARDFileInfo *fileInfo)
|
||||
{
|
||||
puts("CARDCreate is a stub");
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDCreateAsync(s32 chan, const char *fileName, u32 size, CARDFileInfo *fileInfo, CARDCallback callback)
|
||||
{
|
||||
puts("CARDCreateAsync is a stub");
|
||||
|
|
@ -66,6 +78,12 @@ s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo *fileInfo)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDFormat(s32 chan)
|
||||
{
|
||||
puts("CARDFormat is a stub");
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDFreeBlocks(s32 chan, s32 *byteNotUsed, s32 *filesNotUsed)
|
||||
{
|
||||
puts("CARDFreeBlocks is a stub");
|
||||
|
|
@ -84,6 +102,12 @@ s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat *stat)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDGetSectorSize(s32 chan, u32 *size)
|
||||
{
|
||||
puts("CARDGetSectorSize is a stub");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CARDInit()
|
||||
{
|
||||
puts("CARDInit is a stub");
|
||||
|
|
@ -113,6 +137,12 @@ s32 CARDProbeEx(s32 chan, s32 *memSize, s32 *sectorSize)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDRead(CARDFileInfo *fileInfo, void *addr, s32 length, s32 offset)
|
||||
{
|
||||
puts("CARDRead is a stub");
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDReadAsync(CARDFileInfo *fileInfo, void *addr, s32 length, s32 offset, CARDCallback callback)
|
||||
{
|
||||
puts("CARDReadAsync is a stub");
|
||||
|
|
@ -143,6 +173,12 @@ s32 CARDUnmount(s32 chan)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDWrite(CARDFileInfo *fileInfo, const void *addr, s32 length, s32 offset)
|
||||
{
|
||||
puts("CARDWrite is a stub");
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CARDWriteAsync(CARDFileInfo *fileInfo, const void *addr, s32 length, s32 offset, CARDCallback callback)
|
||||
{
|
||||
puts("CARDWriteAsync is a stub");
|
||||
|
|
@ -175,6 +211,16 @@ void DCStoreRange(void *addr, u32 nBytes)
|
|||
puts("DCStoreRange is a stub");
|
||||
}
|
||||
|
||||
void DEMOUpdateStats(unsigned char inc)
|
||||
{
|
||||
puts("DEMOUpdateStats is a stub");
|
||||
}
|
||||
|
||||
void DEMOPrintStats(void)
|
||||
{
|
||||
puts("DEMOPrintStats is a stub");
|
||||
}
|
||||
|
||||
s32 DVDCancel(DVDCommandBlock *block)
|
||||
{
|
||||
puts("DVDCancel is a stub");
|
||||
|
|
@ -401,6 +447,12 @@ void VIConfigurePan(u16 xOrg, u16 yOrg, u16 width, u16 height)
|
|||
puts("VIConfigurePan is a stub");
|
||||
}
|
||||
|
||||
u32 VIGetRetraceCount()
|
||||
{
|
||||
puts("VIGetRetraceCount is a stub");
|
||||
return 0; // TODO this might be important
|
||||
}
|
||||
|
||||
u32 VIGetNextField()
|
||||
{
|
||||
puts("VIGetNextField is a stub");
|
||||
|
|
@ -468,3 +520,5 @@ OSInterruptMask __OSUnmaskInterrupts(OSInterruptMask mask)
|
|||
|
||||
// Hudson
|
||||
void HuDvdErrDispInit(GXRenderModeObj *rmode, void *xfb1, void *xfb2) { }
|
||||
void HuAudInit() { }
|
||||
void HuARInit() { }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue