//note to self: try to make mednafen have file IO callbacks into here: open, close, read, write. //we'll trick mednafen into using a virtual filesystem and track the fake files internally public void LoadCuePath(string path) { Attach(); //note to self: //consider loading a fake cue, which is generated by our Disc class, and converting all reads to the fake bin to reads into the disc class. //thatd be pretty cool.... (may need to add an absolute byte range read method into the disc class, which can traverse the requisite LBAs)... //...but... are there other ideas? LibMednahawkDll.psx_LoadCue(path); }
static Octoshock() { LibMednahawkDll.dll_Initialize(); FopenCallback = new LibMednahawkDll.t_FopenCallback(FopenCallbackProc); FcloseCallback = new LibMednahawkDll.t_FcloseCallback(FcloseCallbackProc); FopCallback = new LibMednahawkDll.t_FopCallback(FopCallbackProc); LibMednahawkDll.dll_SetPropPtr(LibMednahawkDll.eProp.SetPtr_FopenCallback, Marshal.GetFunctionPointerForDelegate(FopenCallback)); LibMednahawkDll.dll_SetPropPtr(LibMednahawkDll.eProp.SetPtr_FcloseCallback, Marshal.GetFunctionPointerForDelegate(FcloseCallback)); LibMednahawkDll.dll_SetPropPtr(LibMednahawkDll.eProp.SetPtr_FopCallback, Marshal.GetFunctionPointerForDelegate(FopCallback)); }
public void FrameAdvance(bool render, bool rendersound) { LibMednahawkDll.psx_FrameAdvance(); if (render == false) { return; } int w = LibMednahawkDll.dll_GetPropPtr(LibMednahawkDll.eProp.GetPtr_FramebufferWidth).ToInt32(); int h = LibMednahawkDll.dll_GetPropPtr(LibMednahawkDll.eProp.GetPtr_FramebufferHeight).ToInt32(); int p = LibMednahawkDll.dll_GetPropPtr(LibMednahawkDll.eProp.GetPtr_FramebufferPitchPixels).ToInt32(); IntPtr iptr = LibMednahawkDll.dll_GetPropPtr(LibMednahawkDll.eProp.GetPtr_FramebufferPointer); void * ptr = iptr.ToPointer(); VirtualWidth = BufferWidth = w; BufferHeight = h; int len = w * h; if (frameBuffer.Length != len) { frameBuffer = new int[len]; } //todo - we could do the reformatting in the PSX core //better yet, we could send a buffer into the psx core before frame advance to use for outputting video to for (int y = 0, i = 0; y < h; y++) { for (int x = 0; x < w; x++, i++) { frameBuffer[i] = (int)unchecked (((int *)ptr)[y * p + x] | (int)0xFF000000); } } }