Dvd and some progress
This commit is contained in:
parent
1bd8f3e14e
commit
14918e187e
7 changed files with 352 additions and 229 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -34,3 +34,12 @@ compile_commands.json
|
||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
/*.txt
|
/*.txt
|
||||||
*.exe
|
*.exe
|
||||||
|
|
||||||
|
.clang-format
|
||||||
|
tools/
|
||||||
|
*.svg
|
||||||
|
main.s
|
||||||
|
decompiled.c
|
||||||
|
debug_source.c
|
||||||
|
decompiled_common.c
|
||||||
|
build_iso.py
|
||||||
|
|
|
||||||
61
.vscode/settings.json
vendored
61
.vscode/settings.json
vendored
|
|
@ -83,63 +83,4 @@
|
||||||
"compile_commands.json": true
|
"compile_commands.json": true
|
||||||
},
|
},
|
||||||
"cmake.ignoreCMakeListsMissing": true,
|
"cmake.ignoreCMakeListsMissing": true,
|
||||||
"editor.fontFamily": "Fira Code",
|
}
|
||||||
"editor.fontLigatures": true,
|
|
||||||
"C_Cpp_Runner.cCompilerPath": "gcc",
|
|
||||||
"C_Cpp_Runner.cppCompilerPath": "g++",
|
|
||||||
"C_Cpp_Runner.debuggerPath": "gdb",
|
|
||||||
"C_Cpp_Runner.cStandard": "",
|
|
||||||
"C_Cpp_Runner.cppStandard": "",
|
|
||||||
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
|
||||||
"C_Cpp_Runner.useMsvc": false,
|
|
||||||
"C_Cpp_Runner.warnings": [
|
|
||||||
"-Wall",
|
|
||||||
"-Wextra",
|
|
||||||
"-Wpedantic",
|
|
||||||
"-Wshadow",
|
|
||||||
"-Wformat=2",
|
|
||||||
"-Wcast-align",
|
|
||||||
"-Wconversion",
|
|
||||||
"-Wsign-conversion",
|
|
||||||
"-Wnull-dereference"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.msvcWarnings": [
|
|
||||||
"/W4",
|
|
||||||
"/permissive-",
|
|
||||||
"/w14242",
|
|
||||||
"/w14287",
|
|
||||||
"/w14296",
|
|
||||||
"/w14311",
|
|
||||||
"/w14826",
|
|
||||||
"/w44062",
|
|
||||||
"/w44242",
|
|
||||||
"/w14905",
|
|
||||||
"/w14906",
|
|
||||||
"/w14263",
|
|
||||||
"/w44265",
|
|
||||||
"/w14928"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.enableWarnings": true,
|
|
||||||
"C_Cpp_Runner.warningsAsError": false,
|
|
||||||
"C_Cpp_Runner.compilerArgs": [],
|
|
||||||
"C_Cpp_Runner.linkerArgs": [],
|
|
||||||
"C_Cpp_Runner.includePaths": [],
|
|
||||||
"C_Cpp_Runner.includeSearch": [
|
|
||||||
"*",
|
|
||||||
"**/*"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.excludeSearch": [
|
|
||||||
"**/build",
|
|
||||||
"**/build/**",
|
|
||||||
"**/.*",
|
|
||||||
"**/.*/**",
|
|
||||||
"**/.vscode",
|
|
||||||
"**/.vscode/**"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.useAddressSanitizer": false,
|
|
||||||
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
|
||||||
"C_Cpp_Runner.useLeakSanitizer": false,
|
|
||||||
"C_Cpp_Runner.showCompilationTime": false,
|
|
||||||
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
|
||||||
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ add_subdirectory(extern/aurora EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(extern/musyx EXCLUDE_FROM_ALL)
|
add_subdirectory(extern/musyx EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
set(DOLPHIN_FILES
|
set(DOLPHIN_FILES
|
||||||
|
|
||||||
# libraries/dolphin_pc/GX.c
|
# libraries/dolphin_pc/GX.c
|
||||||
# libraries/dolphin_pc/vi.c
|
# libraries/dolphin_pc/vi.c
|
||||||
# libraries/dolphin_pc/pad_evdev.c
|
# libraries/dolphin_pc/pad_evdev.c
|
||||||
|
|
@ -24,11 +25,12 @@ set(DOLPHIN_FILES
|
||||||
|
|
||||||
set(GAME_FILES
|
set(GAME_FILES
|
||||||
src/game/main.c
|
src/game/main.c
|
||||||
# src/game/init.c
|
src/game/init.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PORT_FILES
|
set(PORT_FILES
|
||||||
# src/port/byteswap.cpp
|
# src/port/byteswap.cpp
|
||||||
|
src/port/dvd.c
|
||||||
src/port/imgui.cpp
|
src/port/imgui.cpp
|
||||||
src/port/stubs.c
|
src/port/stubs.c
|
||||||
)
|
)
|
||||||
|
|
|
||||||
334
src/game/init.c
334
src/game/init.c
|
|
@ -54,6 +54,7 @@ void HuSysInit(GXRenderModeObj *mode)
|
||||||
VISetWindowTitle("Mario Party 4");
|
VISetWindowTitle("Mario Party 4");
|
||||||
#endif
|
#endif
|
||||||
PADInit();
|
PADInit();
|
||||||
|
#if !TARGET_PC
|
||||||
#if VERSION_NTSC
|
#if VERSION_NTSC
|
||||||
if(OSGetProgressiveMode() == 1 && VIGetDTVStatus() == 1) {
|
if(OSGetProgressiveMode() == 1 && VIGetDTVStatus() == 1) {
|
||||||
mode = &GXNtsc480Prog;
|
mode = &GXNtsc480Prog;
|
||||||
|
|
@ -61,28 +62,29 @@ void HuSysInit(GXRenderModeObj *mode)
|
||||||
#else
|
#else
|
||||||
mode->efbHeight = 480;
|
mode->efbHeight = 480;
|
||||||
#endif
|
#endif
|
||||||
InitRenderMode(mode);
|
|
||||||
InitMem();
|
|
||||||
VIConfigure(RenderMode);
|
|
||||||
#if VERSION_NTSC
|
|
||||||
VIConfigurePan(0, 0, 640, 480);
|
|
||||||
#endif
|
#endif
|
||||||
DefaultFifo = OSAlloc(0x100000);
|
InitRenderMode(mode);
|
||||||
DefaultFifoObj = GXInit(DefaultFifo, 0x100000);
|
InitMem();
|
||||||
InitGX();
|
// VIConfigure(RenderMode);
|
||||||
InitVI();
|
// #if VERSION_NTSC
|
||||||
HuFaultInitXfbDirectDraw(RenderMode);
|
// VIConfigurePan(0, 0, 640, 480);
|
||||||
HuFaultSetXfbAddress(0, DemoFrameBuffer1);
|
// #endif
|
||||||
HuFaultSetXfbAddress(1, DemoFrameBuffer2);
|
// DefaultFifo = OSAlloc(0x100000);
|
||||||
HuDvdErrDispInit(RenderMode, DemoFrameBuffer1, DemoFrameBuffer2);
|
// DefaultFifoObj = GXInit(DefaultFifo, 0x100000);
|
||||||
rnd_temp = frand();
|
// InitGX();
|
||||||
HuMemInitAll();
|
// InitVI();
|
||||||
HuAudInit();
|
// HuFaultInitXfbDirectDraw(RenderMode);
|
||||||
HuARInit();
|
// HuFaultSetXfbAddress(0, DemoFrameBuffer1);
|
||||||
minimumVcount = minimumVcountf = 1.0f;
|
// HuFaultSetXfbAddress(1, DemoFrameBuffer2);
|
||||||
worstVcount = 0;
|
// HuDvdErrDispInit(RenderMode, DemoFrameBuffer1, DemoFrameBuffer2);
|
||||||
OSInitFastCast();
|
// rnd_temp = frand();
|
||||||
HuCardInit();
|
// HuMemInitAll();
|
||||||
|
// HuAudInit();
|
||||||
|
// HuARInit();
|
||||||
|
// minimumVcount = minimumVcountf = 1.0f;
|
||||||
|
// worstVcount = 0;
|
||||||
|
// OSInitFastCast();
|
||||||
|
// HuCardInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitRenderMode(GXRenderModeObj *mode)
|
static void InitRenderMode(GXRenderModeObj *mode)
|
||||||
|
|
@ -136,169 +138,169 @@ static void InitGX()
|
||||||
|
|
||||||
static void InitMem()
|
static void InitMem()
|
||||||
{
|
{
|
||||||
void *arena_lo = OSGetArenaLo();
|
// void *arena_lo = OSGetArenaLo();
|
||||||
void *arena_hi = OSGetArenaHi();
|
// void *arena_hi = OSGetArenaHi();
|
||||||
u32 fb_size = (u16)(((u16)RenderMode->fbWidth+15) & ~15)*RenderMode->xfbHeight*2;
|
// u32 fb_size = (u16)(((u16)RenderMode->fbWidth+15) & ~15)*RenderMode->xfbHeight*2;
|
||||||
u32 *fb1;
|
// u32 *fb1;
|
||||||
u32 *fb2;
|
// u32 *fb2;
|
||||||
u32 i;
|
// u32 i;
|
||||||
DemoFrameBuffer1 = (void *)OSRoundUp32B((u32)arena_lo);
|
// DemoFrameBuffer1 = (void *)OSRoundUp32B((u32)arena_lo);
|
||||||
DemoFrameBuffer2 = (void *)OSRoundUp32B((u32)DemoFrameBuffer1+fb_size);
|
// DemoFrameBuffer2 = (void *)OSRoundUp32B((u32)DemoFrameBuffer1+fb_size);
|
||||||
DemoCurrentBuffer = DemoFrameBuffer2;
|
// DemoCurrentBuffer = DemoFrameBuffer2;
|
||||||
#if VERSION_PAL
|
// #if VERSION_PAL
|
||||||
fb1 = DemoFrameBuffer1;
|
// fb1 = DemoFrameBuffer1;
|
||||||
fb2 = DemoFrameBuffer2;
|
// fb2 = DemoFrameBuffer2;
|
||||||
for(i=0; i<fb_size/4; i++, fb1++, fb2++) {
|
// for(i=0; i<fb_size/4; i++, fb1++, fb2++) {
|
||||||
*fb1 = *fb2 = 0x800080;
|
// *fb1 = *fb2 = 0x800080;
|
||||||
}
|
// }
|
||||||
DCStoreRangeNoSync(DemoFrameBuffer1, fb_size);
|
// DCStoreRangeNoSync(DemoFrameBuffer1, fb_size);
|
||||||
DCStoreRangeNoSync(DemoFrameBuffer2, fb_size);
|
// DCStoreRangeNoSync(DemoFrameBuffer2, fb_size);
|
||||||
#endif
|
// #endif
|
||||||
arena_lo = (void *)OSRoundUp32B((u32)DemoFrameBuffer2+fb_size);
|
// arena_lo = (void *)OSRoundUp32B((u32)DemoFrameBuffer2+fb_size);
|
||||||
OSSetArenaLo(arena_lo);
|
// OSSetArenaLo(arena_lo);
|
||||||
if(OSGetConsoleType() == OS_CONSOLE_DEVHW1 && OSGetPhysicalMemSize() != 0x400000 && OSGetConsoleSimulatedMemSize() < 0x1800000) {
|
// if(OSGetConsoleType() == OS_CONSOLE_DEVHW1 && OSGetPhysicalMemSize() != 0x400000 && OSGetConsoleSimulatedMemSize() < 0x1800000) {
|
||||||
LoadMemInfo();
|
// LoadMemInfo();
|
||||||
} else {
|
// } else {
|
||||||
arena_lo = OSGetArenaLo();
|
// arena_lo = OSGetArenaLo();
|
||||||
arena_hi = OSGetArenaHi();
|
// arena_hi = OSGetArenaHi();
|
||||||
arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
|
// arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
|
||||||
OSSetArenaLo(arena_lo);
|
// OSSetArenaLo(arena_lo);
|
||||||
arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
|
// arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
|
||||||
arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
|
// arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
|
||||||
OSSetCurrentHeap(currentHeapHandle = OSCreateHeap(arena_lo, arena_hi));
|
// OSSetCurrentHeap(currentHeapHandle = OSCreateHeap(arena_lo, arena_hi));
|
||||||
arena_lo = arena_hi;
|
// arena_lo = arena_hi;
|
||||||
OSSetArenaLo(arena_lo);
|
// OSSetArenaLo(arena_lo);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitVI()
|
static void InitVI()
|
||||||
{
|
{
|
||||||
u32 interlace;
|
// u32 interlace;
|
||||||
VISetNextFrameBuffer(DemoFrameBuffer1);
|
// VISetNextFrameBuffer(DemoFrameBuffer1);
|
||||||
DemoCurrentBuffer = DemoFrameBuffer2;
|
// DemoCurrentBuffer = DemoFrameBuffer2;
|
||||||
VIFlush();
|
// VIFlush();
|
||||||
VIWaitForRetrace();
|
// VIWaitForRetrace();
|
||||||
interlace = RenderMode->viTVmode & 0x1;
|
// interlace = RenderMode->viTVmode & 0x1;
|
||||||
if(interlace) {
|
// if(interlace) {
|
||||||
VIWaitForRetrace();
|
// VIWaitForRetrace();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void HuSysBeforeRender()
|
void HuSysBeforeRender()
|
||||||
{
|
{
|
||||||
if(RenderMode->field_rendering) {
|
// if(RenderMode->field_rendering) {
|
||||||
GXSetViewportJitter(0, 0, RenderMode->fbWidth, RenderMode->xfbHeight, 0, 1, VIGetNextField());
|
// GXSetViewportJitter(0, 0, RenderMode->fbWidth, RenderMode->xfbHeight, 0, 1, VIGetNextField());
|
||||||
} else {
|
// } else {
|
||||||
GXSetViewport(0, 0, RenderMode->fbWidth, RenderMode->xfbHeight, 0, 1);
|
// GXSetViewport(0, 0, RenderMode->fbWidth, RenderMode->xfbHeight, 0, 1);
|
||||||
}
|
// }
|
||||||
GXInvalidateVtxCache();
|
// GXInvalidateVtxCache();
|
||||||
GXInvalidateTexAll();
|
// GXInvalidateTexAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HuSysDoneRender(s32 retrace_count)
|
void HuSysDoneRender(s32 retrace_count)
|
||||||
{
|
{
|
||||||
s32 retrace_dist;
|
// s32 retrace_dist;
|
||||||
if(DemoStatEnable) {
|
// if(DemoStatEnable) {
|
||||||
GXDrawDone();
|
// GXDrawDone();
|
||||||
DEMOUpdateStats(1);
|
// DEMOUpdateStats(1);
|
||||||
DEMOPrintStats();
|
// DEMOPrintStats();
|
||||||
GXDrawDone();
|
// GXDrawDone();
|
||||||
DEMOUpdateStats(0);
|
// DEMOUpdateStats(0);
|
||||||
}
|
// }
|
||||||
GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
// GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||||
GXSetColorUpdate(GX_TRUE);
|
// GXSetColorUpdate(GX_TRUE);
|
||||||
GXDrawDone();
|
// GXDrawDone();
|
||||||
GXCopyDisp(DemoCurrentBuffer, GX_TRUE);
|
// GXCopyDisp(DemoCurrentBuffer, GX_TRUE);
|
||||||
if(minimumVcount != 0) {
|
// if(minimumVcount != 0) {
|
||||||
retrace_dist = VIGetRetraceCount()-retrace_count;
|
// retrace_dist = VIGetRetraceCount()-retrace_count;
|
||||||
if(worstVcount < retrace_dist) {
|
// if(worstVcount < retrace_dist) {
|
||||||
worstVcount = retrace_dist;
|
// worstVcount = retrace_dist;
|
||||||
}
|
// }
|
||||||
while(VIGetRetraceCount()-retrace_count < minimumVcount-1) {
|
// while(VIGetRetraceCount()-retrace_count < minimumVcount-1) {
|
||||||
VIWaitForRetrace();
|
// VIWaitForRetrace();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
SwapBuffers();
|
// SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SwapBuffers()
|
static void SwapBuffers()
|
||||||
{
|
{
|
||||||
VISetNextFrameBuffer(DemoCurrentBuffer);
|
// VISetNextFrameBuffer(DemoCurrentBuffer);
|
||||||
if(FirstFrame) {
|
// if(FirstFrame) {
|
||||||
VISetBlack(GX_FALSE);
|
// VISetBlack(GX_FALSE);
|
||||||
FirstFrame = FALSE;
|
// FirstFrame = FALSE;
|
||||||
}
|
// }
|
||||||
VIFlush();
|
// VIFlush();
|
||||||
VIWaitForRetrace();
|
// VIWaitForRetrace();
|
||||||
if(DemoCurrentBuffer == DemoFrameBuffer1) {
|
// if(DemoCurrentBuffer == DemoFrameBuffer1) {
|
||||||
DemoCurrentBuffer = DemoFrameBuffer2;
|
// DemoCurrentBuffer = DemoFrameBuffer2;
|
||||||
} else {
|
// } else {
|
||||||
DemoCurrentBuffer = DemoFrameBuffer1;
|
// DemoCurrentBuffer = DemoFrameBuffer1;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadMemInfo()
|
static void LoadMemInfo()
|
||||||
{
|
{
|
||||||
u32 size;
|
// u32 size;
|
||||||
u32 copy_size;
|
// u32 copy_size;
|
||||||
u32 offset;
|
// u32 offset;
|
||||||
u32 entries;
|
// u32 entries;
|
||||||
u32 i;
|
// u32 i;
|
||||||
void *arena_lo;
|
// void *arena_lo;
|
||||||
void *arena_hi;
|
// void *arena_hi;
|
||||||
void *alloc_max;
|
// void *alloc_max;
|
||||||
void *alloc_min;
|
// void *alloc_min;
|
||||||
|
//
|
||||||
struct memory_info *buf_ptr;
|
// struct memory_info *buf_ptr;
|
||||||
DVDFileInfo file;
|
// DVDFileInfo file;
|
||||||
char buf[240];
|
// char buf[240];
|
||||||
|
//
|
||||||
OSReport("\nNow, try to find memory info file...\n\n");
|
// OSReport("\nNow, try to find memory info file...\n\n");
|
||||||
if(!DVDOpen("/meminfo.bin", &file)) {
|
// if(!DVDOpen("/meminfo.bin", &file)) {
|
||||||
OSReport("\nCan't find memory info file. Use /XXX toolname/ to maximize available\n");
|
// OSReport("\nCan't find memory info file. Use /XXX toolname/ to maximize available\n");
|
||||||
OSReport("memory space. For now, we only use the first %dMB.\n", (OSGetConsoleSimulatedMemSize()/1024)/1024);
|
// OSReport("memory space. For now, we only use the first %dMB.\n", (OSGetConsoleSimulatedMemSize()/1024)/1024);
|
||||||
arena_lo = OSGetArenaLo();
|
// arena_lo = OSGetArenaLo();
|
||||||
arena_hi = OSGetArenaHi();
|
// arena_hi = OSGetArenaHi();
|
||||||
arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
|
// arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
|
||||||
OSSetArenaLo(arena_lo);
|
// OSSetArenaLo(arena_lo);
|
||||||
arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
|
// arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
|
||||||
arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
|
// arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
|
||||||
OSSetCurrentHeap(OSCreateHeap(arena_lo, arena_hi));
|
// OSSetCurrentHeap(OSCreateHeap(arena_lo, arena_hi));
|
||||||
arena_lo = arena_hi;
|
// arena_lo = arena_hi;
|
||||||
OSSetArenaLo(arena_lo);
|
// OSSetArenaLo(arena_lo);
|
||||||
} else {
|
// } else {
|
||||||
buf_ptr = (struct memory_info *)OSRoundUp32B((u32)buf);
|
// buf_ptr = (struct memory_info *)OSRoundUp32B((u32)buf);
|
||||||
alloc_max = OSGetArenaHi();
|
// alloc_max = OSGetArenaHi();
|
||||||
alloc_min = (void *)(OSGetConsoleSimulatedMemSize()+0x80000000);
|
// alloc_min = (void *)(OSGetConsoleSimulatedMemSize()+0x80000000);
|
||||||
OSSetArenaHi((void *)(OSGetPhysicalMemSize()+0x80000000));
|
// OSSetArenaHi((void *)(OSGetPhysicalMemSize()+0x80000000));
|
||||||
arena_lo = OSGetArenaLo();
|
// arena_lo = OSGetArenaLo();
|
||||||
arena_hi = OSGetArenaHi();
|
// arena_hi = OSGetArenaHi();
|
||||||
arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
|
// arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
|
||||||
OSSetArenaLo(arena_lo);
|
// OSSetArenaLo(arena_lo);
|
||||||
arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
|
// arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
|
||||||
arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
|
// arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
|
||||||
OSSetCurrentHeap(OSCreateHeap(arena_lo, arena_hi));
|
// OSSetCurrentHeap(OSCreateHeap(arena_lo, arena_hi));
|
||||||
arena_lo = arena_hi;
|
// arena_lo = arena_hi;
|
||||||
OSSetArenaLo(arena_lo);
|
// OSSetArenaLo(arena_lo);
|
||||||
OSAllocFixed(&alloc_max, &alloc_min);
|
// OSAllocFixed(&alloc_max, &alloc_min);
|
||||||
size = file.length;
|
// size = file.length;
|
||||||
offset = 0;
|
// offset = 0;
|
||||||
while(size) {
|
// while(size) {
|
||||||
OSReport("loop\n");
|
// OSReport("loop\n");
|
||||||
copy_size = (size < 32) ? size : 32;
|
// copy_size = (size < 32) ? size : 32;
|
||||||
if(DVDRead(&file, buf_ptr, OSRoundUp32B(copy_size), offset) < 0) {
|
// if(DVDRead(&file, buf_ptr, OSRoundUp32B(copy_size), offset) < 0) {
|
||||||
OSPanic("init.c", ASSERT_LINE(576, 586), "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);
|
// entries = copy_size/sizeof(struct memory_info);
|
||||||
for(i=0; i<entries; i++) {
|
// for(i=0; i<entries; i++) {
|
||||||
OSReport("start: 0x%08x, end: 0x%08x\n", buf_ptr[i].start, buf_ptr[i].end);
|
// OSReport("start: 0x%08x, end: 0x%08x\n", buf_ptr[i].start, buf_ptr[i].end);
|
||||||
OSAllocFixed(&buf_ptr[i].start, &buf_ptr[i].end);
|
// OSAllocFixed(&buf_ptr[i].start, &buf_ptr[i].end);
|
||||||
OSReport("Removed 0x%08x - 0x%08x from the current heap\n", buf_ptr[i].start, (u32)buf_ptr[i].end-1);
|
// OSReport("Removed 0x%08x - 0x%08x from the current heap\n", buf_ptr[i].start, (u32)buf_ptr[i].end-1);
|
||||||
}
|
// }
|
||||||
size -= copy_size;
|
// size -= copy_size;
|
||||||
offset += copy_size;
|
// offset += copy_size;
|
||||||
}
|
// }
|
||||||
DVDClose(&file);
|
// DVDClose(&file);
|
||||||
OSDumpHeap(__OSCurrHeap);
|
// OSDumpHeap(__OSCurrHeap);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ int main(int argc, char* argv[])
|
||||||
void main(void)
|
void main(void)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef AURORA
|
#ifdef TARGET_PC
|
||||||
const AuroraInfo auroraInfo = aurora_initialize(argc, argv,
|
const AuroraInfo auroraInfo = aurora_initialize(argc, argv,
|
||||||
&(AuroraConfig){
|
&(AuroraConfig){
|
||||||
.appName = "Mario Party 4",
|
.appName = "Mario Party 4",
|
||||||
|
|
@ -106,7 +106,7 @@ void main(void)
|
||||||
HuDvdErrWait = 0;
|
HuDvdErrWait = 0;
|
||||||
SystemInitF = 0;
|
SystemInitF = 0;
|
||||||
#if VERSION_NTSC
|
#if VERSION_NTSC
|
||||||
//HuSysInit(&GXNtsc480IntDf);
|
HuSysInit(&GXNtsc480IntDf);
|
||||||
#else
|
#else
|
||||||
HuSysInit(&GXPal528IntDf);
|
HuSysInit(&GXPal528IntDf);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
149
src/port/dvd.c
Normal file
149
src/port/dvd.c
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
// Credits: Super Monkey Ball
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <direct.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <dolphin.h>
|
||||||
|
|
||||||
|
#ifndef PATH_MAX
|
||||||
|
#define PATH_MAX 256
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char (*s_pathEntries)[PATH_MAX] = NULL;
|
||||||
|
static int s_pathEntriesCount = 0;
|
||||||
|
static char s_rootDir[PATH_MAX];
|
||||||
|
|
||||||
|
void DVDInit(void)
|
||||||
|
{
|
||||||
|
chdir("GMPE01_00/files");
|
||||||
|
if (getcwd(s_rootDir, sizeof(s_rootDir)) == NULL)
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DVDChangeDir(char *dir)
|
||||||
|
{
|
||||||
|
printf("DVDChangeDir: %s\n", dir);
|
||||||
|
if (dir[0] == '/') {
|
||||||
|
char path[PATH_MAX];
|
||||||
|
if (snprintf(path, sizeof(path), "%s/%s", s_rootDir, dir) >= PATH_MAX)
|
||||||
|
return FALSE;
|
||||||
|
return chdir(path) == 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return chdir(dir) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 DVDConvertPathToEntrynum(char *pathPtr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
FILE *f;
|
||||||
|
char absolute[PATH_MAX];
|
||||||
|
|
||||||
|
printf("DVDConvertPathToEntrynum: %s\n", pathPtr);
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (GetFullPathNameA(pathPtr, sizeof(absolute), absolute, NULL) == 0)
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
|
if (realpath(pathPtr, absolute) == NULL)
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
for (i = 0; i < s_pathEntriesCount; i++) {
|
||||||
|
if (strcmp(absolute, s_pathEntries[i]) == 0)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen(absolute) + 1 > PATH_MAX)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// check if file exists
|
||||||
|
f = fopen(absolute, "rb");
|
||||||
|
if (f == NULL)
|
||||||
|
return -1;
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
// add new entry
|
||||||
|
printf("size = %i\n", sizeof(*s_pathEntries));
|
||||||
|
s_pathEntries = realloc(s_pathEntries, (s_pathEntriesCount + 1) * sizeof(*s_pathEntries));
|
||||||
|
strcpy(s_pathEntries[s_pathEntriesCount], absolute);
|
||||||
|
return s_pathEntriesCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DVDOpen(char *fileName, DVDFileInfo *fileInfo)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
printf("DVDOpen: %s\n", fileName);
|
||||||
|
f = fopen(fileName, "rb");
|
||||||
|
if (f == NULL) {
|
||||||
|
puts("open failed\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
fileInfo->cb.addr = f;
|
||||||
|
fseek(f, 0, SEEK_END);
|
||||||
|
fileInfo->length = ftell(f);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DVDFastOpen(s32 entrynum, DVDFileInfo *fileInfo)
|
||||||
|
{
|
||||||
|
printf("DVDFastOpen: %li\n", entrynum);
|
||||||
|
if (entrynum < s_pathEntriesCount)
|
||||||
|
return DVDOpen(s_pathEntries[entrynum], fileInfo);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DVDClose(DVDFileInfo *fileInfo)
|
||||||
|
{
|
||||||
|
FILE *f = fileInfo->cb.addr;
|
||||||
|
|
||||||
|
if (f != NULL)
|
||||||
|
fclose(f);
|
||||||
|
fileInfo->cb.addr = NULL;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DVDReadAsyncPrio(DVDFileInfo *fileInfo, void *addr, s32 length, s32 offset, DVDCallback callback, s32 prio)
|
||||||
|
{
|
||||||
|
FILE *f = fileInfo->cb.addr;
|
||||||
|
BOOL success;
|
||||||
|
|
||||||
|
printf("DVDReadAsyncPrio: length %li, offset %li\n", length, offset);
|
||||||
|
fseek(f, offset, SEEK_SET);
|
||||||
|
success = (fread(addr, length, 1, f) == 1) || feof(f);
|
||||||
|
if (!success)
|
||||||
|
puts("read failed");
|
||||||
|
callback(success ? 0 : -1, fileInfo);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DVDOpenDir(char *dirName, DVDDir *dir)
|
||||||
|
{
|
||||||
|
puts("DVDOpenDir is a stub");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DVDCloseDir(DVDDir *dir)
|
||||||
|
{
|
||||||
|
puts("DVDCloseDir is a stub");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DVDReadDir(DVDDir *dir, DVDDirEntry *dirent)
|
||||||
|
{
|
||||||
|
puts("DVDReadDir is a stub");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 DVDGetDriveStatus(void)
|
||||||
|
{
|
||||||
|
// puts("DVDGetDriveStatus is a stub");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <types.h>
|
||||||
|
|
||||||
|
void OSInit()
|
||||||
|
{
|
||||||
|
printf("OSInit is a stub\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void OSReport(const char *msg, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, msg);
|
||||||
|
vprintf(msg, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OSPanic(const char *file, int line, const char *msg, ...) {
|
||||||
|
printf("Panic in \"%s\" on line %d.\n", file, line);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue