Merge remote-tracking branch 'refs/remotes/origin/LLE_contrib'

This commit is contained in:
PatrickvL 2016-10-21 23:41:16 +02:00
commit bd7e18330d
22 changed files with 1900 additions and 416 deletions

View File

@ -165,6 +165,7 @@
<ClInclude Include="..\..\src\CxbxKrnl\EmuFile.h" />
<ClInclude Include="..\..\src\CxbxKrnl\EmuFS.h" />
<ClInclude Include="..\..\src\CxbxKrnl\EmuNtDll.h" />
<ClInclude Include="..\..\src\CxbxKrnl\EmuNV2A.h" />
<ClInclude Include="..\..\src\CxbxKrnl\EmuShared.h" />
<ClInclude Include="..\..\src\CxbxKrnl\EmuX86.h" />
<ClInclude Include="..\..\src\CxbxKrnl\EmuXactEng.h" />
@ -178,6 +179,7 @@
<ClInclude Include="..\..\src\CxbxKrnl\HLEDataBase.h" />
<ClInclude Include="..\..\src\CxbxKrnl\HLEIntercept.h" />
<ClInclude Include="..\..\src\Common\Win32\Mutex.h" />
<ClInclude Include="..\..\src\CxbxKrnl\nv2a_int.h" />
<ClInclude Include="..\..\src\CxbxKrnl\OOVPA.h" />
<ClInclude Include="..\..\src\CxbxKrnl\ResourceTracker.h" />
<ClInclude Include="..\..\src\Common\Win32\XBController.h" />
@ -483,6 +485,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\src\CxbxKrnl\EmuNV2A.cpp" />
<ClCompile Include="..\..\src\CxbxKrnl\EmuX86.cpp" />
<ClCompile Include="..\..\src\CxbxKrnl\EmuXactEng.cpp" />
<ClCompile Include="..\..\src\CxbxKrnl\EmuXapi.cpp">

View File

@ -136,8 +136,8 @@ CXBXKRNL_API void EmuShared::Cleanup()
// ******************************************************************
CXBXKRNL_API EmuShared::EmuShared()
{
m_XBController.Load("Software\\Cxbx\\XBController");
m_XBVideo.Load("Software\\Cxbx\\XBVideo");
m_XBController.Load("Software\\Cxbx-Reloaded\\XBController");
m_XBVideo.Load("Software\\Cxbx-Reloaded\\XBVideo");
}
// ******************************************************************
@ -145,6 +145,6 @@ CXBXKRNL_API EmuShared::EmuShared()
// ******************************************************************
CXBXKRNL_API EmuShared::~EmuShared()
{
m_XBController.Save("Software\\Cxbx\\XBController");
m_XBVideo.Save("Software\\Cxbx\\XBVideo");
m_XBController.Save("Software\\Cxbx-Reloaded\\XBController");
m_XBVideo.Save("Software\\Cxbx-Reloaded\\XBVideo");
}

View File

@ -371,7 +371,7 @@ bool XBController::ConfigPoll(char *szStatus)
Map(CurConfigObject, DeviceInstance.tszInstanceName, dwHow, dwFlags);
printf("Cxbx: Detected %s%s on %s%lu\n", szDirection, ObjectInstance.tszName, DeviceInstance.tszInstanceName, ObjectInstance.dwType);
printf("Cxbx-Reloaded: Detected %s%s on %s%lu\n", szDirection, ObjectInstance.tszName, DeviceInstance.tszInstanceName, ObjectInstance.dwType);
sprintf(szStatus, "Success: %s Mapped to '%s%s' on '%s'!", m_DeviceNameLookup[CurConfigObject], szDirection, ObjectInstance.tszName, DeviceInstance.tszInstanceName);
@ -408,7 +408,7 @@ bool XBController::ConfigPoll(char *szStatus)
{
Map(CurConfigObject, "SysKeyboard", dwHow, dwFlags);
printf("Cxbx: Detected Key %d on SysKeyboard\n", dwHow);
printf("Cxbx-Reloaded: Detected Key %d on SysKeyboard\n", dwHow);
sprintf(szStatus, "Success: %s Mapped to Key %d on SysKeyboard", m_DeviceNameLookup[CurConfigObject], dwHow);
@ -446,7 +446,7 @@ bool XBController::ConfigPoll(char *szStatus)
{
Map(CurConfigObject, "SysMouse", dwHow, dwFlags);
printf("Cxbx: Detected Button %d on SysMouse\n", dwHow);
printf("Cxbx-Reloaded: Detected Button %d on SysMouse\n", dwHow);
sprintf(szStatus, "Success: %s Mapped to Button %d on SysMouse", m_DeviceNameLookup[CurConfigObject], dwHow);
@ -518,7 +518,7 @@ bool XBController::ConfigPoll(char *szStatus)
Map(CurConfigObject, "SysMouse", dwHow, dwFlags);
printf("Cxbx: Detected Movement on the %s%s on SysMouse\n", szDirection, szObjName);
printf("Cxbx-Reloaded: Detected Movement on the %s%s on SysMouse\n", szDirection, szObjName);
sprintf(szStatus, "Success: %s Mapped to %s%s on SysMouse", m_DeviceNameLookup[CurConfigObject], szDirection, szObjName);
@ -1064,7 +1064,7 @@ int XBController::Insert(const char *szDeviceName)
}
}
MessageBox(NULL, "Unexpected Circumstance (Too Many Controller Devices)! Please contact caustik!", "Cxbx", MB_OK | MB_ICONEXCLAMATION);
MessageBox(NULL, "Unexpected Circumstance (Too Many Controller Devices)! Please contact caustik!", "Cxbx-Reloaded", MB_OK | MB_ICONEXCLAMATION);
ExitProcess(1);

View File

@ -1027,7 +1027,7 @@ void Xbe::DumpInformation(FILE *x_file)
if(GetError() != 0)
return;
fprintf(x_file, "XBE information generated by CXBX (Version " _CXBX_VERSION ")\n");
fprintf(x_file, "XBE information generated by Cxbx-Reloaded (Version " _CXBX_VERSION ")\n");
fprintf(x_file, "\n");
fprintf(x_file, "Title identified as \"%s\"\n", m_szAsciiTitle);
fprintf(x_file, "\n");

View File

@ -1023,7 +1023,7 @@ void Xbe::DumpInformation(FILE *x_file)
if(GetError() != 0)
return;
fprintf(x_file, "XBE information generated by CXBX (Version " _CXBX_VERSION ")\n");
fprintf(x_file, "XBE information generated by Cxbx-Reloaded (Version " _CXBX_VERSION ")\n");
fprintf(x_file, "\n");
fprintf(x_file, "Title identified as \"%s\"\n", m_szAsciiTitle);
fprintf(x_file, "\n");

View File

@ -84,9 +84,9 @@ typedef signed long sint32;
/*! version string dependent on trace flag */
#ifndef _DEBUG_TRACE
#define _CXBX_VERSION "0.8.1-Pre3"
#define _CXBX_VERSION "0.0.1-POC"
#else
#define _CXBX_VERSION "0.8.1-Pre3-Trace"
#define _CXBX_VERSION "0.0.1-POC-Trace"
#endif
/*! debug mode choices */

View File

@ -83,7 +83,7 @@ INT_PTR CALLBACK DlgControllerConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam,
/*! if changes have been made, check if the user wants to save them */
if(g_bHasChanges)
{
int ret = MessageBox(hWndDlg, "Do you wish to apply your changes?", "Cxbx", MB_ICONQUESTION | MB_YESNOCANCEL);
int ret = MessageBox(hWndDlg, "Do you wish to apply your changes?", "Cxbx-Reloaded", MB_ICONQUESTION | MB_YESNOCANCEL);
switch(ret)
{

View File

@ -149,7 +149,7 @@ INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR
/*! if changes have been made, check if the user wants to save them */
if(g_bHasChanges)
{
int ret = MessageBox(hWndDlg, "Do you wish to apply your changes?", "Cxbx", MB_ICONQUESTION | MB_YESNOCANCEL);
int ret = MessageBox(hWndDlg, "Do you wish to apply your changes?", "Cxbx-Reloaded", MB_ICONQUESTION | MB_YESNOCANCEL);
switch(ret)
{

View File

@ -48,7 +48,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
/*! verify CxbxKrnl.dll is the same version as Cxbx.exe */
if(!CxbxKrnlVerifyVersion(_CXBX_VERSION))
{
MessageBox(NULL, "CxbxKrnl.dll is the incorrect version", "Cxbx", MB_OK);
MessageBox(NULL, "CxbxKrnl.dll is the incorrect version", "Cxbx-Reloaded", MB_OK);
return 1;
}
@ -85,7 +85,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
/*! if an error occurred, notify user */
if(MainWindow->GetError() != 0)
{
MessageBox(NULL, MainWindow->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(NULL, MainWindow->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
}
delete MainWindow;

View File

@ -40,7 +40,7 @@
WndAbout::WndAbout(HINSTANCE x_hInstance, HWND x_parent) : Wnd(x_hInstance)
{
m_classname = "WndAbout";
m_wndname = "Cxbx : About";
m_wndname = "Cxbx-Reloaded : About";
m_w = 400;
m_h = 300;

View File

@ -53,7 +53,7 @@ WndMain::WndMain(HINSTANCE x_hInstance) : Wnd(x_hInstance), m_bCreated(false), m
// initialize members
{
m_classname = "WndMain";
m_wndname = "Cxbx " _CXBX_VERSION;
m_wndname = "Cxbx-Reloaded " _CXBX_VERSION;
m_w = 640;
m_h = 480;
@ -315,7 +315,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
char AsciiTitle[255];
sprintf(AsciiTitle, "Cxbx : Emulating %s...", m_Xbe->m_szAsciiTitle);
sprintf(AsciiTitle, "Cxbx-Reloaded : Emulating %s...", m_Xbe->m_szAsciiTitle);
SetWindowText(m_hwnd, AsciiTitle);
@ -326,7 +326,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
case WM_DESTROY:
{
m_hwndChild = NULL;
SetWindowText(m_hwnd, "Cxbx " _CXBX_VERSION);
SetWindowText(m_hwnd, "Cxbx-Reloaded " _CXBX_VERSION);
RefreshMenus();
}
break;
@ -386,7 +386,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(m_Xbe != 0 && m_Xbe->GetError() == 0)
sprintf(buffer, "%s Loaded!", m_Xbe->m_szAsciiTitle);
else
sprintf(buffer, "%s", "Disclaimer: Cxbx has no affiliation with Microsoft");
sprintf(buffer, "%s", "Disclaimer: Cxbx-Reloaded has no affiliation with Microsoft");
RECT rect = {0, 480-15-5, 640-100-4-69, 480-5};
@ -615,7 +615,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
// ask permission to overwrite if file already exists
if(_access(ofn.lpstrFile, 0) != -1)
{
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", MB_ICONQUESTION | MB_YESNO) != IDYES)
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx-Reloaded", MB_ICONQUESTION | MB_YESNO) != IDYES)
return TRUE;
}
@ -686,14 +686,14 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
}
if(m_Xbe->GetError() != 0)
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
else
{
char buffer[255];
sprintf(buffer, "%s's logo bitmap was successfully exported.", m_Xbe->m_szAsciiTitle);
MessageBox(m_hwnd, buffer, "Cxbx", MB_ICONINFORMATION | MB_OK);
MessageBox(m_hwnd, buffer, "Cxbx-Reloaded", MB_ICONINFORMATION | MB_OK);
printf("WndMain: %s\n", buffer);
}
@ -772,7 +772,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(bmp_err != 0)
{
MessageBox(m_hwnd, bmp_err, "Cxbx", MB_OK | MB_ICONEXCLAMATION);
MessageBox(m_hwnd, bmp_err, "Cxbx-Reloaded", MB_OK | MB_ICONEXCLAMATION);
break;
}
}
@ -781,7 +781,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(m_Xbe->GetError() != 0)
{
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
if(m_Xbe->IsFatal())
CloseXbe();
@ -801,7 +801,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
printf("WndMain: %s\n", buffer);
MessageBox(m_hwnd, buffer, "Cxbx", MB_ICONINFORMATION | MB_OK);
MessageBox(m_hwnd, buffer, "Cxbx-Reloaded", MB_ICONINFORMATION | MB_OK);
}
}
}
@ -883,7 +883,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
// ask permission to overwrite if file exists
if(_access(ofn.lpstrFile, 0) != -1)
{
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", MB_ICONQUESTION | MB_YESNO) != IDYES)
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx-Reloaded", MB_ICONQUESTION | MB_YESNO) != IDYES)
return TRUE;
}
@ -893,7 +893,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
// verify file was opened
if(TxtFile == 0)
MessageBox(m_hwnd, "Could not open text file.", "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, "Could not open text file.", "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
else
{
m_Xbe->DumpInformation(TxtFile);
@ -902,7 +902,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(m_Xbe->GetError())
{
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
}
else
{
@ -912,7 +912,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
printf("WndMain: %s\n", buffer);
MessageBox(m_hwnd, buffer, "Cxbx", MB_ICONINFORMATION | MB_OK);
MessageBox(m_hwnd, buffer, "Cxbx-Reloaded", MB_ICONINFORMATION | MB_OK);
}
}
}
@ -927,7 +927,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(m_Xbe->GetError())
{
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
}
else
{
@ -955,7 +955,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
else
m_KrnlDebug = DM_NONE;
MessageBox(m_hwnd, "This will not take effect until the next time emulation is started.\n", "Cxbx", MB_OK);
MessageBox(m_hwnd, "This will not take effect until the next time emulation is started.\n", "Cxbx-Reloaded", MB_OK);
m_bExeChanged = true;
@ -995,7 +995,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(GetSaveFileName(&ofn) != FALSE)
{
MessageBox(m_hwnd, "This will not take effect until emulation is (re)started.\n", "Cxbx", MB_OK);
MessageBox(m_hwnd, "This will not take effect until emulation is (re)started.\n", "Cxbx-Reloaded", MB_OK);
strncpy(m_KrnlDebugFilename, ofn.lpstrFile, 259);
@ -1107,7 +1107,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
Sleep(10);
if(AboutWnd->GetError() != 0)
MessageBox(m_hwnd, AboutWnd->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, AboutWnd->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
delete AboutWnd;
}
@ -1219,7 +1219,7 @@ void WndMain::LoadLogo()
if(m_Xbe->GetError() != 0)
{
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONEXCLAMATION | MB_OK);
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx-Reloaded", MB_ICONEXCLAMATION | MB_OK);
if(m_Xbe->IsFatal())
CloseXbe();
@ -1405,7 +1405,7 @@ void WndMain::UpdateDebugConsoles()
{
freopen("CONOUT$", "wt", stdout);
SetConsoleTitle("Cxbx : Debug Console");
SetConsoleTitle("Cxbx-Reloaded : Debug Console");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
@ -1510,7 +1510,7 @@ void WndMain::OpenXbe(const char *x_filename)
if(m_Xbe->GetError() != 0)
{
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
delete m_Xbe; m_Xbe = 0;
@ -1588,7 +1588,7 @@ void WndMain::CloseXbe()
if(m_bXbeChanged)
{
int ret = MessageBox(m_hwnd, "Changes have been made, do you wish to save?", "Cxbx", MB_ICONQUESTION | MB_YESNOCANCEL);
int ret = MessageBox(m_hwnd, "Changes have been made, do you wish to save?", "Cxbx-Reloaded", MB_ICONQUESTION | MB_YESNOCANCEL);
if(ret == IDYES)
SaveXbeAs();
@ -1626,7 +1626,7 @@ void WndMain::SaveXbe(const char *x_filename)
// ask permission to overwrite if the file already exists
if(_access(x_filename, 0) != -1)
{
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", MB_ICONQUESTION | MB_YESNO) != IDYES)
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx-Reloaded", MB_ICONQUESTION | MB_YESNO) != IDYES)
return;
}
@ -1635,7 +1635,7 @@ void WndMain::SaveXbe(const char *x_filename)
m_Xbe->Export(x_filename);
if(m_Xbe->GetError() != 0)
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
else
{
char buffer[255];
@ -1644,7 +1644,7 @@ void WndMain::SaveXbe(const char *x_filename)
printf("WndMain: %s was successfully saved.\n", m_Xbe->m_szAsciiTitle);
MessageBox(m_hwnd, buffer, "Cxbx", MB_ICONINFORMATION | MB_OK);
MessageBox(m_hwnd, buffer, "Cxbx-Reloaded", MB_ICONINFORMATION | MB_OK);
m_bXbeChanged = false;
}
@ -1685,7 +1685,7 @@ void WndMain::ImportExe(const char *x_filename)
if(i_exe->GetError() != 0)
{
MessageBox(m_hwnd, i_exe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, i_exe->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
delete i_exe;
@ -1696,7 +1696,7 @@ void WndMain::ImportExe(const char *x_filename)
if(m_Xbe->GetError() != 0)
{
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
delete m_Xbe; m_Xbe = 0;
@ -1799,7 +1799,7 @@ bool WndMain::ConvertToExe(const char *x_filename, bool x_bVerifyIfExists, HWND
{
if(_access(filename, 0) != -1)
{
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", MB_ICONQUESTION | MB_YESNO) != IDYES)
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx-Reloaded", MB_ICONQUESTION | MB_YESNO) != IDYES)
return false;
}
}
@ -1812,7 +1812,7 @@ bool WndMain::ConvertToExe(const char *x_filename, bool x_bVerifyIfExists, HWND
if(i_EmuExe.GetError() != 0)
{
MessageBox(m_hwnd, i_EmuExe.GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, i_EmuExe.GetError(), "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
return false;
}
else
@ -1861,7 +1861,7 @@ void WndMain::StartEmulation(EnumAutoConvert x_AutoConvert, HWND hwndParent)
if((int)ShellExecute(NULL, "open", szExeFileName, szArgsBuffer, szBuffer, SW_SHOWDEFAULT) <= 32)
{
m_bCanStart = true;
MessageBox(m_hwnd, "Emulation failed.\n\n If this message repeats, the Xbe is not supported.", "Cxbx", MB_ICONSTOP | MB_OK);
MessageBox(m_hwnd, "Emulation failed.\n\n If this message repeats, the Xbe is not supported.", "Cxbx-Reloaded", MB_ICONSTOP | MB_OK);
printf("WndMain: %s shell failed.\n", m_Xbe->m_szAsciiTitle);
}
@ -1878,7 +1878,7 @@ void WndMain::StopEmulation()
if(!IsWindow(m_hwndChild))
{
m_hwndChild = NULL;
SetWindowText(m_hwnd, "Cxbx " _CXBX_VERSION);
SetWindowText(m_hwnd, "Cxbx-Reloaded " _CXBX_VERSION);
RefreshMenus();
}

View File

@ -372,7 +372,7 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
freopen("CONOUT$", "wt", stdout);
freopen("CONIN$", "rt", stdin);
SetConsoleTitle("Cxbx : Kernel Debug Console");
SetConsoleTitle("Cxbx-Reloaded : Kernel Debug Console");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
@ -457,7 +457,7 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
// Initialize devices :
char szBuffer[260];
SHGetSpecialFolderPath(NULL, szBuffer, CSIDL_APPDATA, TRUE);
strcat(szBuffer, "\\Cxbx\\");
strcat(szBuffer, "\\Cxbx-Reloaded\\");
std::string basePath(szBuffer);
CxbxBasePath = basePath + "\\EmuDisk\\";

View File

@ -184,7 +184,7 @@ extern int EmuException(LPEXCEPTION_POINTERS e)
e->ContextRecord->Eip += 1;
int ret = MessageBox(g_hEmuWindow, buffer, "Cxbx", MB_ICONSTOP | MB_ABORTRETRYIGNORE);
int ret = MessageBox(g_hEmuWindow, buffer, "Cxbx-Reloaded", MB_ICONSTOP | MB_ABORTRETRYIGNORE);
if(ret == IDABORT)
{
@ -245,7 +245,7 @@ extern int EmuException(LPEXCEPTION_POINTERS e)
" Press \"Cancel\" to debug.",
e->ExceptionRecord->ExceptionCode, e->ContextRecord->Eip);
if(MessageBox(g_hEmuWindow, buffer, "Cxbx", MB_ICONSTOP | MB_OKCANCEL) == IDOK)
if(MessageBox(g_hEmuWindow, buffer, "Cxbx-Reloaded", MB_ICONSTOP | MB_OKCANCEL) == IDOK)
{
printf("EmuMain (0x%X): Aborting Emulation\n", GetCurrentThreadId());
fflush(stdout);
@ -300,13 +300,13 @@ int ExitException(LPEXCEPTION_POINTERS e)
fflush(stdout);
MessageBox(g_hEmuWindow, "Warning: Could not safely terminate process!", "Cxbx", MB_OK);
MessageBox(g_hEmuWindow, "Warning: Could not safely terminate process!", "Cxbx-Reloaded", MB_OK);
count++;
if(count > 1)
{
MessageBox(g_hEmuWindow, "Warning: Multiple Problems!", "Cxbx", MB_OK);
MessageBox(g_hEmuWindow, "Warning: Multiple Problems!", "Cxbx-Reloaded", MB_OK);
return EXCEPTION_CONTINUE_SEARCH;
}

View File

@ -364,7 +364,7 @@ static DWORD WINAPI EmuRenderWindow(LPVOID lpVoid)
wcstombs(tAsciiTitle, XbeCert->wszTitleName, 40);
}
sprintf(AsciiTitle, "Cxbx : Emulating %s", tAsciiTitle);
sprintf(AsciiTitle, "Cxbx-Reloaded : Emulating %s", tAsciiTitle);
}
// create the window

349
src/CxbxKrnl/EmuNV2A.cpp Normal file
View File

@ -0,0 +1,349 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->EmuNV2A.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// * (c) 2016 Luke Usher <luke.usher@outlook.com>
// * All rights reserved
// *
// ******************************************************************
#define _CXBXKRNL_INTERNAL
#define _XBOXKRNL_DEFEXTRN_
#include <Zydis.hpp>
#include "CxbxKrnl.h"
#include "Emu.h"
#include "EmuNV2A.h"
#include "nv2a_int.h" // from https://github.com/espes/xqemu/tree/xbox/hw/xbox
uint32_t EmuNV2A_PMC_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PMC_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PBUS_Read32(uint32_t addr)
{
switch (addr) {
case NV_PBUS_PCI_NV_0:
return 0x10de; // PCI_VENDOR_ID_NVIDIA
case NV_PBUS_PCI_NV_2:
return 0x0; // NV_PBUS_PCI_NV_2_REVISION_ID ??
default:
EmuWarning("EmuNV2A_PBUS_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PFIFO_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PFIFO_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PFIFO_CACHE_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PFIFO_CACHE_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PRMA_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PRMA_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PVIDEO_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PVIDEO_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PTIMER_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PTIMER_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PCOUNTER_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PCOUNTER_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PTIMER_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PTIMER_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PVPE_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PVPE_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PTV_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PTV_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PRMFB_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PRMFB_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PRMVIO_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PRMVIO_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PFB_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PFB_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PSTRAPS_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PSTRAPS_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PGRAPH_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PGRAPH_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PCRTC_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PCRTC_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PRMCIO_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PRMCIO_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PRAMDAC_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PRAMDAC_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PRMDIO_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PRMDIO_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_PRAMIN_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_PRAMIN_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_USER_Read32(uint32_t addr)
{
switch (addr) {
default:
EmuWarning("EmuNV2A_USER_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
uint32_t EmuNV2A_Read32(uint32_t addr)
{
switch ((addr >> 12) & 31) {
case NV_PMC : /* card master control */
return EmuNV2A_PMC_Read32(addr & 0x0FFF);
case NV_PBUS : /* bus control */
return EmuNV2A_PBUS_Read32(addr & 0x0FFF);
case NV_PFIFO : /* MMIO and DMA FIFO submission to PGRAPH and VPE */
return EmuNV2A_PFIFO_Read32(addr & 0x0FFF);
case NV_PFIFO_CACHE :
return EmuNV2A_PFIFO_CACHE_Read32(addr & 0x0FFF);
case NV_PRMA : /* access to BAR0/BAR1 from real mode */
return EmuNV2A_PRMA_Read32(addr & 0x0FFF);
case NV_PVIDEO : /* video overlay */
return EmuNV2A_PVIDEO_Read32(addr & 0x0FFF);
case NV_PTIMER : /* time measurement and time-based alarms */
return EmuNV2A_PTIMER_Read32(addr & 0x0FFF);
case NV_PCOUNTER : /* performance monitoring counters */
return EmuNV2A_PCOUNTER_Read32(addr & 0x0FFF);
case NV_PVPE : /* MPEG2 decoding engine */
return EmuNV2A_PVPE_Read32(addr & 0x0FFF);
case NV_PTV : /* TV encoder */
return EmuNV2A_PTV_Read32(addr & 0x0FFF);
case NV_PRMFB : /* aliases VGA memory window */
return EmuNV2A_PRMFB_Read32(addr & 0x0FFF);
case NV_PRMVIO : /* aliases VGA sequencer and graphics controller registers */
return EmuNV2A_PRMVIO_Read32(addr & 0x0FFF);
case NV_PFB : /* memory interface */
return EmuNV2A_PFB_Read32(addr & 0x0FFF);
case NV_PSTRAPS : /* straps readout / override */
return EmuNV2A_PSTRAPS_Read32(addr & 0x0FFF);
case NV_PGRAPH : /* accelerated 2d/3d drawing engine */
return EmuNV2A_PGRAPH_Read32(addr & 0x0FFF);
case NV_PCRTC : /* more CRTC controls */
return EmuNV2A_PCRTC_Read32(addr & 0x0FFF);
case NV_PRMCIO : /* aliases VGA CRTC and attribute controller registers */
return EmuNV2A_PRMCIO_Read32(addr & 0x0FFF);
case NV_PRAMDAC : /* RAMDAC, cursor, and PLL control */
return EmuNV2A_PRAMDAC_Read32(addr & 0x0FFF);
case NV_PRMDIO : /* aliases VGA palette registers */
return EmuNV2A_PRMDIO_Read32(addr & 0x0FFF);
case NV_PRAMIN : /* RAMIN access */
return EmuNV2A_PRAMIN_Read32(addr & 0x0FFF);
case NV_USER : /* PFIFO MMIO and DMA submission area */
return EmuNV2A_USER_Read32(addr & 0x0FFF);
default:
EmuWarning("EmuNV2A_Read32: Unknown Read Address %08X", addr);
}
return 0;
}
void EmuNV2A_Write32(uint32_t addr, uint32_t value)
{
switch ((addr >> 12) & 31) {
// case NV_PMC : /* card master control */
// return EmuNV2A_PMC_Read32(addr & 0x0FFF);
// case NV_PBUS : /* bus control */
// return EmuNV2A_PBUS_Read32(addr & 0x0FFF);
// case NV_PFIFO : /* MMIO and DMA FIFO submission to PGRAPH and VPE */
// case NV_PFIFO_CACHE :
// case NV_PRMA : /* access to BAR0/BAR1 from real mode */
// case NV_PVIDEO : /* video overlay */
// case NV_PTIMER : /* time measurement and time-based alarms */
// case NV_PCOUNTER : /* performance monitoring counters */
// case NV_PVPE : /* MPEG2 decoding engine */
// case NV_PTV : /* TV encoder */
// case NV_PRMFB : /* aliases VGA memory window */
// case NV_PRMVIO : /* aliases VGA sequencer and graphics controller registers */
// case NV_PFB : /* memory interface */
// case NV_PSTRAPS : /* straps readout / override */
// case NV_PGRAPH : /* accelerated 2d/3d drawing engine */
// case NV_PCRTC : /* more CRTC controls */
// case NV_PRMCIO : /* aliases VGA CRTC and attribute controller registers */
// case NV_PRAMDAC : /* RAMDAC, cursor, and PLL control */
// case NV_PRMDIO : /* aliases VGA palette registers */
// case NV_PRAMIN : /* RAMIN access */
// case NV_USER : /* PFIFO MMIO and DMA submission area */
default:
EmuWarning("EmuNV2A_Write32: Unknown Write Address %08X (value %08X)", addr, value);
}
}

40
src/CxbxKrnl/EmuNV2A.h Normal file
View File

@ -0,0 +1,40 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->EmuX86.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// * (c) 2016 Luke Usher <luke.usher@outlook.com>
// * All rights reserved
// *
// ******************************************************************
#ifndef EMUNV2A_H
#define EMUNV2A_H
uint32_t EmuNV2A_Read32(uint32_t addr);
void EmuNV2A_Write32(uint32_t addr, uint32_t value);
#endif

View File

@ -39,6 +39,161 @@
#include "CxbxKrnl.h"
#include "Emu.h"
#include "EmuX86.h"
#include "EmuNV2A.h"
uint32_t EmuX86_Read32(uint32_t addr)
{
if (addr >= 0xFD000000 && addr <= 0xFE000000) {
return EmuNV2A_Read32(addr & 0x00FFFFFF);
}
EmuWarning("EmuX86_Read32: Unknown Read Address %08X", addr);
return 0;
}
void EmuX86_Write32(uint32_t addr, uint32_t value)
{
if (addr >= 0xFD000000 && addr <= 0xFE000000) {
EmuNV2A_Write32(addr & 0x00FFFFFF, value);
return;
}
EmuWarning("EmuX86_Write32: Unknown Write Address %08X (value %08X)", addr, value);
}
DWORD* EmuX86_GetRegisterPointer(LPEXCEPTION_POINTERS e, Zydis::Register reg)
{
switch (reg) {
case Zydis::Register::EAX:
return &e->ContextRecord->Eax;
case Zydis::Register::EBX:
return &e->ContextRecord->Ebx;
case Zydis::Register::ECX:
return &e->ContextRecord->Ecx;
case Zydis::Register::EDX:
return &e->ContextRecord->Edx;
case Zydis::Register::EDI:
return &e->ContextRecord->Edi;
case Zydis::Register::ESI:
return &e->ContextRecord->Esi;
}
return nullptr;
}
bool EmuX86_GetRegisterValue(uint32_t* output, LPEXCEPTION_POINTERS e, Zydis::Register reg)
{
uint32_t value = 0;
if (reg != Zydis::Register::NONE)
{
DWORD* regptr = EmuX86_GetRegisterPointer(e, reg);
if (regptr == nullptr)
return false;
value = *regptr;
}
*output = value;
return true;
}
bool EmuX86_DecodeMemoryOperand(uint32_t* output, LPEXCEPTION_POINTERS e, Zydis::OperandInfo& operand)
{
uint32_t base = 0;
uint32_t index = 0;
if (!EmuX86_GetRegisterValue(&base, e, operand.base) || !EmuX86_GetRegisterValue(&index, e, operand.base)) {
return false;
}
*output = base + (index * operand.scale) + operand.lval.udword;
return true;
}
bool EmuX86_MOV(LPEXCEPTION_POINTERS e, Zydis::InstructionInfo& info)
{
if (info.operand[0].type == Zydis::OperandType::REGISTER && info.operand[1].type == Zydis::OperandType::MEMORY)
{
DWORD* pDstReg = nullptr;
uint32_t srcAddr = 0;
pDstReg = EmuX86_GetRegisterPointer(e, info.operand[0].base);
if (pDstReg == nullptr) {
return false;
}
if (!EmuX86_DecodeMemoryOperand(&srcAddr, e, info.operand[1])) {
return false;
}
*pDstReg = EmuX86_Read32(srcAddr);
return true;
}
else if (info.operand[0].type == Zydis::OperandType::MEMORY && info.operand[1].type == Zydis::OperandType::REGISTER)
{
uint32_t addr = 0;
uint32_t value = 0;
if (!EmuX86_DecodeMemoryOperand(&addr, e, info.operand[0])) {
return false;
}
if (!EmuX86_GetRegisterValue(&value, e, info.operand[1].base)) {
return false;
}
EmuX86_Write32(addr, value);
return true;
}
else if (info.operand[0].type == Zydis::OperandType::MEMORY && info.operand[1].type == Zydis::OperandType::IMMEDIATE)
{
uint32_t addr = 0;
if (!EmuX86_DecodeMemoryOperand(&addr, e, info.operand[0])) {
return false;
}
EmuX86_Write32(addr, info.operand[1].lval.udword);
return true;
}
return false;
}
void EmuX86_SetFlag(LPEXCEPTION_POINTERS e, int flag, int value)
{
e->ContextRecord->EFlags ^= (-value ^ e->ContextRecord->EFlags) & (1 << flag);
}
bool EmuX86_TEST(LPEXCEPTION_POINTERS e, Zydis::InstructionInfo& info)
{
if (info.operand[0].type == Zydis::OperandType::MEMORY && info.operand[1].type == Zydis::OperandType::IMMEDIATE)
{
uint32_t addr = 0;
if (!EmuX86_DecodeMemoryOperand(&addr, e, info.operand[0])) {
return false;
}
uint32_t value = EmuX86_Read32(addr);
// Perform bitwise AND
uint32_t result = value & info.operand[1].lval.udword;
// Set CF/OF to 0
EmuX86_SetFlag(e, EMUX86_EFLAG_CF, 0);
EmuX86_SetFlag(e, EMUX86_EFLAG_OF, 0);
EmuX86_SetFlag(e, EMUX86_EFLAG_SF, result >> 31);
EmuX86_SetFlag(e, EMUX86_EFLAG_ZF, result == 0 ? 1 : 0);
// TODO: Parity Flag
return true;
}
return false;
}
bool EmuX86_DecodeException(LPEXCEPTION_POINTERS e)
{
@ -64,9 +219,32 @@ bool EmuX86_DecodeException(LPEXCEPTION_POINTERS e)
}
else
{
EmuWarning("EmuX86: 0x%08X: %s Ignored\n", e->ContextRecord->Eip, formatter.formatInstruction(info));
switch (info.mnemonic)
{
case Zydis::InstructionMnemonic::MOV:
if (EmuX86_MOV(e, info)) {
break;
}
goto unimplemented_opcode;
case Zydis::InstructionMnemonic::TEST:
if (EmuX86_TEST(e, info)) {
break;
}
goto unimplemented_opcode;
case Zydis::InstructionMnemonic::WBINVD:
// We can safely ignore this
break;
}
e->ContextRecord->Eip += info.length;
return true;
unimplemented_opcode:
EmuWarning("EmuX86: 0x%08X: %s Not Implemented\n", e->ContextRecord->Eip, formatter.formatInstruction(info));
e->ContextRecord->Eip += info.length;
return false;
}
return false;

View File

@ -34,6 +34,25 @@
#ifndef EMUX86_H
#define EMUX86_H
#define EMUX86_EFLAG_CF 0
#define EMUX86_EFLAG_PF 2
#define EMUX86_EFLAG_AF 4
#define EMUX86_EFLAG_ZF 6
#define EMUX86_EFLAG_SF 7
#define EMUX86_EFLAG_TF 8
#define EMUX86_EFLAG_IF 9
#define EMUX86_EFLAG_DF 10
#define EMUX86_EFLAG_OF 11
#define EMUX86_EFLAG_IOPL1 12
#define EMUX86_EFLAG_IOPL2 13
#define EMUX86_EFLAG_NT 14
#define EMUX86_EFLAG_RF 16
#define EMUX86_EFLAG_VM 17
#define EMUX86_EFLAG_AC 18
#define EMUX86_EFLAG_VIF 19
#define EMUX86_EFLAG_VIP 20
#define EMUX86_EFLAG_ID 21
bool EmuX86_DecodeException(LPEXCEPTION_POINTERS e);
#endif

View File

@ -984,7 +984,7 @@ DWORD WINAPI XTL::EmuXLaunchNewImage
sprintf(szDashboardPath, "%s\\xboxdash.xbe", symbolicLinkObject->NativePath.c_str());
if (PathFileExists(szDashboardPath)) {
MessageBox(CxbxKrnl_hEmuParent, "The title is rebooting to dashboard", "Cxbx", 0);
MessageBox(CxbxKrnl_hEmuParent, "The title is rebooting to dashboard", "Cxbx-Reloaded", 0);
char szXboxDashboardPath[MAX_PATH];
sprintf(szXboxDashboardPath, "%c:\\xboxdash.xbe", symbolicLinkObject->DriveLetter);
EmuXLaunchNewImage(szXboxDashboardPath, pLaunchData);

View File

@ -154,76 +154,6 @@ HLEData HLEDataBase[] =
XAPI_1_0_5849,
XAPI_1_0_5849_SIZE
},
// D3D8 Version 1.0.3925
{
"D3D8",
1, 0, 3925,
D3D8_1_0_3925,
D3D8_1_0_3925_SIZE
},
// D3D8 Version 1.0.4034
{
"D3D8",
1, 0, 4034,
D3D8_1_0_4034,
D3D8_1_0_4034_SIZE
},
// D3D8 Version 1.0.4134
{
"D3D8",
1, 0, 4134,
D3D8_1_0_4134,
D3D8_1_0_4134_SIZE
},
// D3D8 Version 1.0.4361
{
"D3D8",
1, 0, 4361,
D3D8_1_0_4361,
D3D8_1_0_4361_SIZE
},
// D3D8 Version 1.0.4432
{
"D3D8",
1, 0, 4432,
D3D8_1_0_4432,
D3D8_1_0_4432_SIZE
},
// D3D8 Version 1.0.4627
{
"D3D8",
1, 0, 4627,
D3D8_1_0_4627,
D3D8_1_0_4627_SIZE
},
// D3D8 Version 1.0.5233
{
"D3D8",
1, 0, 5233,
D3D8_1_0_5233,
D3D8_1_0_5233_SIZE
},
// D3D8 Version 1.0.5558
{
"D3D8",
1, 0, 5558,
D3D8_1_0_5558,
D3D8_1_0_5558_SIZE
},
// D3D8 Version 1.0.5849
{
"D3D8",
1, 0, 5849,
D3D8_1_0_5849,
D3D8_1_0_5849_SIZE
},
// D3D8LTCG Version 1.0.5849
{
"D3D8LTCG",
1, 0, 5849,
D3D8LTCG_1_0_5849,
D3D8LTCG_1_0_5849_SIZE
},
// DSound Version 1.0.3936
{
"DSOUND",
@ -279,62 +209,6 @@ HLEData HLEDataBase[] =
1, 0, 5849,
DSound_1_0_5849,
DSound_1_0_5849_SIZE
},
// XG Version 1.0.3911
{
"XGRAPHC",
1, 0, 3911,
XG_1_0_3911,
XG_1_0_3911_SIZE
},
// XG Version 1.0.4034
{
"XGRAPHC",
1, 0, 4034,
XG_1_0_4034,
XG_1_0_4034_SIZE
},
// XG Version 1.0.4361
{
"XGRAPHC",
1, 0, 4361,
XG_1_0_4361,
XG_1_0_4361_SIZE
},
// XG Version 1.0.4432
{
"XGRAPHC",
1, 0, 4432,
XG_1_0_4432,
XG_1_0_4432_SIZE
},
// XG Version 1.0.4627
{
"XGRAPHC",
1, 0, 4627,
XG_1_0_4627,
XG_1_0_4627_SIZE
},
// XG Version 1.0.5233
{
"XGRAPHC",
1, 0, 5233,
XG_1_0_5233,
XG_1_0_5233_SIZE
},
// XG Version 1.0.5558
{
"XGRAPHC",
1, 0, 5558,
XG_1_0_5558,
XG_1_0_5558_SIZE
},
// XG Version 1.0.5849
{
"XGRAPHC",
1, 0, 5849,
XG_1_0_5849,
XG_1_0_5849_SIZE
},
// XNet Version 1.0.3911
{

View File

@ -80,7 +80,7 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
{
SHGetSpecialFolderPath(NULL, szCacheFileName, CSIDL_APPDATA, TRUE);
strcat(szCacheFileName, "\\Cxbx\\");
strcat(szCacheFileName, "\\Cxbx-Reloaded\\");
CreateDirectory(szCacheFileName, NULL);
@ -265,18 +265,6 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
BuildVersion = 4627;
}
// Some 3911 titles have different D3D8 builds
if(strcmp(szLibraryName, "D3D8") == 0)
{
if(BuildVersion <= 3948)
BuildVersion = 3925;
// Testing... don't release with this code in it!
// TODO: 5233 and 5558
// if(BuildVersion == 4134)
// BuildVersion = 4627;
}
// Change a few XAPILIB versions to similar counterparts
if(strcmp(szLibraryName, "XAPILIB") == 0)
{
@ -288,29 +276,6 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
BuildVersion = 4627;
}
// Test (do not release uncommented!)
/*if(strcmp(szLibraryName, "D3D8LTCG") == 0)
{
strcpy(szLibraryName, "D3D8");
}*/
// TODO: HACK: These libraries are packed into one database
if(strcmp(szLibraryName, "D3DX8") == 0)
{
strcpy(szLibraryName, "D3D8");
}
if(strcmp(szLibraryName, "D3D8") == 0)
{
if(bFoundD3D)
{
//DbgPrintf("Redundant\n");
continue;
}
bFoundD3D = true;
}
if(bXRefFirstPass)
{
if(strcmp("XAPILIB", szLibraryName) == 0 && MajorVersion == 1 && MinorVersion == 0 &&
@ -321,202 +286,6 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
uint32 lower = pXbeHeader->dwBaseAddr;
uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage;
}
else if(strcmp("D3D8", szLibraryName) == 0 /*&& strcmp("D3D8LTCG", szOrigLibraryName)*/ &&
MajorVersion == 1 && MinorVersion == 0 &&
(BuildVersion == 3925 || BuildVersion == 4134 || BuildVersion == 4361 || BuildVersion == 4432
|| BuildVersion == 4627 || BuildVersion == 5233 || BuildVersion == 5558 || BuildVersion == 5849))
{
// Save D3D8 build version
g_BuildVersion = BuildVersion;
g_OrigBuildVersion = OrigBuildVersion;
uint32 lower = pXbeHeader->dwBaseAddr;
uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage;
void *pFunc = 0;
if(BuildVersion == 3925)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_3925, lower, upper);
else if(BuildVersion < 5233)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_4034, lower, upper);
else
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_5233, lower, upper);
// locate D3DDeferredRenderState
if(pFunc != 0)
{
// offset for stencil cull enable render state in the deferred render state buffer
int patchOffset = 0;
if(BuildVersion == 3925)
{
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x25) - 0x1FC + 82*4); // TODO: Clean up (?)
patchOffset = 142*4 - 82*4; // TODO: Verify
//XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x25) - 0x19F + 72*4); // TODO: Clean up (?)
//patchOffset = 142*4 - 72*4; // TODO: Verify
}
else if(BuildVersion == 4034 || BuildVersion == 4134)
{
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x248 + 82*4); // TODO: Verify
patchOffset = 142*4 - 82*4;
}
else if(BuildVersion == 4361)
{
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x200 + 82*4);
patchOffset = 142*4 - 82*4;
}
else if(BuildVersion == 4432)
{
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x204 + 83*4);
patchOffset = 143*4 - 83*4;
}
else if(BuildVersion == 4627 || BuildVersion == 5233 || BuildVersion == 5558 || BuildVersion == 5849)
{
// WARNING: Not thoroughly tested (just seemed very correct right away)
XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x24C + 92*4);
patchOffset = 162*4 - 92*4;
}
XRefDataBase[XREF_D3DDEVICE] = *(DWORD*)((DWORD)pFunc + 0x03);
XRefDataBase[XREF_D3DRS_MULTISAMPLEMODE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset - 8*4;
XRefDataBase[XREF_D3DRS_MULTISAMPLERENDERTARGETMODE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset - 7*4;
XRefDataBase[XREF_D3DRS_STENCILCULLENABLE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 0*4;
XRefDataBase[XREF_D3DRS_ROPZCMPALWAYSREAD] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 1*4;
XRefDataBase[XREF_D3DRS_ROPZREAD] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 2*4;
XRefDataBase[XREF_D3DRS_DONOTCULLUNCOMPRESSED] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 3*4;
for(int v=0;v<44;v++)
{
XTL::EmuD3DDeferredRenderState[v] = X_D3DRS_UNK;
}
DbgPrintf("HLE: 0x%.08X -> EmuD3DDeferredRenderState\n", XTL::EmuD3DDeferredRenderState);
//DbgPrintf("HLE: 0x%.08X -> XREF_D3DRS_ROPZCMPALWAYSREAD\n", XRefDataBase[XREF_D3DRS_ROPZCMPALWAYSREAD] );
}
else
{
XTL::EmuD3DDeferredRenderState = 0;
CxbxKrnlCleanup("EmuD3DDeferredRenderState was not found!");
}
// locate D3DDeferredTextureState
{
pFunc = 0;
if(BuildVersion == 3925)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_3925, lower, upper);
else if(BuildVersion == 4134)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4134, lower, upper);
else if(BuildVersion == 4361 || BuildVersion == 4432)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4361, lower, upper);
else if(BuildVersion == 4627 || BuildVersion == 5233 || BuildVersion == 5558 || BuildVersion == 5849)
pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_4627, lower, upper);
if(pFunc != 0)
{
if(BuildVersion == 3925) // 0x18F180
XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x11) - 0x70); // TODO: Verify
else if(BuildVersion == 4134)
XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x18) - 0x70); // TODO: Verify
else
XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x19) - 0x70);
for(int s=0;s<4;s++)
{
for(int v=0;v<32;v++)
XTL::EmuD3DDeferredTextureState[v+s*32] = X_D3DTSS_UNK;
}
DbgPrintf("HLE: 0x%.08X -> EmuD3DDeferredTextureState\n", XTL::EmuD3DDeferredTextureState);
}
else
{
XTL::EmuD3DDeferredTextureState = 0;
CxbxKrnlCleanup("EmuD3DDeferredTextureState was not found!");
}
}
}
//else if(strcmp("D3D8LTCG", szLibraryName) == 0 && MajorVersion == 1 && MinorVersion == 0 &&
// (BuildVersion == 5849)) // 5849 only so far...
// {
// // Save D3D8 build version
// g_BuildVersion = BuildVersion;
// g_OrigBuildVersion = OrigBuildVersion;
// uint32 lower = pXbeHeader->dwBaseAddr;
// uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage;
// void *pFunc = 0;
// if(BuildVersion == 5849)
// pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetRenderState_CullMode_1_0_5849_LTCG, lower, upper);
// // locate D3DDeferredRenderState
// if(pFunc != 0)
// {
// // offset for stencil cull enable render state in the deferred render state buffer
// int patchOffset = 0;
// if(BuildVersion == 5849)
// {
// // WARNING: Not thoroughly tested (just seemed very correct right away)
// XTL::EmuD3DDeferredRenderState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x2B) - 0x24C + 92*4);
// patchOffset = 162*4 - 92*4;
// }
// XRefDataBase[XREF_D3DDEVICE] = *(DWORD*)((DWORD)pFunc + 0x03);
// XRefDataBase[XREF_D3DRS_MULTISAMPLEMODE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset - 8*4;
// XRefDataBase[XREF_D3DRS_MULTISAMPLERENDERTARGETMODE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset - 7*4;
// XRefDataBase[XREF_D3DRS_STENCILCULLENABLE] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 0*4;
// XRefDataBase[XREF_D3DRS_ROPZCMPALWAYSREAD] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 1*4;
// XRefDataBase[XREF_D3DRS_ROPZREAD] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 2*4;
// XRefDataBase[XREF_D3DRS_DONOTCULLUNCOMPRESSED] = (uint32)XTL::EmuD3DDeferredRenderState + patchOffset + 3*4;
// for(int v=0;v<44;v++)
// {
// XTL::EmuD3DDeferredRenderState[v] = X_D3DRS_UNK;
// }
// DbgPrintf("HLE: 0x%.08X -> EmuD3DDeferredRenderState\n", XTL::EmuD3DDeferredRenderState);
// }
// else
// {
// XTL::EmuD3DDeferredRenderState = 0;
// CxbxKrnlCleanup("EmuD3DDeferredRenderState was not found!");
// }
// // locate D3DDeferredTextureState
// {
// pFunc = 0;
// if(BuildVersion == 3925)
// pFunc = EmuLocateFunction((OOVPA*)&IDirect3DDevice8_SetTextureState_TexCoordIndex_1_0_5849_LTCG, lower, upper);
// if(pFunc != 0)
// {
// if(BuildVersion == 3925) // 0x18F180
// XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x11) - 0x70); // TODO: Verify
// else if(BuildVersion == 4134)
// XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x18) - 0x70); // TODO: Verify
// else
// XTL::EmuD3DDeferredTextureState = (DWORD*)(*(DWORD*)((uint32)pFunc + 0x19) - 0x70);
// for(int s=0;s<4;s++)
// {
// for(int v=0;v<32;v++)
// XTL::EmuD3DDeferredTextureState[v+s*32] = X_D3DTSS_UNK;
// }
// DbgPrintf("HLE: 0x%.08X -> EmuD3DDeferredTextureState\n", XTL::EmuD3DDeferredTextureState);
// }
// else
// {
// XTL::EmuD3DDeferredTextureState = 0;
// CxbxKrnlCleanup("EmuD3DDeferredTextureState was not found!");
// }
// }
// }
}
DbgPrintf("HLE: * Searching HLE database for %s %d.%d.%d...", szLibraryName, MajorVersion, MinorVersion, BuildVersion);

1252
src/CxbxKrnl/nv2a_int.h Normal file

File diff suppressed because it is too large Load Diff