From 02708b4f1fc6e522ac381bed6bc8f0237775bfc2 Mon Sep 17 00:00:00 2001 From: PatrickvL Date: Mon, 7 Nov 2016 08:43:44 +0100 Subject: [PATCH 1/4] Revert unintentional update with LleContrib Reverted https://github.com/PatrickvL/Cxbx-Reloaded/commit/bd7e18330d73a6ba025cd93e3d8c16f8641f86a5 via : git revert -m1 bd7e183 edit src\Cxbx.h # manually fixed conflict git add src\Cxbx.h Commit --- build/win32/CxbxKrnl.vcxproj | 3 - src/Common/Win32/EmuShared.cpp | 8 +- src/Common/Win32/XBController.cpp | 10 +- src/Common/Xbe.cpp | 2 +- src/Core/Xbe.cpp | 2 +- src/Cxbx/DlgControllerConfig.cpp | 2 +- src/Cxbx/DlgVideoConfig.cpp | 2 +- src/Cxbx/WinMain.cpp | 4 +- src/Cxbx/WndAbout.cpp | 2 +- src/Cxbx/WndMain.cpp | 62 +- src/CxbxKrnl/CxbxKrnl.cpp | 4 +- src/CxbxKrnl/Emu.cpp | 8 +- src/CxbxKrnl/EmuD3D8.cpp | 2 +- src/CxbxKrnl/EmuNV2A.cpp | 349 -------- src/CxbxKrnl/EmuNV2A.h | 40 - src/CxbxKrnl/EmuX86.cpp | 180 +---- src/CxbxKrnl/EmuX86.h | 19 - src/CxbxKrnl/EmuXapi.cpp | 2 +- src/CxbxKrnl/HLEDataBase.cpp | 126 +++ src/CxbxKrnl/HLEIntercept.cpp | 233 +++++- src/CxbxKrnl/nv2a_int.h | 1252 ----------------------------- 21 files changed, 414 insertions(+), 1898 deletions(-) delete mode 100644 src/CxbxKrnl/EmuNV2A.cpp delete mode 100644 src/CxbxKrnl/EmuNV2A.h delete mode 100644 src/CxbxKrnl/nv2a_int.h diff --git a/build/win32/CxbxKrnl.vcxproj b/build/win32/CxbxKrnl.vcxproj index 06155b4be..ef61f284f 100644 --- a/build/win32/CxbxKrnl.vcxproj +++ b/build/win32/CxbxKrnl.vcxproj @@ -209,7 +209,6 @@ - @@ -223,7 +222,6 @@ - @@ -529,7 +527,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - diff --git a/src/Common/Win32/EmuShared.cpp b/src/Common/Win32/EmuShared.cpp index 9a7d8ccf7..e0fc03170 100644 --- a/src/Common/Win32/EmuShared.cpp +++ b/src/Common/Win32/EmuShared.cpp @@ -136,8 +136,8 @@ CXBXKRNL_API void EmuShared::Cleanup() // ****************************************************************** CXBXKRNL_API EmuShared::EmuShared() { - m_XBController.Load("Software\\Cxbx-Reloaded\\XBController"); - m_XBVideo.Load("Software\\Cxbx-Reloaded\\XBVideo"); + m_XBController.Load("Software\\Cxbx\\XBController"); + m_XBVideo.Load("Software\\Cxbx\\XBVideo"); } // ****************************************************************** @@ -145,6 +145,6 @@ CXBXKRNL_API EmuShared::EmuShared() // ****************************************************************** CXBXKRNL_API EmuShared::~EmuShared() { - m_XBController.Save("Software\\Cxbx-Reloaded\\XBController"); - m_XBVideo.Save("Software\\Cxbx-Reloaded\\XBVideo"); + m_XBController.Save("Software\\Cxbx\\XBController"); + m_XBVideo.Save("Software\\Cxbx\\XBVideo"); } \ No newline at end of file diff --git a/src/Common/Win32/XBController.cpp b/src/Common/Win32/XBController.cpp index 5ae33e584..fc6913781 100644 --- a/src/Common/Win32/XBController.cpp +++ b/src/Common/Win32/XBController.cpp @@ -371,7 +371,7 @@ bool XBController::ConfigPoll(char *szStatus) Map(CurConfigObject, DeviceInstance.tszInstanceName, dwHow, dwFlags); - printf("Cxbx-Reloaded: Detected %s%s on %s%lu\n", szDirection, ObjectInstance.tszName, DeviceInstance.tszInstanceName, ObjectInstance.dwType); + printf("Cxbx: 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-Reloaded: Detected Key %d on SysKeyboard\n", dwHow); + printf("Cxbx: 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-Reloaded: Detected Button %d on SysMouse\n", dwHow); + printf("Cxbx: 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-Reloaded: Detected Movement on the %s%s on SysMouse\n", szDirection, szObjName); + printf("Cxbx: 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-Reloaded", MB_OK | MB_ICONEXCLAMATION); + MessageBox(NULL, "Unexpected Circumstance (Too Many Controller Devices)! Please contact caustik!", "Cxbx", MB_OK | MB_ICONEXCLAMATION); ExitProcess(1); diff --git a/src/Common/Xbe.cpp b/src/Common/Xbe.cpp index c3605c479..d7b3460cf 100644 --- a/src/Common/Xbe.cpp +++ b/src/Common/Xbe.cpp @@ -1027,7 +1027,7 @@ void Xbe::DumpInformation(FILE *x_file) if(GetError() != 0) return; - fprintf(x_file, "XBE information generated by Cxbx-Reloaded (Version " _CXBX_VERSION ")\n"); + fprintf(x_file, "XBE information generated by CXBX (Version " _CXBX_VERSION ")\n"); fprintf(x_file, "\n"); fprintf(x_file, "Title identified as \"%s\"\n", m_szAsciiTitle); fprintf(x_file, "\n"); diff --git a/src/Core/Xbe.cpp b/src/Core/Xbe.cpp index 4f800a9fa..808d1bc55 100644 --- a/src/Core/Xbe.cpp +++ b/src/Core/Xbe.cpp @@ -1023,7 +1023,7 @@ void Xbe::DumpInformation(FILE *x_file) if(GetError() != 0) return; - fprintf(x_file, "XBE information generated by Cxbx-Reloaded (Version " _CXBX_VERSION ")\n"); + fprintf(x_file, "XBE information generated by CXBX (Version " _CXBX_VERSION ")\n"); fprintf(x_file, "\n"); fprintf(x_file, "Title identified as \"%s\"\n", m_szAsciiTitle); fprintf(x_file, "\n"); diff --git a/src/Cxbx/DlgControllerConfig.cpp b/src/Cxbx/DlgControllerConfig.cpp index 9ef068f32..74d30c466 100644 --- a/src/Cxbx/DlgControllerConfig.cpp +++ b/src/Cxbx/DlgControllerConfig.cpp @@ -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-Reloaded", MB_ICONQUESTION | MB_YESNOCANCEL); + int ret = MessageBox(hWndDlg, "Do you wish to apply your changes?", "Cxbx", MB_ICONQUESTION | MB_YESNOCANCEL); switch(ret) { diff --git a/src/Cxbx/DlgVideoConfig.cpp b/src/Cxbx/DlgVideoConfig.cpp index 13b5b36bc..de151a605 100644 --- a/src/Cxbx/DlgVideoConfig.cpp +++ b/src/Cxbx/DlgVideoConfig.cpp @@ -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-Reloaded", MB_ICONQUESTION | MB_YESNOCANCEL); + int ret = MessageBox(hWndDlg, "Do you wish to apply your changes?", "Cxbx", MB_ICONQUESTION | MB_YESNOCANCEL); switch(ret) { diff --git a/src/Cxbx/WinMain.cpp b/src/Cxbx/WinMain.cpp index a43bfb671..b12128ccc 100644 --- a/src/Cxbx/WinMain.cpp +++ b/src/Cxbx/WinMain.cpp @@ -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-Reloaded", MB_OK); + MessageBox(NULL, "CxbxKrnl.dll is the incorrect version", "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(NULL, MainWindow->GetError(), "Cxbx", MB_ICONSTOP | MB_OK); } delete MainWindow; diff --git a/src/Cxbx/WndAbout.cpp b/src/Cxbx/WndAbout.cpp index adc47438c..74a02c359 100644 --- a/src/Cxbx/WndAbout.cpp +++ b/src/Cxbx/WndAbout.cpp @@ -40,7 +40,7 @@ WndAbout::WndAbout(HINSTANCE x_hInstance, HWND x_parent) : Wnd(x_hInstance) { m_classname = "WndAbout"; - m_wndname = "Cxbx-Reloaded : About"; + m_wndname = "Cxbx : About"; m_w = 400; m_h = 300; diff --git a/src/Cxbx/WndMain.cpp b/src/Cxbx/WndMain.cpp index 610a87cef..667444fc9 100644 --- a/src/Cxbx/WndMain.cpp +++ b/src/Cxbx/WndMain.cpp @@ -53,7 +53,7 @@ WndMain::WndMain(HINSTANCE x_hInstance) : Wnd(x_hInstance), m_bCreated(false), m // initialize members { m_classname = "WndMain"; - m_wndname = "Cxbx-Reloaded " _CXBX_VERSION; + m_wndname = "Cxbx " _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-Reloaded : Emulating %s...", m_Xbe->m_szAsciiTitle); + sprintf(AsciiTitle, "Cxbx : 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-Reloaded " _CXBX_VERSION); + SetWindowText(m_hwnd, "Cxbx " _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-Reloaded has no affiliation with Microsoft"); + sprintf(buffer, "%s", "Disclaimer: Cxbx 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-Reloaded", MB_ICONQUESTION | MB_YESNO) != IDYES) + if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", 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-Reloaded", MB_ICONINFORMATION | MB_OK); + MessageBox(m_hwnd, buffer, "Cxbx", 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-Reloaded", MB_OK | MB_ICONEXCLAMATION); + MessageBox(m_hwnd, bmp_err, "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", 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-Reloaded", MB_ICONINFORMATION | MB_OK); + MessageBox(m_hwnd, buffer, "Cxbx", 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-Reloaded", MB_ICONQUESTION | MB_YESNO) != IDYES) + if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, "Could not open text file.", "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", 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-Reloaded", MB_ICONINFORMATION | MB_OK); + MessageBox(m_hwnd, buffer, "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", 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-Reloaded", MB_OK); + MessageBox(m_hwnd, "This will not take effect until the next time emulation is started.\n", "Cxbx", 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-Reloaded", MB_OK); + MessageBox(m_hwnd, "This will not take effect until emulation is (re)started.\n", "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, AboutWnd->GetError(), "Cxbx", 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-Reloaded", MB_ICONEXCLAMATION | MB_OK); + MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONEXCLAMATION | MB_OK); if(m_Xbe->IsFatal()) CloseXbe(); @@ -1405,7 +1405,7 @@ void WndMain::UpdateDebugConsoles() { freopen("CONOUT$", "wt", stdout); - SetConsoleTitle("Cxbx-Reloaded : Debug Console"); + SetConsoleTitle("Cxbx : 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", 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-Reloaded", MB_ICONQUESTION | MB_YESNOCANCEL); + int ret = MessageBox(m_hwnd, "Changes have been made, do you wish to save?", "Cxbx", 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-Reloaded", MB_ICONQUESTION | MB_YESNO) != IDYES) + if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", 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-Reloaded", MB_ICONINFORMATION | MB_OK); + MessageBox(m_hwnd, buffer, "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, i_exe->GetError(), "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", 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-Reloaded", MB_ICONQUESTION | MB_YESNO) != IDYES) + if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, i_EmuExe.GetError(), "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OK); + MessageBox(m_hwnd, "Emulation failed.\n\n If this message repeats, the Xbe is not supported.", "Cxbx", 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-Reloaded " _CXBX_VERSION); + SetWindowText(m_hwnd, "Cxbx " _CXBX_VERSION); RefreshMenus(); } diff --git a/src/CxbxKrnl/CxbxKrnl.cpp b/src/CxbxKrnl/CxbxKrnl.cpp index 292bfc27d..dcb7a6039 100644 --- a/src/CxbxKrnl/CxbxKrnl.cpp +++ b/src/CxbxKrnl/CxbxKrnl.cpp @@ -372,7 +372,7 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit freopen("CONOUT$", "wt", stdout); freopen("CONIN$", "rt", stdin); - SetConsoleTitle("Cxbx-Reloaded : Kernel Debug Console"); + SetConsoleTitle("Cxbx : 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-Reloaded\\"); + strcat(szBuffer, "\\Cxbx\\"); std::string basePath(szBuffer); CxbxBasePath = basePath + "\\EmuDisk\\"; diff --git a/src/CxbxKrnl/Emu.cpp b/src/CxbxKrnl/Emu.cpp index e4e255c30..1a5f60593 100644 --- a/src/CxbxKrnl/Emu.cpp +++ b/src/CxbxKrnl/Emu.cpp @@ -184,7 +184,7 @@ extern int EmuException(LPEXCEPTION_POINTERS e) e->ContextRecord->Eip += 1; - int ret = MessageBox(g_hEmuWindow, buffer, "Cxbx-Reloaded", MB_ICONSTOP | MB_ABORTRETRYIGNORE); + int ret = MessageBox(g_hEmuWindow, buffer, "Cxbx", 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-Reloaded", MB_ICONSTOP | MB_OKCANCEL) == IDOK) + if(MessageBox(g_hEmuWindow, buffer, "Cxbx", 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-Reloaded", MB_OK); + MessageBox(g_hEmuWindow, "Warning: Could not safely terminate process!", "Cxbx", MB_OK); count++; if(count > 1) { - MessageBox(g_hEmuWindow, "Warning: Multiple Problems!", "Cxbx-Reloaded", MB_OK); + MessageBox(g_hEmuWindow, "Warning: Multiple Problems!", "Cxbx", MB_OK); return EXCEPTION_CONTINUE_SEARCH; } diff --git a/src/CxbxKrnl/EmuD3D8.cpp b/src/CxbxKrnl/EmuD3D8.cpp index 92faffcd8..44e6b5d46 100644 --- a/src/CxbxKrnl/EmuD3D8.cpp +++ b/src/CxbxKrnl/EmuD3D8.cpp @@ -364,7 +364,7 @@ static DWORD WINAPI EmuRenderWindow(LPVOID lpVoid) wcstombs(tAsciiTitle, XbeCert->wszTitleName, 40); } - sprintf(AsciiTitle, "Cxbx-Reloaded : Emulating %s", tAsciiTitle); + sprintf(AsciiTitle, "Cxbx : Emulating %s", tAsciiTitle); } // create the window diff --git a/src/CxbxKrnl/EmuNV2A.cpp b/src/CxbxKrnl/EmuNV2A.cpp deleted file mode 100644 index 0fad844f7..000000000 --- a/src/CxbxKrnl/EmuNV2A.cpp +++ /dev/null @@ -1,349 +0,0 @@ -// ****************************************************************** -// * -// * .,-::::: .,:: .::::::::. .,:: .: -// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; -// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' -// * $$$ 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 -// * (c) 2016 Luke Usher -// * All rights reserved -// * -// ****************************************************************** -#define _CXBXKRNL_INTERNAL -#define _XBOXKRNL_DEFEXTRN_ - -#include - -#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); - } -} diff --git a/src/CxbxKrnl/EmuNV2A.h b/src/CxbxKrnl/EmuNV2A.h deleted file mode 100644 index f286ae168..000000000 --- a/src/CxbxKrnl/EmuNV2A.h +++ /dev/null @@ -1,40 +0,0 @@ -// ****************************************************************** -// * -// * .,-::::: .,:: .::::::::. .,:: .: -// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; -// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' -// * $$$ 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 -// * (c) 2016 Luke Usher -// * 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 diff --git a/src/CxbxKrnl/EmuX86.cpp b/src/CxbxKrnl/EmuX86.cpp index 99a167ebc..a227cea98 100644 --- a/src/CxbxKrnl/EmuX86.cpp +++ b/src/CxbxKrnl/EmuX86.cpp @@ -39,161 +39,6 @@ #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) { @@ -219,32 +64,9 @@ bool EmuX86_DecodeException(LPEXCEPTION_POINTERS e) } else { - 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; - } - + EmuWarning("EmuX86: 0x%08X: %s Ignored\n", e->ContextRecord->Eip, formatter.formatInstruction(info)); 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; diff --git a/src/CxbxKrnl/EmuX86.h b/src/CxbxKrnl/EmuX86.h index 9d30da906..95ce1615a 100644 --- a/src/CxbxKrnl/EmuX86.h +++ b/src/CxbxKrnl/EmuX86.h @@ -34,25 +34,6 @@ #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 diff --git a/src/CxbxKrnl/EmuXapi.cpp b/src/CxbxKrnl/EmuXapi.cpp index 13f3c7111..f06cd6823 100644 --- a/src/CxbxKrnl/EmuXapi.cpp +++ b/src/CxbxKrnl/EmuXapi.cpp @@ -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-Reloaded", 0); + MessageBox(CxbxKrnl_hEmuParent, "The title is rebooting to dashboard", "Cxbx", 0); char szXboxDashboardPath[MAX_PATH]; sprintf(szXboxDashboardPath, "%c:\\xboxdash.xbe", symbolicLinkObject->DriveLetter); EmuXLaunchNewImage(szXboxDashboardPath, pLaunchData); diff --git a/src/CxbxKrnl/HLEDataBase.cpp b/src/CxbxKrnl/HLEDataBase.cpp index 05227d2f1..2eb7716c7 100644 --- a/src/CxbxKrnl/HLEDataBase.cpp +++ b/src/CxbxKrnl/HLEDataBase.cpp @@ -154,6 +154,76 @@ 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", @@ -209,6 +279,62 @@ 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 { diff --git a/src/CxbxKrnl/HLEIntercept.cpp b/src/CxbxKrnl/HLEIntercept.cpp index 11055d640..639df3152 100644 --- a/src/CxbxKrnl/HLEIntercept.cpp +++ b/src/CxbxKrnl/HLEIntercept.cpp @@ -80,7 +80,7 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead { SHGetSpecialFolderPath(NULL, szCacheFileName, CSIDL_APPDATA, TRUE); - strcat(szCacheFileName, "\\Cxbx-Reloaded\\"); + strcat(szCacheFileName, "\\Cxbx\\"); CreateDirectory(szCacheFileName, NULL); @@ -265,6 +265,18 @@ 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) { @@ -276,6 +288,29 @@ 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 && @@ -286,6 +321,202 @@ 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); diff --git a/src/CxbxKrnl/nv2a_int.h b/src/CxbxKrnl/nv2a_int.h deleted file mode 100644 index 6814a3c49..000000000 --- a/src/CxbxKrnl/nv2a_int.h +++ /dev/null @@ -1,1252 +0,0 @@ -/* - * QEMU Geforce NV2A internal definitions - * - * Copyright (c) 2012 espes - * Copyright (c) 2015 Jannik Vogel - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) version 3 of the License. - * - * 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 received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#define NV_NUM_BLOCKS 21 -#define NV_PMC 0 /* card master control */ -#define NV_PBUS 1 /* bus control */ -#define NV_PFIFO 2 /* MMIO and DMA FIFO submission to PGRAPH and VPE */ -#define NV_PFIFO_CACHE 3 -#define NV_PRMA 4 /* access to BAR0/BAR1 from real mode */ -#define NV_PVIDEO 5 /* video overlay */ -#define NV_PTIMER 6 /* time measurement and time-based alarms */ -#define NV_PCOUNTER 7 /* performance monitoring counters */ -#define NV_PVPE 8 /* MPEG2 decoding engine */ -#define NV_PTV 9 /* TV encoder */ -#define NV_PRMFB 10 /* aliases VGA memory window */ -#define NV_PRMVIO 11 /* aliases VGA sequencer and graphics controller registers */ -#define NV_PFB 12 /* memory interface */ -#define NV_PSTRAPS 13 /* straps readout / override */ -#define NV_PGRAPH 14 /* accelerated 2d/3d drawing engine */ -#define NV_PCRTC 15 /* more CRTC controls */ -#define NV_PRMCIO 16 /* aliases VGA CRTC and attribute controller registers */ -#define NV_PRAMDAC 17 /* RAMDAC, cursor, and PLL control */ -#define NV_PRMDIO 18 /* aliases VGA palette registers */ -#define NV_PRAMIN 19 /* RAMIN access */ -#define NV_USER 20 /* PFIFO MMIO and DMA submission area */ - -#define NV_PMC_BOOT_0 0x00000000 -#define NV_PMC_INTR_0 0x00000100 -# define NV_PMC_INTR_0_PFIFO (1 << 8) -# define NV_PMC_INTR_0_PGRAPH (1 << 12) -# define NV_PMC_INTR_0_PCRTC (1 << 24) -# define NV_PMC_INTR_0_PBUS (1 << 28) -# define NV_PMC_INTR_0_SOFTWARE (1 << 31) -#define NV_PMC_INTR_EN_0 0x00000140 -# define NV_PMC_INTR_EN_0_HARDWARE 1 -# define NV_PMC_INTR_EN_0_SOFTWARE 2 -#define NV_PMC_ENABLE 0x00000200 -# define NV_PMC_ENABLE_PFIFO (1 << 8) -# define NV_PMC_ENABLE_PGRAPH (1 << 12) - - -/* These map approximately to the pci registers */ -#define NV_PBUS_PCI_NV_0 0x00000800 -# define NV_PBUS_PCI_NV_0_VENDOR_ID 0x0000FFFF -# define NV_CONFIG_PCI_NV_0_DEVICE_ID 0xFFFF0000 -#define NV_PBUS_PCI_NV_1 0x00000804 -#define NV_PBUS_PCI_NV_2 0x00000808 -# define NV_PBUS_PCI_NV_2_REVISION_ID 0x000000FF -# define NV_PBUS_PCI_NV_2_CLASS_CODE 0xFFFFFF00 - - -#define NV_PFIFO_INTR_0 0x00000100 -# define NV_PFIFO_INTR_0_CACHE_ERROR (1 << 0) -# define NV_PFIFO_INTR_0_RUNOUT (1 << 4) -# define NV_PFIFO_INTR_0_RUNOUT_OVERFLOW (1 << 8) -# define NV_PFIFO_INTR_0_DMA_PUSHER (1 << 12) -# define NV_PFIFO_INTR_0_DMA_PT (1 << 16) -# define NV_PFIFO_INTR_0_SEMAPHORE (1 << 20) -# define NV_PFIFO_INTR_0_ACQUIRE_TIMEOUT (1 << 24) -#define NV_PFIFO_INTR_EN_0 0x00000140 -# define NV_PFIFO_INTR_EN_0_CACHE_ERROR (1 << 0) -# define NV_PFIFO_INTR_EN_0_RUNOUT (1 << 4) -# define NV_PFIFO_INTR_EN_0_RUNOUT_OVERFLOW (1 << 8) -# define NV_PFIFO_INTR_EN_0_DMA_PUSHER (1 << 12) -# define NV_PFIFO_INTR_EN_0_DMA_PT (1 << 16) -# define NV_PFIFO_INTR_EN_0_SEMAPHORE (1 << 20) -# define NV_PFIFO_INTR_EN_0_ACQUIRE_TIMEOUT (1 << 24) -#define NV_PFIFO_RAMHT 0x00000210 -# define NV_PFIFO_RAMHT_BASE_ADDRESS 0x000001F0 -# define NV_PFIFO_RAMHT_SIZE 0x00030000 -# define NV_PFIFO_RAMHT_SIZE_4K 0 -# define NV_PFIFO_RAMHT_SIZE_8K 1 -# define NV_PFIFO_RAMHT_SIZE_16K 2 -# define NV_PFIFO_RAMHT_SIZE_32K 3 -# define NV_PFIFO_RAMHT_SEARCH 0x03000000 -# define NV_PFIFO_RAMHT_SEARCH_16 0 -# define NV_PFIFO_RAMHT_SEARCH_32 1 -# define NV_PFIFO_RAMHT_SEARCH_64 2 -# define NV_PFIFO_RAMHT_SEARCH_128 3 -#define NV_PFIFO_RAMFC 0x00000214 -# define NV_PFIFO_RAMFC_BASE_ADDRESS1 0x000001FC -# define NV_PFIFO_RAMFC_SIZE 0x00010000 -# define NV_PFIFO_RAMFC_BASE_ADDRESS2 0x00FE0000 -#define NV_PFIFO_RAMRO 0x00000218 -# define NV_PFIFO_RAMRO_BASE_ADDRESS 0x000001FE -# define NV_PFIFO_RAMRO_SIZE 0x00010000 -#define NV_PFIFO_RUNOUT_STATUS 0x00000400 -# define NV_PFIFO_RUNOUT_STATUS_RANOUT (1 << 0) -# define NV_PFIFO_RUNOUT_STATUS_LOW_MARK (1 << 4) -# define NV_PFIFO_RUNOUT_STATUS_HIGH_MARK (1 << 8) -#define NV_PFIFO_MODE 0x00000504 -#define NV_PFIFO_DMA 0x00000508 -#define NV_PFIFO_CACHE1_PUSH0 0x00001200 -# define NV_PFIFO_CACHE1_PUSH0_ACCESS (1 << 0) -#define NV_PFIFO_CACHE1_PUSH1 0x00001204 -# define NV_PFIFO_CACHE1_PUSH1_CHID 0x0000001F -# define NV_PFIFO_CACHE1_PUSH1_MODE 0x00000100 -#define NV_PFIFO_CACHE1_STATUS 0x00001214 -# define NV_PFIFO_CACHE1_STATUS_LOW_MARK (1 << 4) -# define NV_PFIFO_CACHE1_STATUS_HIGH_MARK (1 << 8) -#define NV_PFIFO_CACHE1_DMA_PUSH 0x00001220 -# define NV_PFIFO_CACHE1_DMA_PUSH_ACCESS (1 << 0) -# define NV_PFIFO_CACHE1_DMA_PUSH_STATE (1 << 4) -# define NV_PFIFO_CACHE1_DMA_PUSH_BUFFER (1 << 8) -# define NV_PFIFO_CACHE1_DMA_PUSH_STATUS (1 << 12) -# define NV_PFIFO_CACHE1_DMA_PUSH_ACQUIRE (1 << 16) -#define NV_PFIFO_CACHE1_DMA_FETCH 0x00001224 -# define NV_PFIFO_CACHE1_DMA_FETCH_TRIG 0x000000F8 -# define NV_PFIFO_CACHE1_DMA_FETCH_SIZE 0x0000E000 -# define NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS 0x001F0000 -#define NV_PFIFO_CACHE1_DMA_STATE 0x00001228 -# define NV_PFIFO_CACHE1_DMA_STATE_METHOD_TYPE (1 << 0) -# define NV_PFIFO_CACHE1_DMA_STATE_METHOD 0x00001FFC -# define NV_PFIFO_CACHE1_DMA_STATE_SUBCHANNEL 0x0000E000 -# define NV_PFIFO_CACHE1_DMA_STATE_METHOD_COUNT 0x1FFC0000 -# define NV_PFIFO_CACHE1_DMA_STATE_ERROR 0xE0000000 -# define NV_PFIFO_CACHE1_DMA_STATE_ERROR_NONE 0 -# define NV_PFIFO_CACHE1_DMA_STATE_ERROR_CALL 1 -# define NV_PFIFO_CACHE1_DMA_STATE_ERROR_NON_CACHE 2 -# define NV_PFIFO_CACHE1_DMA_STATE_ERROR_RETURN 3 -# define NV_PFIFO_CACHE1_DMA_STATE_ERROR_RESERVED_CMD 4 -# define NV_PFIFO_CACHE1_DMA_STATE_ERROR_PROTECTION 6 -#define NV_PFIFO_CACHE1_DMA_INSTANCE 0x0000122C -# define NV_PFIFO_CACHE1_DMA_INSTANCE_ADDRESS 0x0000FFFF -#define NV_PFIFO_CACHE1_DMA_PUT 0x00001240 -#define NV_PFIFO_CACHE1_DMA_GET 0x00001244 -#define NV_PFIFO_CACHE1_DMA_SUBROUTINE 0x0000124C -# define NV_PFIFO_CACHE1_DMA_SUBROUTINE_RETURN_OFFSET 0x1FFFFFFC -# define NV_PFIFO_CACHE1_DMA_SUBROUTINE_STATE (1 << 0) -#define NV_PFIFO_CACHE1_PULL0 0x00001250 -# define NV_PFIFO_CACHE1_PULL0_ACCESS (1 << 0) -#define NV_PFIFO_CACHE1_ENGINE 0x00001280 -#define NV_PFIFO_CACHE1_DMA_DCOUNT 0x000012A0 -# define NV_PFIFO_CACHE1_DMA_DCOUNT_VALUE 0x00001FFC -#define NV_PFIFO_CACHE1_DMA_GET_JMP_SHADOW 0x000012A4 -# define NV_PFIFO_CACHE1_DMA_GET_JMP_SHADOW_OFFSET 0x1FFFFFFC -#define NV_PFIFO_CACHE1_DMA_RSVD_SHADOW 0x000012A8 -#define NV_PFIFO_CACHE1_DMA_DATA_SHADOW 0x000012AC - - -#define NV_PGRAPH_INTR 0x00000100 -# define NV_PGRAPH_INTR_NOTIFY (1 << 0) -# define NV_PGRAPH_INTR_MISSING_HW (1 << 4) -# define NV_PGRAPH_INTR_TLB_PRESENT_DMA_R (1 << 6) -# define NV_PGRAPH_INTR_TLB_PRESENT_DMA_W (1 << 7) -# define NV_PGRAPH_INTR_TLB_PRESENT_TEX_A (1 << 8) -# define NV_PGRAPH_INTR_TLB_PRESENT_TEX_B (1 << 9) -# define NV_PGRAPH_INTR_TLB_PRESENT_VTX (1 << 10) -# define NV_PGRAPH_INTR_CONTEXT_SWITCH (1 << 12) -# define NV_PGRAPH_INTR_STATE3D (1 << 13) -# define NV_PGRAPH_INTR_BUFFER_NOTIFY (1 << 16) -# define NV_PGRAPH_INTR_ERROR (1 << 20) -# define NV_PGRAPH_INTR_SINGLE_STEP (1 << 24) -#define NV_PGRAPH_NSOURCE 0x00000108 -# define NV_PGRAPH_NSOURCE_NOTIFICATION (1 << 0) -#define NV_PGRAPH_INTR_EN 0x00000140 -# define NV_PGRAPH_INTR_EN_NOTIFY (1 << 0) -# define NV_PGRAPH_INTR_EN_MISSING_HW (1 << 4) -# define NV_PGRAPH_INTR_EN_TLB_PRESENT_DMA_R (1 << 6) -# define NV_PGRAPH_INTR_EN_TLB_PRESENT_DMA_W (1 << 7) -# define NV_PGRAPH_INTR_EN_TLB_PRESENT_TEX_A (1 << 8) -# define NV_PGRAPH_INTR_EN_TLB_PRESENT_TEX_B (1 << 9) -# define NV_PGRAPH_INTR_EN_TLB_PRESENT_VTX (1 << 10) -# define NV_PGRAPH_INTR_EN_CONTEXT_SWITCH (1 << 12) -# define NV_PGRAPH_INTR_EN_STATE3D (1 << 13) -# define NV_PGRAPH_INTR_EN_BUFFER_NOTIFY (1 << 16) -# define NV_PGRAPH_INTR_EN_ERROR (1 << 20) -# define NV_PGRAPH_INTR_EN_SINGLE_STEP (1 << 24) -#define NV_PGRAPH_CTX_CONTROL 0x00000144 -# define NV_PGRAPH_CTX_CONTROL_MINIMUM_TIME 0x00000003 -# define NV_PGRAPH_CTX_CONTROL_TIME (1 << 8) -# define NV_PGRAPH_CTX_CONTROL_CHID (1 << 16) -# define NV_PGRAPH_CTX_CONTROL_CHANGE (1 << 20) -# define NV_PGRAPH_CTX_CONTROL_SWITCHING (1 << 24) -# define NV_PGRAPH_CTX_CONTROL_DEVICE (1 << 28) -#define NV_PGRAPH_CTX_USER 0x00000148 -# define NV_PGRAPH_CTX_USER_CHANNEL_3D (1 << 0) -# define NV_PGRAPH_CTX_USER_CHANNEL_3D_VALID (1 << 4) -# define NV_PGRAPH_CTX_USER_SUBCH 0x0000E000 -# define NV_PGRAPH_CTX_USER_CHID 0x1F000000 -# define NV_PGRAPH_CTX_USER_SINGLE_STEP (1 << 31) -#define NV_PGRAPH_CTX_SWITCH1 0x0000014C -# define NV_PGRAPH_CTX_SWITCH1_GRCLASS 0x000000FF -# define NV_PGRAPH_CTX_SWITCH1_CHROMA_KEY (1 << 12) -# define NV_PGRAPH_CTX_SWITCH1_SWIZZLE (1 << 14) -# define NV_PGRAPH_CTX_SWITCH1_PATCH_CONFIG 0x00038000 -# define NV_PGRAPH_CTX_SWITCH1_SYNCHRONIZE (1 << 18) -# define NV_PGRAPH_CTX_SWITCH1_ENDIAN_MODE (1 << 19) -# define NV_PGRAPH_CTX_SWITCH1_CLASS_TYPE (1 << 22) -# define NV_PGRAPH_CTX_SWITCH1_SINGLE_STEP (1 << 23) -# define NV_PGRAPH_CTX_SWITCH1_PATCH_STATUS (1 << 24) -# define NV_PGRAPH_CTX_SWITCH1_CONTEXT_SURFACE0 (1 << 25) -# define NV_PGRAPH_CTX_SWITCH1_CONTEXT_SURFACE1 (1 << 26) -# define NV_PGRAPH_CTX_SWITCH1_CONTEXT_PATTERN (1 << 27) -# define NV_PGRAPH_CTX_SWITCH1_CONTEXT_ROP (1 << 28) -# define NV_PGRAPH_CTX_SWITCH1_CONTEXT_BETA1 (1 << 29) -# define NV_PGRAPH_CTX_SWITCH1_CONTEXT_BETA4 (1 << 30) -# define NV_PGRAPH_CTX_SWITCH1_VOLATILE_RESET (1 << 31) -#define NV_PGRAPH_TRAPPED_ADDR 0x00000704 -# define NV_PGRAPH_TRAPPED_ADDR_MTHD 0x00001FFF -# define NV_PGRAPH_TRAPPED_ADDR_SUBCH 0x00070000 -# define NV_PGRAPH_TRAPPED_ADDR_CHID 0x01F00000 -# define NV_PGRAPH_TRAPPED_ADDR_DHV 0x10000000 -#define NV_PGRAPH_TRAPPED_DATA_LOW 0x00000708 -#define NV_PGRAPH_SURFACE 0x00000710 -# define NV_PGRAPH_SURFACE_WRITE_3D 0x00700000 -# define NV_PGRAPH_SURFACE_READ_3D 0x07000000 -# define NV_PGRAPH_SURFACE_MODULO_3D 0x70000000 -#define NV_PGRAPH_INCREMENT 0x0000071C -# define NV_PGRAPH_INCREMENT_READ_BLIT (1 << 0) -# define NV_PGRAPH_INCREMENT_READ_3D (1 << 1) -#define NV_PGRAPH_FIFO 0x00000720 -# define NV_PGRAPH_FIFO_ACCESS (1 << 0) -#define NV_PGRAPH_CHANNEL_CTX_TABLE 0x00000780 -# define NV_PGRAPH_CHANNEL_CTX_TABLE_INST 0x0000FFFF -#define NV_PGRAPH_CHANNEL_CTX_POINTER 0x00000784 -# define NV_PGRAPH_CHANNEL_CTX_POINTER_INST 0x0000FFFF -#define NV_PGRAPH_CHANNEL_CTX_TRIGGER 0x00000788 -# define NV_PGRAPH_CHANNEL_CTX_TRIGGER_READ_IN (1 << 0) -# define NV_PGRAPH_CHANNEL_CTX_TRIGGER_WRITE_OUT (1 << 1) -#define NV_PGRAPH_CSV0_D 0x00000FB4 -# define NV_PGRAPH_CSV0_D_LIGHTS 0x0000FFFF -# define NV_PGRAPH_CSV0_D_LIGHT0 0x00000003 -# define NV_PGRAPH_CSV0_D_LIGHT0_OFF 0 -# define NV_PGRAPH_CSV0_D_LIGHT0_INFINITE 1 -# define NV_PGRAPH_CSV0_D_LIGHT0_LOCAL 2 -# define NV_PGRAPH_CSV0_D_LIGHT0_SPOT 3 -# define NV_PGRAPH_CSV0_D_RANGE_MODE (1 << 18) -# define NV_PGRAPH_CSV0_D_FOGENABLE (1 << 19) -# define NV_PGRAPH_CSV0_D_TEXGEN_REF (1 << 20) -# define NV_PGRAPH_CSV0_D_TEXGEN_REF_LOCAL_VIEWER 0 -# define NV_PGRAPH_CSV0_D_TEXGEN_REF_INFINITE_VIEWER 1 -# define NV_PGRAPH_CSV0_D_FOG_MODE (1 << 21) -# define NV_PGRAPH_CSV0_D_FOG_MODE_LINEAR 0 -# define NV_PGRAPH_CSV0_D_FOG_MODE_EXP 1 -# define NV_PGRAPH_CSV0_D_FOGGENMODE 0x01C00000 -# define NV_PGRAPH_CSV0_D_FOGGENMODE_SPEC_ALPHA 0 -# define NV_PGRAPH_CSV0_D_FOGGENMODE_RADIAL 1 -# define NV_PGRAPH_CSV0_D_FOGGENMODE_PLANAR 2 -# define NV_PGRAPH_CSV0_D_FOGGENMODE_ABS_PLANAR 3 -# define NV_PGRAPH_CSV0_D_FOGGENMODE_FOG_X 4 -# define NV_PGRAPH_CSV0_D_MODE 0xC0000000 -# define NV_PGRAPH_CSV0_D_SKIN 0x1C000000 -# define NV_PGRAPH_CSV0_D_SKIN_OFF 0 -# define NV_PGRAPH_CSV0_D_SKIN_2G 1 -# define NV_PGRAPH_CSV0_D_SKIN_2 2 -# define NV_PGRAPH_CSV0_D_SKIN_3G 3 -# define NV_PGRAPH_CSV0_D_SKIN_3 4 -# define NV_PGRAPH_CSV0_D_SKIN_4G 5 -# define NV_PGRAPH_CSV0_D_SKIN_4 6 -#define NV_PGRAPH_CSV0_C 0x00000FB8 -# define NV_PGRAPH_CSV0_C_CHEOPS_PROGRAM_START 0x0000FF00 -# define NV_PGRAPH_CSV0_C_NORMALIZATION_ENABLE (1 << 27) -# define NV_PGRAPH_CSV0_C_LIGHTING (1 << 31) -#define NV_PGRAPH_CSV1_B 0x00000FBC -#define NV_PGRAPH_CSV1_A 0x00000FC0 -# define NV_PGRAPH_CSV1_A_T0_ENABLE (1 << 0) -# define NV_PGRAPH_CSV1_A_T0_MODE (1 << 1) -# define NV_PGRAPH_CSV1_A_T0_TEXTURE (1 << 2) -# define NV_PGRAPH_CSV1_A_T0_TEXTURE_2D 0 -# define NV_PGRAPH_CSV1_A_T0_TEXTURE_3D 1 -# define NV_PGRAPH_CSV1_A_T0_S 0x00000070 -# define NV_PGRAPH_CSV1_A_T0_S_DISABLE 0 -# define NV_PGRAPH_CSV1_A_T0_S_NORMAL_MAP 4 -# define NV_PGRAPH_CSV1_A_T0_S_REFLECTION_MAP 5 -# define NV_PGRAPH_CSV1_A_T0_S_EYE_LINEAR 1 -# define NV_PGRAPH_CSV1_A_T0_S_OBJECT_LINEAR 2 -# define NV_PGRAPH_CSV1_A_T0_S_SPHERE_MAP 3 -# define NV_PGRAPH_CSV1_A_T0_T 0x00000380 -# define NV_PGRAPH_CSV1_A_T0_R 0x00001C00 -# define NV_PGRAPH_CSV1_A_T0_Q 0x0000E000 -# define NV_PGRAPH_CSV1_A_T1_ENABLE (1 << 16) -# define NV_PGRAPH_CSV1_A_T1_MODE (1 << 17) -# define NV_PGRAPH_CSV1_A_T1_TEXTURE (1 << 18) -# define NV_PGRAPH_CSV1_A_T1_S 0x00700000 -# define NV_PGRAPH_CSV1_A_T1_T 0x03800000 -# define NV_PGRAPH_CSV1_A_T1_R 0x1C000000 -# define NV_PGRAPH_CSV1_A_T1_Q 0xE0000000 -#define NV_PGRAPH_CHEOPS_OFFSET 0x00000FC4 -# define NV_PGRAPH_CHEOPS_OFFSET_PROG_LD_PTR 0x000000FF -# define NV_PGRAPH_CHEOPS_OFFSET_CONST_LD_PTR 0x0000FF00 -#define NV_PGRAPH_BLEND 0x00001804 -# define NV_PGRAPH_BLEND_EQN 0x00000007 -# define NV_PGRAPH_BLEND_EN (1 << 3) -# define NV_PGRAPH_BLEND_SFACTOR 0x000000F0 -# define NV_PGRAPH_BLEND_SFACTOR_ZERO 0 -# define NV_PGRAPH_BLEND_SFACTOR_ONE 1 -# define NV_PGRAPH_BLEND_SFACTOR_SRC_COLOR 2 -# define NV_PGRAPH_BLEND_SFACTOR_ONE_MINUS_SRC_COLOR 3 -# define NV_PGRAPH_BLEND_SFACTOR_SRC_ALPHA 4 -# define NV_PGRAPH_BLEND_SFACTOR_ONE_MINUS_SRC_ALPHA 5 -# define NV_PGRAPH_BLEND_SFACTOR_DST_ALPHA 6 -# define NV_PGRAPH_BLEND_SFACTOR_ONE_MINUS_DST_ALPHA 7 -# define NV_PGRAPH_BLEND_SFACTOR_DST_COLOR 8 -# define NV_PGRAPH_BLEND_SFACTOR_ONE_MINUS_DST_COLOR 9 -# define NV_PGRAPH_BLEND_SFACTOR_SRC_ALPHA_SATURATE 10 -# define NV_PGRAPH_BLEND_SFACTOR_CONSTANT_COLOR 12 -# define NV_PGRAPH_BLEND_SFACTOR_ONE_MINUS_CONSTANT_COLOR 13 -# define NV_PGRAPH_BLEND_SFACTOR_CONSTANT_ALPHA 14 -# define NV_PGRAPH_BLEND_SFACTOR_ONE_MINUS_CONSTANT_ALPHA 15 -# define NV_PGRAPH_BLEND_DFACTOR 0x00000F00 -# define NV_PGRAPH_BLEND_DFACTOR_ZERO 0 -# define NV_PGRAPH_BLEND_DFACTOR_ONE 1 -# define NV_PGRAPH_BLEND_DFACTOR_SRC_COLOR 2 -# define NV_PGRAPH_BLEND_DFACTOR_ONE_MINUS_SRC_COLOR 3 -# define NV_PGRAPH_BLEND_DFACTOR_SRC_ALPHA 4 -# define NV_PGRAPH_BLEND_DFACTOR_ONE_MINUS_SRC_ALPHA 5 -# define NV_PGRAPH_BLEND_DFACTOR_DST_ALPHA 6 -# define NV_PGRAPH_BLEND_DFACTOR_ONE_MINUS_DST_ALPHA 7 -# define NV_PGRAPH_BLEND_DFACTOR_DST_COLOR 8 -# define NV_PGRAPH_BLEND_DFACTOR_ONE_MINUS_DST_COLOR 9 -# define NV_PGRAPH_BLEND_DFACTOR_SRC_ALPHA_SATURATE 10 -# define NV_PGRAPH_BLEND_DFACTOR_CONSTANT_COLOR 12 -# define NV_PGRAPH_BLEND_DFACTOR_ONE_MINUS_CONSTANT_COLOR 13 -# define NV_PGRAPH_BLEND_DFACTOR_CONSTANT_ALPHA 14 -# define NV_PGRAPH_BLEND_DFACTOR_ONE_MINUS_CONSTANT_ALPHA 15 -# define NV_PGRAPH_BLEND_LOGICOP_ENABLE (1 << 16) -# define NV_PGRAPH_BLEND_LOGICOP 0x0000F000 -#define NV_PGRAPH_BLENDCOLOR 0x00001808 -#define NV_PGRAPH_BORDERCOLOR0 0x0000180C -#define NV_PGRAPH_BORDERCOLOR1 0x00001810 -#define NV_PGRAPH_BORDERCOLOR2 0x00001814 -#define NV_PGRAPH_BORDERCOLOR3 0x00001818 -#define NV_PGRAPH_BUMPOFFSET1 0x0000184C -#define NV_PGRAPH_BUMPSCALE1 0x00001858 -#define NV_PGRAPH_CLEARRECTX 0x00001864 -# define NV_PGRAPH_CLEARRECTX_XMIN 0x00000FFF -# define NV_PGRAPH_CLEARRECTX_XMAX 0x0FFF0000 -#define NV_PGRAPH_CLEARRECTY 0x00001868 -# define NV_PGRAPH_CLEARRECTY_YMIN 0x00000FFF -# define NV_PGRAPH_CLEARRECTY_YMAX 0x0FFF0000 -#define NV_PGRAPH_COLORCLEARVALUE 0x0000186C -#define NV_PGRAPH_COMBINEFACTOR0 0x00001880 -#define NV_PGRAPH_COMBINEFACTOR1 0x000018A0 -#define NV_PGRAPH_COMBINEALPHAI0 0x000018C0 -#define NV_PGRAPH_COMBINEALPHAO0 0x000018E0 -#define NV_PGRAPH_COMBINECOLORI0 0x00001900 -#define NV_PGRAPH_COMBINECOLORO0 0x00001920 -#define NV_PGRAPH_COMBINECTL 0x00001940 -#define NV_PGRAPH_COMBINESPECFOG0 0x00001944 -#define NV_PGRAPH_COMBINESPECFOG1 0x00001948 -#define NV_PGRAPH_CONTROL_0 0x0000194C -# define NV_PGRAPH_CONTROL_0_ALPHAREF 0x000000FF -# define NV_PGRAPH_CONTROL_0_ALPHAFUNC 0x00000F00 -# define NV_PGRAPH_CONTROL_0_ALPHATESTENABLE (1 << 12) -# define NV_PGRAPH_CONTROL_0_ZENABLE (1 << 14) -# define NV_PGRAPH_CONTROL_0_ZFUNC 0x000F0000 -# define NV_PGRAPH_CONTROL_0_ZFUNC_NEVER 0 -# define NV_PGRAPH_CONTROL_0_ZFUNC_LESS 1 -# define NV_PGRAPH_CONTROL_0_ZFUNC_EQUAL 2 -# define NV_PGRAPH_CONTROL_0_ZFUNC_LEQUAL 3 -# define NV_PGRAPH_CONTROL_0_ZFUNC_GREATER 4 -# define NV_PGRAPH_CONTROL_0_ZFUNC_NOTEQUAL 5 -# define NV_PGRAPH_CONTROL_0_ZFUNC_GEQUAL 6 -# define NV_PGRAPH_CONTROL_0_ZFUNC_ALWAYS 7 -# define NV_PGRAPH_CONTROL_0_DITHERENABLE (1 << 22) -# define NV_PGRAPH_CONTROL_0_Z_PERSPECTIVE_ENABLE (1 << 23) -# define NV_PGRAPH_CONTROL_0_ZWRITEENABLE (1 << 24) -# define NV_PGRAPH_CONTROL_0_STENCIL_WRITE_ENABLE (1 << 25) -# define NV_PGRAPH_CONTROL_0_ALPHA_WRITE_ENABLE (1 << 26) -# define NV_PGRAPH_CONTROL_0_RED_WRITE_ENABLE (1 << 27) -# define NV_PGRAPH_CONTROL_0_GREEN_WRITE_ENABLE (1 << 28) -# define NV_PGRAPH_CONTROL_0_BLUE_WRITE_ENABLE (1 << 29) -#define NV_PGRAPH_CONTROL_1 0x00001950 -# define NV_PGRAPH_CONTROL_1_STENCIL_TEST_ENABLE (1 << 0) -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC 0x000000F0 -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC_NEVER 0 -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC_LESS 1 -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC_EQUAL 2 -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC_LEQUAL 3 -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC_GREATER 4 -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC_NOTEQUAL 5 -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC_GEQUAL 6 -# define NV_PGRAPH_CONTROL_1_STENCIL_FUNC_ALWAYS 7 -# define NV_PGRAPH_CONTROL_1_STENCIL_REF 0x0000FF00 -# define NV_PGRAPH_CONTROL_1_STENCIL_MASK_READ 0x00FF0000 -# define NV_PGRAPH_CONTROL_1_STENCIL_MASK_WRITE 0xFF000000 -#define NV_PGRAPH_CONTROL_2 0x00001954 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_FAIL 0x0000000F -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_ZFAIL 0x000000F0 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_ZPASS 0x00000F00 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_V_KEEP 1 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_V_ZERO 2 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_V_REPLACE 3 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_V_INCRSAT 4 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_V_DECRSAT 5 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_V_INVERT 6 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_V_INCR 7 -# define NV_PGRAPH_CONTROL_2_STENCIL_OP_V_DECR 8 -#define NV_PGRAPH_CONTROL_3 0x00001958 -# define NV_PGRAPH_CONTROL_3_FOGENABLE (1 << 8) -# define NV_PGRAPH_CONTROL_3_FOG_MODE 0x00070000 -# define NV_PGRAPH_CONTROL_3_FOG_MODE_LINEAR 0 -# define NV_PGRAPH_CONTROL_3_FOG_MODE_EXP 1 -# define NV_PGRAPH_CONTROL_3_FOG_MODE_EXP2 3 -# define NV_PGRAPH_CONTROL_3_FOG_MODE_EXP_ABS 5 -# define NV_PGRAPH_CONTROL_3_FOG_MODE_EXP2_ABS 7 -# define NV_PGRAPH_CONTROL_3_FOG_MODE_LINEAR_ABS 4 -#define NV_PGRAPH_FOGCOLOR 0x00001980 -# define NV_PGRAPH_FOGCOLOR_RED 0x00FF0000 -# define NV_PGRAPH_FOGCOLOR_GREEN 0x0000FF00 -# define NV_PGRAPH_FOGCOLOR_BLUE 0x000000FF -# define NV_PGRAPH_FOGCOLOR_ALPHA 0xFF000000 -#define NV_PGRAPH_FOGPARAM0 0x00001984 -#define NV_PGRAPH_FOGPARAM1 0x00001988 -#define NV_PGRAPH_SETUPRASTER 0x00001990 -# define NV_PGRAPH_SETUPRASTER_FRONTFACEMODE 0x00000003 -# define NV_PGRAPH_SETUPRASTER_FRONTFACEMODE_FILL 0 -# define NV_PGRAPH_SETUPRASTER_FRONTFACEMODE_POINT 1 -# define NV_PGRAPH_SETUPRASTER_FRONTFACEMODE_LINE 2 -# define NV_PGRAPH_SETUPRASTER_BACKFACEMODE 0x0000000C -# define NV_PGRAPH_SETUPRASTER_POFFSETPOINTENABLE (1 << 6) -# define NV_PGRAPH_SETUPRASTER_POFFSETLINEENABLE (1 << 7) -# define NV_PGRAPH_SETUPRASTER_POFFSETFILLENABLE (1 << 8) -# define NV_PGRAPH_SETUPRASTER_CULLCTRL 0x00600000 -# define NV_PGRAPH_SETUPRASTER_CULLCTRL_FRONT 1 -# define NV_PGRAPH_SETUPRASTER_CULLCTRL_BACK 2 -# define NV_PGRAPH_SETUPRASTER_CULLCTRL_FRONT_AND_BACK 3 -# define NV_PGRAPH_SETUPRASTER_FRONTFACE (1 << 23) -# define NV_PGRAPH_SETUPRASTER_CULLENABLE (1 << 28) -# define NV_PGRAPH_SETUPRASTER_Z_FORMAT (1 << 29) -#define NV_PGRAPH_SHADERCLIPMODE 0x00001994 -#define NV_PGRAPH_SHADERCTL 0x00001998 -#define NV_PGRAPH_SHADERPROG 0x0000199C -#define NV_PGRAPH_SHADOWZSLOPETHRESHOLD 0x000019A8 -#define NV_PGRAPH_SPECFOGFACTOR0 0x000019AC -#define NV_PGRAPH_SPECFOGFACTOR1 0x000019B0 -#define NV_PGRAPH_TEXADDRESS0 0x000019BC -# define NV_PGRAPH_TEXADDRESS0_ADDRU 0x00000007 -# define NV_PGRAPH_TEXADDRESS0_ADDRU_WRAP 1 -# define NV_PGRAPH_TEXADDRESS0_ADDRU_MIRROR 2 -# define NV_PGRAPH_TEXADDRESS0_ADDRU_CLAMP_TO_EDGE 3 -# define NV_PGRAPH_TEXADDRESS0_ADDRU_BORDER 4 -# define NV_PGRAPH_TEXADDRESS0_ADDRU_CLAMP_OGL 5 -# define NV_PGRAPH_TEXADDRESS0_WRAP_U (1 << 4) -# define NV_PGRAPH_TEXADDRESS0_ADDRV 0x00000700 -# define NV_PGRAPH_TEXADDRESS0_WRAP_V (1 << 12) -# define NV_PGRAPH_TEXADDRESS0_ADDRP 0x00070000 -# define NV_PGRAPH_TEXADDRESS0_WRAP_P (1 << 20) -# define NV_PGRAPH_TEXADDRESS0_WRAP_Q (1 << 24) -#define NV_PGRAPH_TEXADDRESS1 0x000019C0 -#define NV_PGRAPH_TEXADDRESS2 0x000019C4 -#define NV_PGRAPH_TEXADDRESS3 0x000019C8 -#define NV_PGRAPH_TEXCTL0_0 0x000019CC -# define NV_PGRAPH_TEXCTL0_0_ALPHAKILLEN (1 << 2) -# define NV_PGRAPH_TEXCTL0_0_MAX_LOD_CLAMP 0x0003FFC0 -# define NV_PGRAPH_TEXCTL0_0_MIN_LOD_CLAMP 0x3FFC0000 -# define NV_PGRAPH_TEXCTL0_0_ENABLE (1 << 30) -#define NV_PGRAPH_TEXCTL0_1 0x000019D0 -#define NV_PGRAPH_TEXCTL0_2 0x000019D4 -#define NV_PGRAPH_TEXCTL0_3 0x000019D8 -#define NV_PGRAPH_TEXCTL1_0 0x000019DC -# define NV_PGRAPH_TEXCTL1_0_IMAGE_PITCH 0xFFFF0000 -#define NV_PGRAPH_TEXCTL1_1 0x000019E0 -#define NV_PGRAPH_TEXCTL1_2 0x000019E4 -#define NV_PGRAPH_TEXCTL1_3 0x000019E8 -#define NV_PGRAPH_TEXCTL2_0 0x000019EC -#define NV_PGRAPH_TEXCTL2_1 0x000019F0 -#define NV_PGRAPH_TEXFILTER0 0x000019F4 -# define NV_PGRAPH_TEXFILTER0_MIPMAP_LOD_BIAS 0x00001FFF -# define NV_PGRAPH_TEXFILTER0_MIN 0x003F0000 -# define NV_PGRAPH_TEXFILTER0_MIN_BOX_LOD0 1 -# define NV_PGRAPH_TEXFILTER0_MIN_TENT_LOD0 2 -# define NV_PGRAPH_TEXFILTER0_MIN_BOX_NEARESTLOD 3 -# define NV_PGRAPH_TEXFILTER0_MIN_TENT_NEARESTLOD 4 -# define NV_PGRAPH_TEXFILTER0_MIN_BOX_TENT_LOD 5 -# define NV_PGRAPH_TEXFILTER0_MIN_TENT_TENT_LOD 6 -# define NV_PGRAPH_TEXFILTER0_MIN_CONVOLUTION_2D_LOD0 7 -# define NV_PGRAPH_TEXFILTER0_MAG 0x0F000000 -# define NV_PGRAPH_TEXFILTER0_ASIGNED (1 << 28) -# define NV_PGRAPH_TEXFILTER0_RSIGNED (1 << 29) -# define NV_PGRAPH_TEXFILTER0_GSIGNED (1 << 30) -# define NV_PGRAPH_TEXFILTER0_BSIGNED (1 << 31) -#define NV_PGRAPH_TEXFILTER1 0x000019F8 -#define NV_PGRAPH_TEXFILTER2 0x000019FC -#define NV_PGRAPH_TEXFILTER3 0x00001A00 -#define NV_PGRAPH_TEXFMT0 0x00001A04 -# define NV_PGRAPH_TEXFMT0_CONTEXT_DMA (1 << 1) -# define NV_PGRAPH_TEXFMT0_CUBEMAPENABLE (1 << 2) -# define NV_PGRAPH_TEXFMT0_BORDER_SOURCE (1 << 3) -# define NV_PGRAPH_TEXFMT0_BORDER_SOURCE_TEXTURE 0 -# define NV_PGRAPH_TEXFMT0_BORDER_SOURCE_COLOR 1 -# define NV_PGRAPH_TEXFMT0_DIMENSIONALITY 0x000000C0 -# define NV_PGRAPH_TEXFMT0_COLOR 0x00007F00 -# define NV_PGRAPH_TEXFMT0_MIPMAP_LEVELS 0x000F0000 -# define NV_PGRAPH_TEXFMT0_BASE_SIZE_U 0x00F00000 -# define NV_PGRAPH_TEXFMT0_BASE_SIZE_V 0x0F000000 -# define NV_PGRAPH_TEXFMT0_BASE_SIZE_P 0xF0000000 -#define NV_PGRAPH_TEXFMT1 0x00001A08 -#define NV_PGRAPH_TEXFMT2 0x00001A0C -#define NV_PGRAPH_TEXFMT3 0x00001A10 -#define NV_PGRAPH_TEXIMAGERECT0 0x00001A14 -# define NV_PGRAPH_TEXIMAGERECT0_WIDTH 0x1FFF0000 -# define NV_PGRAPH_TEXIMAGERECT0_HEIGHT 0x00001FFF -#define NV_PGRAPH_TEXIMAGERECT1 0x00001A18 -#define NV_PGRAPH_TEXIMAGERECT2 0x00001A1C -#define NV_PGRAPH_TEXIMAGERECT3 0x00001A20 -#define NV_PGRAPH_TEXOFFSET0 0x00001A24 -#define NV_PGRAPH_TEXOFFSET1 0x00001A28 -#define NV_PGRAPH_TEXOFFSET2 0x00001A2C -#define NV_PGRAPH_TEXOFFSET3 0x00001A30 -#define NV_PGRAPH_TEXPALETTE0 0x00001A34 -# define NV_PGRAPH_TEXPALETTE0_CONTEXT_DMA (1 << 0) -# define NV_PGRAPH_TEXPALETTE0_LENGTH 0x0000000C -# define NV_PGRAPH_TEXPALETTE0_LENGTH_256 0 -# define NV_PGRAPH_TEXPALETTE0_LENGTH_128 1 -# define NV_PGRAPH_TEXPALETTE0_LENGTH_64 2 -# define NV_PGRAPH_TEXPALETTE0_LENGTH_32 3 -# define NV_PGRAPH_TEXPALETTE0_OFFSET 0xFFFFFFC0 -#define NV_PGRAPH_TEXPALETTE1 0x00001A38 -#define NV_PGRAPH_TEXPALETTE2 0x00001A3C -#define NV_PGRAPH_TEXPALETTE3 0x00001A40 -#define NV_PGRAPH_ZSTENCILCLEARVALUE 0x00001A88 -#define NV_PGRAPH_ZCLIPMIN 0x00001A90 -#define NV_PGRAPH_ZOFFSETBIAS 0x00001AA4 -#define NV_PGRAPH_ZOFFSETFACTOR 0x00001AA8 -#define NV_PGRAPH_EYEVEC0 0x00001AAC -#define NV_PGRAPH_EYEVEC1 0x00001AB0 -#define NV_PGRAPH_EYEVEC2 0x00001AB4 -#define NV_PGRAPH_ZCLIPMAX 0x00001ABC - - -#define NV_PCRTC_INTR_0 0x00000100 -# define NV_PCRTC_INTR_0_VBLANK (1 << 0) -#define NV_PCRTC_INTR_EN_0 0x00000140 -# define NV_PCRTC_INTR_EN_0_VBLANK (1 << 0) -#define NV_PCRTC_START 0x00000800 -#define NV_PCRTC_CONFIG 0x00000804 - - -#define NV_PVIDEO_INTR 0x00000100 -# define NV_PVIDEO_INTR_BUFFER_0 (1 << 0) -# define NV_PVIDEO_INTR_BUFFER_1 (1 << 4) -#define NV_PVIDEO_INTR_EN 0x00000140 -# define NV_PVIDEO_INTR_EN_BUFFER_0 (1 << 0) -# define NV_PVIDEO_INTR_EN_BUFFER_1 (1 << 4) -#define NV_PVIDEO_BUFFER 0x00000700 -# define NV_PVIDEO_BUFFER_0_USE (1 << 0) -# define NV_PVIDEO_BUFFER_1_USE (1 << 4) -#define NV_PVIDEO_STOP 0x00000704 -#define NV_PVIDEO_BASE 0x00000900 -#define NV_PVIDEO_LIMIT 0x00000908 -#define NV_PVIDEO_LUMINANCE 0x00000910 -#define NV_PVIDEO_CHROMINANCE 0x00000918 -#define NV_PVIDEO_OFFSET 0x00000920 -#define NV_PVIDEO_SIZE_IN 0x00000928 -# define NV_PVIDEO_SIZE_IN_WIDTH 0x000007FF -# define NV_PVIDEO_SIZE_IN_HEIGHT 0x07FF0000 -#define NV_PVIDEO_POINT_IN 0x00000930 -# define NV_PVIDEO_POINT_IN_S 0x00007FFF -# define NV_PVIDEO_POINT_IN_T 0xFFFE0000 -#define NV_PVIDEO_DS_DX 0x00000938 -#define NV_PVIDEO_DT_DY 0x00000940 -#define NV_PVIDEO_POINT_OUT 0x00000948 -# define NV_PVIDEO_POINT_OUT_X 0x00000FFF -# define NV_PVIDEO_POINT_OUT_Y 0x0FFF0000 -#define NV_PVIDEO_SIZE_OUT 0x00000950 -# define NV_PVIDEO_SIZE_OUT_WIDTH 0x00000FFF -# define NV_PVIDEO_SIZE_OUT_HEIGHT 0x0FFF0000 -#define NV_PVIDEO_FORMAT 0x00000958 -# define NV_PVIDEO_FORMAT_PITCH 0x00001FFF -# define NV_PVIDEO_FORMAT_COLOR 0x00030000 -# define NV_PVIDEO_FORMAT_COLOR_LE_CR8YB8CB8YA8 1 -# define NV_PVIDEO_FORMAT_DISPLAY (1 << 20) - - -#define NV_PTIMER_INTR_0 0x00000100 -# define NV_PTIMER_INTR_0_ALARM (1 << 0) -#define NV_PTIMER_INTR_EN_0 0x00000140 -# define NV_PTIMER_INTR_EN_0_ALARM (1 << 0) -#define NV_PTIMER_NUMERATOR 0x00000200 -#define NV_PTIMER_DENOMINATOR 0x00000210 -#define NV_PTIMER_TIME_0 0x00000400 -#define NV_PTIMER_TIME_1 0x00000410 -#define NV_PTIMER_ALARM_0 0x00000420 - - -#define NV_PFB_CFG0 0x00000200 -# define NV_PFB_CFG0_PART 0x00000003 -#define NV_PFB_CSTATUS 0x0000020C -#define NV_PFB_WBC 0x00000410 -# define NV_PFB_WBC_FLUSH (1 << 16) - - -#define NV_PRAMDAC_NVPLL_COEFF 0x00000500 -# define NV_PRAMDAC_NVPLL_COEFF_MDIV 0x000000FF -# define NV_PRAMDAC_NVPLL_COEFF_NDIV 0x0000FF00 -# define NV_PRAMDAC_NVPLL_COEFF_PDIV 0x00070000 -#define NV_PRAMDAC_MPLL_COEFF 0x00000504 -# define NV_PRAMDAC_MPLL_COEFF_MDIV 0x000000FF -# define NV_PRAMDAC_MPLL_COEFF_NDIV 0x0000FF00 -# define NV_PRAMDAC_MPLL_COEFF_PDIV 0x00070000 -#define NV_PRAMDAC_VPLL_COEFF 0x00000508 -# define NV_PRAMDAC_VPLL_COEFF_MDIV 0x000000FF -# define NV_PRAMDAC_VPLL_COEFF_NDIV 0x0000FF00 -# define NV_PRAMDAC_VPLL_COEFF_PDIV 0x00070000 -#define NV_PRAMDAC_PLL_TEST_COUNTER 0x00000514 -# define NV_PRAMDAC_PLL_TEST_COUNTER_NOOFIPCLKS 0x000003FF -# define NV_PRAMDAC_PLL_TEST_COUNTER_VALUE 0x0000FFFF -# define NV_PRAMDAC_PLL_TEST_COUNTER_ENABLE (1 << 16) -# define NV_PRAMDAC_PLL_TEST_COUNTER_RESET (1 << 20) -# define NV_PRAMDAC_PLL_TEST_COUNTER_SOURCE 0x03000000 -# define NV_PRAMDAC_PLL_TEST_COUNTER_VPLL2_LOCK (1 << 27) -# define NV_PRAMDAC_PLL_TEST_COUNTER_PDIV_RST (1 << 28) -# define NV_PRAMDAC_PLL_TEST_COUNTER_NVPLL_LOCK (1 << 29) -# define NV_PRAMDAC_PLL_TEST_COUNTER_MPLL_LOCK (1 << 30) -# define NV_PRAMDAC_PLL_TEST_COUNTER_VPLL_LOCK (1 << 31) - - -#define NV_USER_DMA_PUT 0x40 -#define NV_USER_DMA_GET 0x44 -#define NV_USER_REF 0x48 - - - -/* DMA objects */ -#define NV_DMA_FROM_MEMORY_CLASS 0x02 -#define NV_DMA_TO_MEMORY_CLASS 0x03 -#define NV_DMA_IN_MEMORY_CLASS 0x3d - -#define NV_DMA_CLASS 0x00000FFF -#define NV_DMA_PAGE_TABLE (1 << 12) -#define NV_DMA_PAGE_ENTRY (1 << 13) -#define NV_DMA_FLAGS_ACCESS (1 << 14) -#define NV_DMA_FLAGS_MAPPING_COHERENCY (1 << 15) -#define NV_DMA_TARGET 0x00030000 -# define NV_DMA_TARGET_NVM 0x00000000 -# define NV_DMA_TARGET_NVM_TILED 0x00010000 -# define NV_DMA_TARGET_PCI 0x00020000 -# define NV_DMA_TARGET_AGP 0x00030000 -#define NV_DMA_ADJUST 0xFFF00000 - -#define NV_DMA_ADDRESS 0xFFFFF000 - - -#define NV_RAMHT_HANDLE 0xFFFFFFFF -#define NV_RAMHT_INSTANCE 0x0000FFFF -#define NV_RAMHT_ENGINE 0x00030000 -# define NV_RAMHT_ENGINE_SW 0x00000000 -# define NV_RAMHT_ENGINE_GRAPHICS 0x00010000 -# define NV_RAMHT_ENGINE_DVD 0x00020000 -#define NV_RAMHT_CHID 0x1F000000 -#define NV_RAMHT_STATUS 0x80000000 - - - -/* graphic classes and methods */ -#define NV_SET_OBJECT 0x00000000 - - -#define NV_CONTEXT_SURFACES_2D 0x0062 -# define NV062_SET_CONTEXT_DMA_IMAGE_SOURCE 0x00000184 -# define NV062_SET_CONTEXT_DMA_IMAGE_DESTIN 0x00000188 -# define NV062_SET_COLOR_FORMAT 0x00000300 -# define NV062_SET_COLOR_FORMAT_LE_Y8 0x01 -# define NV062_SET_COLOR_FORMAT_LE_A8R8G8B8 0x0A -# define NV062_SET_PITCH 0x00000304 -# define NV062_SET_OFFSET_SOURCE 0x00000308 -# define NV062_SET_OFFSET_DESTIN 0x0000030C - -#define NV_IMAGE_BLIT 0x009F -# define NV09F_SET_CONTEXT_SURFACES 0x0000019C -# define NV09F_SET_OPERATION 0x000002FC -# define NV09F_SET_OPERATION_SRCCOPY 3 -# define NV09F_CONTROL_POINT_IN 0x00000300 -# define NV09F_CONTROL_POINT_OUT 0x00000304 -# define NV09F_SIZE 0x00000308 - - -#define NV_KELVIN_PRIMITIVE 0x0097 -# define NV097_NO_OPERATION 0x00000100 -# define NV097_WAIT_FOR_IDLE 0x00000110 -# define NV097_SET_FLIP_READ 0x00000120 -# define NV097_SET_FLIP_WRITE 0x00000124 -# define NV097_SET_FLIP_MODULO 0x00000128 -# define NV097_FLIP_INCREMENT_WRITE 0x0000012C -# define NV097_FLIP_STALL 0x00000130 -# define NV097_SET_CONTEXT_DMA_NOTIFIES 0x00000180 -# define NV097_SET_CONTEXT_DMA_A 0x00000184 -# define NV097_SET_CONTEXT_DMA_B 0x00000188 -# define NV097_SET_CONTEXT_DMA_STATE 0x00000190 -# define NV097_SET_CONTEXT_DMA_COLOR 0x00000194 -# define NV097_SET_CONTEXT_DMA_ZETA 0x00000198 -# define NV097_SET_CONTEXT_DMA_VERTEX_A 0x0000019C -# define NV097_SET_CONTEXT_DMA_VERTEX_B 0x000001A0 -# define NV097_SET_CONTEXT_DMA_SEMAPHORE 0x000001A4 -# define NV097_SET_CONTEXT_DMA_REPORT 0x000001A8 -# define NV097_SET_SURFACE_CLIP_HORIZONTAL 0x00000200 -# define NV097_SET_SURFACE_CLIP_HORIZONTAL_X 0x0000FFFF -# define NV097_SET_SURFACE_CLIP_HORIZONTAL_WIDTH 0xFFFF0000 -# define NV097_SET_SURFACE_CLIP_VERTICAL 0x00000204 -# define NV097_SET_SURFACE_CLIP_VERTICAL_Y 0x0000FFFF -# define NV097_SET_SURFACE_CLIP_VERTICAL_HEIGHT 0xFFFF0000 -# define NV097_SET_SURFACE_FORMAT 0x00000208 -# define NV097_SET_SURFACE_FORMAT_COLOR 0x0000000F -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_X1R5G5B5_Z1R5G5B5 0x01 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_X1R5G5B5_O1R5G5B5 0x02 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_R5G6B5 0x03 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_X8R8G8B8_Z8R8G8B8 0x04 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_X8R8G8B8_O8R8G8B8 0x05 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_X1A7R8G8B8_Z1A7R8G8B8 0x06 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_X1A7R8G8B8_O1A7R8G8B8 0x07 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_A8R8G8B8 0x08 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_B8 0x09 -# define NV097_SET_SURFACE_FORMAT_COLOR_LE_G8B8 0x0A -# define NV097_SET_SURFACE_FORMAT_ZETA 0x000000F0 -# define NV097_SET_SURFACE_FORMAT_ZETA_Z16 1 -# define NV097_SET_SURFACE_FORMAT_ZETA_Z24S8 2 -# define NV097_SET_SURFACE_FORMAT_TYPE 0x00000F00 -# define NV097_SET_SURFACE_FORMAT_TYPE_PITCH 0x1 -# define NV097_SET_SURFACE_FORMAT_TYPE_SWIZZLE 0x2 -# define NV097_SET_SURFACE_FORMAT_ANTI_ALIASING 0x0000F000 -# define NV097_SET_SURFACE_FORMAT_ANTI_ALIASING_CENTER_1 0 -# define NV097_SET_SURFACE_FORMAT_ANTI_ALIASING_CENTER_CORNER_2 1 -# define NV097_SET_SURFACE_FORMAT_ANTI_ALIASING_SQUARE_OFFSET_4 2 -# define NV097_SET_SURFACE_FORMAT_WIDTH 0x00FF0000 -# define NV097_SET_SURFACE_FORMAT_HEIGHT 0xFF000000 -# define NV097_SET_SURFACE_PITCH 0x0000020C -# define NV097_SET_SURFACE_PITCH_COLOR 0x0000FFFF -# define NV097_SET_SURFACE_PITCH_ZETA 0xFFFF0000 -# define NV097_SET_SURFACE_COLOR_OFFSET 0x00000210 -# define NV097_SET_SURFACE_ZETA_OFFSET 0x00000214 -# define NV097_SET_COMBINER_ALPHA_ICW 0x00000260 -# define NV097_SET_COMBINER_SPECULAR_FOG_CW0 0x00000288 -# define NV097_SET_COMBINER_SPECULAR_FOG_CW1 0x0000028C -# define NV097_SET_CONTROL0 0x00000290 -# define NV097_SET_CONTROL0_STENCIL_WRITE_ENABLE (1 << 0) -# define NV097_SET_CONTROL0_Z_FORMAT (1 << 12) -# define NV097_SET_CONTROL0_Z_PERSPECTIVE_ENABLE (1 << 16) -# define NV097_SET_FOG_MODE 0x0000029C -# define NV097_SET_FOG_MODE_V_LINEAR 0x2601 -# define NV097_SET_FOG_MODE_V_EXP 0x800 -# define NV097_SET_FOG_MODE_V_EXP2 0x801 -# define NV097_SET_FOG_MODE_V_EXP_ABS 0x802 -# define NV097_SET_FOG_MODE_V_EXP2_ABS 0x803 -# define NV097_SET_FOG_MODE_V_LINEAR_ABS 0x804 -# define NV097_SET_FOG_GEN_MODE 0x000002A0 -# define NV097_SET_FOG_GEN_MODE_V_SPEC_ALPHA 0 -# define NV097_SET_FOG_GEN_MODE_V_RADIAL 1 -# define NV097_SET_FOG_GEN_MODE_V_PLANAR 2 -# define NV097_SET_FOG_GEN_MODE_V_ABS_PLANAR 3 -# define NV097_SET_FOG_GEN_MODE_V_FOG_X 6 -# define NV097_SET_FOG_ENABLE 0x000002A4 -# define NV097_SET_FOG_COLOR 0x000002A8 -# define NV097_SET_FOG_COLOR_RED 0x000000FF -# define NV097_SET_FOG_COLOR_GREEN 0x0000FF00 -# define NV097_SET_FOG_COLOR_BLUE 0x00FF0000 -# define NV097_SET_FOG_COLOR_ALPHA 0xFF000000 -# define NV097_SET_ALPHA_TEST_ENABLE 0x00000300 -# define NV097_SET_BLEND_ENABLE 0x00000304 -# define NV097_SET_CULL_FACE_ENABLE 0x00000308 -# define NV097_SET_DEPTH_TEST_ENABLE 0x0000030C -# define NV097_SET_DITHER_ENABLE 0x00000310 -# define NV097_SET_LIGHTING_ENABLE 0x00000314 -# define NV097_SET_SKIN_MODE 0x00000328 -# define NV097_SET_SKIN_MODE_OFF 0 -# define NV097_SET_SKIN_MODE_2G 1 -# define NV097_SET_SKIN_MODE_2 2 -# define NV097_SET_SKIN_MODE_3G 3 -# define NV097_SET_SKIN_MODE_3 4 -# define NV097_SET_SKIN_MODE_4G 5 -# define NV097_SET_SKIN_MODE_4 6 -# define NV097_SET_STENCIL_TEST_ENABLE 0x0000032C -# define NV097_SET_POLY_OFFSET_POINT_ENABLE 0x00000330 -# define NV097_SET_POLY_OFFSET_LINE_ENABLE 0x00000334 -# define NV097_SET_POLY_OFFSET_FILL_ENABLE 0x00000338 -# define NV097_SET_ALPHA_FUNC 0x0000033C -# define NV097_SET_ALPHA_REF 0x00000340 -# define NV097_SET_BLEND_FUNC_SFACTOR 0x00000344 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_ZERO 0x0000 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_ONE 0x0001 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_SRC_COLOR 0x0300 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_ONE_MINUS_SRC_COLOR 0x0301 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_SRC_ALPHA 0x0302 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_ONE_MINUS_SRC_ALPHA 0x0303 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_DST_ALPHA 0x0304 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_ONE_MINUS_DST_ALPHA 0x0305 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_DST_COLOR 0x0306 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_ONE_MINUS_DST_COLOR 0x0307 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_SRC_ALPHA_SATURATE 0x0308 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_CONSTANT_COLOR 0x8001 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_ONE_MINUS_CONSTANT_COLOR 0x8002 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_CONSTANT_ALPHA 0x8003 -# define NV097_SET_BLEND_FUNC_SFACTOR_V_ONE_MINUS_CONSTANT_ALPHA 0x8004 -# define NV097_SET_BLEND_FUNC_DFACTOR 0x00000348 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_ZERO 0x0000 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_ONE 0x0001 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_SRC_COLOR 0x0300 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_ONE_MINUS_SRC_COLOR 0x0301 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_SRC_ALPHA 0x0302 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_ONE_MINUS_SRC_ALPHA 0x0303 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_DST_ALPHA 0x0304 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_ONE_MINUS_DST_ALPHA 0x0305 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_DST_COLOR 0x0306 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_ONE_MINUS_DST_COLOR 0x0307 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_SRC_ALPHA_SATURATE 0x0308 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_CONSTANT_COLOR 0x8001 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_ONE_MINUS_CONSTANT_COLOR 0x8002 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_CONSTANT_ALPHA 0x8003 -# define NV097_SET_BLEND_FUNC_DFACTOR_V_ONE_MINUS_CONSTANT_ALPHA 0x8004 -# define NV097_SET_BLEND_COLOR 0x0000034C -# define NV097_SET_BLEND_EQUATION 0x00000350 -# define NV097_SET_BLEND_EQUATION_V_FUNC_SUBTRACT 0x800A -# define NV097_SET_BLEND_EQUATION_V_FUNC_REVERSE_SUBTRACT 0x800B -# define NV097_SET_BLEND_EQUATION_V_FUNC_ADD 0x8006 -# define NV097_SET_BLEND_EQUATION_V_MIN 0x8007 -# define NV097_SET_BLEND_EQUATION_V_MAX 0x8008 -# define NV097_SET_BLEND_EQUATION_V_FUNC_REVERSE_SUBTRACT_SIGNED 0xF005 -# define NV097_SET_BLEND_EQUATION_V_FUNC_ADD_SIGNED 0xF006 -# define NV097_SET_DEPTH_FUNC 0x00000354 -# define NV097_SET_COLOR_MASK 0x00000358 -# define NV097_SET_COLOR_MASK_BLUE_WRITE_ENABLE (1 << 0) -# define NV097_SET_COLOR_MASK_GREEN_WRITE_ENABLE (1 << 8) -# define NV097_SET_COLOR_MASK_RED_WRITE_ENABLE (1 << 16) -# define NV097_SET_COLOR_MASK_ALPHA_WRITE_ENABLE (1 << 24) -# define NV097_SET_DEPTH_MASK 0x0000035C -# define NV097_SET_STENCIL_MASK 0x00000360 -# define NV097_SET_STENCIL_FUNC 0x00000364 -# define NV097_SET_STENCIL_FUNC_REF 0x00000368 -# define NV097_SET_STENCIL_FUNC_MASK 0x0000036C -# define NV097_SET_STENCIL_OP_FAIL 0x00000370 -# define NV097_SET_STENCIL_OP_ZFAIL 0x00000374 -# define NV097_SET_STENCIL_OP_ZPASS 0x00000378 -# define NV097_SET_STENCIL_OP_V_KEEP 0x1E00 -# define NV097_SET_STENCIL_OP_V_ZERO 0x0000 -# define NV097_SET_STENCIL_OP_V_REPLACE 0x1E01 -# define NV097_SET_STENCIL_OP_V_INCRSAT 0x1E02 -# define NV097_SET_STENCIL_OP_V_DECRSAT 0x1E03 -# define NV097_SET_STENCIL_OP_V_INVERT 0x150A -# define NV097_SET_STENCIL_OP_V_INCR 0x8507 -# define NV097_SET_STENCIL_OP_V_DECR 0x8508 -# define NV097_SET_POLYGON_OFFSET_SCALE_FACTOR 0x00000384 -# define NV097_SET_POLYGON_OFFSET_BIAS 0x00000388 -# define NV097_SET_FRONT_POLYGON_MODE 0x0000038C -# define NV097_SET_FRONT_POLYGON_MODE_V_POINT 0x1B00 -# define NV097_SET_FRONT_POLYGON_MODE_V_LINE 0x1B01 -# define NV097_SET_FRONT_POLYGON_MODE_V_FILL 0x1B02 -# define NV097_SET_BACK_POLYGON_MODE 0x00000390 -# define NV097_SET_CLIP_MIN 0x00000394 -# define NV097_SET_CLIP_MAX 0x00000398 -# define NV097_SET_CULL_FACE 0x0000039C -# define NV097_SET_CULL_FACE_V_FRONT 0x404 -# define NV097_SET_CULL_FACE_V_BACK 0x405 -# define NV097_SET_CULL_FACE_V_FRONT_AND_BACK 0x408 -# define NV097_SET_FRONT_FACE 0x000003A0 -# define NV097_SET_FRONT_FACE_V_CW 0x900 -# define NV097_SET_FRONT_FACE_V_CCW 0x901 -# define NV097_SET_NORMALIZATION_ENABLE 0x000003A4 -# define NV097_SET_LIGHT_ENABLE_MASK 0x000003BC -# define NV097_SET_LIGHT_ENABLE_MASK_LIGHT0_OFF 0 -# define NV097_SET_LIGHT_ENABLE_MASK_LIGHT0_INFINITE 1 -# define NV097_SET_LIGHT_ENABLE_MASK_LIGHT0_LOCAL 2 -# define NV097_SET_LIGHT_ENABLE_MASK_LIGHT0_SPOT 3 -# define NV097_SET_TEXGEN_S 0x000003C0 -# define NV097_SET_TEXGEN_S_DISABLE 0x0000 -# define NV097_SET_TEXGEN_S_EYE_LINEAR 0x2400 -# define NV097_SET_TEXGEN_S_OBJECT_LINEAR 0x2401 -# define NV097_SET_TEXGEN_S_SPHERE_MAP 0x2402 -# define NV097_SET_TEXGEN_S_REFLECTION_MAP 0x8512 -# define NV097_SET_TEXGEN_S_NORMAL_MAP 0x8511 -# define NV097_SET_TEXGEN_T 0x000003C4 -# define NV097_SET_TEXGEN_R 0x000003C8 -# define NV097_SET_TEXGEN_Q 0x000003CC -# define NV097_SET_TEXTURE_MATRIX_ENABLE 0x00000420 -# define NV097_SET_PROJECTION_MATRIX 0x00000440 -# define NV097_SET_MODEL_VIEW_MATRIX 0x00000480 -# define NV097_SET_INVERSE_MODEL_VIEW_MATRIX 0x00000580 -# define NV097_SET_COMPOSITE_MATRIX 0x00000680 -# define NV097_SET_TEXTURE_MATRIX 0x000006C0 -# define NV097_SET_FOG_PARAMS 0x000009C0 -# define NV097_SET_TEXGEN_PLANE_S 0x00000840 -# define NV097_SET_TEXGEN_PLANE_T 0x00000850 -# define NV097_SET_TEXGEN_PLANE_R 0x00000860 -# define NV097_SET_TEXGEN_PLANE_Q 0x00000870 -# define NV097_SET_TEXGEN_VIEW_MODEL 0x000009CC -# define NV097_SET_TEXGEN_VIEW_MODEL_LOCAL_VIEWER 0 -# define NV097_SET_TEXGEN_VIEW_MODEL_INFINITE_VIEWER 1 -# define NV097_SET_FOG_PLANE 0x000009D0 -# define NV097_SET_SCENE_AMBIENT_COLOR 0x00000A10 -# define NV097_SET_VIEWPORT_OFFSET 0x00000A20 -# define NV097_SET_EYE_POSITION 0x00000A50 -# define NV097_SET_COMBINER_FACTOR0 0x00000A60 -# define NV097_SET_COMBINER_FACTOR1 0x00000A80 -# define NV097_SET_COMBINER_ALPHA_OCW 0x00000AA0 -# define NV097_SET_COMBINER_COLOR_ICW 0x00000AC0 -# define NV097_SET_VIEWPORT_SCALE 0x00000AF0 -# define NV097_SET_TRANSFORM_PROGRAM 0x00000B00 -# define NV097_SET_TRANSFORM_CONSTANT 0x00000B80 -# define NV097_SET_VERTEX3F 0x00001500 -# define NV097_SET_BACK_LIGHT_AMBIENT_COLOR 0x00000C00 -# define NV097_SET_BACK_LIGHT_DIFFUSE_COLOR 0x00000C0C -# define NV097_SET_BACK_LIGHT_SPECULAR_COLOR 0x00000C18 -# define NV097_SET_LIGHT_AMBIENT_COLOR 0x00001000 -# define NV097_SET_LIGHT_DIFFUSE_COLOR 0x0000100C -# define NV097_SET_LIGHT_SPECULAR_COLOR 0x00001018 -# define NV097_SET_LIGHT_LOCAL_RANGE 0x00001024 -# define NV097_SET_LIGHT_INFINITE_HALF_VECTOR 0x00001028 -# define NV097_SET_LIGHT_INFINITE_DIRECTION 0x00001034 -# define NV097_SET_LIGHT_SPOT_FALLOFF 0x00001040 -# define NV097_SET_LIGHT_SPOT_DIRECTION 0x0000104C -# define NV097_SET_LIGHT_LOCAL_POSITION 0x0000105C -# define NV097_SET_LIGHT_LOCAL_ATTENUATION 0x00001068 -# define NV097_SET_VERTEX4F 0x00001518 -# define NV097_SET_VERTEX_DATA_ARRAY_OFFSET 0x00001720 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT 0x00001760 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_TYPE 0x0000000F -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_TYPE_UB_D3D 0 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_TYPE_S1 1 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_TYPE_F 2 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_TYPE_UB_OGL 4 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_TYPE_S32K 5 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_TYPE_CMP 6 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_SIZE 0x000000F0 -# define NV097_SET_VERTEX_DATA_ARRAY_FORMAT_STRIDE 0xFFFFFF00 -# define NV097_SET_LOGIC_OP_ENABLE 0x000017BC -# define NV097_SET_LOGIC_OP 0x000017C0 -# define NV097_CLEAR_REPORT_VALUE 0x000017C8 -# define NV097_CLEAR_REPORT_VALUE_TYPE 0xFFFFFFFF -# define NV097_CLEAR_REPORT_VALUE_TYPE_ZPASS_PIXEL_CNT 1 -# define NV097_SET_ZPASS_PIXEL_COUNT_ENABLE 0x000017CC -# define NV097_GET_REPORT 0x000017D0 -# define NV097_GET_REPORT_OFFSET 0x00FFFFFF -# define NV097_GET_REPORT_TYPE 0xFF000000 -# define NV097_GET_REPORT_TYPE_ZPASS_PIXEL_CNT 1 -# define NV097_SET_EYE_DIRECTION 0x000017E0 -# define NV097_SET_SHADER_CLIP_PLANE_MODE 0x000017F8 -# define NV097_SET_BEGIN_END 0x000017FC -# define NV097_SET_BEGIN_END_OP_END 0x00 -# define NV097_SET_BEGIN_END_OP_POINTS 0x01 -# define NV097_SET_BEGIN_END_OP_LINES 0x02 -# define NV097_SET_BEGIN_END_OP_LINE_LOOP 0x03 -# define NV097_SET_BEGIN_END_OP_LINE_STRIP 0x04 -# define NV097_SET_BEGIN_END_OP_TRIANGLES 0x05 -# define NV097_SET_BEGIN_END_OP_TRIANGLE_STRIP 0x06 -# define NV097_SET_BEGIN_END_OP_TRIANGLE_FAN 0x07 -# define NV097_SET_BEGIN_END_OP_QUADS 0x08 -# define NV097_SET_BEGIN_END_OP_QUAD_STRIP 0x09 -# define NV097_SET_BEGIN_END_OP_POLYGON 0x0A -# define NV097_ARRAY_ELEMENT16 0x00001800 -# define NV097_ARRAY_ELEMENT32 0x00001808 -# define NV097_DRAW_ARRAYS 0x00001810 -# define NV097_DRAW_ARRAYS_COUNT 0xFF000000 -# define NV097_DRAW_ARRAYS_START_INDEX 0x00FFFFFF -# define NV097_INLINE_ARRAY 0x00001818 -# define NV097_SET_EYE_VECTOR 0x0000181C -# define NV097_SET_VERTEX_DATA2F_M 0x00001880 -# define NV097_SET_VERTEX_DATA4F_M 0x00001A00 -# define NV097_SET_VERTEX_DATA2S 0x00001900 -# define NV097_SET_VERTEX_DATA4UB 0x00001940 -# define NV097_SET_VERTEX_DATA4S_M 0x00001980 -# define NV097_SET_TEXTURE_OFFSET 0x00001B00 -# define NV097_SET_TEXTURE_FORMAT 0x00001B04 -# define NV097_SET_TEXTURE_FORMAT_CONTEXT_DMA 0x00000003 -# define NV097_SET_TEXTURE_FORMAT_CUBEMAP_ENABLE (1 << 2) -# define NV097_SET_TEXTURE_FORMAT_BORDER_SOURCE (1 << 3) -# define NV097_SET_TEXTURE_FORMAT_BORDER_SOURCE_TEXTURE 0 -# define NV097_SET_TEXTURE_FORMAT_BORDER_SOURCE_COLOR 1 -# define NV097_SET_TEXTURE_FORMAT_DIMENSIONALITY 0x000000F0 -# define NV097_SET_TEXTURE_FORMAT_COLOR 0x0000FF00 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_Y8 0x00 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_AY8 0x01 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_A1R5G5B5 0x02 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_X1R5G5B5 0x03 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_A4R4G4B4 0x04 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_R5G6B5 0x05 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_A8R8G8B8 0x06 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_X8R8G8B8 0x07 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_I8_A8R8G8B8 0x0B -# define NV097_SET_TEXTURE_FORMAT_COLOR_L_DXT1_A1R5G5B5 0x0C -# define NV097_SET_TEXTURE_FORMAT_COLOR_L_DXT23_A8R8G8B8 0x0E -# define NV097_SET_TEXTURE_FORMAT_COLOR_L_DXT45_A8R8G8B8 0x0F -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_A1R5G5B5 0x10 -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_R5G6B5 0x11 -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_A8R8G8B8 0x12 -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_Y8 0x13 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_A8 0x19 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_A8Y8 0x1A -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_AY8 0x1B -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_X1R5G5B5 0x1C -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_A4R4G4B4 0x1D -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_X8R8G8B8 0x1E -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_A8 0x1F -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_A8Y8 0x20 -# define NV097_SET_TEXTURE_FORMAT_COLOR_LC_IMAGE_CR8YB8CB8YA8 0x24 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_R6G5B5 0x27 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_G8B8 0x28 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_R8B8 0x29 -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_DEPTH_X8_Y24_FIXED 0x2E -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_DEPTH_Y16_FIXED 0x30 -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_Y16 0x35 -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_A8B8G8R8 0x3A -# define NV097_SET_TEXTURE_FORMAT_COLOR_SZ_R8G8B8A8 0x3C -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_A8B8G8R8 0x3F -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_B8G8R8A8 0x40 -# define NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_R8G8B8A8 0x41 -# define NV097_SET_TEXTURE_FORMAT_MIPMAP_LEVELS 0x000F0000 -# define NV097_SET_TEXTURE_FORMAT_BASE_SIZE_U 0x00F00000 -# define NV097_SET_TEXTURE_FORMAT_BASE_SIZE_V 0x0F000000 -# define NV097_SET_TEXTURE_FORMAT_BASE_SIZE_P 0xF0000000 -# define NV097_SET_TEXTURE_ADDRESS 0x00001B08 -# define NV097_SET_TEXTURE_CONTROL0 0x00001B0C -# define NV097_SET_TEXTURE_CONTROL0_ENABLE (1 << 30) -# define NV097_SET_TEXTURE_CONTROL0_MIN_LOD_CLAMP 0x3FFC0000 -# define NV097_SET_TEXTURE_CONTROL0_MAX_LOD_CLAMP 0x0003FFC0 -# define NV097_SET_TEXTURE_CONTROL1 0x00001B10 -# define NV097_SET_TEXTURE_CONTROL1_IMAGE_PITCH 0xFFFF0000 -# define NV097_SET_TEXTURE_FILTER 0x00001B14 -# define NV097_SET_TEXTURE_FILTER_MIPMAP_LOD_BIAS 0x00001FFF -# define NV097_SET_TEXTURE_FILTER_MIN 0x00FF0000 -# define NV097_SET_TEXTURE_FILTER_MAG 0x0F000000 -# define NV097_SET_TEXTURE_FILTER_ASIGNED (1 << 28) -# define NV097_SET_TEXTURE_FILTER_RSIGNED (1 << 29) -# define NV097_SET_TEXTURE_FILTER_GSIGNED (1 << 30) -# define NV097_SET_TEXTURE_FILTER_BSIGNED (1 << 31) -# define NV097_SET_TEXTURE_IMAGE_RECT 0x00001B1C -# define NV097_SET_TEXTURE_IMAGE_RECT_WIDTH 0xFFFF0000 -# define NV097_SET_TEXTURE_IMAGE_RECT_HEIGHT 0x0000FFFF -# define NV097_SET_TEXTURE_PALETTE 0x00001B20 -# define NV097_SET_TEXTURE_PALETTE_CONTEXT_DMA (1 << 0) -# define NV097_SET_TEXTURE_PALETTE_LENGTH 0x0000000C -# define NV097_SET_TEXTURE_PALETTE_LENGTH_256 0 -# define NV097_SET_TEXTURE_PALETTE_LENGTH_128 1 -# define NV097_SET_TEXTURE_PALETTE_LENGTH_64 2 -# define NV097_SET_TEXTURE_PALETTE_LENGTH_32 3 -# define NV097_SET_TEXTURE_PALETTE_OFFSET 0xFFFFFFC0 -# define NV097_SET_TEXTURE_BORDER_COLOR 0x00001B24 -# define NV097_SET_TEXTURE_SET_BUMP_ENV_MAT 0x00001B28 -# define NV097_SET_TEXTURE_SET_BUMP_ENV_SCALE 0x00001B38 -# define NV097_SET_TEXTURE_SET_BUMP_ENV_OFFSET 0x00001B3C -# define NV097_SET_SEMAPHORE_OFFSET 0x00001D6C -# define NV097_BACK_END_WRITE_SEMAPHORE_RELEASE 0x00001D70 -# define NV097_SET_ZSTENCIL_CLEAR_VALUE 0x00001D8C -# define NV097_SET_COLOR_CLEAR_VALUE 0x00001D90 -# define NV097_CLEAR_SURFACE 0x00001D94 -# define NV097_CLEAR_SURFACE_Z (1 << 0) -# define NV097_CLEAR_SURFACE_STENCIL (1 << 1) -# define NV097_CLEAR_SURFACE_COLOR 0x000000F0 -# define NV097_CLEAR_SURFACE_R (1 << 4) -# define NV097_CLEAR_SURFACE_G (1 << 5) -# define NV097_CLEAR_SURFACE_B (1 << 6) -# define NV097_CLEAR_SURFACE_A (1 << 7) -# define NV097_SET_CLEAR_RECT_HORIZONTAL 0x00001D98 -# define NV097_SET_CLEAR_RECT_VERTICAL 0x00001D9C -# define NV097_SET_SPECULAR_FOG_FACTOR 0x00001E20 -# define NV097_SET_COMBINER_COLOR_OCW 0x00001E40 -# define NV097_SET_COMBINER_CONTROL 0x00001E60 -# define NV097_SET_SHADOW_ZSLOPE_THRESHOLD 0x00001E68 -# define NV097_SET_SHADER_STAGE_PROGRAM 0x00001E70 -# define NV097_SET_SHADER_OTHER_STAGE_INPUT 0x00001E78 -# define NV097_SET_TRANSFORM_EXECUTION_MODE 0x00001E94 -# define NV097_SET_TRANSFORM_EXECUTION_MODE_MODE 0x00000003 -# define NV097_SET_TRANSFORM_EXECUTION_MODE_RANGE_MODE 0xFFFFFFFC -# define NV097_SET_TRANSFORM_PROGRAM_CXT_WRITE_EN 0x00001E98 -# define NV097_SET_TRANSFORM_PROGRAM_LOAD 0x00001E9C -# define NV097_SET_TRANSFORM_PROGRAM_START 0x00001EA0 -# define NV097_SET_TRANSFORM_CONSTANT_LOAD 0x00001EA4 - -/* vertex processing (cheops) context layout */ -#define NV_IGRAPH_XF_XFCTX_CMAT0 0x00 -#define NV_IGRAPH_XF_XFCTX_PMAT0 0x04 -#define NV_IGRAPH_XF_XFCTX_MMAT0 0x08 -#define NV_IGRAPH_XF_XFCTX_IMMAT0 0x0c -#define NV_IGRAPH_XF_XFCTX_MMAT1 0x10 -#define NV_IGRAPH_XF_XFCTX_IMMAT1 0x14 -#define NV_IGRAPH_XF_XFCTX_MMAT2 0x18 -#define NV_IGRAPH_XF_XFCTX_IMMAT2 0x1c -#define NV_IGRAPH_XF_XFCTX_MMAT3 0x20 -#define NV_IGRAPH_XF_XFCTX_IMMAT3 0x24 -#define NV_IGRAPH_XF_XFCTX_LIT0 0x28 -#define NV_IGRAPH_XF_XFCTX_LIT1 0x29 -#define NV_IGRAPH_XF_XFCTX_LIT2 0x2a -#define NV_IGRAPH_XF_XFCTX_LIT3 0x2b -#define NV_IGRAPH_XF_XFCTX_LIT4 0x2c -#define NV_IGRAPH_XF_XFCTX_LIT5 0x2d -#define NV_IGRAPH_XF_XFCTX_LIT6 0x2e -#define NV_IGRAPH_XF_XFCTX_LIT7 0x2f -#define NV_IGRAPH_XF_XFCTX_SPOT0 0x30 -#define NV_IGRAPH_XF_XFCTX_SPOT1 0x31 -#define NV_IGRAPH_XF_XFCTX_SPOT2 0x32 -#define NV_IGRAPH_XF_XFCTX_SPOT3 0x33 -#define NV_IGRAPH_XF_XFCTX_SPOT4 0x34 -#define NV_IGRAPH_XF_XFCTX_SPOT5 0x35 -#define NV_IGRAPH_XF_XFCTX_SPOT6 0x36 -#define NV_IGRAPH_XF_XFCTX_SPOT7 0x37 -#define NV_IGRAPH_XF_XFCTX_EYEP 0x38 -#define NV_IGRAPH_XF_XFCTX_FOG 0x39 -#define NV_IGRAPH_XF_XFCTX_VPSCL 0x3a -#define NV_IGRAPH_XF_XFCTX_VPOFF 0x3b -#define NV_IGRAPH_XF_XFCTX_CONS0 0x3c -#define NV_IGRAPH_XF_XFCTX_CONS1 0x3d -#define NV_IGRAPH_XF_XFCTX_CONS2 0x3e -#define NV_IGRAPH_XF_XFCTX_CONS3 0x3f -#define NV_IGRAPH_XF_XFCTX_TG0MAT 0x40 -#define NV_IGRAPH_XF_XFCTX_T0MAT 0x44 -#define NV_IGRAPH_XF_XFCTX_TG1MAT 0x48 -#define NV_IGRAPH_XF_XFCTX_T1MAT 0x4c -#define NV_IGRAPH_XF_XFCTX_TG2MAT 0x50 -#define NV_IGRAPH_XF_XFCTX_T2MAT 0x54 -#define NV_IGRAPH_XF_XFCTX_TG3MAT 0x58 -#define NV_IGRAPH_XF_XFCTX_T3MAT 0x5c -#define NV_IGRAPH_XF_XFCTX_PRSPACE 0x60 - -/* lighting (zoser) context layout */ -#define NV_IGRAPH_XF_LTCTXA_L0_K 0x00 -#define NV_IGRAPH_XF_LTCTXA_L0_SPT 0x01 -#define NV_IGRAPH_XF_LTCTXA_L1_K 0x02 -#define NV_IGRAPH_XF_LTCTXA_L1_SPT 0x03 -#define NV_IGRAPH_XF_LTCTXA_L2_K 0x04 -#define NV_IGRAPH_XF_LTCTXA_L2_SPT 0x05 -#define NV_IGRAPH_XF_LTCTXA_L3_K 0x06 -#define NV_IGRAPH_XF_LTCTXA_L3_SPT 0x07 -#define NV_IGRAPH_XF_LTCTXA_L4_K 0x08 -#define NV_IGRAPH_XF_LTCTXA_L4_SPT 0x09 -#define NV_IGRAPH_XF_LTCTXA_L5_K 0x0a -#define NV_IGRAPH_XF_LTCTXA_L5_SPT 0x0b -#define NV_IGRAPH_XF_LTCTXA_L6_K 0x0c -#define NV_IGRAPH_XF_LTCTXA_L6_SPT 0x0d -#define NV_IGRAPH_XF_LTCTXA_L7_K 0x0e -#define NV_IGRAPH_XF_LTCTXA_L7_SPT 0x0f -#define NV_IGRAPH_XF_LTCTXA_EYED 0x10 -#define NV_IGRAPH_XF_LTCTXA_FR_AMB 0x11 -#define NV_IGRAPH_XF_LTCTXA_BR_AMB 0x12 -#define NV_IGRAPH_XF_LTCTXA_CM_COL 0x13 -#define NV_IGRAPH_XF_LTCTXA_BCM_COL 0x14 -#define NV_IGRAPH_XF_LTCTXA_FOG_K 0x15 -#define NV_IGRAPH_XF_LTCTXA_ZERO 0x16 -#define NV_IGRAPH_XF_LTCTXA_PT0 0x17 -#define NV_IGRAPH_XF_LTCTXA_FOGLIN 0x18 - -#define NV_IGRAPH_XF_LTCTXB_L0_AMB 0x00 -#define NV_IGRAPH_XF_LTCTXB_L0_DIF 0x01 -#define NV_IGRAPH_XF_LTCTXB_L0_SPC 0x02 -#define NV_IGRAPH_XF_LTCTXB_L0_BAMB 0x03 -#define NV_IGRAPH_XF_LTCTXB_L0_BDIF 0x04 -#define NV_IGRAPH_XF_LTCTXB_L0_BSPC 0x05 -#define NV_IGRAPH_XF_LTCTXB_L1_AMB 0x06 -#define NV_IGRAPH_XF_LTCTXB_L1_DIF 0x07 -#define NV_IGRAPH_XF_LTCTXB_L1_SPC 0x08 -#define NV_IGRAPH_XF_LTCTXB_L1_BAMB 0x09 -#define NV_IGRAPH_XF_LTCTXB_L1_BDIF 0x0a -#define NV_IGRAPH_XF_LTCTXB_L1_BSPC 0x0b -#define NV_IGRAPH_XF_LTCTXB_L2_AMB 0x0c -#define NV_IGRAPH_XF_LTCTXB_L2_DIF 0x0d -#define NV_IGRAPH_XF_LTCTXB_L2_SPC 0x0e -#define NV_IGRAPH_XF_LTCTXB_L2_BAMB 0x0f -#define NV_IGRAPH_XF_LTCTXB_L2_BDIF 0x10 -#define NV_IGRAPH_XF_LTCTXB_L2_BSPC 0x11 -#define NV_IGRAPH_XF_LTCTXB_L3_AMB 0x12 -#define NV_IGRAPH_XF_LTCTXB_L3_DIF 0x13 -#define NV_IGRAPH_XF_LTCTXB_L3_SPC 0x14 -#define NV_IGRAPH_XF_LTCTXB_L3_BAMB 0x15 -#define NV_IGRAPH_XF_LTCTXB_L3_BDIF 0x16 -#define NV_IGRAPH_XF_LTCTXB_L3_BSPC 0x17 -#define NV_IGRAPH_XF_LTCTXB_L4_AMB 0x18 -#define NV_IGRAPH_XF_LTCTXB_L4_DIF 0x19 -#define NV_IGRAPH_XF_LTCTXB_L4_SPC 0x1a -#define NV_IGRAPH_XF_LTCTXB_L4_BAMB 0x1b -#define NV_IGRAPH_XF_LTCTXB_L4_BDIF 0x1c -#define NV_IGRAPH_XF_LTCTXB_L4_BSPC 0x1d -#define NV_IGRAPH_XF_LTCTXB_L5_AMB 0x1e -#define NV_IGRAPH_XF_LTCTXB_L5_DIF 0x1f -#define NV_IGRAPH_XF_LTCTXB_L5_SPC 0x20 -#define NV_IGRAPH_XF_LTCTXB_L5_BAMB 0x21 -#define NV_IGRAPH_XF_LTCTXB_L5_BDIF 0x22 -#define NV_IGRAPH_XF_LTCTXB_L5_BSPC 0x23 -#define NV_IGRAPH_XF_LTCTXB_L6_AMB 0x24 -#define NV_IGRAPH_XF_LTCTXB_L6_DIF 0x25 -#define NV_IGRAPH_XF_LTCTXB_L6_SPC 0x26 -#define NV_IGRAPH_XF_LTCTXB_L6_BAMB 0x27 -#define NV_IGRAPH_XF_LTCTXB_L6_BDIF 0x28 -#define NV_IGRAPH_XF_LTCTXB_L6_BSPC 0x29 -#define NV_IGRAPH_XF_LTCTXB_L7_AMB 0x2a -#define NV_IGRAPH_XF_LTCTXB_L7_DIF 0x2b -#define NV_IGRAPH_XF_LTCTXB_L7_SPC 0x2c -#define NV_IGRAPH_XF_LTCTXB_L7_BAMB 0x2d -#define NV_IGRAPH_XF_LTCTXB_L7_BDIF 0x2e -#define NV_IGRAPH_XF_LTCTXB_L7_BSPC 0x2f -#define NV_IGRAPH_XF_LTCTXB_PT1 0x30 -#define NV_IGRAPH_XF_LTCTXB_ONE 0x31 -#define NV_IGRAPH_XF_LTCTXB_VPOFFSET 0x32 - -#define NV_IGRAPH_XF_LTC1_ZERO1 0x00 -#define NV_IGRAPH_XF_LTC1_l0 0x01 -#define NV_IGRAPH_XF_LTC1_Bl0 0x02 -#define NV_IGRAPH_XF_LTC1_PP 0x03 -#define NV_IGRAPH_XF_LTC1_r0 0x04 -#define NV_IGRAPH_XF_LTC1_r1 0x05 -#define NV_IGRAPH_XF_LTC1_r2 0x06 -#define NV_IGRAPH_XF_LTC1_r3 0x07 -#define NV_IGRAPH_XF_LTC1_r4 0x08 -#define NV_IGRAPH_XF_LTC1_r5 0x09 -#define NV_IGRAPH_XF_LTC1_r6 0x0a -#define NV_IGRAPH_XF_LTC1_r7 0x0b -#define NV_IGRAPH_XF_LTC1_L0 0x0c -#define NV_IGRAPH_XF_LTC1_L1 0x0d -#define NV_IGRAPH_XF_LTC1_L2 0x0e -#define NV_IGRAPH_XF_LTC1_L3 0x0f -#define NV_IGRAPH_XF_LTC1_L4 0x10 -#define NV_IGRAPH_XF_LTC1_L5 0x11 -#define NV_IGRAPH_XF_LTC1_L6 0x12 -#define NV_IGRAPH_XF_LTC1_L7 0x13 - - -#define NV2A_VERTEX_ATTR_POSITION 0 -#define NV2A_VERTEX_ATTR_WEIGHT 1 -#define NV2A_VERTEX_ATTR_NORMAL 2 -#define NV2A_VERTEX_ATTR_DIFFUSE 3 -#define NV2A_VERTEX_ATTR_SPECULAR 4 -#define NV2A_VERTEX_ATTR_FOG 5 -#define NV2A_VERTEX_ATTR_POINT_SIZE 6 -#define NV2A_VERTEX_ATTR_BACK_DIFFUSE 7 -#define NV2A_VERTEX_ATTR_BACK_SPECULAR 8 -#define NV2A_VERTEX_ATTR_TEXTURE0 9 -#define NV2A_VERTEX_ATTR_TEXTURE1 10 -#define NV2A_VERTEX_ATTR_TEXTURE2 11 -#define NV2A_VERTEX_ATTR_TEXTURE3 12 -#define NV2A_VERTEX_ATTR_RESERVED1 13 -#define NV2A_VERTEX_ATTR_RESERVED2 14 -#define NV2A_VERTEX_ATTR_RESERVED3 15 - -#define NV2A_CRYSTAL_FREQ 13500000 -#define NV2A_NUM_CHANNELS 32 -#define NV2A_NUM_SUBCHANNELS 8 - -#define NV2A_MAX_BATCH_LENGTH 0x1FFFF -#define NV2A_VERTEXSHADER_ATTRIBUTES 16 -#define NV2A_MAX_TEXTURES 4 - -#define NV2A_MAX_TRANSFORM_PROGRAM_LENGTH 136 -#define NV2A_VERTEXSHADER_CONSTANTS 192 -#define NV2A_MAX_LIGHTS 8 - -#define NV2A_LTCTXA_COUNT 26 -#define NV2A_LTCTXB_COUNT 52 -#define NV2A_LTC1_COUNT 20 From 94d3fbbffee61e17ecd1c3122b00ad74cab62ec7 Mon Sep 17 00:00:00 2001 From: PatrickvL Date: Mon, 7 Nov 2016 11:38:59 +0100 Subject: [PATCH 2/4] Replaced DbgPrintg EmuKrnl with DbgFuncArgs, avoiding typos altogether --- src/Cxbx.h | 16 +- src/CxbxKrnl/EmuKrnl.cpp | 831 ++++++++++++++---------------------- src/CxbxKrnl/EmuXG.cpp | 57 +-- src/CxbxKrnl/EmuXOnline.cpp | 66 ++- src/CxbxKrnl/EmuXactEng.cpp | 162 +++---- src/CxbxKrnl/EmuXapi.cpp | 316 +++++--------- 6 files changed, 540 insertions(+), 908 deletions(-) diff --git a/src/Cxbx.h b/src/Cxbx.h index 8d725d27c..8aeefa469 100644 --- a/src/Cxbx.h +++ b/src/Cxbx.h @@ -82,8 +82,6 @@ typedef signed long sint32; /*! define this to dump textures that are registered */ //#define _DEBUG_DUMP_TEXTURE_REGISTER "D:\\cxbx\\_textures\\" -#include "Version.h" - /*! version string dependent on trace flag */ #ifndef _DEBUG_TRACE #define _CXBX_VERSION _GIT_VERSION " ("__DATE__ ")" @@ -105,11 +103,13 @@ extern volatile bool g_bPrintfOn; #endif /*! DbgPrintf enabled if _DEBUG_TRACE is set */ -#ifdef _DEBUG_TRACE -#define DbgPrintf if(g_bPrintfOn) printf -#else -inline void null_func(...) { } -#define DbgPrintf null_func -#endif +#define DbgPrintf(fmt, ...) do { if (_DEBUG_TRACE) if(g_bPrintfOn) printf(fmt, __VA_ARGS__); } while (0) + +// See http://stackoverflow.com/questions/1644868/c-define-macro-for-debug-printing +// TODO : print each argument indented on a separate line +#define DbgFuncArgs(fmt, ...) \ + do { if (_DEBUG_TRACE) if(g_bPrintfOn) \ + printf(__FILE__ " (0x%X): " __func__ "(" fmt ");\n", GetCurrentThreadID(), __VA_ARGS__); \ + } while (0) #endif diff --git a/src/CxbxKrnl/EmuKrnl.cpp b/src/CxbxKrnl/EmuKrnl.cpp index 80dbeb44f..763f76211 100644 --- a/src/CxbxKrnl/EmuKrnl.cpp +++ b/src/CxbxKrnl/EmuKrnl.cpp @@ -1075,13 +1075,11 @@ static unsigned int WINAPI PCSTProxy // Once deleted, unable to directly access iPCSTProxyParam in remainder of function. delete iPCSTProxyParam; - DbgPrintf("EmuKrnl (0x%X): PCSTProxy\n" - "(\n" + DbgFuncArgs( " StartContext1 : 0x%.08X\n" " StartContext2 : 0x%.08X\n" - " StartRoutine : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), StartContext1, StartContext2, StartRoutine); + " StartRoutine : 0x%.08X\n", + StartContext1, StartContext2, StartRoutine); if(StartSuspended == TRUE) SuspendThread(GetCurrentThread()); @@ -1289,9 +1287,9 @@ using namespace xboxkrnl; // ****************************************************************** XBSYSAPI EXPORTNUM(1) xboxkrnl::PVOID NTAPI xboxkrnl::AvGetSavedDataAddress() { - + - DbgPrintf("EmuKrnl (0x%X): AvGetSavedDataAddress();\n", GetCurrentThreadId() ); + DbgFuncArgs(); __asm int 3; @@ -1351,14 +1349,12 @@ XBSYSAPI EXPORTNUM(2) VOID NTAPI xboxkrnl::AvSendTVEncoderOption { - DbgPrintf("EmuKrnl (0x%X): AvSendTVEncoderOption\n" - "(\n" + DbgFuncArgs( " RegisterBase : 0x%.08X\n" " Option : 0x%.08X\n" " Param : 0x%.08X\n" - " Result : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), RegisterBase, Option, Param, Result); + " Result : 0x%.08X\n", + RegisterBase, Option, Param, Result); // TODO: What does this do? EmuWarning( "AvSendTVEncoderOption ignored!" ); @@ -1376,12 +1372,10 @@ XBSYSAPI EXPORTNUM(8) xboxkrnl::ULONG _cdecl xboxkrnl::DbgPrint { - DbgPrintf( "EmuKrnl (0x%X): DbgPrint\n" - "(\n" + DbgFuncArgs( " Format : 0x%.08X\n" - " ...\n" - ");\n", - GetCurrentThreadId(), Format); + " ...\n", + Format); if(Format != NULL) { @@ -1415,12 +1409,10 @@ XBSYSAPI EXPORTNUM(9) VOID NTAPI xboxkrnl::HalReadSMCTrayState { - DbgPrintf("EmuKrnl (0x%X): HalReadSMCTrayState\n" - "(\n" + DbgFuncArgs( " State : 0x%.08X\n" - " Count : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), State, Count); + " Count : 0x%.08X\n", + State, Count); #define TRAY_CLOSED_MEDIA_PRESENT 96 #define TRAY_CLOSED_NO_MEDIA 64 @@ -1448,11 +1440,9 @@ XBSYSAPI EXPORTNUM(14) xboxkrnl::PVOID NTAPI xboxkrnl::ExAllocatePool { - DbgPrintf("EmuKrnl (0x%X): ExAllocatePool\n" - "(\n" - " NumberOfBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes); + DbgFuncArgs( + " NumberOfBytes : 0x%.08X\n", + NumberOfBytes); PVOID pRet = ExAllocatePoolWithTag(NumberOfBytes, (ULONG)"enoN"); @@ -1475,12 +1465,10 @@ XBSYSAPI EXPORTNUM(15) xboxkrnl::PVOID NTAPI xboxkrnl::ExAllocatePoolWithTag { - DbgPrintf("EmuKrnl (0x%X): ExAllocatePoolWithTag\n" - "(\n" + DbgFuncArgs( " NumberOfBytes : 0x%.08X\n" - " Tag : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes, Tag); + " Tag : 0x%.08X\n", + NumberOfBytes, Tag); // TODO: Actually implement this PVOID pRet = CxbxMalloc(NumberOfBytes); @@ -1500,11 +1488,9 @@ XBSYSAPI EXPORTNUM(17) VOID NTAPI xboxkrnl::ExFreePool { - DbgPrintf("EmuKrnl (0x%X): ExFreePool\n" - "(\n" - " P : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), P); + DbgFuncArgs( + " P : 0x%.08X\n", + P); CxbxFree(P); } @@ -1517,11 +1503,9 @@ XBSYSAPI EXPORTNUM(23) xboxkrnl::ULONG NTAPI xboxkrnl::ExQueryPoolBlockSize IN PVOID PoolBlock ) { - DbgPrintf("EmuKrnl (0x%X): ExQueryPoolBlockSize\n" - "(\n" - " PoolBlock : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), PoolBlock); + DbgFuncArgs( + " PoolBlock : 0x%.08X\n", + PoolBlock); // Not strictly correct, but it will do for now return MmQueryAllocationSize(PoolBlock); @@ -1541,15 +1525,13 @@ XBSYSAPI EXPORTNUM(24) xboxkrnl::NTSTATUS NTAPI xboxkrnl::ExQueryNonVolatileSett { - DbgPrintf("EmuKrnl (0x%X): ExQueryNonVolatileSetting\n" - "(\n" + DbgFuncArgs( " ValueIndex : 0x%.08X\n" " Type : 0x%.08X\n" " Value : 0x%.08X\n" " ValueLength : 0x%.08X\n" - " ResultLength : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ValueIndex, Type, Value, ValueLength, ResultLength); + " ResultLength : 0x%.08X\n", + ValueIndex, Type, Value, ValueLength, ResultLength); if (!Type || !Value) CxbxKrnlCleanup("Assertion in ExQueryNonVolatileSetting()"); @@ -1664,13 +1646,11 @@ XBSYSAPI EXPORTNUM(25) xboxkrnl::NTSTATUS NTAPI xboxkrnl::ExReadWriteRefurbInfo { - DbgPrintf("EmuKrnl (0x%X): ExReadWriteRefurbInfo\n" - "(\n" + DbgFuncArgs( " Unknown1 : 0x%.08X\n" " Unknown2 : 0x%.08X\n" - " Unknown3 : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Unknown1, Unknown2, Unknown3); + " Unknown3 : 0x%.08X\n", + Unknown1, Unknown2, Unknown3); // TODO: What does this do? EmuWarning( "ExReadWriteRefurbInfo ignored!" ); @@ -1693,14 +1673,12 @@ XBSYSAPI EXPORTNUM(29) xboxkrnl::NTSTATUS NTAPI xboxkrnl::ExSaveNonVolatileSetti { - DbgPrintf("EmuKrnl (0x%X): ExSaveNonVolatileSetting\n" - "(\n" + DbgFuncArgs( " ValueIndex : 0x%.08X\n" " Type : 0x%.08X\n" " Value : 0x%.08X\n" - " ValueLength : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ValueIndex, Type, Value, ValueLength); + " ValueLength : 0x%.08X\n", + ValueIndex, Type, Value, ValueLength); // TODO: Later. @@ -1716,7 +1694,7 @@ XBSYSAPI EXPORTNUM(35) xboxkrnl::DWORD NTAPI xboxkrnl::FscGetCacheSize() { - DbgPrintf("EmuKrnl (0x%X): FscGetCacheSize();\n", GetCurrentThreadId()); + DbgFuncArgs(); EmuWarning("FscGetCacheSize returning default 64kb"); @@ -1732,11 +1710,9 @@ XBSYSAPI EXPORTNUM(37) xboxkrnl::LONG NTAPI xboxkrnl::FscSetCacheSize(ULONG uCac { - DbgPrintf("EmuKrnl (0x%X): FscSetCacheSize\n" - "(\n" - " uCachePages : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), uCachePages); + DbgFuncArgs( + " uCachePages : 0x%.08X\n", + uCachePages); EmuWarning("FscSetCacheSize is being ignored"); @@ -1756,12 +1732,10 @@ XBSYSAPI EXPORTNUM(44) xboxkrnl::ULONG NTAPI xboxkrnl::HalGetInterruptVector { - DbgPrintf("EmuKrnl (0x%X): HalGetInterruptVector\n" - "(\n" + DbgFuncArgs( " InterruptLevel : 0x%.08X\n" - " Irql : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), InterruptLevel, Irql); + " Irql : 0x%.08X\n", + InterruptLevel, Irql); // I'm only adding this for Virtua Cop 3 (Chihiro). Xbox games need not emulate this. @@ -1785,14 +1759,12 @@ XBSYSAPI EXPORTNUM(45) xboxkrnl::NTSTATUS NTAPI xboxkrnl::HalReadSMBusValue { - DbgPrintf("EmuKrnl (0x%X): HalReadSMBusValue\n" - "(\n" + DbgFuncArgs( " Address : 0x%.08X\n" " Command : 0x%.08X\n" " ReadWord : 0x%.08X\n" - " DataValue : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Address, Command, ReadWord, DataValue); + " DataValue : 0x%.08X\n", + Address, Command, ReadWord, DataValue); if (ReadWord) { // Write UCHAR @@ -1816,12 +1788,10 @@ XBSYSAPI EXPORTNUM(47) VOID xboxkrnl::HalRegisterShutdownNotification { - DbgPrintf("EmuKrnl (0x%X): HalRegisterShutdownNotification\n" - "(\n" + DbgFuncArgs( " ShutdownRegistration : 0x%.08X\n" - " Register : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ShutdownRegistration, Register); + " Register : 0x%.08X\n", + ShutdownRegistration, Register); EmuWarning("HalRegisterShutdownNotification not implemented!\n"); @@ -1841,11 +1811,9 @@ XBSYSAPI EXPORTNUM(49) VOID DECLSPEC_NORETURN xboxkrnl::HalReturnToFirmware { - DbgPrintf("EmuKrnl (0x%X): HalReturnToFirmware\n" - "(\n" - " Routine : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Routine); + DbgFuncArgs( + " Routine : 0x%.08X\n", + Routine); // Prevent the dashboard from rebooting due to unimplemented crypto routines if ((uint32_t)Routine != 4) { @@ -1868,14 +1836,12 @@ XBSYSAPI EXPORTNUM(50) xboxkrnl::NTSTATUS NTAPI xboxkrnl::HalWriteSMBusValue { - DbgPrintf("EmuKrnl (0x%X): HalWriteSMBusValue\n" - "(\n" + DbgFuncArgs( " Address : 0x%.08X\n" " Command : 0x%.08X\n" " WriteWord : 0x%.08X\n" - " DataValue : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Address, Command, WriteWord, DataValue); + " DataValue : 0x%.08X\n", + Address, Command, WriteWord, DataValue); // TODO: Later. @@ -1903,8 +1869,7 @@ XBSYSAPI EXPORTNUM(66) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoCreateFile { - DbgPrintf("EmuKrnl (0x%X): IoCreateFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " DesiredAccess : 0x%.08X\n" " ObjectAttributes : 0x%.08X (%s)\n" @@ -1914,9 +1879,8 @@ XBSYSAPI EXPORTNUM(66) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoCreateFile " ShareAccess : 0x%.08X\n" " Disposition : 0x%.08X\n" " CreateOptions : 0x%.08X\n" - " Options : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, + " Options : 0x%.08X\n", + FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, Disposition, CreateOptions, Options); NTSTATUS ret = STATUS_SUCCESS; @@ -1940,12 +1904,10 @@ XBSYSAPI EXPORTNUM(67) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoCreateSymbolicLink { - DbgPrintf("EmuKrnl (0x%X): IoCreateSymbolicLink\n" - "(\n" + DbgFuncArgs( " SymbolicLinkName : 0x%.08X (%s)\n" - " DeviceName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), SymbolicLinkName->Buffer, SymbolicLinkName->Buffer, + " DeviceName : 0x%.08X (%s)\n", + SymbolicLinkName->Buffer, SymbolicLinkName->Buffer, DeviceName, DeviceName->Buffer); NTSTATUS ret = CxbxCreateSymbolicLink(std::string(SymbolicLinkName->Buffer, SymbolicLinkName->Length), std::string(DeviceName->Buffer, DeviceName->Length)); @@ -1965,11 +1927,9 @@ XBSYSAPI EXPORTNUM(69) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoDeleteSymbolicLink { - DbgPrintf("EmuKrnl (0x%X): IoDeleteSymbolicLink\n" - "(\n" - " SymbolicLinkName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), SymbolicLinkName, SymbolicLinkName->Buffer); + DbgFuncArgs( + " SymbolicLinkName : 0x%.08X (%s)\n", + SymbolicLinkName, SymbolicLinkName->Buffer); EmuNtSymbolicLinkObject* symbolicLink = FindNtSymbolicLinkObjectByName(std::string(SymbolicLinkName->Buffer, SymbolicLinkName->Length)); @@ -1993,11 +1953,9 @@ XBSYSAPI EXPORTNUM(91) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoDismountVolumeByName { - DbgPrintf("EmuKrnl (0x%X): IoDismountVolumeByName\n" - "(\n" - " VolumeName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), VolumeName, VolumeName->Buffer); + DbgFuncArgs( + " VolumeName : 0x%.08X (%s)\n", + VolumeName, VolumeName->Buffer); // TODO: Anything? NTSTATUS ret = STATUS_SUCCESS; @@ -2017,11 +1975,9 @@ XBSYSAPI EXPORTNUM(95) VOID NTAPI xboxkrnl::KeBugCheck { - DbgPrintf("EmuKrnl (0x%X): KeBugCheck\n" - "(\n" - " BugCheckMode : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BugCheckMode); + DbgFuncArgs( + " BugCheckMode : 0x%.08X\n", + BugCheckMode); // TODO: Investigate XapiFiberStartup maybe? @@ -2038,11 +1994,9 @@ XBSYSAPI EXPORTNUM(98) xboxkrnl::LONG NTAPI xboxkrnl::KeConnectInterrupt { - DbgPrintf("EmuKrnl (0x%X): KeConnectInterrupt\n" - "(\n" - " InterruptObject : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), InterruptObject); + DbgFuncArgs( + " InterruptObject : 0x%.08X\n", + InterruptObject); @@ -2061,13 +2015,11 @@ XBSYSAPI EXPORTNUM(99) xboxkrnl::NTSTATUS NTAPI xboxkrnl::KeDelayExecutionThread { - DbgPrintf("EmuKrnl (0x%X): KeDelayExecutionThread\n" - "(\n" + DbgFuncArgs( " WaitMode : 0x%.08X\n" " Alertable : 0x%.08X\n" - " Interval : 0x%.08X (%I64d)\n" - ");\n", - GetCurrentThreadId(), WaitMode, Alertable, Interval, Interval == 0 ? 0 : Interval->QuadPart); + " Interval : 0x%.08X (%I64d)\n", + WaitMode, Alertable, Interval, Interval == 0 ? 0 : Interval->QuadPart); NTSTATUS ret = NtDll::NtDelayExecution(Alertable, (NtDll::LARGE_INTEGER*)Interval); @@ -2088,13 +2040,11 @@ XBSYSAPI EXPORTNUM(107) VOID NTAPI xboxkrnl::KeInitializeDpc { - DbgPrintf("EmuKrnl (0x%X): KeInitializeDpc\n" - "(\n" + DbgFuncArgs( " Dpc : 0x%.08X\n" " DeferredRoutine : 0x%.08X\n" - " DeferredContext : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Dpc, DeferredRoutine, DeferredContext); + " DeferredContext : 0x%.08X\n", + Dpc, DeferredRoutine, DeferredContext); // inialize Dpc field values Dpc->DeferredRoutine = DeferredRoutine; @@ -2123,17 +2073,15 @@ XBSYSAPI EXPORTNUM(109) VOID NTAPI xboxkrnl::KeInitializeInterrupt { - DbgPrintf("EmuKrnl (0x%X): KeInitializeInterrupt\n" - "(\n" + DbgFuncArgs( " Interrupt : 0x%.08X\n" " ServiceRoutine : 0x%.08X\n" " ServiceContext : 0x%.08X\n" " Vector : 0x%.08X\n" " Irql : 0x%.08X\n" " InterruptMode : 0x%.08X\n" - " ShareVector : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Interrupt, ServiceRoutine, ServiceContext, Vector, Irql, InterruptMode, ShareVector); + " ShareVector : 0x%.08X\n", + Interrupt, ServiceRoutine, ServiceContext, Vector, Irql, InterruptMode, ShareVector); } @@ -2149,12 +2097,10 @@ XBSYSAPI EXPORTNUM(113) VOID NTAPI xboxkrnl::KeInitializeTimerEx { - DbgPrintf("EmuKrnl (0x%X): KeInitializeTimerEx\n" - "(\n" + DbgFuncArgs( " Timer : 0x%.08X\n" - " Type : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Timer, Type); + " Type : 0x%.08X\n", + Timer, Type); Timer->Header.Type = Type + 8; // 8 = TimerNotificationObject Timer->Header.Inserted = 0; @@ -2181,7 +2127,7 @@ XBSYSAPI EXPORTNUM(126) xboxkrnl::ULONGLONG NTAPI xboxkrnl::KeQueryPerformanceCo { - DbgPrintf("EmuKrnl (0x%X): KeQueryPerformanceCounter();\n", GetCurrentThreadId()); + DbgFuncArgs(); ::LARGE_INTEGER Counter; @@ -2199,7 +2145,7 @@ XBSYSAPI EXPORTNUM(127) xboxkrnl::ULONGLONG NTAPI xboxkrnl::KeQueryPerformanceFr { - DbgPrintf("EmuKrnl (0x%X): KeQueryPerformanceFrequency();\n", GetCurrentThreadId()); + DbgFuncArgs(); // Xbox Performance Counter Frequency := 337F98h ::LARGE_INTEGER Frequency; @@ -2221,11 +2167,9 @@ XBSYSAPI EXPORTNUM(128) VOID NTAPI xboxkrnl::KeQuerySystemTime { - DbgPrintf("EmuKrnl (0x%X): KeQuerySystemTime\n" - "(\n" - " CurrentTime : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CurrentTime); + DbgFuncArgs( + " CurrentTime : 0x%.08X\n", + CurrentTime); // TODO: optimize for WinXP if speed ever becomes important here @@ -2247,7 +2191,7 @@ XBSYSAPI EXPORTNUM(129) xboxkrnl::UCHAR NTAPI xboxkrnl::KeRaiseIrqlToDpcLevel() { - DbgPrintf("EmuKrnl (0x%X): KeRaiseIrqlToDpcLevel()\n", GetCurrentThreadId()); + DbgFuncArgs(); // I really tried to avoid adding this... // __asm int 3; @@ -2270,13 +2214,11 @@ XBSYSAPI EXPORTNUM(149) xboxkrnl::BOOLEAN NTAPI xboxkrnl::KeSetTimer { - DbgPrintf("EmuKrnl (0x%X): KeSetTimer\n" - "(\n" + DbgFuncArgs( " Timer : 0x%.08X\n" " DueTime : 0x%.16X\n" - " Dpc : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Timer, DueTime.QuadPart, Dpc); + " Dpc : 0x%.08X\n", + Timer, DueTime.QuadPart, Dpc); // Call KeSetTimerEx with a period of zero BOOLEAN bRet = KeSetTimerEx(Timer, DueTime, 0, Dpc); @@ -2299,14 +2241,12 @@ XBSYSAPI EXPORTNUM(150) xboxkrnl::BOOLEAN NTAPI xboxkrnl::KeSetTimerEx { - DbgPrintf("EmuKrnl (0x%X): KeSetTimerEx\n" - "(\n" + DbgFuncArgs( " Timer : 0x%.08X\n" " DueTime : 0x%.16X\n" " Period : 0x%.08X\n" - " Dpc : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Timer, DueTime.QuadPart, Period, Dpc); + " Dpc : 0x%.08X\n", + Timer, DueTime.QuadPart, Period, Dpc); BOOLEAN Inserted; LARGE_INTEGER Interval; @@ -2390,8 +2330,7 @@ XBSYSAPI EXPORTNUM(158) xboxkrnl::NTSTATUS xboxkrnl::KeWaitForMultipleObjects IN PLARGE_INTEGER Timeout OPTIONAL, IN VOID* WaitBlockArray ) { - DbgPrintf("EmuKrnl (0x%X): KeWaitForMultipleObjects\n" - "(\n" + DbgFuncArgs( " Count : 0x%.08X\n" " Object : 0x%.08X\n" " WaitType : 0x%.08X\n" @@ -2399,9 +2338,8 @@ XBSYSAPI EXPORTNUM(158) xboxkrnl::NTSTATUS xboxkrnl::KeWaitForMultipleObjects " WaitMode : 0x%.08X\n" " Alertable : 0x%.08X\n" " Timeout : 0x%.08X\n" - " WaitBlockArray : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Count, Object, WaitType, WaitReason, WaitMode, Alertable, Timeout, WaitBlockArray); + " WaitBlockArray : 0x%.08X\n", + Count, Object, WaitType, WaitReason, WaitMode, Alertable, Timeout, WaitBlockArray); EmuWarning("EmuKrnl: Redirecting KeWaitForMultipleObjects to NtWaitForMultipleObjectsEx"); return NtWaitForMultipleObjectsEx(Count, Object, WaitType, WaitMode, Alertable, Timeout); @@ -2418,15 +2356,13 @@ XBSYSAPI EXPORTNUM(159) xboxkrnl::NTSTATUS xboxkrnl::KeWaitForSingleObject IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL ) { - DbgPrintf("EmuKrnl (0x%X): KeWaitForSingleObject\n" - "(\n" + DbgFuncArgs( " Object : 0x%.08X\n" " WaitReason : 0x%.08X\n" " WaitMode : 0x%.08X\n" " Alertable : 0x%.08X\n" - " Timeout : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Object, WaitReason, WaitMode, Alertable, Timeout); + " Timeout : 0x%.08X\n", + Object, WaitReason, WaitMode, Alertable, Timeout); EmuWarning("EmuKrnl: Redirecting KeWaitForSingleObject to NtWaitForSingleObjectEx"); return NtWaitForSingleObjectEx(Object, WaitMode, Alertable, Timeout); @@ -2443,11 +2379,9 @@ XBSYSAPI EXPORTNUM(160) xboxkrnl::UCHAR* NTAPI xboxkrnl::KfRaiseIrql // HACK: Not thread safe! static xboxkrnl::UCHAR previousIrqlValue = 0; - DbgPrintf("EmuKrnl (0x%X): KfRaiseIrql\n" - "(\n" - " NewIrql : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NewIrql); + DbgFuncArgs( + " NewIrql : 0x%.08X\n", + NewIrql); // Return addr where old irq level should be stored @@ -2464,11 +2398,9 @@ XBSYSAPI EXPORTNUM(161) VOID NTAPI xboxkrnl::KfLowerIrql { - DbgPrintf("EmuKrnl (0x%X): KfLowerIrql\n" - "(\n" - " NewIrql : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NewIrql); + DbgFuncArgs( + " NewIrql : 0x%.08X\n", + NewIrql); @@ -2489,11 +2421,9 @@ XBSYSAPI EXPORTNUM(165) xboxkrnl::PVOID NTAPI xboxkrnl::MmAllocateContiguousMemo { - DbgPrintf("EmuKrnl (0x%X): MmAllocateContiguousMemory\n" - "(\n" - " NumberOfBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes); + DbgFuncArgs( + " NumberOfBytes : 0x%.08X\n", + NumberOfBytes); // // NOTE: Kludgey (but necessary) solution: @@ -2536,15 +2466,13 @@ XBSYSAPI EXPORTNUM(166) xboxkrnl::PVOID NTAPI xboxkrnl::MmAllocateContiguousMemo { - DbgPrintf("EmuKrnl (0x%X): MmAllocateContiguousMemoryEx\n" - "(\n" + DbgFuncArgs( " NumberOfBytes : 0x%.08X\n" " LowestAcceptableAddress : 0x%.08X\n" " HighestAcceptableAddress : 0x%.08X\n" " Alignment : 0x%.08X\n" - " ProtectionType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes, LowestAcceptableAddress, HighestAcceptableAddress, + " ProtectionType : 0x%.08X\n", + NumberOfBytes, LowestAcceptableAddress, HighestAcceptableAddress, Alignment, ProtectionType); // @@ -2587,12 +2515,10 @@ XBSYSAPI EXPORTNUM(167) xboxkrnl::PVOID NTAPI xboxkrnl::MmAllocateSystemMemory { - DbgPrintf("EmuKrnl (0x%X): MmAllocateSystemMemory\n" - "(\n" + DbgFuncArgs( " NumberOfBytes : 0x%.08X\n" - " Protect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes, Protect); + " Protect : 0x%.08X\n", + NumberOfBytes, Protect); // TODO: should this be aligned? PVOID pRet = CxbxMalloc(NumberOfBytes); @@ -2615,12 +2541,10 @@ XBSYSAPI EXPORTNUM(169) xboxkrnl::PVOID NTAPI xboxkrnl::MmCreateKernelStack { - DbgPrintf("EmuKrnl (0x%X): MmCreateKernelStack\n" - "(\n" + DbgFuncArgs( " NumberOfBytes : 0x%.08X\n" - " DebuggerThread : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), NumberOfBytes, DebuggerThread); + " DebuggerThread : 0x%.08X\n", + NumberOfBytes, DebuggerThread); NtDll::PVOID pRet = NULL; @@ -2662,12 +2586,10 @@ XBSYSAPI EXPORTNUM(170) VOID NTAPI xboxkrnl::MmDeleteKernelStack { - DbgPrintf("EmuKrnl (0x%X): MmDeleteKernelStack\n" - "(\n" + DbgFuncArgs( " EndAddress : 0x%.08X\n" - " BaseAddress : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), EndAddress, BaseAddress); + " BaseAddress : 0x%.08X\n", + EndAddress, BaseAddress); /* __asm int 3; CxbxKrnlCleanup( "MmDeleteKernelStack unimplemented (check call stack)" );*/ @@ -2688,11 +2610,9 @@ XBSYSAPI EXPORTNUM(171) VOID NTAPI xboxkrnl::MmFreeContiguousMemory { - DbgPrintf("EmuKrnl (0x%X): MmFreeContiguousMemory\n" - "(\n" - " BaseAddress : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress); + DbgFuncArgs( + " BaseAddress : 0x%.08X\n", + BaseAddress); PVOID OrigBaseAddress = BaseAddress; @@ -2728,12 +2648,10 @@ XBSYSAPI EXPORTNUM(172) xboxkrnl::NTSTATUS NTAPI xboxkrnl::MmFreeSystemMemory { - DbgPrintf("EmuKrnl (0x%X): MmFreeSystemMemory\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X\n" - " NumberOfBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, NumberOfBytes); + " NumberOfBytes : 0x%.08X\n", + BaseAddress, NumberOfBytes); CxbxFree(BaseAddress); @@ -2752,13 +2670,11 @@ XBSYSAPI EXPORTNUM(175) void NTAPI xboxkrnl::MmLockUnlockBufferPages IN ULONG Protect ) { - DbgPrintf("EmuKrnl (0x%X): MmLockUnlockBufferPages\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X\n" " NumberOfBytes : 0x%.08X\n" - " Protect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, NumberOfBytes, Protect); + " Protect : 0x%.08X\n", + BaseAddress, NumberOfBytes, Protect); EmuWarning("EmuKrnl: MmLockUnlockBufferPages ignored"); @@ -2776,13 +2692,11 @@ XBSYSAPI EXPORTNUM(177) xboxkrnl::PVOID NTAPI xboxkrnl::MmMapIoSpace { - DbgPrintf("EmuKrnl (0x%X): MmMapIoSpace\n" - "(\n" + DbgFuncArgs( " PhysicalAddress : 0x%.08X\n" " NumberOfBytes : 0x%.08X\n" - " ProtectionType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), PhysicalAddress, NumberOfBytes, ProtectionType); + " ProtectionType : 0x%.08X\n", + PhysicalAddress, NumberOfBytes, ProtectionType); // TODO: should this be aligned? PVOID pRet = CxbxMalloc(NumberOfBytes); @@ -2804,13 +2718,11 @@ XBSYSAPI EXPORTNUM(178) VOID NTAPI xboxkrnl::MmPersistContiguousMemory { - DbgPrintf("EmuKrnl (0x%X): MmPersistContiguousMemory\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X\n" " NumberOfBytes : 0x%.08X\n" - " Persist : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, NumberOfBytes, Persist); + " Persist : 0x%.08X\n", + BaseAddress, NumberOfBytes, Persist); // TODO: Actually set this up to be remember across a "reboot" EmuWarning("MmPersistContiguousMemory is being ignored\n"); @@ -2828,11 +2740,9 @@ XBSYSAPI EXPORTNUM(180) XTL::ULONG NTAPI xboxkrnl::MmQueryAllocationSize { - DbgPrintf("EmuKrnl (0x%X): MmQueryAllocationSize\n" - "(\n" - " BaseAddress : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress); + DbgFuncArgs( + " BaseAddress : 0x%.08X\n", + BaseAddress); ULONG uiSize = EmuCheckAllocationSize(BaseAddress, false); @@ -2851,11 +2761,9 @@ XBSYSAPI EXPORTNUM(181) xboxkrnl::NTSTATUS NTAPI xboxkrnl::MmQueryStatistics { - DbgPrintf("EmuKrnl (0x%X): MmQueryStatistics\n" - "(\n" + DbgFuncArgs( " MemoryStatistics : 0x%.08X (MemoryStatistics->Length = 0x%.08X)\n" - ");\n", - GetCurrentThreadId(), MemoryStatistics, MemoryStatistics->Length); + MemoryStatistics, MemoryStatistics->Length); MEMORYSTATUS MemoryStatus; SYSTEM_INFO SysInfo; @@ -2917,13 +2825,11 @@ XBSYSAPI EXPORTNUM(182) VOID NTAPI xboxkrnl::MmSetAddressProtect { - DbgPrintf("EmuKrnl (0x%X): MmSetAddressProtect\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X\n" " NumberOfBytes : 0x%.08X\n" - " NewProtect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, NumberOfBytes, NewProtect); + " NewProtect : 0x%.08X\n", + BaseAddress, NumberOfBytes, NewProtect); DWORD dwOldProtect; @@ -2948,12 +2854,10 @@ XBSYSAPI EXPORTNUM(183) xboxkrnl::NTSTATUS NTAPI xboxkrnl::MmUnmapIoSpace { - DbgPrintf("EmuKrnl (0x%X): MmUnmapIoSpace\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X\n" - " NumberOfBytes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, NumberOfBytes); + " NumberOfBytes : 0x%.08X\n", + BaseAddress, NumberOfBytes); CxbxFree(BaseAddress); @@ -2976,15 +2880,13 @@ XBSYSAPI EXPORTNUM(184) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtAllocateVirtualMemo { - DbgPrintf("EmuKrnl (0x%X): NtAllocateVirtualMemory\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X (0x%.08X)\n" " ZeroBits : 0x%.08X\n" " AllocationSize : 0x%.08X (0x%.08X)\n" " AllocationType : 0x%.08X\n" - " Protect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, *BaseAddress, ZeroBits, AllocationSize, *AllocationSize, AllocationType, Protect); + " Protect : 0x%.08X\n", + BaseAddress, *BaseAddress, ZeroBits, AllocationSize, *AllocationSize, AllocationType, Protect); // TODO: The flag known as MEM_NOZERO (which appears to be exclusive to Xbox) has the exact // same value as MEM_ROTATE which causes problems for Windows XP, but not Vista. Removing @@ -3016,11 +2918,9 @@ XBSYSAPI EXPORTNUM(186) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtClearEvent { - DbgPrintf("EmuKrnl (0x%X): NtClearEvent\n" - "(\n" - " EventHandle : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), EventHandle); + DbgFuncArgs( + " EventHandle : 0x%.08X\n", + EventHandle); NTSTATUS ret = NtDll::NtClearEvent(EventHandle); @@ -3042,11 +2942,9 @@ XBSYSAPI EXPORTNUM(187) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtClose { - DbgPrintf("EmuKrnl (0x%X): NtClose\n" - "(\n" - " Handle : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Handle); + DbgFuncArgs( + " Handle : 0x%.08X\n", + Handle); NTSTATUS ret = STATUS_SUCCESS; @@ -3078,12 +2976,10 @@ XBSYSAPI EXPORTNUM(189) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateDirectoryObje { - DbgPrintf("EmuKrnl (0x%X): NtCreateDirectoryObject\n" - "(\n" + DbgFuncArgs( " DirectoryHandle : 0x%.08X\n" - " ObjectAttributes : 0x%.08X (\"%s\")\n" - ");\n", - GetCurrentThreadId(), DirectoryHandle, ObjectAttributes, ObjectAttributes); + " ObjectAttributes : 0x%.08X (\"%s\")\n", + DirectoryHandle, ObjectAttributes, ObjectAttributes); NTSTATUS ret = 0; @@ -3123,14 +3019,12 @@ XBSYSAPI EXPORTNUM(189) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateEvent { - DbgPrintf("EmuKrnl (0x%X): NtCreateEvent\n" - "(\n" + DbgFuncArgs( " EventHandle : 0x%.08X\n" " ObjectAttributes : 0x%.08X\n" " EventType : 0x%.08X\n" - " InitialState : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), EventHandle, ObjectAttributes, EventType, InitialState); + " InitialState : 0x%.08X\n", + EventHandle, ObjectAttributes, EventType, InitialState); NativeObjectAttributes nativeObjectAttributes; ACCESS_MASK DesiredAccess = 0; @@ -3176,8 +3070,7 @@ XBSYSAPI EXPORTNUM(190) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateFile { - DbgPrintf("EmuKrnl (0x%X): NtCreateFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " DesiredAccess : 0x%.08X\n" " ObjectAttributes : 0x%.08X (\"%s\")\n" @@ -3186,9 +3079,8 @@ XBSYSAPI EXPORTNUM(190) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateFile " FileAttributes : 0x%.08X\n" " ShareAccess : 0x%.08X\n" " CreateDisposition : 0x%.08X\n" - " CreateOptions : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, + " CreateOptions : 0x%.08X\n", + FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, IoStatusBlock, AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions); NativeObjectAttributes nativeObjectAttributes; @@ -3229,13 +3121,11 @@ XBSYSAPI EXPORTNUM(192) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateMutant char *szBuffer = (ObjectAttributes != 0) ? ObjectAttributes->ObjectName->Buffer : 0; - DbgPrintf("EmuKrnl (0x%X): NtCreateMutant\n" - "(\n" + DbgFuncArgs( " MutantHandle : 0x%.08X\n" " ObjectAttributes : 0x%.08X (\"%s\")\n" - " InitialOwner : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), MutantHandle, ObjectAttributes, szBuffer, InitialOwner); + " InitialOwner : 0x%.08X\n", + MutantHandle, ObjectAttributes, szBuffer, InitialOwner); wchar_t wszObjectName[160]; @@ -3281,14 +3171,12 @@ XBSYSAPI EXPORTNUM(193) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateSemaphore { - DbgPrintf("EmuKrnl (0x%X): NtCreateSemaphore\n" - "(\n" + DbgFuncArgs( " SemaphoreHandle : 0x%.08X\n" " ObjectAttributes : 0x%.08X\n" " InitialCount : 0x%.08X\n" - " MaximumCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), SemaphoreHandle, ObjectAttributes, + " MaximumCount : 0x%.08X\n", + SemaphoreHandle, ObjectAttributes, InitialCount, MaximumCount); // redirect to Win2k/XP @@ -3324,8 +3212,7 @@ XBSYSAPI EXPORTNUM(196) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtDeviceIoControlFile IN ULONG OutputBufferLength ) { - DbgPrintf("EmuKrnl (0x%X): NtDeviceIoControlFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " Event : 0x%.08X\n" " ApcRoutine : 0x%.08X\n" @@ -3335,9 +3222,8 @@ XBSYSAPI EXPORTNUM(196) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtDeviceIoControlFile " InputBuffer : 0x%.08X\n" " InputBufferLength : 0x%.08X\n" " OutputBuffer : 0x%.08X\n" - " OutputBufferLength : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, IoControlCode, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength); + " OutputBufferLength : 0x%.08X\n", + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, IoControlCode, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength); switch (IoControlCode) { @@ -3373,13 +3259,11 @@ XBSYSAPI EXPORTNUM(197) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtDuplicateObject { - DbgPrintf("EmuKrnl (0x%X): NtDuplicateObject\n" - "(\n" + DbgFuncArgs( " SourceHandle : 0x%.08X\n" " TargetHandle : 0x%.08X\n" - " Options : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), SourceHandle, TargetHandle, Options); + " Options : 0x%.08X\n", + SourceHandle, TargetHandle, Options); NTSTATUS ret; @@ -3419,12 +3303,10 @@ XBSYSAPI EXPORTNUM(198) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtFlushBuffersFile { - DbgPrintf("EmuKrnl (0x%X): NtFlushBuffersFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" - " IoStatusBlock : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, IoStatusBlock); + " IoStatusBlock : 0x%.08X\n", + FileHandle, IoStatusBlock); NTSTATUS ret = NtDll::NtFlushBuffersFile(FileHandle, (NtDll::IO_STATUS_BLOCK*)IoStatusBlock); @@ -3445,13 +3327,11 @@ XBSYSAPI EXPORTNUM(199) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtFreeVirtualMemory { - DbgPrintf("EmuKrnl (0x%X): NtFreeVirtualMemory\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X\n" " FreeSize : 0x%.08X\n" - " FreeType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, FreeSize, FreeType); + " FreeType : 0x%.08X\n", + BaseAddress, FreeSize, FreeType); NTSTATUS ret = NtDll::NtFreeVirtualMemory(GetCurrentProcess(), BaseAddress, FreeSize, FreeType); @@ -3473,25 +3353,17 @@ XBSYSAPI EXPORTNUM(202) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtOpenFile IN ULONG OpenOptions ) { - // debug trace /* Redundant - #ifdef _DEBUG_TRACE - { - - DbgPrintf("EmuKrnl (0x%X): NtOpenFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " DesiredAccess : 0x%.08X\n" " ObjectAttributes : 0x%.08X (\"%s\")\n" " IoStatusBlock : 0x%.08X\n" " ShareAccess : 0x%.08X\n" - " CreateOptions : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, + " CreateOptions : 0x%.08X\n", + FileHandle, DesiredAccess, ObjectAttributes, ObjectAttributes->ObjectName->Buffer, IoStatusBlock, ShareAccess, OpenOptions); - } - #endif //*/ return NtCreateFile(FileHandle, DesiredAccess, ObjectAttributes, IoStatusBlock, NULL, 0, ShareAccess, FILE_OPEN, OpenOptions); @@ -3508,12 +3380,10 @@ XBSYSAPI EXPORTNUM(203) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtOpenSymbolicLinkObj { - DbgPrintf("EmuKrnl (0x%X): NtOpenSymbolicLinkObject\n" - "(\n" + DbgFuncArgs( " LinkHandle : 0x%.08X\n" - " ObjectAttributes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), LinkHandle, ObjectAttributes); + " ObjectAttributes : 0x%.08X\n", + LinkHandle, ObjectAttributes); NTSTATUS ret = 0; EmuNtSymbolicLinkObject* symbolicLinkObject = NULL; @@ -3548,14 +3418,12 @@ XBSYSAPI EXPORTNUM(205) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtProtectVirtualMemor OUT PULONG OldProtect ) { - DbgPrintf("EmuKrnl (0x%X): NtProtectVirtualMemory\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X\n" " RegionSize : 0x%.08X\n" " NewProtect : 0x%.08X\n" - " OldProtect : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, RegionSize, NewProtect, + " OldProtect : 0x%.08X\n", + BaseAddress, RegionSize, NewProtect, OldProtect); EmuWarning("NtProtectVirtualMemory Ignored!"); @@ -3577,15 +3445,13 @@ XBSYSAPI EXPORTNUM(206) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueueApcThread { - DbgPrintf("EmuKrnl (0x%X): NtQueueApcThread\n" - "(\n" + DbgFuncArgs( " ThreadHandle : 0x%.08X\n" " ApcRoutine : 0x%.08X\n" " ApcRoutineContext : 0x%.08X\n" " ApcStatusBlock : 0x%.08X\n" - " ApcReserved : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ThreadHandle, ApcRoutine, ApcRoutineContext, + " ApcReserved : 0x%.08X\n", + ThreadHandle, ApcRoutine, ApcRoutineContext, ApcStatusBlock, ApcReserved); NTSTATUS ret; @@ -3621,8 +3487,7 @@ XBSYSAPI EXPORTNUM(207) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryDirectoryFile { - DbgPrintf("EmuKrnl (0x%X): NtQueryDirectoryFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " Event : 0x%.08X\n" " ApcRoutine : 0x%.08X\n" @@ -3632,9 +3497,8 @@ XBSYSAPI EXPORTNUM(207) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryDirectoryFile " Length : 0x%.08X\n" " FileInformationClass : 0x%.08X\n" " FileMask : 0x%.08X (%s)\n" - " RestartScan : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, + " RestartScan : 0x%.08X\n", + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FileInformation, Length, FileInformationClass, FileMask, (FileMask != 0) ? FileMask->Buffer : "", RestartScan); @@ -3705,12 +3569,10 @@ XBSYSAPI EXPORTNUM(210) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryFullAttributes { - DbgPrintf("EmuKrnl (0x%X): NtQueryFullAttributesFile\n" - "(\n" + DbgFuncArgs( " ObjectAttributes : 0x%.08X (%s)\n" - " Attributes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ObjectAttributes, ObjectAttributes->ObjectName->Buffer, Attributes); + " Attributes : 0x%.08X\n", + ObjectAttributes, ObjectAttributes->ObjectName->Buffer, Attributes); // __asm int 3; NativeObjectAttributes nativeObjectAttributes; @@ -3741,15 +3603,13 @@ XBSYSAPI EXPORTNUM(211) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryInformationFil { - DbgPrintf("EmuKrnl (0x%X): NtQueryInformationFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " IoStatusBlock : 0x%.08X\n" " FileInformation : 0x%.08X\n" " Length : 0x%.08X\n" - " FileInformationClass: 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, + " FileInformationClass: 0x%.08X\n", + FileHandle, IoStatusBlock, FileInformation, Length, FileInfo); // TODO: IIRC, this function is depreciated. Maybe we should just use @@ -3807,12 +3667,11 @@ XBSYSAPI EXPORTNUM(215) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQuerySymbolicLinkOb { - DbgPrintf("EmuKrnl (0x%X): NtQuerySymbolicLinkObject\n" - "(\n" + DbgFuncArgs( " LinkHandle : 0x%.08X\n" " LinkTarget : 0x%.08X\n" - " ReturnedLength : 0x%.08X\n" - ");\n", GetCurrentThreadId(), LinkHandle, LinkTarget, ReturnedLength); + " ReturnedLength : 0x%.08X\n", + LinkHandle, LinkTarget, ReturnedLength); NTSTATUS result = 0; EmuNtSymbolicLinkObject* symbolicLinkObject = NULL; @@ -3859,12 +3718,10 @@ XBSYSAPI EXPORTNUM(217) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryVirtualMemory { - DbgPrintf("EmuKrnl (0x%X): NtQueryVirtualMemory\n" - "(\n" + DbgFuncArgs( " BaseAddress : 0x%.08X\n" - " Buffer : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), BaseAddress, Buffer); + " Buffer : 0x%.08X\n", + BaseAddress, Buffer); NTSTATUS ret = NtDll::NtQueryVirtualMemory ( @@ -3919,15 +3776,13 @@ XBSYSAPI EXPORTNUM(218) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryVolumeInformat { - DbgPrintf("EmuKrnl (0x%X): NtQueryVolumeInformationFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " IoStatusBlock : 0x%.08X\n" " FileInformation : 0x%.08X\n" " Length : 0x%.08X\n" - " FileInformationClass: 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, + " FileInformationClass: 0x%.08X\n", + FileHandle, IoStatusBlock, FileInformation, Length, FileInformationClass); NTSTATUS ret = NtDll::NtQueryVolumeInformationFile @@ -3979,8 +3834,7 @@ XBSYSAPI EXPORTNUM(219) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtReadFile { - DbgPrintf("EmuKrnl (0x%X): NtReadFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " Event : 0x%.08X\n" " ApcRoutine : 0x%.08X\n" @@ -3988,9 +3842,8 @@ XBSYSAPI EXPORTNUM(219) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtReadFile " IoStatusBlock : 0x%.08X\n" " Buffer : 0x%.08X\n" " Length : 0x%.08X\n" - " ByteOffset : 0x%.08X (0x%.08X)\n" - ");\n", - GetCurrentThreadId(), FileHandle, Event, ApcRoutine, + " ByteOffset : 0x%.08X (0x%.08X)\n", + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, ByteOffset == 0 ? 0 : ByteOffset->QuadPart); // Halo... @@ -4018,12 +3871,10 @@ XBSYSAPI EXPORTNUM(221) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtReleaseMutant { - DbgPrintf("EmuKrnl (0x%X): NtReleaseMutant\n" - "(\n" + DbgFuncArgs( " MutantHandle : 0x%.08X\n" - " PreviousCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), MutantHandle, PreviousCount); + " PreviousCount : 0x%.08X\n", + MutantHandle, PreviousCount); // redirect to NtCreateMutant NTSTATUS ret = NtDll::NtReleaseMutant(MutantHandle, PreviousCount); @@ -4048,13 +3899,11 @@ XBSYSAPI EXPORTNUM(222) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtReleaseSemaphore { - DbgPrintf("EmuKrnl (0x%X): NtReleaseSemaphore\n" - "(\n" + DbgFuncArgs( " SemaphoreHandle : 0x%.08X\n" " ReleaseCount : 0x%.08X\n" - " PreviousCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), SemaphoreHandle, ReleaseCount, PreviousCount); + " PreviousCount : 0x%.08X\n", + SemaphoreHandle, ReleaseCount, PreviousCount); NTSTATUS ret = NtDll::NtReleaseSemaphore(SemaphoreHandle, ReleaseCount, PreviousCount); @@ -4077,12 +3926,10 @@ XBSYSAPI EXPORTNUM(224) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtResumeThread { - DbgPrintf("EmuKrnl (0x%X): NtResumeThread\n" - "(\n" + DbgFuncArgs( " ThreadHandle : 0x%.08X\n" - " PreviousSuspendCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ThreadHandle, PreviousSuspendCount); + " PreviousSuspendCount : 0x%.08X\n", + ThreadHandle, PreviousSuspendCount); NTSTATUS ret = NtDll::NtResumeThread(ThreadHandle, PreviousSuspendCount); @@ -4104,12 +3951,10 @@ XBSYSAPI EXPORTNUM(225) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtSetEvent { - DbgPrintf("EmuKrnl (0x%X): NtSetEvent\n" - "(\n" + DbgFuncArgs( " EventHandle : 0x%.08X\n" - " PreviousState : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), EventHandle, PreviousState); + " PreviousState : 0x%.08X\n", + EventHandle, PreviousState); NTSTATUS ret = NtDll::NtSetEvent(EventHandle, PreviousState); @@ -4135,15 +3980,13 @@ XBSYSAPI EXPORTNUM(226) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtSetInformationFile { - DbgPrintf("EmuKrnl (0x%X): NtSetInformationFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " IoStatusBlock : 0x%.08X\n" " FileInformation : 0x%.08X\n" " Length : 0x%.08X\n" - " FileInformationClass : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, + " FileInformationClass : 0x%.08X\n", + FileHandle, IoStatusBlock, FileInformation, Length, FileInformationClass); NTSTATUS ret = NtDll::NtSetInformationFile(FileHandle, IoStatusBlock, FileInformation, Length, FileInformationClass); @@ -4164,12 +4007,10 @@ XBSYSAPI EXPORTNUM(228) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtSetSystemTime { - DbgPrintf("EmuKrnl (0x%X): NtSetSystemTime\n" - "(\n" + DbgFuncArgs( " SystemTime : 0x%.08X\n" - " PreviousTime : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), SystemTime, PreviousTime); + " PreviousTime : 0x%.08X\n", + SystemTime, PreviousTime); // Maybe it's not such a good idea to allow Cxbx to change your time // clock. Might need admin privileges to do this.... dunno. @@ -4192,12 +4033,10 @@ XBSYSAPI EXPORTNUM(231) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtSuspendThread { - DbgPrintf("EmuKrnl (0x%X): NtSuspendThread\n" - "(\n" + DbgFuncArgs( " ThreadHandle : 0x%.08X\n" - " PreviousSuspendCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ThreadHandle, PreviousSuspendCount); + " PreviousSuspendCount : 0x%.08X\n", + ThreadHandle, PreviousSuspendCount); NTSTATUS ret = NtDll::NtSuspendThread(ThreadHandle, PreviousSuspendCount); @@ -4216,15 +4055,11 @@ XBSYSAPI EXPORTNUM(232) VOID NTAPI xboxkrnl::NtUserIoApcDispatcher ULONG Reserved ) { - // Note: This function is called within Win2k/XP context, so no EmuSwapFS here - - DbgPrintf("EmuKrnl (0x%X): NtUserIoApcDispatcher\n" - "(\n" + DbgFuncArgs( " ApcContext : 0x%.08X\n" " IoStatusBlock : 0x%.08X\n" - " Reserved : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ApcContext, IoStatusBlock, Reserved); + " Reserved : 0x%.08X\n", + ApcContext, IoStatusBlock, Reserved); DbgPrintf("IoStatusBlock->Pointer : 0x%.08X\n" "IoStatusBlock->Information : 0x%.08X\n", IoStatusBlock->u1.Pointer, IoStatusBlock->Information); @@ -4305,14 +4140,12 @@ XBSYSAPI EXPORTNUM(234) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtWaitForSingleObject { - DbgPrintf("EmuKrnl (0x%X): NtWaitForSingleObjectEx\n" - "(\n" + DbgFuncArgs( " Handle : 0x%.08X\n" " WaitMode : 0x%.08X\n" " Alertable : 0x%.08X\n" - " Timeout : 0x%.08X (%d)\n" - ");\n", - GetCurrentThreadId(), Handle, WaitMode, Alertable, Timeout, Timeout == 0 ? 0 : Timeout->QuadPart); + " Timeout : 0x%.08X (%d)\n", + Handle, WaitMode, Alertable, Timeout, Timeout == 0 ? 0 : Timeout->QuadPart); NTSTATUS ret; @@ -4350,16 +4183,14 @@ XBSYSAPI EXPORTNUM(235) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtWaitForMultipleObje { - DbgPrintf("EmuKrnl (0x%X): NtWaitForMultipleObjectsEx\n" - "(\n" + DbgFuncArgs( " Count : 0x%.08X\n" " Handles : 0x%.08X\n" " WaitType : 0x%.08X\n" " WaitMode : 0x%.08X\n" " Alertable : 0x%.08X\n" - " Timeout : 0x%.08X (%d)\n" - ");\n", - GetCurrentThreadId(), Count, Handles, WaitType, WaitMode, Alertable, + " Timeout : 0x%.08X (%d)\n", + Count, Handles, WaitType, WaitMode, Alertable, Timeout, Timeout == 0 ? 0 : Timeout->QuadPart); // TODO: Process EmuHandle @@ -4387,8 +4218,7 @@ XBSYSAPI EXPORTNUM(236) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtWriteFile { - DbgPrintf("EmuKrnl (0x%X): NtWriteFile\n" - "(\n" + DbgFuncArgs( " FileHandle : 0x%.08X\n" " Event : 0x%.08X\n" " ApcRoutine : 0x%.08X\n" @@ -4396,9 +4226,8 @@ XBSYSAPI EXPORTNUM(236) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtWriteFile " IoStatusBlock : 0x%.08X\n" " Buffer : 0x%.08X\n" " Length : 0x%.08X\n" - " ByteOffset : 0x%.08X (0x%.08X)\n" - ");\n", - GetCurrentThreadId(), FileHandle, Event, ApcRoutine, + " ByteOffset : 0x%.08X (0x%.08X)\n", + FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, ByteOffset == 0 ? 0 : ByteOffset->QuadPart); // Halo.. @@ -4423,7 +4252,7 @@ XBSYSAPI EXPORTNUM(238) VOID NTAPI xboxkrnl::NtYieldExecution() // NOTE: this eats up the debug log far too quickly - //DbgPrintf("EmuKrnl (0x%X): NtYieldExecution();\n", GetCurrentThreadId()); + //DbgFuncArgs(); NtDll::NtYieldExecution(); @@ -4451,8 +4280,7 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE { - DbgPrintf("EmuKrnl (0x%X): PsCreateSystemThreadEx\n" - "(\n" + DbgFuncArgs( " ThreadHandle : 0x%.08X\n" " ThreadExtraSize : 0x%.08X\n" " KernelStackSize : 0x%.08X\n" @@ -4462,9 +4290,8 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE " StartContext2 : 0x%.08X\n" " CreateSuspended : 0x%.08X\n" " DebugStack : 0x%.08X\n" - " StartRoutine : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ThreadHandle, ThreadExtraSize, KernelStackSize, TlsDataSize, ThreadId, + " StartRoutine : 0x%.08X\n", + ThreadHandle, ThreadExtraSize, KernelStackSize, TlsDataSize, ThreadId, StartContext1, StartContext2, CreateSuspended, DebugStack, StartRoutine); static bool bFirstTime = false; @@ -4518,11 +4345,9 @@ XBSYSAPI EXPORTNUM(258) VOID NTAPI xboxkrnl::PsTerminateSystemThread(IN NTSTATUS { - DbgPrintf("EmuKrnl (0x%X): PsTerminateSystemThread\n" - "(\n" - " ExitStatus : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), ExitStatus); + DbgFuncArgs( + " ExitStatus : 0x%.08X\n", + ExitStatus); // call thread notification routine(s) if(g_iThreadNotificationCount != 0) @@ -4567,13 +4392,11 @@ XBSYSAPI EXPORTNUM(260) xboxkrnl::NTSTATUS NTAPI xboxkrnl::RtlAnsiStringToUnicod { - DbgPrintf("EmuKrnl (0x%X): RtlAnsiStringToUnicodeString\n" - "(\n" + DbgFuncArgs( " DestinationString : 0x%.08X\n" " SourceString : 0x%.08X\n" - " AllocateDestinationString : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DestinationString, SourceString, AllocateDestinationString); + " AllocateDestinationString : 0x%.08X\n", + DestinationString, SourceString, AllocateDestinationString); NTSTATUS ret = NtDll::RtlAnsiStringToUnicodeString((NtDll::UNICODE_STRING*)DestinationString, (NtDll::STRING*)SourceString, AllocateDestinationString); @@ -4594,14 +4417,12 @@ XBSYSAPI EXPORTNUM(264) VOID NTAPI xboxkrnl::RtlAssert { - DbgPrintf("EmuKrnl (0x%X): RtlAssert\n" - "(\n" + DbgFuncArgs( " FailedAssertion : 0x%.08X (\"%s\")\n" " FileName : 0x%.08X (\"%s\")\n" " LineNumber : 0x%.08X (\"%lu\")\n" - " Message : 0x%.08X (\"%s\")\n" - ");\n", - GetCurrentThreadId(), FailedAssertion, FailedAssertion, FileName, FileName, LineNumber, LineNumber, Message, Message); + " Message : 0x%.08X (\"%s\")\n", + FailedAssertion, FailedAssertion, FileName, FileName, LineNumber, LineNumber, Message, Message); CxbxKrnlCleanup("RtlAssert() raised by emulated program - consult Debug log"); @@ -4621,11 +4442,9 @@ XBSYSAPI EXPORTNUM(277) VOID NTAPI xboxkrnl::RtlEnterCriticalSection /** sorta pointless - DbgPrintf("EmuKrnl (0x%X): RtlEnterCriticalSection\n" - "(\n" - " CriticalSection : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CriticalSection); + DbgFuncArgs( + " CriticalSection : 0x%.08X\n", + CriticalSection); //*/ //printf("CriticalSection->LockCount : %d\n", CriticalSection->LockCount); @@ -4671,13 +4490,11 @@ XBSYSAPI EXPORTNUM(279) xboxkrnl::BOOLEAN NTAPI xboxkrnl::RtlEqualString { - DbgPrintf("EmuKrnl (0x%X): RtlEqualString\n" - "(\n" + DbgFuncArgs( " String1 : 0x%.08X (\"%s\")\n" " String2 : 0x%.08X (\"%s\")\n" - " CaseSensitive : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), String1, String1->Buffer, String2, String2->Buffer, CaseSensitive ); + " CaseSensitive : 0x%.08X\n", + String1, String1->Buffer, String2, String2->Buffer, CaseSensitive ); BOOLEAN bRet = NtDll::RtlEqualString( (NtDll::PSTRING)String1, (NtDll::PSTRING)String2, (NtDll::BOOLEAN)CaseSensitive ); @@ -4696,11 +4513,9 @@ XBSYSAPI EXPORTNUM(286) VOID NTAPI xboxkrnl::RtlFreeAnsiString { - DbgPrintf("EmuKrnl (0x%X): RtlFreeAnsiString\n" - "(\n" - " AnsiString : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), AnsiString); + DbgFuncArgs( + " AnsiString : 0x%.08X\n", + AnsiString); NtDll::RtlFreeAnsiString((NtDll::PANSI_STRING)AnsiString); @@ -4720,12 +4535,10 @@ XBSYSAPI EXPORTNUM(289) VOID NTAPI xboxkrnl::RtlInitAnsiString { - DbgPrintf("EmuKrnl (0x%X): RtlInitAnsiString\n" - "(\n" + DbgFuncArgs( " DestinationString : 0x%.08X\n" - " SourceString : 0x%.08X (\"%s\")\n" - ");\n", - GetCurrentThreadId(), DestinationString, SourceString, SourceString); + " SourceString : 0x%.08X (\"%s\")\n", + DestinationString, SourceString, SourceString); NtDll::RtlInitAnsiString((NtDll::PANSI_STRING)DestinationString, (NtDll::PCSZ)SourceString); @@ -4745,12 +4558,10 @@ XBSYSAPI EXPORTNUM(290) VOID NTAPI xboxkrnl::RtlInitUnicodeString { - DbgPrintf("EmuKrnl (0x%X): RtlInitUnicodeString\n" - "(\n" + DbgFuncArgs( " DestinationString : 0x%.08X\n" - " SourceString : 0x%.08X (\"%ls\")\n" - ");\n", - GetCurrentThreadId(), DestinationString, SourceString, SourceString->Buffer); + " SourceString : 0x%.08X (\"%ls\")\n", + DestinationString, SourceString, SourceString->Buffer); NtDll::RtlInitUnicodeString((NtDll::PUNICODE_STRING)DestinationString, (NtDll::PCWSTR)SourceString); @@ -4772,11 +4583,9 @@ XBSYSAPI EXPORTNUM(291) VOID NTAPI xboxkrnl::RtlInitializeCriticalSection } /* - DbgPrintf("EmuKrnl (0x%X): RtlInitializeCriticalSection\n" - "(\n" - " CriticalSection : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CriticalSection); + DbgFuncArgs( + " CriticalSection : 0x%.08X\n", + CriticalSection); //*/ int iSection = FindCriticalSection(CriticalSection); @@ -4823,11 +4632,9 @@ XBSYSAPI EXPORTNUM(294) VOID NTAPI xboxkrnl::RtlLeaveCriticalSection //NtDll::RtlLeaveCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection); /* sorta pointless - DbgPrintf("EmuKrnl (0x%X): RtlLeaveCriticalSection\n" - "(\n" - " CriticalSection : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CriticalSection); + DbgFuncArgs( + " CriticalSection : 0x%.08X\n", + CriticalSection); //*/ @@ -4842,7 +4649,9 @@ XBSYSAPI EXPORTNUM(296) xboxkrnl::CHAR NTAPI xboxkrnl::RtlLowerChar(CHAR Charact { - DbgPrintf("EmuKrnl (0x%X): RtlLowerChar(%c)\n", GetCurrentThreadId(), Character); + DbgFuncArgs( + " Character : %c\n", + Character); CHAR ret = tolower(Character); @@ -4861,11 +4670,9 @@ XBSYSAPI EXPORTNUM(301) xboxkrnl::ULONG NTAPI xboxkrnl::RtlNtStatusToDosError { - DbgPrintf("EmuKrnl (0x%X): RtlNtStatusToDosError\n" - "(\n" - " Status : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Status); + DbgFuncArgs( + " Status : 0x%.08X\n", + Status); ULONG ret = NtDll::RtlNtStatusToDosError(Status); @@ -4885,12 +4692,10 @@ XBSYSAPI EXPORTNUM(304) xboxkrnl::BOOLEAN NTAPI xboxkrnl::RtlTimeFieldsToTime { - DbgPrintf("EmuKrnl (0x%X): RtlTimeFieldsToTime\n" - "(\n" + DbgFuncArgs( " TimeFields : 0x%.08X\n" - " Time : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), TimeFields, Time); + " Time : 0x%.08X\n", + TimeFields, Time); BOOLEAN bRet = NtDll::RtlTimeFieldsToTime((NtDll::TIME_FIELDS*)TimeFields, (NtDll::LARGE_INTEGER*)Time); @@ -4910,12 +4715,10 @@ XBSYSAPI EXPORTNUM(305) VOID NTAPI xboxkrnl::RtlTimeToTimeFields { - DbgPrintf("EmuKrnl (0x%X): RtlTimeToTimeFields\n" - "(\n" + DbgFuncArgs( " Time : 0x%.08X\n" - " TimeFields : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Time, TimeFields); + " TimeFields : 0x%.08X\n", + Time, TimeFields); NtDll::RtlTimeToTimeFields((NtDll::LARGE_INTEGER*)Time, (NtDll::TIME_FIELDS*)TimeFields); @@ -4937,11 +4740,9 @@ XBSYSAPI EXPORTNUM(306) xboxkrnl::BOOLEAN NTAPI xboxkrnl::RtlTryEnterCriticalSec return false; } - DbgPrintf("EmuKrnl (0x%X): RtlTryEnterCriticalSection\n" - "(\n" - " CriticalSection : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), CriticalSection); + DbgFuncArgs( + " CriticalSection : 0x%.08X\n", + CriticalSection); BOOL bRet = FALSE; @@ -4978,13 +4779,11 @@ XBSYSAPI EXPORTNUM(308) xboxkrnl::NTSTATUS NTAPI xboxkrnl::RtlUnicodeStringToAns { - DbgPrintf("EmuKrnl (0x%X): RtlUnicodeStringToAnsiString\n" - "(\n" + DbgFuncArgs( " DestinationString : 0x%.08X\n" " SourceString : 0x%.08X\n" - " AllocateDestinationString : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DestinationString, SourceString, AllocateDestinationString); + " AllocateDestinationString : 0x%.08X\n", + DestinationString, SourceString, AllocateDestinationString); NTSTATUS ret = NtDll::RtlUnicodeStringToAnsiString((NtDll::STRING*)DestinationString, (NtDll::UNICODE_STRING*)SourceString, AllocateDestinationString); @@ -5072,11 +4871,9 @@ XBSYSAPI EXPORTNUM(335) VOID NTAPI xboxkrnl::XcSHAInit(UCHAR *pbSHAContext) { - DbgPrintf("EmuKrnl (0x%X): XcSHAInit\n" - "(\n" - " pbSHAContext : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pbSHAContext); + DbgFuncArgs( + " pbSHAContext : 0x%.08X\n", + pbSHAContext); @@ -5090,13 +4887,11 @@ XBSYSAPI EXPORTNUM(336) VOID NTAPI xboxkrnl::XcSHAUpdate(UCHAR *pbSHAContext, UC { - DbgPrintf("EmuKrnl (0x%X): XcSHAUpdate\n" - "(\n" + DbgFuncArgs( " pbSHAContext : 0x%.08X\n" " pbInput : 0x%.08X\n" - " dwInputLength : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pbSHAContext, pbInput, dwInputLength); + " dwInputLength : 0x%.08X\n", + pbSHAContext, pbInput, dwInputLength); @@ -5110,12 +4905,10 @@ XBSYSAPI EXPORTNUM(337) VOID NTAPI xboxkrnl::XcSHAFinal(UCHAR *pbSHAContext, UCH { - DbgPrintf("EmuKrnl (0x%X): XcSHAFinal\n" - "(\n" + DbgFuncArgs( " pbSHAContext : 0x%.08X\n" - " pbDigest : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pbSHAContext, pbDigest); + " pbDigest : 0x%.08X\n", + pbSHAContext, pbDigest); // for now, we dont care about the digest for(int v=0;v<20;v++) diff --git a/src/CxbxKrnl/EmuXG.cpp b/src/CxbxKrnl/EmuXG.cpp index c823a0935..9be4c3526 100644 --- a/src/CxbxKrnl/EmuXG.cpp +++ b/src/CxbxKrnl/EmuXG.cpp @@ -58,20 +58,9 @@ PVOID WINAPI XTL::EmuXGIsSwizzledFormat XTL::D3DFORMAT Format ) { - // ****************************************************************** - // * debug trace - // ****************************************************************** - #ifdef _DEBUG_TRACE - { - - DbgPrintf("EmuXapi (0x%X): EmuXGIsSwizzledFormat\n" - "(\n" - " Format : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Format); - - } - #endif + DbgFuncArgs( + " Format : 0x%.08X\n", + Format); return FALSE; } @@ -93,8 +82,7 @@ VOID WINAPI XTL::EmuXGSwizzleRect { - DbgPrintf("EmuXapi (0x%X): EmuXGSwizzleRect\n" - "(\n" + DbgFuncArgs( " pSource : 0x%.08X\n" " Pitch : 0x%.08X\n" " pRect : 0x%.08X\n" @@ -102,9 +90,8 @@ VOID WINAPI XTL::EmuXGSwizzleRect " Width : 0x%.08X\n" " Height : 0x%.08X\n" " pPoint : 0x%.08X\n" - " BytesPerPixel : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pSource, Pitch, pRect, pDest, Width, Height, + " BytesPerPixel : 0x%.08X\n", + pSource, Pitch, pRect, pDest, Width, Height, pPoint, BytesPerPixel); if(pRect == NULL && pPoint == NULL && Pitch == 0) @@ -163,8 +150,7 @@ VOID WINAPI XTL::EmuXGSwizzleBox { - DbgPrintf("EmuXapi (0x%X): EmuXGSwizzleBox\n" - "(\n" + DbgFuncArgs( " pSource : 0x%.08X\n" " RowPitch : 0x%.08X\n" " SlicePitch : 0x%.08X\n" @@ -174,9 +160,8 @@ VOID WINAPI XTL::EmuXGSwizzleBox " Height : 0x%.08X\n" " Depth : 0x%.08X\n" " pPoint : 0x%.08X\n" - " BytesPerPixel : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height, + " BytesPerPixel : 0x%.08X\n", + pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height, Depth, pPoint, BytesPerPixel); if(pDest != (LPVOID) 0x80000000) @@ -339,13 +324,11 @@ HRESULT WINAPI XTL::EmuXGWriteSurfaceOrTextureToXPR { - DbgPrintf("EmuXapi (0x%X): EmuXGWriteSurfaceOrTextureToXPR\n" - "(\n" + DbgFuncArgs( " pResource : 0x%.08X\n" " cPath : 0x%.08X\n" - " bWriteSurfaceAsTexture : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pResource, cPath, bWriteSurfaceAsTexture); + " bWriteSurfaceAsTexture : 0x%.08X\n", + pResource, cPath, bWriteSurfaceAsTexture); // TODO: If necessary, either reverse the .xbx and .xpr file formats // and write the surface/texture to a file, or output a generic .xbx @@ -376,8 +359,7 @@ VOID WINAPI XTL::EmuXGSetTextureHeader { - DbgPrintf("EmuXapi (0x%X): EmuXGSetTextureHeader\n" - "(\n" + DbgFuncArgs( " Width : 0x%.08X\n" " Height : 0x%.08X\n" " Levels : 0x%.08X\n" @@ -386,9 +368,8 @@ VOID WINAPI XTL::EmuXGSetTextureHeader " Pool : 0x%.08X\n" " pTexture : 0x%.08X\n" " Data : 0x%.08X\n" - " Pitch : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), Width, Height, Levels, Usage, + " Pitch : 0x%.08X\n", + Width, Height, Levels, Usage, Format, Pool, pTexture, Data, Pitch); // NOTES: This function simply creates a texture that needs to be registered @@ -454,13 +435,11 @@ VOID WINAPI XTL::EmuXGSetTextureHeader //{ // // -// DbgPrintf("EmuXapi (0x%X): EmuXFONT_OpenBitmapFontFromMemory\n" -// "(\n" +// DbgFuncArgs( // " pFontData : 0x%.08X\n" // " uFontDataSize : 0x%.08X\n" -// " ppFont : 0x%.08X\n" -// ");\n", -// GetCurrentThreadId(), pFontData, uFontDataSize, ppFont); +// " ppFont : 0x%.08X\n", +// pFontData, uFontDataSize, ppFont); // // __asm int 3; // diff --git a/src/CxbxKrnl/EmuXOnline.cpp b/src/CxbxKrnl/EmuXOnline.cpp index da0ccc19e..a0f9839b5 100644 --- a/src/CxbxKrnl/EmuXOnline.cpp +++ b/src/CxbxKrnl/EmuXOnline.cpp @@ -58,12 +58,10 @@ int WINAPI XTL::EmuWSAStartup { - DbgPrintf("EmuXapi (0x%X): EmuWSAStartup\n" - "(\n" + DbgFuncArgs( " wVersionRequested : 0x%.08X\n" - " lpWSAData : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), wVersionRequested, lpWSAData); + " lpWSAData : 0x%.08X\n", + wVersionRequested, lpWSAData); int ret = WSAStartup(wVersionRequested, lpWSAData); @@ -82,11 +80,9 @@ INT WINAPI XTL::EmuXNetStartup { - DbgPrintf("EmuXapi (0x%X): EmuXNetStartup\n" - "(\n" - " pDummy : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pDummy); + DbgFuncArgs( + " pDummy : 0x%.08X\n", + pDummy); @@ -101,7 +97,7 @@ DWORD WINAPI XTL::EmuXNetGetEthernetLinkStatus() { - DbgPrintf("EmuXapi (0x%X): EmuXNetGetEthernetLinkStatus();\n", GetCurrentThreadId()); + DbgFuncArgs(); @@ -121,14 +117,12 @@ SOCKET XTL::EmuThis::Emusocket { - DbgPrintf("EmuXapi (0x%X): EmuThis::Emusocket\n" - "(\n" + DbgFuncArgs( " this : 0x%.08X\n" " af : 0x%.08X\n" " type : 0x%.08X\n" - " protocol : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), this, af, type, protocol); + " protocol : 0x%.08X\n", + this, af, type, protocol); SOCKET ret = socket(af, type, protocol); @@ -144,14 +138,12 @@ int XTL::EmuThis::Emubind(SOCKET s, const struct sockaddr FAR *name, int namelen { - DbgPrintf("EmuXapi (0x%X): EmuThis::Emubind\n" - "(\n" + DbgFuncArgs( " this : 0x%.08X\n" " s : 0x%.08X\n" " name : 0x%.08X\n" - " namelen : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), this, s, name, namelen); + " namelen : 0x%.08X\n", + this, s, name, namelen); // TODO: Host-To-Network order if necessary (probably not?) @@ -169,13 +161,11 @@ int XTL::EmuThis::Emulisten(SOCKET s, int backlog) { - DbgPrintf("EmuXapi (0x%X): EmuThis::Emulisten\n" - "(\n" + DbgFuncArgs( " this : 0x%.08X\n" " s : 0x%.08X\n" - " listen : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), this, s, backlog); + " listen : 0x%.08X\n", + this, s, backlog); // TODO: Host-To-Network order if necessary (probably not?) @@ -193,14 +183,12 @@ int XTL::EmuThis::Emuioctlsocket(SOCKET s, long cmd, u_long FAR *argp) { - DbgPrintf("EmuXapi (0x%X): EmuThis::Emuioctlsocket\n" - "(\n" + DbgFuncArgs( " this : 0x%.08X\n" " s : 0x%.08X\n" " cmd : 0x%.08X\n" - " argp : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), this, s, cmd, argp); + " argp : 0x%.08X\n", + this, s, cmd, argp); int ret = ioctlsocket(s, cmd, argp); @@ -220,12 +208,10 @@ HRESULT WINAPI XOnlineLaunchNewImage { - DbgPrintf("XOnline (0x%X): EmuXOnlineLaunchNewImage\n" - "(\n" + DbgFuncArgs( " lpImagePath : 0x%.08X (%s)\n" - " pLaunchData : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpImagePath, lpImagePath, pLaunchData); + " pLaunchData : 0x%.08X\n", + lpImagePath, lpImagePath, pLaunchData); // TODO: Launch another .xbe from Cxbx someday? @@ -248,15 +234,13 @@ HRESULT WINAPI XTL::EmuXOnlineLogon { - DbgPrintf("XOnline (0x%X): EmuXOnlineLogon\n" - "(\n" + DbgFuncArgs( " pUsers : 0x%.08X\n" " pdwServiceIDs : 0x%.08X\n" " dwServices : 0x%.08X\n" " hEvent : 0x%.08X\n" - " pHandle : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pUsers, pdwServiceIDs, dwServices, hEvent, pHandle); + " pHandle : 0x%.08X\n", + pUsers, pdwServiceIDs, dwServices, hEvent, pHandle); // TODO: What will it take to log on to Xbox Live? diff --git a/src/CxbxKrnl/EmuXactEng.cpp b/src/CxbxKrnl/EmuXactEng.cpp index 66bc59905..47573970d 100644 --- a/src/CxbxKrnl/EmuXactEng.cpp +++ b/src/CxbxKrnl/EmuXactEng.cpp @@ -70,12 +70,10 @@ HRESULT WINAPI XTL::EmuXACTEngineCreate { - DbgPrintf("EmuXactEng (0x%X): EmuXACTEngineCreate\n" - "(\n" + DbgFuncArgs( " pParams : 0x%.08X\n" - " ppEngine : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pParams, ppEngine); + " ppEngine : 0x%.08X\n", + pParams, ppEngine); // TODO: Any other form of initialization? @@ -93,7 +91,7 @@ void WINAPI XTL::EmuXACTEngineDoWork() { - DbgPrintf("EmuXactEng (0x%X): EmuXACTEngineCreate()\n", GetCurrentThreadId() ); + DbgFuncArgs(); // TODO: Anything else required here? // AFAIK, this function just calls DirectSoundDoWork() @@ -118,14 +116,12 @@ HRESULT WINAPI XTL::EmuIXACTEngine_RegisterWaveBank { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_RegisterWaveBank\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " pvData : 0x%.08X\n" " dwSize : 0x%.08X\n" - " ppWaveBank : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pvData, dwSize, ppWaveBank); + " ppWaveBank : 0x%.08X\n", + pThis, pvData, dwSize, ppWaveBank); // TODO: Implement @@ -148,13 +144,11 @@ HRESULT WINAPI XTL::EmuIXACTEngine_RegisterStreamedWaveBank { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_RegisterWaveBank\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " pParams : 0x%.08X\n" - " ppWaveBank : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pParams, ppWaveBank); + " ppWaveBank : 0x%.08X\n", + pThis, pParams, ppWaveBank); // TODO: Implement @@ -178,14 +172,12 @@ HRESULT WINAPI XTL::EmuIXACTEngine_CreateSoundBank { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_CreateSoundBank\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " pvData : 0x%.08X\n" " dwSize : 0x%.08X\n" - " ppSoundBank : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pvData, dwSize, ppSoundBank); + " ppSoundBank : 0x%.08X\n", + pThis, pvData, dwSize, ppSoundBank); // TODO: Implement @@ -210,15 +202,13 @@ HRESULT WINAPI XTL::EmuIXACTEngine_DownloadEffectsImage { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_DownloadEffectsImage\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " pvData : 0x%.08X\n" " dwSize : 0x%.08X\n" " pEffectLoc : 0x%.08X\n" - " ppImageDesc : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pvData, dwSize, pEffectLoc, ppImageDesc); + " ppImageDesc : 0x%.08X\n", + pThis, pvData, dwSize, pEffectLoc, ppImageDesc); // TODO: Implement @@ -239,13 +229,11 @@ HRESULT WINAPI XTL::EmuIXACTEngine_CreateSoundSource { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_CreateSoundSource\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " dwFlags : 0x%.08X\n" - " ppSoundSource : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwFlags, ppSoundSource); + " ppSoundSource : 0x%.08X\n", + pThis, dwFlags, ppSoundSource); *ppSoundSource = (X_XACTSoundSource*) CxbxMalloc( sizeof( X_XACTSoundSource ) ); @@ -265,12 +253,10 @@ HRESULT WINAPI XTL::EmuIXACTEngine_EnableHeadphones { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_EnableHeadphones\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" - " fEnabled : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, fEnabled); + " fEnabled : 0x%.08X\n", + pThis, fEnabled); @@ -294,8 +280,7 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetListenerOrientation { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_SetListenerOrientation\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " xFront : %f" " yFront : %f" @@ -303,9 +288,8 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetListenerOrientation " xTop : %f" " yTop : %f" " zTop : %f" - " dwApply : 0x%.08X" - ");\n", - GetCurrentThreadId(), pThis, xFront, yFront, zFront, xTop, yTop, zTop, dwApply); + " dwApply : 0x%.08X", + pThis, xFront, yFront, zFront, xTop, yTop, zTop, dwApply); @@ -326,15 +310,13 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetListenerPosition { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_SetListenerPosition\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " x : %f" " y : %f" " z : %f" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, x, y, z, dwApply); + " dwApply : 0x%.08X\n", + pThis, x, y, z, dwApply); @@ -355,15 +337,13 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetListenerVelocity { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_SetListenerVelocity\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " x : %f" " y : %f" " z : %f" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, x, y, z, dwApply); + " dwApply : 0x%.08X\n", + pThis, x, y, z, dwApply); @@ -382,13 +362,11 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetMasterVolume { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_SetMasterVolume\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " wCategory : 0x%.08X\n" - " lVolume : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, wCategory, lVolume); + " lVolume : 0x%.08X\n", + pThis, wCategory, lVolume); @@ -402,11 +380,9 @@ HRESULT WINAPI XTL::EmuIXACTEngine_CommitDeferredSettings(X_XACTEngine* pThis) { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_CommitDeferredSettings\n" - "(\n" - " pThis : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis); + DbgFuncArgs( + " pThis : 0x%.08X\n", + pThis); @@ -425,13 +401,11 @@ HRESULT WINAPI XTL::EmuIXACTSoundBank_GetSoundCueIndexFromFriendlyName { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundBank_GetSoundCueIndexFromFriendlyName\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " pFriendlyName : (%s)\n" - " pdwSoundCueIndex : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pFriendlyName, pdwSoundCueIndex); + " pdwSoundCueIndex : 0x%.08X\n", + pThis, pFriendlyName, pdwSoundCueIndex); @@ -452,15 +426,13 @@ HRESULT WINAPI XTL::EmuIXACTSoundBank_Play { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundBank_Play\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " dwSoundCueIndex : 0x%.08X\n" " pSoundSource : 0x%.08X\n" " dwFlags : 0x%.08X\n" - " ppSoundCue : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwSoundCueIndex, pSoundSource, dwFlags, ppSoundCue); + " ppSoundCue : 0x%.08X\n", + pThis, dwSoundCueIndex, pSoundSource, dwFlags, ppSoundCue); @@ -480,14 +452,12 @@ HRESULT WINAPI XTL::EmuIXACTSoundBank_Stop { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundBank_Stop\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " dwSoundCueIndex : 0x%.08X\n" " dwFlags : 0x%.08X\n" - " pSoundCue : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, dwSoundCueIndex, dwFlags, pSoundCue); + " pSoundCue : 0x%.08X\n", + pThis, dwSoundCueIndex, dwFlags, pSoundCue); @@ -508,15 +478,13 @@ HRESULT WINAPI XTL::EmuIXACTSoundSource_SetPosition { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundSource_SetPosition\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " x : %f\n" " y : %f\n" " z : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, x, y, z, dwApply); + " dwApply : 0x%.08X\n", + pThis, x, y, z, dwApply); @@ -537,15 +505,13 @@ HRESULT WINAPI XTL::EmuIXACTSoundSource_SetVelocity { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundSource_SetVelocity\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " x : %f\n" " y : %f\n" " z : %f\n" - " dwApply : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, x, y, z, dwApply); + " dwApply : 0x%.08X\n", + pThis, x, y, z, dwApply); @@ -563,12 +529,10 @@ HRESULT WINAPI XTL::EmuIXACTEngine_RegisterNotification { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_RegisterNotification\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" - " pNotificationDesc : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pNotificationDesc); + " pNotificationDesc : 0x%.08X\n", + pThis, pNotificationDesc); @@ -587,13 +551,11 @@ HRESULT WINAPI XTL::EmuIXACTEngine_GetNotification { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_GetNotification\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" " pNotificationDesc : 0x%.08X\n" - " pNotification : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pNotificationDesc, pNotification); + " pNotification : 0x%.08X\n", + pThis, pNotificationDesc, pNotification); // TODO: The contents of XACT_NOTIFICATION can vary from one XDK to the next. // The definition for 4627 is different than 5558. @@ -614,12 +576,10 @@ HRESULT WINAPI XTL::EmuIXACTEngine_UnRegisterWaveBank { - DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_UnRegisterWaveBank\n" - "(\n" + DbgFuncArgs( " pThis : 0x%.08X\n" - " pWaveBank : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThis, pWaveBank); + " pWaveBank : 0x%.08X\n", + pThis, pWaveBank); // Even though the documentation doesn't tell us much, I'm // assuming that after this function is called, the pointer diff --git a/src/CxbxKrnl/EmuXapi.cpp b/src/CxbxKrnl/EmuXapi.cpp index f06cd6823..1ef2f441c 100644 --- a/src/CxbxKrnl/EmuXapi.cpp +++ b/src/CxbxKrnl/EmuXapi.cpp @@ -84,11 +84,7 @@ XTL::LAUNCH_DATA g_SavedLaunchData; // ****************************************************************** BOOL WINAPI XTL::EmuXFormatUtilityDrive() { - #ifdef _DEBUG_TRACE - - DbgPrintf("EmuXapi (0x%X): EmuXFormatUtilityDrive()\n", GetCurrentThreadId()); - - #endif + DbgFuncArgs(); // TODO: yeah... we'll format... riiiiight @@ -105,11 +101,9 @@ DWORD WINAPI XTL::EmuGetTimeZoneInformation { - DbgPrintf("EmuXapi (0x%X): EmuGetTimeZoneInformation\n" - "(\n" - " lpTimeZoneInformation : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpTimeZoneInformation); + DbgFuncArgs( + " lpTimeZoneInformation : 0x%.08X\n", + lpTimeZoneInformation); DWORD dwRet = GetTimeZoneInformation(lpTimeZoneInformation); @@ -128,11 +122,9 @@ BOOL WINAPI XTL::EmuQueryPerformanceCounter { - DbgPrintf("EmuXapi (0x%X): EmuQueryPerformanceCounter\n" - "(\n" - " lpPerformanceCount : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpPerformanceCount); + DbgFuncArgs( + " lpPerformanceCount : 0x%.08X\n", + lpPerformanceCount); BOOL bRet = QueryPerformanceCounter(lpPerformanceCount); @@ -154,11 +146,9 @@ BOOL WINAPI XTL::EmuQueryPerformanceFrequency { - DbgPrintf("EmuXapi (0x%X): EmuQueryPerformanceFrequency\n" - "(\n" - " lpFrequency : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpFrequency); + DbgFuncArgs( + " lpFrequency : 0x%.08X\n", + lpFrequency); BOOL bRet = QueryPerformanceFrequency(lpFrequency); @@ -175,17 +165,9 @@ BOOL WINAPI XTL::EmuXMountUtilityDrive BOOL fFormatClean ) { - #ifdef _DEBUG_TRACE - { - - DbgPrintf("EmuXapi (0x%X): EmuXMountUtilityDrive\n" - "(\n" - " fFormatClean : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), fFormatClean); - - } - #endif + DbgFuncArgs( + " fFormatClean : 0x%.08X\n", + fFormatClean); CxbxMountUtilityDrive(fFormatClean); @@ -203,12 +185,10 @@ VOID WINAPI XTL::EmuXInitDevices { - DbgPrintf("EmuXapi (0x%X): EmuXInitDevices\n" - "(\n" + DbgFuncArgs( " dwPreallocTypeCount : 0x%.08X\n" - " PreallocTypes : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwPreallocTypeCount, PreallocTypes); + " PreallocTypes : 0x%.08X\n", + dwPreallocTypeCount, PreallocTypes); /*for( DWORD i = 0; i < dwPreallocTypeCount; i++ ) { @@ -247,11 +227,9 @@ DWORD WINAPI XTL::EmuXGetDevices { - DbgPrintf("EmuXapi (0x%X): EmuXGetDevices\n" - "(\n" - " DeviceType : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DeviceType); + DbgFuncArgs( + " DeviceType : 0x%.08X\n", + DeviceType); DWORD ret = 0; @@ -277,13 +255,11 @@ BOOL WINAPI XTL::EmuXGetDeviceChanges { - DbgPrintf("EmuXapi (0x%X): EmuXGetDeviceChanges\n" - "(\n" + DbgFuncArgs( " DeviceType : 0x%.08X\n" " pdwInsertions : 0x%.08X\n" - " pdwRemovals : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DeviceType, pdwInsertions, pdwRemovals); + " pdwRemovals : 0x%.08X\n", + DeviceType, pdwInsertions, pdwRemovals); BOOL bRet = FALSE; static BOOL bFirst = TRUE; @@ -328,14 +304,12 @@ HANDLE WINAPI XTL::EmuXInputOpen { - DbgPrintf("EmuXapi (0x%X): EmuXInputOpen\n" - "(\n" + DbgFuncArgs( " DeviceType : 0x%.08X\n" " dwPort : 0x%.08X\n" " dwSlot : 0x%.08X\n" - " pPollingParameters : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), DeviceType, dwPort, dwSlot, pPollingParameters); + " pPollingParameters : 0x%.08X\n", + DeviceType, dwPort, dwSlot, pPollingParameters); POLLING_PARAMETERS_HANDLE *pph = 0; @@ -402,11 +376,9 @@ VOID WINAPI XTL::EmuXInputClose { - DbgPrintf("EmuXapi (0x%X): EmuXInputClose\n" - "(\n" - " hDevice : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice); + DbgFuncArgs( + " hDevice : 0x%.08X\n", + hDevice); POLLING_PARAMETERS_HANDLE *pph = (POLLING_PARAMETERS_HANDLE*)hDevice; @@ -450,11 +422,9 @@ DWORD WINAPI XTL::EmuXInputPoll { - DbgPrintf("EmuXapi (0x%X): EmuXInputPoll\n" - "(\n" - " hDevice : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice); + DbgFuncArgs( + " hDevice : 0x%.08X\n", + hDevice); POLLING_PARAMETERS_HANDLE *pph = (POLLING_PARAMETERS_HANDLE*)hDevice; @@ -511,12 +481,10 @@ DWORD WINAPI XTL::EmuXInputGetCapabilities { - DbgPrintf("EmuXapi (0x%X): EmuXInputGetCapabilities\n" - "(\n" + DbgFuncArgs( " hDevice : 0x%.08X\n" - " pCapabilities : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice, pCapabilities); + " pCapabilities : 0x%.08X\n", + hDevice, pCapabilities); DWORD ret = ERROR_INVALID_HANDLE; @@ -552,12 +520,10 @@ DWORD WINAPI XTL::EmuXInputGetState { - DbgPrintf("EmuXapi (0x%X): EmuXInputGetState\n" - "(\n" + DbgFuncArgs( " hDevice : 0x%.08X\n" - " pState : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice, pState); + " pState : 0x%.08X\n", + hDevice, pState); DWORD ret = ERROR_INVALID_HANDLE; @@ -610,12 +576,10 @@ DWORD WINAPI XTL::EmuXInputSetState { - DbgPrintf("EmuXapi (0x%X): EmuXInputSetState\n" - "(\n" + DbgFuncArgs( " hDevice : 0x%.08X\n" - " pFeedback : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice, pFeedback); + " pFeedback : 0x%.08X\n", + hDevice, pFeedback); DWORD ret = ERROR_IO_PENDING; @@ -693,12 +657,10 @@ BOOL WINAPI XTL::EmuSetThreadPriorityBoost { - DbgPrintf("EmuXapi (0x%X): EmuSetThreadPriorityBoost\n" - "(\n" + DbgFuncArgs( " hThread : 0x%.08X\n" - " DisablePriorityBoost: 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hThread, DisablePriorityBoost); + " DisablePriorityBoost: 0x%.08X\n", + hThread, DisablePriorityBoost); BOOL bRet = SetThreadPriorityBoost(hThread, DisablePriorityBoost); @@ -721,12 +683,10 @@ BOOL WINAPI XTL::EmuSetThreadPriority { - DbgPrintf("EmuXapi (0x%X): EmuSetThreadPriority\n" - "(\n" + DbgFuncArgs( " hThread : 0x%.08X\n" - " nPriority : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hThread, nPriority); + " nPriority : 0x%.08X\n", + hThread, nPriority); BOOL bRet = SetThreadPriority(hThread, nPriority); @@ -749,11 +709,9 @@ int WINAPI XTL::EmuGetThreadPriority { - DbgPrintf("EmuXapi (0x%X): EmuGetThreadPriority\n" - "(\n" - " hThread : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hThread); + DbgFuncArgs( + " hThread : 0x%.08X\n", + hThread); int iRet = GetThreadPriority(hThread); @@ -776,12 +734,10 @@ BOOL WINAPI XTL::EmuGetExitCodeThread { - DbgPrintf("EmuXapi (0x%X): EmuGetExitCodeThread\n" - "(\n" + DbgFuncArgs( " hThread : 0x%.08X\n" - " lpExitCode : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hThread, lpExitCode); + " lpExitCode : 0x%.08X\n", + hThread, lpExitCode); BOOL bRet = GetExitCodeThread(hThread, lpExitCode); @@ -801,12 +757,10 @@ VOID WINAPI XTL::EmuXapiThreadStartup { - DbgPrintf("EmuXapi (0x%X): EmuXapiThreadStartup\n" - "(\n" + DbgFuncArgs( " dwDummy1 : 0x%.08X\n" - " dwDummy2 : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwDummy1, dwDummy2); + " dwDummy2 : 0x%.08X\n", + dwDummy1, dwDummy2); @@ -842,12 +796,10 @@ VOID WINAPI XTL::EmuXRegisterThreadNotifyRoutine { - DbgPrintf("EmuXapi (0x%X): EmuXRegisterThreadNotifyRoutine\n" - "(\n" + DbgFuncArgs( " pThreadNotification : 0x%.08X (0x%.08X)\n" - " fRegister : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pThreadNotification, pThreadNotification->pfnNotifyRoutine, fRegister); + " fRegister : 0x%.08X\n", + pThreadNotification, pThreadNotification->pfnNotifyRoutine, fRegister); if(fRegister) { @@ -898,13 +850,11 @@ DWORD WINAPI XTL::EmuQueueUserAPC { - DbgPrintf("EmuXapi (0x%X): EmuQueueUserAPC\n" - "(\n" + DbgFuncArgs( " pfnAPC : 0x%.08X\n" " hThread : 0x%.08X\n" - " dwData : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pfnAPC, hThread, dwData); + " dwData : 0x%.08X\n", + pfnAPC, hThread, dwData); DWORD dwRet = 0; @@ -937,14 +887,12 @@ BOOL WINAPI XTL::EmuGetOverlappedResult { - DbgPrintf("EmuXapi (0x%X): EmuGetOverlappedResult\n" - "(\n" + DbgFuncArgs( " hFile : 0x%.08X\n" " lpOverlapped : 0x%.08X\n" " lpNumberOfBytesTransformed : 0x%.08X\n" - " bWait : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait); + " bWait : 0x%.08X\n", + hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait); BOOL bRet = GetOverlappedResult( hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait ); @@ -967,12 +915,10 @@ DWORD WINAPI XTL::EmuXLaunchNewImage { - DbgPrintf("EmuXapi (0x%X): EmuXLaunchNewImage\n" - "(\n" + DbgFuncArgs( " lpTitlePath : 0x%.08X (%s)\n" - " pLaunchData : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), lpTitlePath, lpTitlePath, pLaunchData); + " pLaunchData : 0x%.08X\n", + lpTitlePath, lpTitlePath, pLaunchData); // If this function succeeds, it doesn't get a chance to return anything. DWORD dwRet = ERROR_GEN_FAILURE; @@ -1052,12 +998,10 @@ DWORD WINAPI XTL::EmuXGetLaunchInfo { - DbgPrintf("EmuXapi (0x%X): EmuXGetLaunchInfo\n" - "(\n" + DbgFuncArgs( " pdwLaunchDataType : 0x%.08X\n" - " pLaunchData : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), pdwLaunchDataType, pLaunchData); + " pLaunchData : 0x%.08X\n", + pdwLaunchDataType, pLaunchData); // The title was launched by turning on the Xbox console with the title disc already in the DVD drive DWORD dwRet = ERROR_NOT_FOUND; @@ -1121,11 +1065,9 @@ VOID WINAPI XTL::EmuXSetProcessQuantumLength { - DbgPrintf("EmuXapi (0x%X): EmuXSetProcessQuantumLength\n" - "(\n" - " dwMilliseconds : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwMilliseconds); + DbgFuncArgs( + " dwMilliseconds : 0x%.08X\n", + dwMilliseconds); // TODO: Implement? EmuWarning("XSetProcessQuantumLength is being ignored!"); @@ -1140,7 +1082,7 @@ DWORD WINAPI XTL::EmuXGetFileCacheSize() { - DbgPrintf("EmuXapi (0x%X): EmuXGetFileCacheSize()\n", GetCurrentThreadId()); + DbgFuncArgs(); // Return the default cache size for now. // TODO: Save the file cache size if/when set. @@ -1164,14 +1106,12 @@ DWORD WINAPI XTL::EmuSignalObjectAndWait { - DbgPrintf("EmuXapi (0x%X): EmuSignalObjectAndWait\n" - "(\n" + DbgFuncArgs( " hObjectToSignal : 0x%.08X\n" " hObjectToWaitOn : 0x%.08X\n" " dwMilliseconds : 0x%.08X\n" - " bAlertable : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable); + " bAlertable : 0x%.08X\n", + hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable); DWORD dwRet = SignalObjectAndWait( hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable ); @@ -1187,11 +1127,9 @@ BOOL WINAPI XTL::EmuPulseEvent( HANDLE hEvent ) { - DbgPrintf("EmuXapi (0x%X): EmuPulseEvent\n" - "(\n" - " hEvent : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hEvent); + DbgFuncArgs( + " hEvent : 0x%.08X\n", + hEvent); // TODO: This function might be a bit too high level. If it is, // feel free to implement NtPulseEvent in EmuKrnl.cpp @@ -1217,15 +1155,13 @@ MMRESULT WINAPI XTL::EmutimeSetEvent { - DbgPrintf("EmuXapi (0x%X): EmutimeSetEvent\n" - "(\n" + DbgFuncArgs( " uDelay : 0x%.08X\n" " uResolution : 0x%.08X\n" " fptc : 0x%.08X\n" " dwUser : 0x%.08X\n" - " fuEvent : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), uDelay, uResolution, fptc, dwUser, fuEvent); + " fuEvent : 0x%.08X\n", + uDelay, uResolution, fptc, dwUser, fuEvent); MMRESULT Ret = timeSetEvent( uDelay, uResolution, fptc, (DWORD_PTR) dwUser, fuEvent ); @@ -1244,11 +1180,9 @@ MMRESULT WINAPI XTL::EmutimeKillEvent { - DbgPrintf("EmuXapi (0x%X): EmuReleaseSemaphore\n" - "(\n" - " uTimerID : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), uTimerID); + DbgFuncArgs( + " uTimerID : 0x%.08X\n", + uTimerID); MMRESULT Ret = timeKillEvent( uTimerID ); @@ -1270,14 +1204,12 @@ VOID WINAPI XTL::EmuRaiseException { - DbgPrintf("EmuXapi (0x%X): EmuRaiseException\n" - "(\n" + DbgFuncArgs( " dwExceptionCode : 0x%.08X\n" " dwExceptionFlags : 0x%.08X\n" " nNumberOfArguments: 0x%.08X\n" - " lpArguments : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments); + " lpArguments : 0x%.08X\n", + dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments); // TODO: Implement or not? // RaiseException(dwExceptionCode, dwExceptionFlags, nNumberOfArguments, (*(ULONG_PTR**) &lpArguments)); @@ -1295,11 +1227,9 @@ DWORD WINAPI XTL::EmuGetFileAttributesA { - DbgPrintf("EmuXapi (0x%X): EmuGetFileAttributesA\n" - "(\n" - " lpFileName : (%s)\n" - ");\n", - GetCurrentThreadId(), lpFileName); + DbgFuncArgs( + " lpFileName : (%s)\n", + lpFileName); // Dues Ex... @@ -1338,13 +1268,11 @@ DWORD WINAPI XTL::EmuXMountMUA { - DbgPrintf("EmuXapi (0x%X): EmuXMountMUA\n" - "(\n" + DbgFuncArgs( " dwPort : 0x%.08X\n" " dwSlot : 0x%.08X\n" - " pchDrive : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), dwPort, dwSlot, pchDrive, pchDrive); + " pchDrive : 0x%.08X (%s)\n", + dwPort, dwSlot, pchDrive, pchDrive); // TODO: Actually allow memory card emulation? This might make transferring // game saves a bit easier if the memory card directory was configurable. =] @@ -1366,13 +1294,11 @@ HANDLE WINAPI XTL::EmuCreateWaitableTimerA { - DbgPrintf("EmuXapi (0x%X): EmuCreateWaitableTimerA\n" - "(\n" + DbgFuncArgs( " lpTimerAttributes : 0x%.08X\n" " bManualReset : 0x%.08X\n" - " lpTimerName : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), lpTimerAttributes, bManualReset, lpTimerName, lpTimerName); + " lpTimerName : 0x%.08X (%s)\n", + lpTimerAttributes, bManualReset, lpTimerName, lpTimerName); // For Xbox titles, this param should always be NULL. if(lpTimerAttributes) @@ -1401,16 +1327,14 @@ BOOL WINAPI XTL::EmuSetWaitableTimer - DbgPrintf("EmuXapi (0x%X): EmuSetWaitableTimer\n" - "(\n" + DbgFuncArgs( " hTimer : 0x%.08X\n" " pDueTime : 0x%.08X\n" " lPeriod : 0x%.08X\n" " pfnCompletionRoutine : 0x%.08X\n" " lpArgToCompletionRoutine : 0x%.08X\n" - " fResume : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hTimer, pDueTime, lPeriod, pfnCompletionRoutine, + " fResume : 0x%.08X\n", + hTimer, pDueTime, lPeriod, pfnCompletionRoutine, lpArgToCompletionRoutine, fResume); BOOL Ret = SetWaitableTimer( hTimer, pDueTime, lPeriod, pfnCompletionRoutine, @@ -1435,13 +1359,11 @@ DWORD WINAPI XTL::EmuXMountAlternateTitle { - DbgPrintf("EmuXapi (0x%X): EmuXMountAlternateTitle\n" - "(\n" + DbgFuncArgs( " lpRootPath : 0x%.08X (%s)\n" " dwAltTitleId : 0x%.08X\n" - " pchDrive : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), lpRootPath, lpRootPath, dwAltTitleId, pchDrive, pchDrive); + " pchDrive : 0x%.08X (%s)\n", + lpRootPath, lpRootPath, dwAltTitleId, pchDrive, pchDrive); // TODO: Anything? @@ -1457,11 +1379,9 @@ DWORD WINAPI XTL::EmuXUnmountAlternateTitle(CHAR chDrive) { - DbgPrintf("EmuXapi (0x%X): EmuXUnmountAlternativeTitle\n" - "(\n" - " chDrive : 0x%.08X (%c)\n" - ");\n", - GetCurrentThreadId(), chDrive, chDrive); + DbgFuncArgs( + " chDrive : 0x%.08X (%c)\n", + chDrive, chDrive); @@ -1475,7 +1395,7 @@ DWORD WINAPI XTL::EmuXGetDeviceEnumerationStatus() { - DbgPrintf("EmuXapi (0x%X): EmuXGetDeviceEnumerationStatus()\n", GetCurrentThreadId()); + DbgFuncArgs(); @@ -1493,12 +1413,10 @@ DWORD WINAPI XTL::EmuXInputGetDeviceDescription { - DbgPrintf("EmuXapi (0x%X): EmuXInputGetDeviceDescription\n" - "(\n" + DbgFuncArgs( " hDevice : 0x%.08X\n" - " pDescription : 0x%.08X\n" - ");\n", - GetCurrentThreadId(), hDevice, pDescription); + " pDescription : 0x%.08X\n", + hDevice, pDescription); // TODO: Lightgun support? @@ -1514,8 +1432,8 @@ int WINAPI XTL::EmuXAutoPowerDownResetTimer() { - DbgPrintf("EmuXapi (0x%X): EmuXAutoPowerDownResetTimer()\n", - GetCurrentThreadId()); + DbgFuncArgs(); + // Meh, that's what the 'X' is for! =] @@ -1537,13 +1455,11 @@ DWORD WINAPI XTL::EmuXMountMURootA - DbgPrintf("EmuXapi (0x%X): EmuXMountMURootA\n" - "(\n" + DbgFuncArgs( " dwPort : 0x%.08X\n" " dwSlot : 0x%.08X\n" - " pchDrive : 0x%.08X (%s)\n" - ");\n", - GetCurrentThreadId(), dwPort, dwSlot, pchDrive, pchDrive); + " pchDrive : 0x%.08X (%s)\n", + dwPort, dwSlot, pchDrive, pchDrive); // TODO: The params are probably wrong... From 3f47c7bef5998f9d47d1ec524d714cd2d9f11fee Mon Sep 17 00:00:00 2001 From: PatrickvL Date: Mon, 7 Nov 2016 11:39:10 +0100 Subject: [PATCH 3/4] Removed useless #ifdef _DEBUG_TRACE checks surrounding single DbgPrintf statements (since this checks _DEBUG_TRACE itself already) --- src/CxbxKrnl/EmuD3D8.cpp | 61 -------------- src/CxbxKrnl/EmuDSound.cpp | 157 +------------------------------------ 2 files changed, 1 insertion(+), 217 deletions(-) diff --git a/src/CxbxKrnl/EmuD3D8.cpp b/src/CxbxKrnl/EmuD3D8.cpp index 44e6b5d46..2ae4d00bf 100644 --- a/src/CxbxKrnl/EmuD3D8.cpp +++ b/src/CxbxKrnl/EmuD3D8.cpp @@ -2172,10 +2172,6 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetBackBuffer X_D3DSurface **ppBackBuffer ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetBackBuffer\n" "(\n" " BackBuffer : 0x%.08X\n" @@ -2183,9 +2179,6 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetBackBuffer " ppBackBuffer : 0x%.08X\n" ");\n", GetCurrentThreadId(), BackBuffer, Type, ppBackBuffer); - - } - #endif *ppBackBuffer = EmuIDirect3DDevice8_GetBackBuffer2(BackBuffer); @@ -2825,19 +2818,12 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetVertexShaderConstant1 CONST PVOID pConstantData ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant1\n" "(\n" " Register : 0x%.08X\n" " pConstantData : 0x%.08X\n" ");\n", GetCurrentThreadId(), Register, pConstantData); - - } - #endif XTL::EmuIDirect3DDevice8_SetVertexShaderConstant(Register, pConstantData, 1); @@ -2853,19 +2839,12 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetVertexShaderConstant4 CONST PVOID pConstantData ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant4\n" "(\n" " Register : 0x%.08X\n" " pConstantData : 0x%.08X\n" ");\n", GetCurrentThreadId(), Register, pConstantData); - - } - #endif XTL::EmuIDirect3DDevice8_SetVertexShaderConstant(Register, pConstantData, 4); @@ -2882,10 +2861,6 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetVertexShaderConstantNotInline DWORD ConstantCount ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstantNotInline\n" "(\n" " Register : 0x%.08X\n" @@ -2893,9 +2868,6 @@ VOID __fastcall XTL::EmuIDirect3DDevice8_SetVertexShaderConstantNotInline " ConstantCount : 0x%.08X\n" ");\n", GetCurrentThreadId(), Register, pConstantData, ConstantCount); - - } - #endif XTL::EmuIDirect3DDevice8_SetVertexShaderConstant(Register, pConstantData, ConstantCount / 4); @@ -3914,10 +3886,6 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData2f FLOAT b ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexData2f >>\n" "(\n" " Register : 0x%.08X\n" @@ -3925,9 +3893,6 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData2f " b : %f\n" ");\n", GetCurrentThreadId(), Register, a, b); - - } - #endif return EmuIDirect3DDevice8_SetVertexData4f(Register, a, b, 0.0f, 1.0f); } @@ -3945,10 +3910,6 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData2s SHORT b ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexData2s >>\n" "(\n" " Register : 0x%.08X\n" @@ -3956,9 +3917,6 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexData2s " b : %d\n" ");\n", GetCurrentThreadId(), Register, a, b); - - } - #endif DWORD dwA = a, dwB = b; @@ -4224,19 +4182,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexDataColor D3DCOLOR Color ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexDataColor >>\n" "(\n" " Register : 0x%.08X\n" " Color : 0x%.08X\n" ");\n", GetCurrentThreadId(), Register, Color); - - } - #endif FLOAT a = DWtoF((Color & 0xFF000000) >> 24); FLOAT r = DWtoF((Color & 0x00FF0000) >> 16); @@ -5631,10 +5582,6 @@ VOID WINAPI XTL::EmuGet2DSurfaceDescD X_D3DSURFACE_DESC *pDesc ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuD3D8 (0x%X): EmuGet2DSurfaceDescD\n" "(\n" " pPixelContainer : 0x%.08X\n" @@ -5642,9 +5589,6 @@ VOID WINAPI XTL::EmuGet2DSurfaceDescD ");\n", GetCurrentThreadId(), pPixelContainer, pDesc); - } - #endif - EmuGet2DSurfaceDesc(pPixelContainer, 0xFEFEFEFE, pDesc); return; @@ -8700,8 +8644,6 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetShaderConstantMode DWORD *pMode ) { - #ifdef _DEBUG_TRACE - { DbgPrintf( "EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetShaderConstantMode\n" "(\n" @@ -8709,9 +8651,6 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetShaderConstantMode ");\n", GetCurrentThreadId(), pMode); - } - #endif - if(pMode) { *pMode = g_VertexShaderConstantMode; diff --git a/src/CxbxKrnl/EmuDSound.cpp b/src/CxbxKrnl/EmuDSound.cpp index 401aa9b7c..bb85830b9 100644 --- a/src/CxbxKrnl/EmuDSound.cpp +++ b/src/CxbxKrnl/EmuDSound.cpp @@ -609,10 +609,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetI3DL2Listener DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetI3DL2Listener\n" "(\n" " pThis : 0x%.08X\n" @@ -620,9 +616,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetI3DL2Listener " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, pDummy, dwApply); - - } - #endif // TODO: Actually do something @@ -639,10 +632,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetMixBinHeadroom DWORD dwHeadroom ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetMixBinHeadroom\n" "(\n" " pThis : 0x%.08X\n" @@ -650,9 +639,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetMixBinHeadroom " dwHeadroom : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, dwMixBinMask, dwHeadroom); - - } - #endif // TODO: Actually do something @@ -668,19 +654,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMixBins PVOID pMixBins ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMixBins\n" "(\n" " pThis : 0x%.08X\n" " pMixBins : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, pMixBins); - - } - #endif // TODO: Actually do something @@ -696,19 +675,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMixBinVolumes PVOID pMixBins ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMixBinVolumes\n" "(\n" " pThis : 0x%.08X\n" " pMixBins : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, pMixBins); - - } - #endif // TODO: Actually do something @@ -727,10 +699,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetPosition DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetPosition\n" "(\n" " pThis : 0x%.08X\n" @@ -740,9 +708,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetPosition " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, x, y, z, dwApply); - - } - #endif // TODO: Actually do something @@ -761,10 +726,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetVelocity DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetVelocity\n" "(\n" " pThis : 0x%.08X\n" @@ -774,9 +735,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetVelocity " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, x, y, z, dwApply); - - } - #endif // TODO: Actually do something @@ -793,10 +751,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetAllParameters DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_SetAllParameters\n" "(\n" " pThis : 0x%.08X\n" @@ -804,9 +758,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetAllParameters " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, pTodo, dwApply); - - } - #endif // TODO: Actually do something @@ -821,8 +772,6 @@ HRESULT WINAPI XTL::EmuCDirectSound_CommitDeferredSettings X_CDirectSound *pThis ) { - - DbgPrintf("EmuDSound (0x%X): EmuCDirectSound_CommitDeferredSettings\n" "(\n" " pThis : 0x%.08X\n" @@ -831,8 +780,6 @@ HRESULT WINAPI XTL::EmuCDirectSound_CommitDeferredSettings // TODO: Translate params, then make the PC DirectSound call - - return DS_OK; } @@ -845,8 +792,6 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer X_CDirectSoundBuffer **ppBuffer ) { - - DbgPrintf("EmuDSound (0x%X): EmuDirectSoundCreateBuffer\n" "(\n" " pdsbd : 0x%.08X\n" @@ -1021,10 +966,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateBuffer PVOID pUnknown ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_CreateBuffer\n" "(\n" " pThis : 0x%.08X\n" @@ -1033,9 +974,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateBuffer " pUnknown : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, pdssd, ppBuffer, pUnknown); - - } - #endif EmuDirectSoundCreateBuffer(pdssd, ppBuffer); @@ -1053,10 +991,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateSoundBuffer LPUNKNOWN pUnkOuter ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_CreateSoundBuffer\n" "(\n" " pdsbd : 0x%.08X\n" @@ -1064,9 +998,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateSoundBuffer " pUnkOuter : 0x%.08X\n" ");\n", GetCurrentThreadId(), pdsbd, ppBuffer, pUnkOuter); - - } - #endif return EmuDirectSoundCreateBuffer(pdsbd, ppBuffer); } @@ -1756,10 +1687,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateStream PVOID pUnknown ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSound8_CreateStream\n" "(\n" " pThis : 0x%.08X\n" @@ -1768,9 +1695,6 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateStream " pUnknown : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, pdssd, ppStream, pUnknown); - - } - #endif EmuDirectSoundCreateStream(pdssd, ppStream); @@ -2453,20 +2377,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMaxDistance DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMaxDistance\n" "(\n" " pThis : 0x%.08X\n" " flMaxDistance : %f\n" " dwApply : 0x%.08X\n" ");\n", - GetCurrentThreadId(), pThis, flMaxDistance, dwApply); - - } - #endif // TODO: Actually do something @@ -2483,10 +2399,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMinDistance DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMinDistance\n" "(\n" " pThis : 0x%.08X\n" @@ -2494,9 +2406,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMinDistance " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, flMinDistance, dwApply); - - } - #endif // TODO: Actually do something @@ -2513,10 +2422,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetRolloffFactor DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetRolloffFactor\n" "(\n" " pThis : 0x%.08X\n" @@ -2524,9 +2429,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetRolloffFactor " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, flRolloffFactor, dwApply); - - } - #endif // TODO: Actually do something @@ -2543,10 +2445,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetDistanceFactor DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetDistanceFactor\n" "(\n" " pThis : 0x%.08X\n" @@ -2554,9 +2452,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetDistanceFactor " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, flDistanceFactor, dwApply); - - } - #endif // TODO: Actually do something @@ -2574,10 +2469,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeAngles DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeAngles\n" "(\n" " pThis : 0x%.08X\n" @@ -2587,9 +2478,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeAngles ");\n", GetCurrentThreadId(), pThis, dwInsideConeAngle, dwOutsideConeAngle, dwApply); - - } - #endif // TODO: Actually do something @@ -2608,10 +2496,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeOrientation DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOrientation\n" "(\n" " pThis : 0x%.08X\n" @@ -2621,9 +2505,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeOrientation " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, x, y, z, dwApply); - - } - #endif // TODO: Actually do something @@ -2640,10 +2521,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeOutsideVolume DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOutsideVolume\n" "(\n" " pThis : 0x%.08X\n" @@ -2651,9 +2528,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetConeOutsideVolume " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, lConeOutsideVolume, dwApply); - - } - #endif // TODO: Actually do something @@ -2672,10 +2546,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetPosition DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetPosition\n" "(\n" " pThis : 0x%.08X\n" @@ -2685,9 +2555,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetPosition " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, x, y, z, dwApply); - - } - #endif // TODO: Actually do something @@ -2706,10 +2573,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetVelocity DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { - DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetVelocity\n" "(\n" " pThis : 0x%.08X\n" @@ -2719,9 +2582,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetVelocity " dwApply : 0x%.08X\n" ");\n", GetCurrentThreadId(), pThis, x, y, z, dwApply); - - } - #endif // TODO: Actually do something @@ -2738,9 +2598,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetDopplerFactor DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetConeOutsideVolume\n" "(\n" @@ -2750,8 +2607,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetDopplerFactor ");\n", GetCurrentThreadId(), pThis, flDopplerFactor, dwApply); - } - #endif // TODO: Actually do something @@ -2768,9 +2623,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetI3DL2Source DWORD dwApply ) { - // debug trace - #ifdef _DEBUG_TRACE - { DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetI3DL2Source\n" "(\n" @@ -2780,8 +2632,6 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetI3DL2Source ");\n", GetCurrentThreadId(), pThis, pds3db, dwApply); - } - #endif // TODO: Actually do something @@ -2829,17 +2679,12 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetFormat { - // debug trace - #ifdef _DEBUG_TRACE - { - printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetFormat\n" + DbgPrintf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetFormat\n" "(\n" " pBuffer : 0x%.08X\n" " pwfxFormat : 0x%.08X\n" ");\n", GetCurrentThreadId(), pBuffer,pwfxFormat); - } - #endif HRESULT hRet = DS_OK; From 89b2a5cf5f7b2f418010fb0ff1df8e550ea7a19c Mon Sep 17 00:00:00 2001 From: PatrickvL Date: Mon, 7 Nov 2016 11:39:27 +0100 Subject: [PATCH 4/4] Small speedup in Mutex::Lock() --- src/Common/Win32/Mutex.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Common/Win32/Mutex.cpp b/src/Common/Win32/Mutex.cpp index 83cb4cc83..c9b6a5007 100644 --- a/src/Common/Win32/Mutex.cpp +++ b/src/Common/Win32/Mutex.cpp @@ -49,6 +49,8 @@ Mutex::Mutex() // ****************************************************************** void Mutex::Lock() { + LONG _CurrentProcessId = (LONG) GetCurrentProcessId(); + LONG _CurrentThreadId = (LONG) GetCurrentThreadId(); while(true) { // Grab the lock, letting us look at the variables @@ -63,8 +65,8 @@ void Mutex::Lock() if (!m_OwnerProcess) { // Take ownership - InterlockedExchange(&m_OwnerProcess, (LONG)GetCurrentProcessId()); - InterlockedExchange(&m_OwnerThread, (LONG)GetCurrentThreadId()); + InterlockedExchange(&m_OwnerProcess, _CurrentProcessId); + InterlockedExchange(&m_OwnerThread, _CurrentThreadId); InterlockedExchange(&m_LockCount, 1); // Unlock the mutex itself @@ -76,13 +78,14 @@ void Mutex::Lock() // If a different process owns this mutex right now, unlock // the mutex lock and wait. The reading need not be // interlocked. - if ((m_OwnerProcess != (LONG) GetCurrentProcessId()) || - (m_OwnerThread != (LONG) GetCurrentThreadId())) + if ((m_OwnerProcess != _CurrentProcessId) || + (m_OwnerThread != _CurrentThreadId)) { // Unlock the mutex itself InterlockedExchange(&m_MutexLock, 0); // Wait and try again + // TODO : Improve performance replacing Sleep(1) with YieldProcessor and perhaps an optional SpinLock Sleep(1); continue; }