Added "File..." debug output option

This commit is contained in:
Aaron Robinson 2003-01-29 23:59:07 +00:00
parent 5fade39fac
commit 3b8830a2bd
13 changed files with 243 additions and 68 deletions

View File

@ -95,7 +95,15 @@ LINK32=link.exe
# Begin Group "Debug"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Bin\Debug\Cxbx.exe
# End Source File
# End Group
# Begin Source File
SOURCE=.\Bin\Cxbx.exe
# End Source File
# End Group
# Begin Group "Doc"

View File

@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CXBXKRNL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "Include" /I "Include/Win32/" /I "Include/Win32/Cxbxkrnl" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CXBXKRNL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "Include" /I "Include/Win32/" /I "Include/Win32/Cxbx" /I "Include/Win32/Cxbxkrnl" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CXBXKRNL_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@ -93,7 +93,15 @@ LINK32=link.exe
# Begin Group "Debug"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Bin\Debug\Cxbx.dll
# End Source File
# End Group
# Begin Source File
SOURCE=.\Bin\Cxbx.dll
# End Source File
# End Group
# Begin Group "Doc"

View File

@ -9,6 +9,9 @@ Cxbx Todo:
Debug outputs should be configurable to STDOUT (console) or text file.
- Passing a ptr to CxbxKrnl is not enough (seperate process) pass the
full DebugFilename.
Exe->Xbe should use an "OpenXDK" logo bitmap by default. This can be done
by having a debug version of Cxbx output the necessary raw data. Then, you
just inline it into the code.

View File

@ -65,6 +65,16 @@ static uint32 RoundUp(uint32 x_dwValue, uint32 x_dwMult)
return x_dwValue - (x_dwValue-1)%x_dwMult + (x_dwMult - 1);
}
// ******************************************************************
// * enum : DebugMode
// ******************************************************************
enum DebugMode
{
DM_NONE,
DM_CONSOLE,
DM_FILE
};
// ******************************************************************
// * Core Components
// ******************************************************************

View File

@ -45,7 +45,7 @@ class EmuExe : public Exe
// ******************************************************************
// * Construct via Xbe file object
// ******************************************************************
EmuExe(class Xbe *x_Xbe, uint32 x_debug_console);
EmuExe(class Xbe *x_Xbe, uint32 x_debug_console, char *x_debug_filename);
};
#endif

View File

@ -77,14 +77,17 @@ class WndMain : public Wnd
Xbe *m_xbe;
Exe *m_exe;
char *m_xbe_filename;
char *m_exe_filename;
char *m_XbeFilename;
char *m_ExeFilename;
bool m_xbe_changed;
bool m_exe_changed;
uint32 m_cxbx_debug;
uint32 m_krnl_debug;
enum DebugMode m_CxbxDebug;
enum DebugMode m_KrnlDebug;
char *m_CxbxDebugFilename;
char *m_KrnlDebugFilename;
};
#endif

View File

@ -64,7 +64,7 @@ extern CXBXKRNL_API uint32 KernelThunkTable[367];
// ******************************************************************
// * func: EmuXInit
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXInit(uint32 DebugConsole, uint08 *XBEHeader, uint32 XBEHeaderSize, void (*Entry)());
CXBXKRNL_API void NTAPI EmuXInit(DebugMode DebugConsole, char *DebugFilename, uint08 *XBEHeader, uint32 XBEHeaderSize, void (*Entry)());
// ******************************************************************
// * func: EmuXDummy

View File

@ -105,8 +105,20 @@ BEGIN
END
POPUP "&View"
BEGIN
MENUITEM "&Debug Console (GUI)", ID_VIEW_DEBUGCONSOLE
MENUITEM "Debug Console (Kernel)", ID_VIEW_KERNELDEBUGCONSOLE
POPUP "&Debug Output (GUI)"
BEGIN
MENUITEM "&Console", ID_VIEW_DEBUGOUTPUTGUI_CONSOLE
MENUITEM "&File...", ID_VIEW_DEBUGOUTPUTGUI_FILE
END
POPUP "Debug Output (Kernel)"
BEGIN
MENUITEM "&Console", ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE
MENUITEM "&File...", ID_VIEW_DEBUGOUTPUTKERNEL_FILE
END
END
POPUP "E&mulation"
BEGIN

View File

@ -23,13 +23,17 @@
#define ID_EDIT_PATCH_DEBUGMODE 40031
#define ID_FILE_IMPORTFROMEXE 40032
#define ID_VIEW_KERNELDEBUGCONSOLE 40033
#define ID_VIEW_DEBUGOUTPUTGUI_CONSOLE 40035
#define ID_VIEW_DEBUGOUTPUTGUI_FILE 40036
#define ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE 40037
#define ID_VIEW_DEBUGOUTPUTKERNEL_FILE 40038
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40034
#define _APS_NEXT_COMMAND_VALUE 40039
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 103
#endif

View File

@ -45,7 +45,7 @@
// ******************************************************************
// * constructor
// ******************************************************************
EmuExe::EmuExe(Xbe *x_Xbe, uint32 x_debug_console) : Exe()
EmuExe::EmuExe(Xbe *x_Xbe, uint32 x_debug_console, char *x_debug_filename) : Exe()
{
ConstructorInit();
@ -455,6 +455,11 @@ EmuExe::EmuExe(Xbe *x_Xbe, uint32 x_debug_console) : Exe()
// ******************************************************************
memcpy(m_bzSection[i] + 0x100 + sizeof(Xbe::Header), x_Xbe->m_HeaderEx, x_Xbe->m_Header.dwSizeofHeaders - sizeof(Xbe::Header));
// ******************************************************************
// * append x_debug_filename
// ******************************************************************
memcpy(m_bzSection[i] + 0x100 + x_Xbe->m_Header.dwSizeofHeaders, x_debug_filename, 260);
// ******************************************************************
// * patch prolog function parameters
// ******************************************************************
@ -462,7 +467,8 @@ EmuExe::EmuExe(Xbe *x_Xbe, uint32 x_debug_console) : Exe()
*(uint32 *)((uint32)m_bzSection[i] + 6) = (uint32)ep;
*(uint32 *)((uint32)m_bzSection[i] + 11) = (uint32)x_Xbe->m_Header.dwSizeofHeaders;
*(uint32 *)((uint32)m_bzSection[i] + 16) = m_SectionHeader[i].m_virtual_addr + m_OptionalHeader.m_image_base + 0x100;
*(uint32 *)((uint32)m_bzSection[i] + 21) = x_debug_console;
*(uint32 *)((uint32)m_bzSection[i] + 21) = m_SectionHeader[i].m_virtual_addr + m_OptionalHeader.m_image_base + 0x100 + x_Xbe->m_Header.dwSizeofHeaders;
*(uint32 *)((uint32)m_bzSection[i] + 26) = x_debug_console;
}
}

View File

@ -59,6 +59,7 @@ __declspec(allocate(".cxbxplg")) uint08 Prolog[] =
0x68, 0xC3, 0xC3, 0xC3, 0xC3, // push 0xC3C3C3C3
0x68, 0xC3, 0xC3, 0xC3, 0xC3, // push 0xC3C3C3C3
0x68, 0xC3, 0xC3, 0xC3, 0xC3, // push 0xC3C3C3C3
0x68, 0xC3, 0xC3, 0xC3, 0xC3, // push 0xC3C3C3C3
0xFF, 0xD6, // call esi
0xC3 // ret
};

View File

@ -44,7 +44,7 @@
// ******************************************************************
// * constructor
// ******************************************************************
WndMain::WndMain(HINSTANCE x_hInstance) : Wnd(x_hInstance), m_xbe(0), m_exe(0), m_exe_changed(false), m_xbe_changed(false), m_krnl_debug(0), m_cxbx_debug(0)
WndMain::WndMain(HINSTANCE x_hInstance) : Wnd(x_hInstance), m_xbe(0), m_exe(0), m_exe_changed(false), m_xbe_changed(false), m_KrnlDebug(DM_NONE), m_CxbxDebug(DM_NONE)
{
m_classname = "WndMain";
m_wndname = "Cxbx: Version " CXBX_VERSION;
@ -64,11 +64,17 @@ WndMain::WndMain(HINSTANCE x_hInstance) : Wnd(x_hInstance), m_xbe(0), m_exe(0),
m_y = rect.top + (rect.bottom - rect.top)/2 - m_h/2;
}
m_exe_filename = new char[260];
m_exe_filename[0] = '\0';
m_ExeFilename = new char[260];
m_ExeFilename[0] = '\0';
m_xbe_filename = new char[260];
m_xbe_filename[0] = '\0';
m_XbeFilename = new char[260];
m_XbeFilename[0] = '\0';
m_CxbxDebugFilename = new char[260];
m_CxbxDebugFilename[0] = '\0';
m_KrnlDebugFilename = new char[260];
m_KrnlDebugFilename[0] = '\0';
// ******************************************************************
// * Load configuration from registry
@ -82,8 +88,14 @@ WndMain::WndMain(HINSTANCE x_hInstance) : Wnd(x_hInstance), m_xbe(0), m_exe(0),
dwType = REG_DWORD;
dwSize = sizeof(DWORD);
RegQueryValueEx(hKey, "CxbxDebug", NULL, &dwType, (PBYTE)&m_cxbx_debug, &dwSize);
RegQueryValueEx(hKey, "KrnlDebug", NULL, &dwType, (PBYTE)&m_krnl_debug, &dwSize);
RegQueryValueEx(hKey, "CxbxDebug", NULL, &dwType, (PBYTE)&m_CxbxDebug, &dwSize);
RegQueryValueEx(hKey, "KrnlDebug", NULL, &dwType, (PBYTE)&m_KrnlDebug, &dwSize);
dwType = REG_SZ;
dwSize = 260;
RegQueryValueEx(hKey, "CxbxDebugFilename", NULL, &dwType, (PBYTE)m_CxbxDebugFilename, &dwSize);
RegQueryValueEx(hKey, "KrnlDebugFilename", NULL, &dwType, (PBYTE)m_KrnlDebugFilename, &dwSize);
RegCloseKey(hKey);
}
@ -109,15 +121,24 @@ WndMain::~WndMain()
dwType = REG_DWORD;
dwSize = sizeof(DWORD);
RegSetValueEx(hKey, "CxbxDebug", 0, dwType, (PBYTE)&m_cxbx_debug, dwSize);
RegSetValueEx(hKey, "KrnlDebug", 0, dwType, (PBYTE)&m_krnl_debug, dwSize);
RegSetValueEx(hKey, "CxbxDebug", 0, dwType, (PBYTE)&m_CxbxDebug, dwSize);
RegSetValueEx(hKey, "KrnlDebug", 0, dwType, (PBYTE)&m_KrnlDebug, dwSize);
dwType = REG_SZ;
dwSize = 260;
RegSetValueEx(hKey, "CxbxDebugFilename", 0, dwType, (PBYTE)m_CxbxDebugFilename, dwSize);
RegSetValueEx(hKey, "KrnlDebugFilename", 0, dwType, (PBYTE)m_KrnlDebugFilename, dwSize);
RegCloseKey(hKey);
}
}
delete[] m_xbe_filename;
delete[] m_exe_filename;
delete[] m_XbeFilename;
delete[] m_ExeFilename;
delete[] m_CxbxDebugFilename;
delete[] m_KrnlDebugFilename;
}
// ******************************************************************
@ -229,7 +250,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
{
case ID_FILE_OPEN_XBE:
{
m_exe_filename[0] = '\0';
m_ExeFilename[0] = '\0';
OPENFILENAME ofn = {0};
@ -248,7 +269,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(GetOpenFileName(&ofn) == TRUE)
{
strcpy(m_xbe_filename, ofn.lpstrFile);
strcpy(m_XbeFilename, ofn.lpstrFile);
m_xbe = new Xbe(ofn.lpstrFile);
@ -275,10 +296,10 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
case ID_FILE_SAVEXBEFILE:
{
if(m_xbe_filename[0] == '\0')
if(m_XbeFilename[0] == '\0')
SaveXbeAs();
else
SaveXbe(m_xbe_filename);
SaveXbe(m_XbeFilename);
}
break;
@ -290,7 +311,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
case ID_FILE_IMPORTFROMEXE:
{
m_exe_filename[0] = '\0';
m_ExeFilename[0] = '\0';
OPENFILENAME ofn = {0};
@ -309,7 +330,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(GetOpenFileName(&ofn) == TRUE)
{
m_xbe_filename[0] = '\0';
m_XbeFilename[0] = '\0';
Exe *tmp = new Exe(ofn.lpstrFile);
@ -698,12 +719,12 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
}
break;
case ID_VIEW_KERNELDEBUGCONSOLE:
case ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE:
{
if(m_krnl_debug == 0)
m_krnl_debug = 1;
if(m_KrnlDebug == DM_NONE || m_KrnlDebug == DM_FILE)
m_KrnlDebug = DM_CONSOLE;
else
m_krnl_debug = 0;
m_KrnlDebug = DM_NONE;
MessageBox(m_hwnd, "This will not take effect until emulation is (re)started.\n", "Cxbx", MB_OK);
@ -711,20 +732,92 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
}
break;
case ID_VIEW_DEBUGCONSOLE:
{
if(m_cxbx_debug == 0)
m_cxbx_debug = 1;
case ID_VIEW_DEBUGOUTPUTKERNEL_FILE:
{
if(m_KrnlDebug == DM_NONE || m_KrnlDebug == DM_CONSOLE)
m_KrnlDebug = DM_FILE;
else
m_cxbx_debug = 0;
{
m_KrnlDebug = DM_NONE;
UpdateDebugConsoles();
break;
}
OPENFILENAME ofn = {0};
char filename[260] = "KrnlDebug.txt";
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = m_hwnd;
ofn.lpstrFilter = "Text Documents (*.txt)\0*.txt\0";
ofn.lpstrFile = filename;
ofn.nMaxFile = 260;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrDefExt = "txt";
ofn.Flags = OFN_PATHMUSTEXIST;
if(GetSaveFileName(&ofn) == FALSE)
return false;
strncpy(m_KrnlDebugFilename, ofn.lpstrFile, 259);
UpdateDebugConsoles();
}
break;
case ID_VIEW_DEBUGOUTPUTGUI_CONSOLE:
{
if(m_CxbxDebug == DM_NONE || m_CxbxDebug == DM_FILE)
m_CxbxDebug = DM_CONSOLE;
else
m_CxbxDebug = DM_NONE;
UpdateDebugConsoles();
}
break;
case ID_VIEW_DEBUGOUTPUTGUI_FILE:
{
if(m_CxbxDebug == DM_NONE || m_CxbxDebug == DM_CONSOLE)
m_CxbxDebug = DM_FILE;
else
{
m_CxbxDebug = DM_NONE;
UpdateDebugConsoles();
break;
}
OPENFILENAME ofn = {0};
char filename[260] = "CxbxDebug.txt";
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = m_hwnd;
ofn.lpstrFilter = "Text Documents (*.txt)\0*.txt\0";
ofn.lpstrFile = filename;
ofn.nMaxFile = 260;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.lpstrDefExt = "txt";
ofn.Flags = OFN_PATHMUSTEXIST;
if(GetSaveFileName(&ofn) == FALSE)
return false;
strncpy(m_CxbxDebugFilename, ofn.lpstrFile, 259);
UpdateDebugConsoles();
}
break;
case ID_EMULATION_START:
{
if(m_exe_filename[0] == '\0' || m_exe_changed)
if(m_ExeFilename[0] == '\0' || m_exe_changed)
if(!ConvertToExe())
break;
@ -746,7 +839,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if(spot != -1)
dir[spot] = '\0';
if((int)ShellExecute(NULL, "open", m_exe_filename, NULL, dir, SW_SHOWDEFAULT) <= 32)
if((int)ShellExecute(NULL, "open", m_ExeFilename, NULL, dir, SW_SHOWDEFAULT) <= 32)
{
MessageBox(m_hwnd, "Shell failed. (try converting .exe again)", "Cxbx", MB_ICONSTOP | MB_OK);
@ -990,13 +1083,26 @@ void WndMain::UpdateDebugConsoles()
{
HMENU menu = GetMenu(m_hwnd);
HMENU view_menu = GetSubMenu(menu, 2);
HMENU view_debg = GetSubMenu(view_menu, 0);
HMENU view_krnl = GetSubMenu(view_menu, 1);
if(m_krnl_debug == 1)
CheckMenuItem(view_menu, ID_VIEW_KERNELDEBUGCONSOLE, MF_CHECKED);
if(m_KrnlDebug == DM_CONSOLE)
{
CheckMenuItem(view_krnl, ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE, MF_CHECKED);
CheckMenuItem(view_krnl, ID_VIEW_DEBUGOUTPUTKERNEL_FILE, MF_UNCHECKED);
}
else if(m_KrnlDebug == DM_FILE)
{
CheckMenuItem(view_krnl, ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE, MF_UNCHECKED);
CheckMenuItem(view_krnl, ID_VIEW_DEBUGOUTPUTKERNEL_FILE, MF_CHECKED);
}
else
CheckMenuItem(view_menu, ID_VIEW_KERNELDEBUGCONSOLE, MF_UNCHECKED);
{
CheckMenuItem(view_krnl, ID_VIEW_DEBUGOUTPUTKERNEL_CONSOLE, MF_UNCHECKED);
CheckMenuItem(view_krnl, ID_VIEW_DEBUGOUTPUTKERNEL_FILE, MF_UNCHECKED);
}
if(m_cxbx_debug == 1)
if(m_CxbxDebug == DM_CONSOLE)
{
if(AllocConsole())
{
@ -1004,14 +1110,27 @@ void WndMain::UpdateDebugConsoles()
printf("%s", "Cxbx: Debug console allocated.\n");
CheckMenuItem(view_menu, ID_VIEW_DEBUGCONSOLE, MF_CHECKED);
CheckMenuItem(view_debg, ID_VIEW_DEBUGOUTPUTGUI_CONSOLE, MF_CHECKED);
CheckMenuItem(view_debg, ID_VIEW_DEBUGOUTPUTGUI_FILE, MF_UNCHECKED);
}
}
else if(m_CxbxDebug == DM_FILE)
{
FreeConsole();
freopen(m_CxbxDebugFilename, "wt", stdout);
printf("%s", "Cxbx: Debug console allocated.\n");
CheckMenuItem(view_debg, ID_VIEW_DEBUGOUTPUTGUI_CONSOLE, MF_UNCHECKED);
CheckMenuItem(view_debg, ID_VIEW_DEBUGOUTPUTGUI_FILE, MF_CHECKED);
}
else
{
FreeConsole();
CheckMenuItem(view_menu, ID_VIEW_DEBUGCONSOLE, MF_UNCHECKED);
CheckMenuItem(view_debg, ID_VIEW_DEBUGOUTPUTGUI_CONSOLE, MF_UNCHECKED);
CheckMenuItem(view_debg, ID_VIEW_DEBUGOUTPUTGUI_FILE, MF_UNCHECKED);
}
}
@ -1024,7 +1143,7 @@ bool WndMain::ConvertToExe()
char filename[260] = "default.exe";
SuggestFilename(m_xbe_filename, filename, ".exe");
SuggestFilename(m_XbeFilename, filename, ".exe");
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = m_hwnd;
@ -1056,7 +1175,7 @@ bool WndMain::ConvertToExe()
// convert file
{
EmuExe i_EmuExe(m_xbe, m_krnl_debug);
EmuExe i_EmuExe(m_xbe, m_KrnlDebug, m_KrnlDebugFilename);
i_EmuExe.Export(ofn.lpstrFile);
@ -1067,7 +1186,7 @@ bool WndMain::ConvertToExe()
}
else
{
strcpy(m_exe_filename, ofn.lpstrFile);
strcpy(m_ExeFilename, ofn.lpstrFile);
char buffer[255];
@ -1093,7 +1212,7 @@ void WndMain::SaveXbeAs()
char filename[260] = "default.xbe";
SuggestFilename(m_xbe_filename, filename, ".xbe");
SuggestFilename(m_XbeFilename, filename, ".xbe");
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = m_hwnd;

View File

@ -74,7 +74,7 @@ inline void EmuXSwapFS()
{
__asm
{
mov ax, fs:[0x14]
mov ax, fs:[0x14] // FS.ArbitraryUserPointer
mov fs, ax
}
}
@ -107,7 +107,7 @@ void EmuXGenerateFS()
__asm
{
mov ax, NewFS
mov fs:[0x14], ax
mov fs:[0x14], ax // FS.ArbitraryUserPointer
}
// ******************************************************************
@ -121,23 +121,32 @@ void EmuXGenerateFS()
__asm
{
mov ax, OrgFS
mov fs:[0x14], ax
mov fs:[0x14], ax // FS.ArbitraryUserPointer
}
}
// ******************************************************************
// * func: EmuXInit
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXInit(uint32 DebugConsole, uint08 *XBEHeader, uint32 XBEHeaderSize, void (*Entry)())
CXBXKRNL_API void NTAPI EmuXInit(DebugMode DebugConsole, char *DebugFilename, uint08 *XBEHeader, uint32 XBEHeaderSize, void (*Entry)())
{
// ******************************************************************
// * debug console allocation (if configured)
// ******************************************************************
if(DebugConsole)
if(DebugConsole == DM_CONSOLE)
{
AllocConsole();
if(AllocConsole())
{
freopen("CONOUT$", "wt", stdout);
freopen("CONOUT$", "wt", stdout);
printf("CxbxKrnl [0x%.08X]: Debug console allocated.\n", GetCurrentThreadId());
}
}
else if(DebugConsole == DM_FILE)
{
FreeConsole();
freopen(DebugFilename, "wt", stdout);
printf("CxbxKrnl [0x%.08X]: Debug console allocated.\n", GetCurrentThreadId());
}
@ -149,11 +158,12 @@ CXBXKRNL_API void NTAPI EmuXInit(uint32 DebugConsole, uint08 *XBEHeader, uint32
printf("CxbxKrnl [0x%.08X]: EmuXInit\n"
" (\n"
" DebugConsole : 0x%.08X\n"
" DebugFilename : %s"
" XBEHeader : 0x%.08X\n"
" XBEHeaderSize : 0x%.08X\n"
" Entry : 0x%.08X\n"
" );\n",
GetCurrentThreadId(), DebugConsole, XBEHeader, XBEHeaderSize, Entry);
GetCurrentThreadId(), DebugConsole, DebugFilename, XBEHeader, XBEHeaderSize, Entry);
}
// ******************************************************************
@ -188,16 +198,7 @@ CXBXKRNL_API void NTAPI EmuXInit(uint32 DebugConsole, uint08 *XBEHeader, uint32
EmuXSwapFS();
NT_TIB *dbgTIB = 0;
// TODO: Store EmuX FS structure within the user data offset of Win2k/XP FS: struct
__asm
{
mov esi, fs:[18h]
mov dbgTIB, esi
}
printf("CxbxKrnl [0x%.08X]: NT_TIB.Self=0x%.08X\n", GetCurrentThreadId(), dbgTIB->Self);
// TODO: Initialize "new" FS structure
}
printf("CxbxKrnl [0x%.08X]: Initial thread starting.\n", GetCurrentThreadId());