GPGX64 works with the new waterbox, or would if I pushed the binaries. Savestates are hosed; TBD

This commit is contained in:
nattthebear 2017-05-20 18:50:01 -04:00
parent a325969963
commit fa24f5fc9d
6 changed files with 18 additions and 19 deletions

View File

@ -267,6 +267,10 @@ namespace BizHawk.Emulation.Cores.Waterbox
}
}
private class EndOfMainException : Exception
{
}
/// <summary>
/// serves as a standin for libpsxscl.so
/// </summary>
@ -306,7 +310,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
if (ptr == IntPtr.Zero)
{
var s = string.Format("Trapped on unimplemented function {0}:{1}", moduleName, e);
Action del = () => { throw new InvalidOperationException(e); };
Action del = () => { throw new InvalidOperationException(s); };
_traps.Add(del);
ptr = Marshal.GetFunctionPointerForDelegate(del);
}
@ -351,7 +355,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
context.DoGlobalDtors = tmp[3];
}
return 1;
return 0; // success
}
}
@ -366,10 +370,6 @@ namespace BizHawk.Emulation.Cores.Waterbox
_parent = parent;
}
public class EndOfMainException: Exception
{
}
[BizExport(CallingConvention.Cdecl, EntryPoint = "alloc_sealed")]
public IntPtr AllocSealed(UIntPtr size)
{
@ -387,12 +387,6 @@ namespace BizHawk.Emulation.Cores.Waterbox
{
Console.WriteLine("_debug_puts:" + Marshal.PtrToStringAnsi(s));
}
[BizExport(CallingConvention.Cdecl, EntryPoint = "_leave_main")]
public void LeaveMain()
{
throw new EndOfMainException();
}
}
/// <summary>
@ -445,6 +439,15 @@ namespace BizHawk.Emulation.Cores.Waterbox
return Z.UU(end);
}
}
// aka __psx_init_frame
// in midipix, this just sets up SEH and does not do anything that start_main does in MUSL normally
[BizExport(CallingConvention.Cdecl, EntryPoint = "start_main")]
public int StartMain(IntPtr u0, int u1, IntPtr u2, IntPtr main)
{
// since we don't really need main, we can blow up here
throw new EndOfMainException();
}
}
// usual starting address for the executable
@ -582,7 +585,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
_modules[0].RunExeEntry();
throw new InvalidOperationException("main() returned!");
}
catch (Emu.EndOfMainException)
catch (EndOfMainException)
{ }
foreach (var m in _modules.Skip(1))
{

Binary file not shown.

Binary file not shown.

View File

@ -4,4 +4,3 @@
void *alloc_sealed(size_t size) { return NULL; }
void *alloc_invisible(size_t size) { return NULL; }
void _debug_puts(const char *s) { }
void _leave_main(void) { }

View File

@ -22,8 +22,4 @@ void *alloc_invisible(size_t size);
// send a debug string somewhere, bypassing stdio
void _debug_puts(const char *);
// this might be used for something
void _leave_main(void);
#endif

View File

@ -714,7 +714,8 @@ GPGX_EX int gpgx_getregs(gpregister_t *regs)
return ret;
}
// at the moment, this dummy is not called
int main(void)
{
_leave_main();
return 0;
}