Initial work on F-Zero - map & gameconfig. Far from playable - wacky math errors. NOTE: The game only boots if you disable LoadStore in the debugger window menu.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1941 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-01-19 21:42:24 +00:00
parent 0b267948cc
commit c64bae837f
6 changed files with 119 additions and 9 deletions

View file

@ -0,0 +1,7 @@
# GFZE01 - F-ZERO GX (US Version)
[Core] Values set here will override the main dolphin settings.
TLBHack=1
[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 0
[OnFrame] Add memory patches to be applied every frame here.
[ActionReplay] Add action replay cheats here.

34
Data/User/Maps/GFZE01.map Normal file
View file

@ -0,0 +1,34 @@
.text
80003488 000000b8 80003488 0 __fill_mem
80003540 00000050 80003540 0 memcpy
8006cff8 0000004c 8006cff8 0 .LoadQuantizers
8006d044 0000002c 8006d044 0 .kill_infinites_helper
8006d070 00000018 8006d070 0 .kill_infinites
8006d088 0000002c 8006d088 0 .rsqrt
8006d0b4 00000034 8006d0b4 0 .sqrt_internal_needs_cr1
8006d0e8 00000030 8006d0e8 0 .rsqrt_internal_needs_cr1
8006d188 00000030 8006d188 0 .wrapping_once_fp_lookup
8006d1b8 00000064 8006d1b8 0 .weird2
8006d1c4 00000058 8006d1c4 0 .into_weird2
8006d21c 00000030 8006d21c 0 .lookup_some_float_in_table_with_neg_wrap
8006d24c 00000184 8006d24c 0 .atan2
8006d534 00000070 8006d534 0 .evil_vec_cosine
8006d5f0 00000078 8006d5f0 0 .evil_vec_setlength
8006d668 00000094 8006d668 0 .evil_vec_something
8006d6fc 0000005c 8006d6fc 0 .func
8006d784 0000002c 8006d784 0 .load_strange_matrix1
8006d7b0 0000002c 8006d7b0 0 .load_strange_matrix2
8006d7f4 0000003c 8006d7f4 0 .some_strange_destination
8006db30 00000044 8006db30 0 .push_matrix_3x3?
8006db74 00000038 8006db74 0 .write_top_3x3_matrix
8006dbe4 0000003c 8006dbe4 0 .read_current_3x3_matrix
8006dc20 00000014 8006dc20 0 .pop_matrix_stack
8006e424 00000074 8006e424 0 .weird_param_in_p1_p2
8006f6a8 000000cc 8006f6a8 0 .z_last_skum_function
800798f0 000000ec 800798f0 0 __div2u
800799dc 00000138 800799dc 0 __div2i
80079b14 000000e0 80079b14 0 __mod2u
80079bf8 0000010c 80079bf8 0 __mod2i
80079d04 00000024 80079d04 0 __shl2i
80079d28 00000024 80079d28 0 __shr2u
80079d4c 00000028 80079d4c 0 __shr2i

View file

@ -33,8 +33,9 @@
#define MAP_ANONYMOUS MAP_ANON
#endif
const char* ram_temp_file = "/tmp/gc_mem.tmp";
#ifndef _WIN32
static const char* ram_temp_file = "/tmp/gc_mem.tmp";
#endif
void MemArena::GrabLowMemSpace(size_t size)
{
@ -64,7 +65,7 @@ void MemArena::ReleaseSpace()
void* MemArena::CreateView(s64 offset, size_t size, bool ensure_low_mem)
{
#ifdef _WIN32
return(MapViewOfFile(hMemoryMapping, FILE_MAP_ALL_ACCESS, 0, (DWORD)((u64)offset), size));
return MapViewOfFile(hMemoryMapping, FILE_MAP_ALL_ACCESS, 0, (DWORD)((u64)offset), size);
#else
void* ptr = mmap(0, size,
@ -89,12 +90,10 @@ void* MemArena::CreateView(s64 offset, size_t size, bool ensure_low_mem)
void* MemArena::CreateViewAt(s64 offset, size_t size, void* base)
{
#ifdef _WIN32
return(MapViewOfFileEx(hMemoryMapping, FILE_MAP_ALL_ACCESS, 0, (DWORD)((u64)offset), size, base));
return MapViewOfFileEx(hMemoryMapping, FILE_MAP_ALL_ACCESS, 0, (DWORD)((u64)offset), size, base);
#else
return(mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, offset));
return mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, offset);
#endif
}

View file

@ -74,6 +74,7 @@ static const SPatch OSPatches[] =
{ ".rsqrt_internal_needs_cr1", HLE_Misc::SMB_rsqrt_internal },
{ ".atan2", HLE_Misc::SMB_atan2},
//{ ".kill_infinites", HLE_Misc::FZero_kill_infinites },
// special
// { "GXPeekZ", HLE_Misc::GXPeekZ},
// { "GXPeekARGB", HLE_Misc::GXPeekARGB},

View file

@ -25,18 +25,22 @@
namespace HLE_Misc
{
// Helper to quickly read the floating point value at a memory location.
inline float F(u32 addr)
{
u32 mem = Memory::ReadFast32(addr);
return *((float*)&mem);
}
// Helper to quickly write a floating point value to a memory location.
inline void FW(u32 addr, float x)
{
u32 data = *((u32*)&x);
Memory::WriteUnchecked_U32(data, addr);
}
// If you just want to kill a function, one of the three following are usually appropriate.
// According to the PPC ABI, the return value is always in r3.
void UnimplementedFunction()
{
NPC = LR;
@ -56,23 +60,27 @@ void UnimplementedFunctionFalse()
void GXPeekZ()
{
// Just some fake Z value.
Memory::Write_U32(0xFFFFFF, GPR(5));
NPC = LR;
}
void GXPeekARGB()
{
// Just some fake color value.
Memory::Write_U32(0xFFFFFFFF, GPR(5));
NPC = LR;
}
// If you want a function to panic, you can rename it PanicAlert :p
// Don't know if this is worth keeping.
void HLEPanicAlert()
{
::PanicAlert("HLE: PanicAlert %08x", LR);
NPC = LR;
}
// .evil_vec_cosine
// Computes the cosine of the angle between the two fvec3s pointed at by r3 and r4.
void SMB_EvilVecCosine()
{
u32 r3 = GPR(3);
@ -95,6 +103,7 @@ void SMB_EvilVecCosine()
NPC = LR;
}
// Normalizes the vector pointed at by r3.
void SMB_EvilNormalize()
{
u32 r3 = GPR(3);
@ -111,6 +120,8 @@ void SMB_EvilNormalize()
NPC = LR;
}
// Scales the vector pointed at by r3 to the length specified by f0.
// Writes results to vector pointed at by r4.
void SMB_evil_vec_setlength()
{
u32 r3 = GPR(3);
@ -128,7 +139,7 @@ void SMB_evil_vec_setlength()
NPC = LR;
}
// Internal square root function in the crazy math lib. Acts a bit odd, just read it. It's not a bug :p
void SMB_sqrt_internal()
{
double f = sqrt(rPS0(1));
@ -139,6 +150,7 @@ void SMB_sqrt_internal()
NPC = LR;
}
// Internal inverse square root function in the crazy math lib.
void SMB_rsqrt_internal()
{
double f = 1.0 / sqrt(rPS0(1));
@ -158,4 +170,60 @@ void SMB_atan2()
GPR(3) = angle_fixpt;
NPC = LR;
}
// F-zero math lib range: 8006d044 - 8006f770
void FZero_kill_infinites()
{
// TODO: Kill infinites in FPR(1)
NPC = LR;
}
void FZero_evil_vec_something()
{
/*
.evil_vec_something
8006d668: lis r5, 0xE000
8006d66c: lfs f6, 0 (r3)
8006d670: lfs f7, 0x0004 (r3)
8006d674: fmuls f1,f6,f6
8006d678: lfs f8, 0x0008 (r3)
8006d67c: fmadds f1,f7,f7,f1
8006d680: fmadds f1,f8,f8,f1
8006d684: lfs f2, 0x01A0 (r5)
8006d688: mcrfs cr1, cr4
8006d68c: mcrfs cr0, cr3
8006d690: bso- cr1,->0x8006D6E8
8006d694: ble- cr1,->0x8006D6E8
8006d698: bso- ->0x8006D6E8
8006d69c: fmr f0,f2
8006d6a0: fmuls f4,f2,f1
8006d6a4: fadds f3,f2,f2
8006d6a8: frsqrte f1,f0,f1
8006d6ac: fadds f3,f3,f2
8006d6b0: fmuls f5,f1,f1
8006d6b4: fnmsubs f5,f5,f4,f3
8006d6b8: fmuls f1,f1,f5
8006d6bc: fmuls f5,f1,f1
8006d6c0: fnmsubs f5,f5,f4,f3
8006d6c4: fmuls f1,f1,f5
8006d6c8: fmuls f6,f6,f1
8006d6cc: stfs f6, 0 (r3)
8006d6d0: fmuls f7,f7,f1
8006d6d4: stfs f7, 0x0004 (r3)
8006d6d8: fmuls f8,f8,f1
8006d6dc: stfs f8, 0x0008 (r3)
8006d6e0: fmuls f1,f1,f0
8006d6e4: blr
8006d6e8: lfs f1, 0x0198 (r5)
8006d6ec: stfs f1, 0 (r3)
8006d6f0: stfs f1, 0x0004 (r3)
8006d6f4: stfs f1, 0x0008 (r3)
8006d6f8: blr
*/
NPC = LR;
}
}

View file

@ -33,6 +33,7 @@ namespace HLE_Misc
void SMB_rsqrt_internal();
void SMB_atan2();
void SMB_evil_vec_setlength();
void FZero_kill_infinites();
}
#endif