psx - support loading exes
This commit is contained in:
parent
183199fdc6
commit
2a3a8a3124
|
@ -259,7 +259,7 @@ namespace BizHawk.Client.Common
|
||||||
nextEmulator = new PSP(nextComm, file.Name);
|
nextEmulator = new PSP(nextComm, file.Name);
|
||||||
break;
|
break;
|
||||||
case "PSX":
|
case "PSX":
|
||||||
nextEmulator = new Octoshock(nextComm, disc);
|
nextEmulator = new Octoshock(nextComm, disc, null);
|
||||||
nextEmulator.CoreComm.RomStatusDetails = "PSX etc.";
|
nextEmulator.CoreComm.RomStatusDetails = "PSX etc.";
|
||||||
break;
|
break;
|
||||||
case "PCE":
|
case "PCE":
|
||||||
|
@ -306,6 +306,12 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
rom = new RomGame(file);
|
rom = new RomGame(file);
|
||||||
|
|
||||||
|
//hacky for now
|
||||||
|
if (file.Extension.ToLower() == ".exe")
|
||||||
|
{
|
||||||
|
rom.GameInfo.System = "PSX";
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(rom.GameInfo.System))
|
if (string.IsNullOrEmpty(rom.GameInfo.System))
|
||||||
{
|
{
|
||||||
// Has the user picked a preference for this extension?
|
// Has the user picked a preference for this extension?
|
||||||
|
@ -406,6 +412,10 @@ namespace BizHawk.Client.Common
|
||||||
//core = CoreInventory.Instance["GBA", "Meteor"];
|
//core = CoreInventory.Instance["GBA", "Meteor"];
|
||||||
core = CoreInventory.Instance["GBA", "VBA-Next"];
|
core = CoreInventory.Instance["GBA", "VBA-Next"];
|
||||||
break;
|
break;
|
||||||
|
case "PSX":
|
||||||
|
nextEmulator = new Octoshock(nextComm, null, rom.FileData);
|
||||||
|
nextEmulator.CoreComm.RomStatusDetails = "PSX etc.";
|
||||||
|
break;
|
||||||
case "DEBUG":
|
case "DEBUG":
|
||||||
if (VersionInfo.DeveloperBuild)
|
if (VersionInfo.DeveloperBuild)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,6 +74,9 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||||
disposed = true;
|
disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wraps the ShockDiscRef returned from the DLL and acts as a bridge between it and a DiscSystem disc
|
||||||
|
/// </summary>
|
||||||
class DiscInterface : IDisposable
|
class DiscInterface : IDisposable
|
||||||
{
|
{
|
||||||
public DiscInterface(DiscSystem.Disc disc, Action cbActivity)
|
public DiscInterface(DiscSystem.Disc disc, Action cbActivity)
|
||||||
|
@ -164,7 +167,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||||
|
|
||||||
//note: its annoying that we have to have a disc before constructing this.
|
//note: its annoying that we have to have a disc before constructing this.
|
||||||
//might want to change that later. HOWEVER - we need to definitely have a region, at least
|
//might want to change that later. HOWEVER - we need to definitely have a region, at least
|
||||||
public Octoshock(CoreComm comm, DiscSystem.Disc disc)
|
public Octoshock(CoreComm comm, DiscSystem.Disc disc, byte[] exe)
|
||||||
{
|
{
|
||||||
ServiceProvider = new BasicServiceProvider(this);
|
ServiceProvider = new BasicServiceProvider(this);
|
||||||
CoreComm = comm;
|
CoreComm = comm;
|
||||||
|
@ -174,27 +177,38 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||||
Attach();
|
Attach();
|
||||||
|
|
||||||
this.disc = disc;
|
this.disc = disc;
|
||||||
discInterface = new DiscInterface(disc,
|
|
||||||
() =>
|
|
||||||
{
|
|
||||||
//if current disc this delegate disc, activity is happening
|
|
||||||
if (disc == this.disc)
|
|
||||||
CoreComm.DriveLED = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
//determine region of the provided disc
|
|
||||||
OctoshockDll.ShockDiscInfo discInfo;
|
|
||||||
OctoshockDll.shock_AnalyzeDisc(discInterface.OctoshockHandle, out discInfo);
|
|
||||||
|
|
||||||
//try to acquire the appropriate firmware
|
|
||||||
string firmwareRegion = "U";
|
string firmwareRegion = "U";
|
||||||
if(discInfo.region == OctoshockDll.eRegion.EU) firmwareRegion = "E";
|
OctoshockDll.eRegion region = OctoshockDll.eRegion.NA;
|
||||||
if (discInfo.region == OctoshockDll.eRegion.JP) firmwareRegion = "J";
|
|
||||||
|
if (disc != null)
|
||||||
|
{
|
||||||
|
discInterface = new DiscInterface(disc,
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
//if current disc this delegate disc, activity is happening
|
||||||
|
if (disc == this.disc)
|
||||||
|
CoreComm.DriveLED = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
//determine region of the provided disc
|
||||||
|
OctoshockDll.ShockDiscInfo discInfo;
|
||||||
|
OctoshockDll.shock_AnalyzeDisc(discInterface.OctoshockHandle, out discInfo);
|
||||||
|
|
||||||
|
//try to acquire the appropriate firmware
|
||||||
|
if (discInfo.region == OctoshockDll.eRegion.EU) firmwareRegion = "E";
|
||||||
|
if (discInfo.region == OctoshockDll.eRegion.JP) firmwareRegion = "J";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//assume its NA region for test programs, for now. could it be read out of the ps-exe header?
|
||||||
|
}
|
||||||
|
|
||||||
byte[] firmware = comm.CoreFileProvider.GetFirmware("PSX", "U", true, "A PSX `" + firmwareRegion + "` region bios file is required");
|
byte[] firmware = comm.CoreFileProvider.GetFirmware("PSX", "U", true, "A PSX `" + firmwareRegion + "` region bios file is required");
|
||||||
|
|
||||||
//create the instance
|
//create the instance
|
||||||
fixed (byte* pFirmware = firmware)
|
fixed (byte* pFirmware = firmware)
|
||||||
OctoshockDll.shock_Create(out psx, discInfo.region, pFirmware);
|
OctoshockDll.shock_Create(out psx, region, pFirmware);
|
||||||
|
|
||||||
SetMemoryDomains();
|
SetMemoryDomains();
|
||||||
|
|
||||||
|
@ -214,10 +228,18 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||||
VirtualWidth = 800;
|
VirtualWidth = 800;
|
||||||
VirtualHeight = 480;
|
VirtualHeight = 480;
|
||||||
|
|
||||||
|
if (disc != null)
|
||||||
OctoshockDll.shock_OpenTray(psx);
|
{
|
||||||
OctoshockDll.shock_SetDisc(psx, discInterface.OctoshockHandle);
|
OctoshockDll.shock_OpenTray(psx);
|
||||||
OctoshockDll.shock_CloseTray(psx);
|
OctoshockDll.shock_SetDisc(psx, discInterface.OctoshockHandle);
|
||||||
|
OctoshockDll.shock_CloseTray(psx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//must be an exe
|
||||||
|
fixed (byte* pExeBuffer = exe)
|
||||||
|
OctoshockDll.shock_MountEXE(psx, pExeBuffer, exe.Length);
|
||||||
|
}
|
||||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x01, OctoshockDll.ePeripheralType.DualShock);
|
OctoshockDll.shock_Peripheral_Connect(psx, 0x01, OctoshockDll.ePeripheralType.DualShock);
|
||||||
OctoshockDll.shock_PowerOn(psx);
|
OctoshockDll.shock_PowerOn(psx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,9 @@ public unsafe static class OctoshockDll
|
||||||
[DllImport("octoshock.dll")]
|
[DllImport("octoshock.dll")]
|
||||||
public static extern int shock_Peripheral_MemcardTransact(IntPtr psx, int address, ref ShockMemcardTransaction transaction);
|
public static extern int shock_Peripheral_MemcardTransact(IntPtr psx, int address, ref ShockMemcardTransaction transaction);
|
||||||
|
|
||||||
|
[DllImport("octoshock.dll")]
|
||||||
|
public static extern int shock_MountEXE(IntPtr psx, void* exebuf, int size);
|
||||||
|
|
||||||
[DllImport("octoshock.dll")]
|
[DllImport("octoshock.dll")]
|
||||||
public static extern int shock_PowerOn(IntPtr psx);
|
public static extern int shock_PowerOn(IntPtr psx);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ namespace BizHawk.Emulation.Cores
|
||||||
Multiple, //dont think this makes sense. shouldnt the multiple options be returned?
|
Multiple, //dont think this makes sense. shouldnt the multiple options be returned?
|
||||||
|
|
||||||
Disc, //an unknown disc
|
Disc, //an unknown disc
|
||||||
PSX, PSP,
|
PSX, PSX_EXE,
|
||||||
|
PSP,
|
||||||
Saturn, MegaCD,
|
Saturn, MegaCD,
|
||||||
|
|
||||||
PCE, SGX, TurboCD,
|
PCE, SGX, TurboCD,
|
||||||
|
@ -264,7 +265,8 @@ namespace BizHawk.Emulation.Cores
|
||||||
public static SimpleMagicRecord SEGASATURN = new SimpleMagicRecord { Offset = 0, Key = "SEGA SEGASATURN" };
|
public static SimpleMagicRecord SEGASATURN = new SimpleMagicRecord { Offset = 0, Key = "SEGA SEGASATURN" };
|
||||||
public static SimpleMagicRecord SEGADISCSYSTEM = new SimpleMagicRecord { Offset = 0, Key = "SEGADISCSYSTEM" };
|
public static SimpleMagicRecord SEGADISCSYSTEM = new SimpleMagicRecord { Offset = 0, Key = "SEGADISCSYSTEM" };
|
||||||
|
|
||||||
public static SimpleMagicRecord PSX = new SimpleMagicRecord { Offset = 0x24E0, Key = " Licensed by Sony Computer Entertainment" };
|
public static SimpleMagicRecord PSX = new SimpleMagicRecord { Offset = 0x24E0, Key = " Licensed by Sony Computer Entertainment" }; //there might be other ideas for checking in mednafen sources, if we need them
|
||||||
|
public static SimpleMagicRecord PSX_EXE = new SimpleMagicRecord { Key = "PS-X EXE\0" };
|
||||||
public static SimpleMagicRecord PSP = new SimpleMagicRecord { Offset = 0x8000, Key = "\x01CD001\x01\0x00PSP GAME" };
|
public static SimpleMagicRecord PSP = new SimpleMagicRecord { Offset = 0x8000, Key = "\x01CD001\x01\0x00PSP GAME" };
|
||||||
|
|
||||||
//https://sites.google.com/site/atari7800wiki/a78-header
|
//https://sites.google.com/site/atari7800wiki/a78-header
|
||||||
|
@ -312,6 +314,8 @@ namespace BizHawk.Emulation.Cores
|
||||||
{ "JAD", new ExtensionInfo(FileIDType.Multiple, Test_JAD_JAC ) },
|
{ "JAD", new ExtensionInfo(FileIDType.Multiple, Test_JAD_JAC ) },
|
||||||
{ "JAC", new ExtensionInfo(FileIDType.Multiple, Test_JAD_JAC ) },
|
{ "JAC", new ExtensionInfo(FileIDType.Multiple, Test_JAD_JAC ) },
|
||||||
|
|
||||||
|
{ "EXE", new ExtensionInfo(FileIDType.PSX_EXE, (j)=>Test_Simple(j,FileIDType.PSX_EXE,SimpleMagics.PSX_EXE) ) },
|
||||||
|
|
||||||
//royal mess
|
//royal mess
|
||||||
{ "MD", new ExtensionInfo(FileIDType.SMD, null ) },
|
{ "MD", new ExtensionInfo(FileIDType.SMD, null ) },
|
||||||
{ "SMD", new ExtensionInfo(FileIDType.SMD, null ) },
|
{ "SMD", new ExtensionInfo(FileIDType.SMD, null ) },
|
||||||
|
|
Binary file not shown.
|
@ -1554,177 +1554,187 @@ EW_EXPORT s32 shock_GetFramebuffer(void* psx, ShockFramebufferInfo* fb)
|
||||||
|
|
||||||
static void LoadEXE(const uint8 *data, const uint32 size, bool ignore_pcsp = false)
|
static void LoadEXE(const uint8 *data, const uint32 size, bool ignore_pcsp = false)
|
||||||
{
|
{
|
||||||
// uint32 PC;
|
uint32 PC;
|
||||||
// uint32 SP;
|
uint32 SP;
|
||||||
// uint32 TextStart;
|
uint32 TextStart;
|
||||||
// uint32 TextSize;
|
uint32 TextSize;
|
||||||
//
|
|
||||||
// if(size < 0x800)
|
//TODO ERROR HANDLING
|
||||||
// throw(MDFN_Error(0, "PS-EXE is too small."));
|
//if(size < 0x800)
|
||||||
//
|
// throw(MDFN_Error(0, "PS-EXE is too small."));
|
||||||
// PC = MDFN_de32lsb(&data[0x10]);
|
|
||||||
// SP = MDFN_de32lsb(&data[0x30]);
|
PC = MDFN_de32lsb(&data[0x10]);
|
||||||
// TextStart = MDFN_de32lsb(&data[0x18]);
|
SP = MDFN_de32lsb(&data[0x30]);
|
||||||
// TextSize = MDFN_de32lsb(&data[0x1C]);
|
TextStart = MDFN_de32lsb(&data[0x18]);
|
||||||
//
|
TextSize = MDFN_de32lsb(&data[0x1C]);
|
||||||
// if(ignore_pcsp)
|
|
||||||
// printf("TextStart=0x%08x\nTextSize=0x%08x\n", TextStart, TextSize);
|
if(ignore_pcsp)
|
||||||
// else
|
printf("TextStart=0x%08x\nTextSize=0x%08x\n", TextStart, TextSize);
|
||||||
// printf("PC=0x%08x\nSP=0x%08x\nTextStart=0x%08x\nTextSize=0x%08x\n", PC, SP, TextStart, TextSize);
|
else
|
||||||
//
|
printf("PC=0x%08x\nSP=0x%08x\nTextStart=0x%08x\nTextSize=0x%08x\n", PC, SP, TextStart, TextSize);
|
||||||
// TextStart &= 0x1FFFFF;
|
|
||||||
//
|
TextStart &= 0x1FFFFF;
|
||||||
// if(TextSize > 2048 * 1024)
|
|
||||||
// {
|
if(TextSize > 2048 * 1024)
|
||||||
// throw(MDFN_Error(0, "Text section too large"));
|
{
|
||||||
// }
|
//TODO ERROR HANDLING
|
||||||
//
|
//throw(MDFN_Error(0, "Text section too large"));
|
||||||
// if(TextSize > (size - 0x800))
|
}
|
||||||
// throw(MDFN_Error(0, "Text section recorded size is larger than data available in file. Header=0x%08x, Available=0x%08x", TextSize, size - 0x800));
|
|
||||||
//
|
//TODO ERROR HANDLING
|
||||||
// if(TextSize < (size - 0x800))
|
/*if(TextSize > (size - 0x800))
|
||||||
// throw(MDFN_Error(0, "Text section recorded size is smaller than data available in file. Header=0x%08x, Available=0x%08x", TextSize, size - 0x800));
|
throw(MDFN_Error(0, "Text section recorded size is larger than data available in file. Header=0x%08x, Available=0x%08x", TextSize, size - 0x800));
|
||||||
//
|
|
||||||
// if(!TextMem.size())
|
if(TextSize < (size - 0x800))
|
||||||
// {
|
throw(MDFN_Error(0, "Text section recorded size is smaller than data available in file. Header=0x%08x, Available=0x%08x", TextSize, size - 0x800));*/
|
||||||
// TextMem_Start = TextStart;
|
|
||||||
// TextMem.resize(TextSize);
|
if(!TextMem.size())
|
||||||
// }
|
{
|
||||||
//
|
TextMem_Start = TextStart;
|
||||||
// if(TextStart < TextMem_Start)
|
TextMem.resize(TextSize);
|
||||||
// {
|
}
|
||||||
// uint32 old_size = TextMem.size();
|
|
||||||
//
|
if(TextStart < TextMem_Start)
|
||||||
// //printf("RESIZE: 0x%08x\n", TextMem_Start - TextStart);
|
{
|
||||||
//
|
uint32 old_size = TextMem.size();
|
||||||
// TextMem.resize(old_size + TextMem_Start - TextStart);
|
|
||||||
// memmove(&TextMem[TextMem_Start - TextStart], &TextMem[0], old_size);
|
//printf("RESIZE: 0x%08x\n", TextMem_Start - TextStart);
|
||||||
//
|
|
||||||
// TextMem_Start = TextStart;
|
TextMem.resize(old_size + TextMem_Start - TextStart);
|
||||||
// }
|
memmove(&TextMem[TextMem_Start - TextStart], &TextMem[0], old_size);
|
||||||
//
|
|
||||||
// if(TextMem.size() < (TextStart - TextMem_Start + TextSize))
|
TextMem_Start = TextStart;
|
||||||
// TextMem.resize(TextStart - TextMem_Start + TextSize);
|
}
|
||||||
//
|
|
||||||
// memcpy(&TextMem[TextStart - TextMem_Start], data + 0x800, TextSize);
|
if(TextMem.size() < (TextStart - TextMem_Start + TextSize))
|
||||||
//
|
TextMem.resize(TextStart - TextMem_Start + TextSize);
|
||||||
//
|
|
||||||
// //
|
memcpy(&TextMem[TextStart - TextMem_Start], data + 0x800, TextSize);
|
||||||
// //
|
|
||||||
// //
|
|
||||||
//
|
//
|
||||||
// // BIOS patch
|
//
|
||||||
// BIOSROM->WriteU32(0x6990, (3 << 26) | ((0xBF001000 >> 2) & ((1 << 26) - 1)));
|
//
|
||||||
//// BIOSROM->WriteU32(0x691C, (3 << 26) | ((0xBF001000 >> 2) & ((1 << 26) - 1)));
|
|
||||||
//
|
// BIOS patch
|
||||||
//// printf("INSN: 0x%08x\n", BIOSROM->ReadU32(0x6990));
|
BIOSROM->WriteU32(0x6990, (3 << 26) | ((0xBF001000 >> 2) & ((1 << 26) - 1)));
|
||||||
//// exit(1);
|
// BIOSROM->WriteU32(0x691C, (3 << 26) | ((0xBF001000 >> 2) & ((1 << 26) - 1)));
|
||||||
// uint8 *po;
|
|
||||||
//
|
// printf("INSN: 0x%08x\n", BIOSROM->ReadU32(0x6990));
|
||||||
// po = &PIOMem->data8[0x0800];
|
// exit(1);
|
||||||
//
|
uint8 *po;
|
||||||
// MDFN_en32lsb(po, (0x0 << 26) | (31 << 21) | (0x8 << 0)); // JR
|
|
||||||
// po += 4;
|
po = &PIOMem->data8[0x0800];
|
||||||
// MDFN_en32lsb(po, 0); // NOP(kinda)
|
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0x0 << 26) | (31 << 21) | (0x8 << 0)); // JR
|
||||||
//
|
po += 4;
|
||||||
// po = &PIOMem->data8[0x1000];
|
MDFN_en32lsb(po, 0); // NOP(kinda)
|
||||||
//
|
po += 4;
|
||||||
// // Load cacheable-region target PC into r2
|
|
||||||
// MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (0x9F001010 >> 16)); // LUI
|
po = &PIOMem->data8[0x1000];
|
||||||
// po += 4;
|
|
||||||
// MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (2 << 16) | (0x9F001010 & 0xFFFF)); // ORI
|
// Load cacheable-region target PC into r2
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (0x9F001010 >> 16)); // LUI
|
||||||
//
|
po += 4;
|
||||||
// // Jump to r2
|
MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (2 << 16) | (0x9F001010 & 0xFFFF)); // ORI
|
||||||
// MDFN_en32lsb(po, (0x0 << 26) | (2 << 21) | (0x8 << 0)); // JR
|
po += 4;
|
||||||
// po += 4;
|
|
||||||
// MDFN_en32lsb(po, 0); // NOP(kinda)
|
// Jump to r2
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0x0 << 26) | (2 << 21) | (0x8 << 0)); // JR
|
||||||
//
|
po += 4;
|
||||||
// //
|
MDFN_en32lsb(po, 0); // NOP(kinda)
|
||||||
// // 0x9F001010:
|
po += 4;
|
||||||
// //
|
|
||||||
//
|
//
|
||||||
// // Load source address into r8
|
// 0x9F001010:
|
||||||
// uint32 sa = 0x9F000000 + 65536;
|
//
|
||||||
// MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (sa >> 16)); // LUI
|
|
||||||
// po += 4;
|
// Load source address into r8
|
||||||
// MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (8 << 16) | (sa & 0xFFFF)); // ORI
|
uint32 sa = 0x9F000000 + 65536;
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (sa >> 16)); // LUI
|
||||||
//
|
po += 4;
|
||||||
// // Load dest address into r9
|
MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (8 << 16) | (sa & 0xFFFF)); // ORI
|
||||||
// MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (TextMem_Start >> 16)); // LUI
|
po += 4;
|
||||||
// po += 4;
|
|
||||||
// MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (9 << 16) | (TextMem_Start & 0xFFFF)); // ORI
|
// Load dest address into r9
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (TextMem_Start >> 16)); // LUI
|
||||||
//
|
po += 4;
|
||||||
// // Load size into r10
|
MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (9 << 16) | (TextMem_Start & 0xFFFF)); // ORI
|
||||||
// MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (TextMem.size() >> 16)); // LUI
|
po += 4;
|
||||||
// po += 4;
|
|
||||||
// MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (10 << 16) | (TextMem.size() & 0xFFFF)); // ORI
|
// Load size into r10
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (TextMem.size() >> 16)); // LUI
|
||||||
//
|
po += 4;
|
||||||
// //
|
MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (10 << 16) | (TextMem.size() & 0xFFFF)); // ORI
|
||||||
// // Loop begin
|
po += 4;
|
||||||
// //
|
|
||||||
//
|
//
|
||||||
// MDFN_en32lsb(po, (0x24 << 26) | (8 << 21) | (1 << 16)); // LBU to r1
|
// Loop begin
|
||||||
// po += 4;
|
//
|
||||||
//
|
|
||||||
// MDFN_en32lsb(po, (0x08 << 26) | (10 << 21) | (10 << 16) | 0xFFFF); // Decrement size
|
MDFN_en32lsb(po, (0x24 << 26) | (8 << 21) | (1 << 16)); // LBU to r1
|
||||||
// po += 4;
|
po += 4;
|
||||||
//
|
|
||||||
// MDFN_en32lsb(po, (0x28 << 26) | (9 << 21) | (1 << 16)); // SB from r1
|
MDFN_en32lsb(po, (0x08 << 26) | (10 << 21) | (10 << 16) | 0xFFFF); // Decrement size
|
||||||
// po += 4;
|
po += 4;
|
||||||
//
|
|
||||||
// MDFN_en32lsb(po, (0x08 << 26) | (8 << 21) | (8 << 16) | 0x0001); // Increment source addr
|
MDFN_en32lsb(po, (0x28 << 26) | (9 << 21) | (1 << 16)); // SB from r1
|
||||||
// po += 4;
|
po += 4;
|
||||||
//
|
|
||||||
// MDFN_en32lsb(po, (0x05 << 26) | (0 << 21) | (10 << 16) | (-5 & 0xFFFF));
|
MDFN_en32lsb(po, (0x08 << 26) | (8 << 21) | (8 << 16) | 0x0001); // Increment source addr
|
||||||
// po += 4;
|
po += 4;
|
||||||
// MDFN_en32lsb(po, (0x08 << 26) | (9 << 21) | (9 << 16) | 0x0001); // Increment dest addr
|
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0x05 << 26) | (0 << 21) | (10 << 16) | (-5 & 0xFFFF));
|
||||||
//
|
po += 4;
|
||||||
// //
|
MDFN_en32lsb(po, (0x08 << 26) | (9 << 21) | (9 << 16) | 0x0001); // Increment dest addr
|
||||||
// // Loop end
|
po += 4;
|
||||||
// //
|
|
||||||
//
|
//
|
||||||
// // Load SP into r29
|
// Loop end
|
||||||
// if(ignore_pcsp)
|
//
|
||||||
// {
|
|
||||||
// po += 16;
|
// Load SP into r29
|
||||||
// }
|
if(ignore_pcsp)
|
||||||
// else
|
{
|
||||||
// {
|
po += 16;
|
||||||
// MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (SP >> 16)); // LUI
|
}
|
||||||
// po += 4;
|
else
|
||||||
// MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (29 << 16) | (SP & 0xFFFF)); // ORI
|
{
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | (SP >> 16)); // LUI
|
||||||
//
|
po += 4;
|
||||||
// // Load PC into r2
|
MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (29 << 16) | (SP & 0xFFFF)); // ORI
|
||||||
// MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | ((PC >> 16) | 0x8000)); // LUI
|
po += 4;
|
||||||
// po += 4;
|
|
||||||
// MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (2 << 16) | (PC & 0xFFFF)); // ORI
|
// Load PC into r2
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0xF << 26) | (0 << 21) | (1 << 16) | ((PC >> 16) | 0x8000)); // LUI
|
||||||
// }
|
po += 4;
|
||||||
//
|
MDFN_en32lsb(po, (0xD << 26) | (1 << 21) | (2 << 16) | (PC & 0xFFFF)); // ORI
|
||||||
// // Half-assed instruction cache flush. ;)
|
po += 4;
|
||||||
// for(unsigned i = 0; i < 1024; i++)
|
}
|
||||||
// {
|
|
||||||
// MDFN_en32lsb(po, 0);
|
// Half-assed instruction cache flush. ;)
|
||||||
// po += 4;
|
for(unsigned i = 0; i < 1024; i++)
|
||||||
// }
|
{
|
||||||
//
|
MDFN_en32lsb(po, 0);
|
||||||
//
|
po += 4;
|
||||||
//
|
}
|
||||||
// // Jump to r2
|
|
||||||
// MDFN_en32lsb(po, (0x0 << 26) | (2 << 21) | (0x8 << 0)); // JR
|
|
||||||
// po += 4;
|
|
||||||
// MDFN_en32lsb(po, 0); // NOP(kinda)
|
// Jump to r2
|
||||||
// po += 4;
|
MDFN_en32lsb(po, (0x0 << 26) | (2 << 21) | (0x8 << 0)); // JR
|
||||||
|
po += 4;
|
||||||
|
MDFN_en32lsb(po, 0); // NOP(kinda)
|
||||||
|
po += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EW_EXPORT s32 shock_MountEXE(void* psx, void* exebuf, int size)
|
||||||
|
{
|
||||||
|
LoadEXE((uint8*)exebuf, (uint32)size);
|
||||||
|
return SHOCK_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef WANT_PSF
|
#ifdef WANT_PSF
|
||||||
PSF1Loader::PSF1Loader(MDFNFILE *fp)
|
PSF1Loader::PSF1Loader(MDFNFILE *fp)
|
||||||
{
|
{
|
||||||
|
@ -1744,72 +1754,6 @@ void PSF1Loader::HandleEXE(const uint8 *data, uint32 size, bool ignore_pcsp)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//static void Cleanup(void);
|
|
||||||
//static int Load(MDFNFILE *fp)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// const bool IsPSF = PSFLoader::TestMagic(0x01, fp);
|
|
||||||
//
|
|
||||||
// if(!TestMagic(fp))
|
|
||||||
// throw MDFN_Error(0, _("File format is unknown to module \"%s\"."), MDFNGameInfo->shortname);
|
|
||||||
//
|
|
||||||
//// For testing.
|
|
||||||
//#if 0
|
|
||||||
// #warning "GREMLINS GREMLINS EVERYWHEREE IYEEEEEE"
|
|
||||||
// #warning "Seriously, GREMLINS! Or peanut butter. Or maybe...DINOSAURS."
|
|
||||||
//
|
|
||||||
// static std::vector<CDIF *> CDInterfaces;
|
|
||||||
//
|
|
||||||
// //CDInterfaces.push_back(CDIF_Open("/home/sarah-projects/psxdev/tests/cd/adpcm.cue", false, false));
|
|
||||||
// //CDInterfaces.push_back(CDIF_Open("/extra/games/PSX/Tony Hawk's Pro Skater 2 (USA)/Tony Hawk's Pro Skater 2 (USA).cue", false, false));
|
|
||||||
// //CDInterfaces.push_back(CDIF_Open("/extra/games/PSX/Jumping Flash! (USA)/Jumping Flash! (USA).cue", false, false));
|
|
||||||
// //CDInterfaces.push_back(CDIF_Open("/extra/games/PC-FX/Blue Breaker.cue", false, false));
|
|
||||||
// CDInterfaces.push_back(CDIF_Open("/dev/cdrom2", true, false));
|
|
||||||
// InitCommon(&CDInterfaces, !IsPSF, true);
|
|
||||||
//#else
|
|
||||||
// InitCommon(NULL, !IsPSF, true);
|
|
||||||
//#endif
|
|
||||||
//
|
|
||||||
// TextMem.resize(0);
|
|
||||||
//
|
|
||||||
// if(IsPSF)
|
|
||||||
// {
|
|
||||||
// psf_loader = new PSF1Loader(fp);
|
|
||||||
//
|
|
||||||
// std::vector<std::string> SongNames;
|
|
||||||
//
|
|
||||||
// SongNames.push_back(psf_loader->tags.GetTag("title"));
|
|
||||||
//
|
|
||||||
// Player_Init(1, psf_loader->tags.GetTag("game"), psf_loader->tags.GetTag("artist"), psf_loader->tags.GetTag("copyright"), SongNames);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// LoadEXE(fp->data, fp->size);
|
|
||||||
// }
|
|
||||||
// catch(std::exception &e)
|
|
||||||
// {
|
|
||||||
// Cleanup();
|
|
||||||
// throw;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return(1);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//static void LoadCD(std::vector<CDIF *> *CDInterfaces)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// InitCommon(CDInterfaces);
|
|
||||||
//
|
|
||||||
// MDFNGameInfo->GameType = GMT_CDROM;
|
|
||||||
// }
|
|
||||||
// catch(std::exception &e)
|
|
||||||
// {
|
|
||||||
// Cleanup();
|
|
||||||
// throw;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
static void Cleanup(void)
|
static void Cleanup(void)
|
||||||
{
|
{
|
||||||
TextMem.resize(0);
|
TextMem.resize(0);
|
||||||
|
|
|
@ -278,6 +278,9 @@ EW_EXPORT s32 shock_Peripheral_SetPadInput(void* psx, s32 address, u32 buttons,
|
||||||
//Performs one of several transactions on an attached memory card.
|
//Performs one of several transactions on an attached memory card.
|
||||||
EW_EXPORT s32 shock_Peripheral_MemcardTransact(void* psx, s32 address, ShockMemcardTransaction* transaction);
|
EW_EXPORT s32 shock_Peripheral_MemcardTransact(void* psx, s32 address, ShockMemcardTransaction* transaction);
|
||||||
|
|
||||||
|
//Mounts a PS-EXE executable
|
||||||
|
EW_EXPORT s32 shock_MountEXE(void* psx, void* exebuf, int size);
|
||||||
|
|
||||||
//Sets the power to ON. Returns SHOCK_NOCANDO if already on.
|
//Sets the power to ON. Returns SHOCK_NOCANDO if already on.
|
||||||
EW_EXPORT s32 shock_PowerOn(void* psx);
|
EW_EXPORT s32 shock_PowerOn(void* psx);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue