#using <mscorlib.dll>
#using <System.dll>
#include <vcclr.h>
#include <msclr/marshal.h>
#include <msclr/marshal_cppstd.h>
#include <string>
#include "psx.h"
#include "loader.h"
using namespace msclr::interop;
public ref class PsxApi
{
public:
PSX *psx;
static void StdioFixes()
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD fileType = GetFileType(handle);
bool shouldReopen = fileType == FILE_TYPE_CHAR;
if(shouldReopen)
freopen("CONOUT$", "w", stdout);
handle = GetStdHandle(STD_ERROR_HANDLE);
fileType = GetFileType(handle);
shouldReopen = fileType == FILE_TYPE_CHAR;
if(shouldReopen)
freopen("CONOUT$", "w", stderr);
}
PsxApi()
{
StdioFixes();
psx = new PSX();
psx->poweron(PSX::eConsoleType_DTL);
Load_BIOS(*psx, "B:\\svn\\bizhawk4\\BizHawk.MultiClient\\output\\SCPH5500.bin");
psx->reset();
}
void Load_EXE(System::String^ str)
{
::Load_EXE(*psx, marshal_as<std::wstring>(str).c_str());
}
void RunForever()
{
psx->RunForever();
}
};