mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-12-19 17:37:42 -05:00
Run clang-format on legacy code
This commit is contained in:
@@ -99,13 +99,13 @@ int Num_cards = 0;
|
||||
#define MAX_D3D_DEVICES 16
|
||||
|
||||
struct d3d_device {
|
||||
GUID guid_2d;
|
||||
LPGUID pguid_2d;
|
||||
GUID guid_2d;
|
||||
LPGUID pguid_2d;
|
||||
|
||||
GUID guid_3d;
|
||||
LPGUID pguid_3d;
|
||||
GUID guid_3d;
|
||||
LPGUID pguid_3d;
|
||||
|
||||
char name[1024];
|
||||
char name[1024];
|
||||
};
|
||||
|
||||
d3d_device D2D_devices[MAX_D2D_DEVICES];
|
||||
@@ -115,414 +115,398 @@ int Num_d2d_devices = 0;
|
||||
int Num_d3d_devices = 0;
|
||||
|
||||
// The enumeration callback for D3D devices
|
||||
HRESULT WINAPI gr_d3d_enum( LPGUID lpGUID,
|
||||
LPSTR lpDeviceDescription,
|
||||
LPSTR lpDeviceName,
|
||||
LPD3DDEVICEDESC lpHWDesc,
|
||||
LPD3DDEVICEDESC lpHELDesc,
|
||||
LPVOID lpContext )
|
||||
{
|
||||
int use_it = 0;
|
||||
HRESULT WINAPI gr_d3d_enum(LPGUID lpGUID, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC lpHWDesc,
|
||||
LPD3DDEVICEDESC lpHELDesc, LPVOID lpContext) {
|
||||
int use_it = 0;
|
||||
|
||||
// mprintf( "Found 3d device %s: %s\n", lpDeviceName, lpDeviceDescription );
|
||||
// mprintf( "Found 3d device %s: %s\n", lpDeviceName, lpDeviceDescription );
|
||||
|
||||
if ( lpHWDesc && lpHWDesc->dwFlags != 0 ) {
|
||||
use_it = 1;
|
||||
} //else if ( lpHELDesc ) {
|
||||
if (lpHWDesc && lpHWDesc->dwFlags != 0) {
|
||||
use_it = 1;
|
||||
} // else if ( lpHELDesc ) {
|
||||
|
||||
if (use_it) {
|
||||
d3d_device *d2d = (d3d_device *)lpContext;
|
||||
d3d_device *d3d = (d3d_device *)&D3D_devices[Num_d3d_devices++];
|
||||
|
||||
if ( use_it ) {
|
||||
d3d_device *d2d = (d3d_device *)lpContext;
|
||||
d3d_device *d3d = (d3d_device *)&D3D_devices[Num_d3d_devices++];
|
||||
if (lpGUID) {
|
||||
memmove(&d3d->guid_3d, lpGUID, sizeof(GUID));
|
||||
d3d->pguid_3d = &d3d->guid_3d;
|
||||
} else {
|
||||
memset(&d3d->guid_3d, 0, sizeof(GUID));
|
||||
d3d->pguid_3d = NULL;
|
||||
}
|
||||
|
||||
if ( lpGUID ) {
|
||||
memmove( &d3d->guid_3d, lpGUID, sizeof(GUID) );
|
||||
d3d->pguid_3d = &d3d->guid_3d;
|
||||
} else {
|
||||
memset( &d3d->guid_3d, 0, sizeof(GUID) );
|
||||
d3d->pguid_3d = NULL;
|
||||
}
|
||||
memmove(&d3d->guid_2d, &d2d->guid_2d, sizeof(GUID));
|
||||
if (d2d->pguid_2d) {
|
||||
d3d->pguid_2d = &d3d->guid_2d;
|
||||
} else {
|
||||
d3d->pguid_2d = NULL;
|
||||
}
|
||||
|
||||
memmove( &d3d->guid_2d, &d2d->guid_2d, sizeof(GUID) );
|
||||
if ( d2d->pguid_2d ) {
|
||||
d3d->pguid_2d = &d3d->guid_2d;
|
||||
} else {
|
||||
d3d->pguid_2d = NULL;
|
||||
}
|
||||
// strcpy( d3d->name, "Direct 3D - " );
|
||||
strcpy(d3d->name, d2d->name);
|
||||
}
|
||||
|
||||
//strcpy( d3d->name, "Direct 3D - " );
|
||||
strcpy( d3d->name, d2d->name );
|
||||
}
|
||||
|
||||
return D3DENUMRET_OK;
|
||||
return D3DENUMRET_OK;
|
||||
}
|
||||
|
||||
// The enumeration callback for 2D
|
||||
BOOL WINAPI gr_d2d_enum( LPGUID lpGUID,
|
||||
LPSTR lpDeviceDescription,
|
||||
LPSTR lpDeviceName,
|
||||
LPVOID lpContext )
|
||||
{
|
||||
BOOL WINAPI gr_d2d_enum(LPGUID lpGUID, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPVOID lpContext) {
|
||||
|
||||
d3d_device *d2d = (d3d_device *)&D2D_devices[Num_d2d_devices++];
|
||||
d3d_device *d2d = (d3d_device *)&D2D_devices[Num_d2d_devices++];
|
||||
|
||||
// mprintf( "Found 2d device %s: %s\n", lpDeviceName, lpDeviceDescription );
|
||||
// mprintf( "Found 2d device %s: %s\n", lpDeviceName, lpDeviceDescription );
|
||||
|
||||
if ( lpGUID ) {
|
||||
memmove( &d2d->guid_2d, lpGUID, sizeof(GUID) );
|
||||
d2d->pguid_2d = &d2d->guid_2d;
|
||||
} else {
|
||||
memset( &d2d->guid_2d, 0, sizeof(GUID) );
|
||||
d2d->pguid_2d = NULL;
|
||||
}
|
||||
if (lpGUID) {
|
||||
memmove(&d2d->guid_2d, lpGUID, sizeof(GUID));
|
||||
d2d->pguid_2d = &d2d->guid_2d;
|
||||
} else {
|
||||
memset(&d2d->guid_2d, 0, sizeof(GUID));
|
||||
d2d->pguid_2d = NULL;
|
||||
}
|
||||
|
||||
strcpy( d2d->name, lpDeviceDescription );
|
||||
// strcat( d2d->name, lpDeviceName );
|
||||
strcpy(d2d->name, lpDeviceDescription);
|
||||
// strcat( d2d->name, lpDeviceName );
|
||||
|
||||
return D3DENUMRET_OK;
|
||||
return D3DENUMRET_OK;
|
||||
}
|
||||
|
||||
HRESULT (__stdcall *pfn_DirectDrawEnumerate) (LPDDENUMCALLBACK, LPVOID) = NULL;
|
||||
HRESULT (__stdcall *pfn_DirectDrawCreate) (GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *) = NULL;
|
||||
HRESULT(__stdcall *pfn_DirectDrawEnumerate)(LPDDENUMCALLBACK, LPVOID) = NULL;
|
||||
HRESULT(__stdcall *pfn_DirectDrawCreate)(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *) = NULL;
|
||||
|
||||
// Check for any Direct 3D devices
|
||||
void check_direct3d()
|
||||
{
|
||||
int i;
|
||||
HRESULT ddrval;
|
||||
LPDIRECTDRAW lpDD1=NULL;
|
||||
LPDIRECT3D2 lpD3D=NULL;
|
||||
void check_direct3d() {
|
||||
int i;
|
||||
HRESULT ddrval;
|
||||
LPDIRECTDRAW lpDD1 = NULL;
|
||||
LPDIRECT3D2 lpD3D = NULL;
|
||||
|
||||
Num_d2d_devices = 0;
|
||||
Num_d3d_devices = 0;
|
||||
Num_d2d_devices = 0;
|
||||
Num_d3d_devices = 0;
|
||||
|
||||
if (!Dd_dll_handle)
|
||||
return;
|
||||
if (!Dd_dll_handle)
|
||||
return;
|
||||
|
||||
if (!pfn_DirectDrawCreate)
|
||||
pfn_DirectDrawCreate = (HRESULT (__stdcall *) (GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *)) GetProcAddress(Dd_dll_handle, "DirectDrawCreate");
|
||||
if (!pfn_DirectDrawCreate)
|
||||
goto D3DError;
|
||||
if (!pfn_DirectDrawCreate)
|
||||
pfn_DirectDrawCreate = (HRESULT(__stdcall *)(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *))GetProcAddress(
|
||||
Dd_dll_handle, "DirectDrawCreate");
|
||||
if (!pfn_DirectDrawCreate)
|
||||
goto D3DError;
|
||||
|
||||
if (!pfn_DirectDrawEnumerate)
|
||||
pfn_DirectDrawEnumerate = (HRESULT (__stdcall *) (LPDDENUMCALLBACK, LPVOID)) GetProcAddress(Dd_dll_handle, "DirectDrawEnumerateA");
|
||||
if (!pfn_DirectDrawEnumerate)
|
||||
goto D3DError;
|
||||
if (!pfn_DirectDrawEnumerate)
|
||||
pfn_DirectDrawEnumerate =
|
||||
(HRESULT(__stdcall *)(LPDDENUMCALLBACK, LPVOID))GetProcAddress(Dd_dll_handle, "DirectDrawEnumerateA");
|
||||
if (!pfn_DirectDrawEnumerate)
|
||||
goto D3DError;
|
||||
|
||||
ddrval = pfn_DirectDrawEnumerate( gr_d2d_enum, NULL );
|
||||
if ( ddrval != DD_OK ) {
|
||||
OutputDebugString( "GR_D3D_INIT: DirectDrawEnumerate failed.\n" );
|
||||
goto D3DError;
|
||||
}
|
||||
ddrval = pfn_DirectDrawEnumerate(gr_d2d_enum, NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
OutputDebugString("GR_D3D_INIT: DirectDrawEnumerate failed.\n");
|
||||
goto D3DError;
|
||||
}
|
||||
|
||||
for ( i=0; i<Num_d2d_devices; i++) {
|
||||
d3d_device *d2d = (d3d_device *)&D2D_devices[i];
|
||||
for (i = 0; i < Num_d2d_devices; i++) {
|
||||
d3d_device *d2d = (d3d_device *)&D2D_devices[i];
|
||||
|
||||
ddrval = pfn_DirectDrawCreate( d2d->pguid_2d, &lpDD1, NULL );
|
||||
if ( ddrval != DD_OK ) {
|
||||
OutputDebugString( "GR_D3D_INIT: DirectDrawCreate failed.\n" );
|
||||
goto D3DError;
|
||||
}
|
||||
ddrval = pfn_DirectDrawCreate(d2d->pguid_2d, &lpDD1, NULL);
|
||||
if (ddrval != DD_OK) {
|
||||
OutputDebugString("GR_D3D_INIT: DirectDrawCreate failed.\n");
|
||||
goto D3DError;
|
||||
}
|
||||
|
||||
ddrval = lpDD1->QueryInterface( IID_IDirect3D2, ( LPVOID *) &lpD3D );
|
||||
if ( ddrval != DD_OK ) {
|
||||
OutputDebugString( "GR_D3D_INIT: QueryInterface failed.\n" );
|
||||
goto D3DError;
|
||||
}
|
||||
ddrval = lpDD1->QueryInterface(IID_IDirect3D2, (LPVOID *)&lpD3D);
|
||||
if (ddrval != DD_OK) {
|
||||
OutputDebugString("GR_D3D_INIT: QueryInterface failed.\n");
|
||||
goto D3DError;
|
||||
}
|
||||
|
||||
ddrval = lpD3D->EnumDevices(gr_d3d_enum, d2d );
|
||||
if ( ddrval != DD_OK ) {
|
||||
OutputDebugString( "WIN_DD32: D3D enum devices failed. (0x%x)\n");//, ddrval );
|
||||
}
|
||||
ddrval = lpD3D->EnumDevices(gr_d3d_enum, d2d);
|
||||
if (ddrval != DD_OK) {
|
||||
OutputDebugString("WIN_DD32: D3D enum devices failed. (0x%x)\n"); //, ddrval );
|
||||
}
|
||||
|
||||
lpD3D->Release();
|
||||
lpD3D = NULL;
|
||||
lpD3D->Release();
|
||||
lpD3D = NULL;
|
||||
|
||||
lpDD1->Release();
|
||||
lpDD1 = NULL;
|
||||
}
|
||||
lpDD1->Release();
|
||||
lpDD1 = NULL;
|
||||
}
|
||||
|
||||
// Store Direct3D devices in number of cards
|
||||
for ( i=0; i<Num_d3d_devices; i++) {
|
||||
strcpy( Cards[Num_cards].name, D3D_devices[i].name );
|
||||
Cards[Num_cards].renderer_type=RENDERER_DIRECT3D;
|
||||
Num_cards++;
|
||||
}
|
||||
// Store Direct3D devices in number of cards
|
||||
for (i = 0; i < Num_d3d_devices; i++) {
|
||||
strcpy(Cards[Num_cards].name, D3D_devices[i].name);
|
||||
Cards[Num_cards].renderer_type = RENDERER_DIRECT3D;
|
||||
Num_cards++;
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
|
||||
D3DError:
|
||||
|
||||
// If any devices haven't been freed, free them
|
||||
if(lpD3D!=NULL) {
|
||||
lpD3D->Release();
|
||||
lpD3D = NULL;
|
||||
}
|
||||
// If any devices haven't been freed, free them
|
||||
if (lpD3D != NULL) {
|
||||
lpD3D->Release();
|
||||
lpD3D = NULL;
|
||||
}
|
||||
|
||||
if(lpDD1!=NULL) {
|
||||
lpDD1->Release();
|
||||
lpDD1 = NULL;
|
||||
}
|
||||
//mprintf( "Direct3D Polling failed.\n" );
|
||||
if (lpDD1 != NULL) {
|
||||
lpDD1->Release();
|
||||
lpDD1 = NULL;
|
||||
}
|
||||
// mprintf( "Direct3D Polling failed.\n" );
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
void check_glide()
|
||||
{
|
||||
static GrHwConfiguration hwconfig;
|
||||
module *GlideDLLHandle;
|
||||
void check_glide() {
|
||||
static GrHwConfiguration hwconfig;
|
||||
module *GlideDLLHandle;
|
||||
|
||||
if ( !(GlideDLLHandle=LoadGlideDLL()) ) {
|
||||
//mprintf( "Glide DLL not found!\n" );
|
||||
return;
|
||||
}
|
||||
if (!(GlideDLLHandle = LoadGlideDLL())) {
|
||||
// mprintf( "Glide DLL not found!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GlideInited) {
|
||||
if (!GlideInited) {
|
||||
|
||||
// Check if any 3dfx systems are present
|
||||
grSstQueryBoards(&hwconfig);
|
||||
if(hwconfig.num_sst<=0) {
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
return;
|
||||
}
|
||||
// Check if any 3dfx systems are present
|
||||
grSstQueryBoards(&hwconfig);
|
||||
if (hwconfig.num_sst <= 0) {
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
grGlideInit();
|
||||
GlideInited=TRUE;
|
||||
grGlideInit();
|
||||
GlideInited = TRUE;
|
||||
|
||||
if (grSstQueryHardware(&hwconfig)==0 || hwconfig.num_sst<1)
|
||||
{
|
||||
// Glide is now only shutdown when the application exits
|
||||
//grGlideShutdown();
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
return;
|
||||
}
|
||||
if (grSstQueryHardware(&hwconfig) == 0 || hwconfig.num_sst < 1) {
|
||||
// Glide is now only shutdown when the application exits
|
||||
// grGlideShutdown();
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
grGlideShutdown();
|
||||
}
|
||||
grGlideShutdown();
|
||||
}
|
||||
|
||||
if(hwconfig.num_sst<=0) {
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
return;
|
||||
}
|
||||
if (hwconfig.num_sst <= 0) {
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
Cards[Num_cards].renderer_type=RENDERER_GLIDE;
|
||||
Cards[Num_cards].renderer_type = RENDERER_GLIDE;
|
||||
|
||||
switch(hwconfig.SSTs[0].type) {
|
||||
case GR_SSTTYPE_VOODOO:
|
||||
switch (hwconfig.SSTs[0].type) {
|
||||
case GR_SSTTYPE_VOODOO:
|
||||
#if (defined(OEM_VOODOO3) && !defined(USE_ALL_VIDEO_OPTIONS))
|
||||
strcpy( Cards[Num_cards].name, "Voodoo3" );
|
||||
strcpy(Cards[Num_cards].name, "Voodoo3");
|
||||
#else
|
||||
strcpy( Cards[Num_cards].name, "Voodoo Graphics Family" );
|
||||
strcpy(Cards[Num_cards].name, "Voodoo Graphics Family");
|
||||
#endif
|
||||
break;
|
||||
case GR_SSTTYPE_SST96:
|
||||
strcpy( Cards[Num_cards].name, "SST96" );
|
||||
break;
|
||||
case GR_SSTTYPE_AT3D:
|
||||
strcpy( Cards[Num_cards].name, "AT3D" );
|
||||
break;
|
||||
default:
|
||||
strcpy( Cards[Num_cards].name, "" );
|
||||
break;
|
||||
}
|
||||
Num_cards++;
|
||||
break;
|
||||
case GR_SSTTYPE_SST96:
|
||||
strcpy(Cards[Num_cards].name, "SST96");
|
||||
break;
|
||||
case GR_SSTTYPE_AT3D:
|
||||
strcpy(Cards[Num_cards].name, "AT3D");
|
||||
break;
|
||||
default:
|
||||
strcpy(Cards[Num_cards].name, "");
|
||||
break;
|
||||
}
|
||||
Num_cards++;
|
||||
|
||||
// Glide is now only shutdown when the application exits
|
||||
//grGlideShutdown();
|
||||
// Glide is now only shutdown when the application exits
|
||||
// grGlideShutdown();
|
||||
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
}
|
||||
|
||||
// Shuts down glide (if it has been initialized)
|
||||
void shutdown_glide(void)
|
||||
{
|
||||
if(GlideInited) {
|
||||
module *GlideDLLHandle;
|
||||
void shutdown_glide(void) {
|
||||
if (GlideInited) {
|
||||
module *GlideDLLHandle;
|
||||
|
||||
if ( (GlideDLLHandle=LoadGlideDLL()) ) {
|
||||
grGlideShutdown();
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
}
|
||||
}
|
||||
if ((GlideDLLHandle = LoadGlideDLL())) {
|
||||
grGlideShutdown();
|
||||
mod_FreeModule(GlideDLLHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OpenGL function pointer type definitions
|
||||
typedef const GLubyte *(CALLBACK* LPFN_GLGETSTRING)(GLenum);
|
||||
typedef BOOL (CALLBACK *LPFN_WGLMAKECURRENT)(HDC, HGLRC);
|
||||
typedef HGLRC (CALLBACK *LPFN_WGLCREATECONTEXT)(HDC);
|
||||
typedef BOOL (CALLBACK *LPFN_WGLDELETECONTEXT)(HGLRC);
|
||||
typedef const GLubyte *(CALLBACK *LPFN_GLGETSTRING)(GLenum);
|
||||
typedef BOOL(CALLBACK *LPFN_WGLMAKECURRENT)(HDC, HGLRC);
|
||||
typedef HGLRC(CALLBACK *LPFN_WGLCREATECONTEXT)(HDC);
|
||||
typedef BOOL(CALLBACK *LPFN_WGLDELETECONTEXT)(HGLRC);
|
||||
|
||||
// Check for OpenGL support, and add it to list
|
||||
void check_openGL()
|
||||
{
|
||||
LPFN_GLGETSTRING pfn_glGetString=NULL;
|
||||
LPFN_WGLMAKECURRENT pfn_wglMakeCurrent=NULL;
|
||||
LPFN_WGLCREATECONTEXT pfn_wglCreateContext=NULL;
|
||||
LPFN_WGLDELETECONTEXT pfn_wglDeleteContext=NULL;
|
||||
void check_openGL() {
|
||||
LPFN_GLGETSTRING pfn_glGetString = NULL;
|
||||
LPFN_WGLMAKECURRENT pfn_wglMakeCurrent = NULL;
|
||||
LPFN_WGLCREATECONTEXT pfn_wglCreateContext = NULL;
|
||||
LPFN_WGLDELETECONTEXT pfn_wglDeleteContext = NULL;
|
||||
|
||||
// Check for the OpenGL dll, and open it
|
||||
if(opengl_dll_handle==NULL) {
|
||||
opengl_dll_handle=LoadLibrary("opengl32.dll");
|
||||
if(opengl_dll_handle==NULL) {
|
||||
OutputDebugString("OpenGL DLL not found.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Check for the OpenGL dll, and open it
|
||||
if (opengl_dll_handle == NULL) {
|
||||
opengl_dll_handle = LoadLibrary("opengl32.dll");
|
||||
if (opengl_dll_handle == NULL) {
|
||||
OutputDebugString("OpenGL DLL not found.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the functions to check the OpenGL renderer
|
||||
pfn_glGetString = (LPFN_GLGETSTRING)GetProcAddress(opengl_dll_handle,"glGetString");
|
||||
pfn_wglCreateContext = (LPFN_WGLCREATECONTEXT)GetProcAddress(opengl_dll_handle,"wglCreateContext");
|
||||
pfn_wglDeleteContext = (LPFN_WGLDELETECONTEXT)GetProcAddress(opengl_dll_handle,"wglDeleteContext");
|
||||
pfn_wglMakeCurrent = (LPFN_WGLMAKECURRENT)GetProcAddress(opengl_dll_handle,"wglMakeCurrent");
|
||||
if (!pfn_glGetString || !pfn_wglCreateContext ||
|
||||
!pfn_wglDeleteContext || !pfn_wglMakeCurrent) {
|
||||
OutputDebugString("Could not obtain pfn_glGetString().\n");
|
||||
return;
|
||||
}
|
||||
// Get the functions to check the OpenGL renderer
|
||||
pfn_glGetString = (LPFN_GLGETSTRING)GetProcAddress(opengl_dll_handle, "glGetString");
|
||||
pfn_wglCreateContext = (LPFN_WGLCREATECONTEXT)GetProcAddress(opengl_dll_handle, "wglCreateContext");
|
||||
pfn_wglDeleteContext = (LPFN_WGLDELETECONTEXT)GetProcAddress(opengl_dll_handle, "wglDeleteContext");
|
||||
pfn_wglMakeCurrent = (LPFN_WGLMAKECURRENT)GetProcAddress(opengl_dll_handle, "wglMakeCurrent");
|
||||
if (!pfn_glGetString || !pfn_wglCreateContext || !pfn_wglDeleteContext || !pfn_wglMakeCurrent) {
|
||||
OutputDebugString("Could not obtain pfn_glGetString().\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the video tab has been initialized first
|
||||
if(CurrentVideoTab==NULL) {
|
||||
OutputDebugString("The Video Tab was not set.\n");
|
||||
return;
|
||||
}
|
||||
// Make sure the video tab has been initialized first
|
||||
if (CurrentVideoTab == NULL) {
|
||||
OutputDebugString("The Video Tab was not set.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the window device context
|
||||
// NOTE:the window is now set to the scanning window that is
|
||||
// displayed just before detect_3dcards() is called, and
|
||||
// destroyed afterwords - this function will fail if
|
||||
// it is called in any other context.
|
||||
HDC hOpenGLDC = GetDC(CurrentVideoTab->m_MsgDlg.m_hWnd);
|
||||
if(hOpenGLDC==NULL) {
|
||||
OutputDebugString("GetDC() failed.\n");
|
||||
return;
|
||||
}
|
||||
// Get the window device context
|
||||
// NOTE:the window is now set to the scanning window that is
|
||||
// displayed just before detect_3dcards() is called, and
|
||||
// destroyed afterwords - this function will fail if
|
||||
// it is called in any other context.
|
||||
HDC hOpenGLDC = GetDC(CurrentVideoTab->m_MsgDlg.m_hWnd);
|
||||
if (hOpenGLDC == NULL) {
|
||||
OutputDebugString("GetDC() failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Finds an acceptable pixel format to render to
|
||||
PIXELFORMATDESCRIPTOR pfd, pfd_copy;
|
||||
int pf;
|
||||
// Finds an acceptable pixel format to render to
|
||||
PIXELFORMATDESCRIPTOR pfd, pfd_copy;
|
||||
int pf;
|
||||
|
||||
memset(&pfd, 0, sizeof(pfd));
|
||||
pfd.nSize = sizeof(pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_GENERIC_ACCELERATED;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 16;
|
||||
pfd.cDepthBits =16;
|
||||
memset(&pfd, 0, sizeof(pfd));
|
||||
pfd.nSize = sizeof(pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_GENERIC_ACCELERATED;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 16;
|
||||
pfd.cDepthBits = 16;
|
||||
|
||||
// Find the user's "best match" PFD
|
||||
pf = ChoosePixelFormat(hOpenGLDC, &pfd);
|
||||
if (pf == 0)
|
||||
{
|
||||
OutputDebugString("ChoosePixelFormat() failed.\n");
|
||||
return;
|
||||
}
|
||||
// Find the user's "best match" PFD
|
||||
pf = ChoosePixelFormat(hOpenGLDC, &pfd);
|
||||
if (pf == 0) {
|
||||
OutputDebugString("ChoosePixelFormat() failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Try and set the new PFD
|
||||
if (SetPixelFormat(hOpenGLDC, pf, &pfd) == FALSE)
|
||||
{
|
||||
DWORD ret=GetLastError();
|
||||
OutputDebugString("SetPixelFormat() failed.\n");
|
||||
return;
|
||||
}
|
||||
// Try and set the new PFD
|
||||
if (SetPixelFormat(hOpenGLDC, pf, &pfd) == FALSE) {
|
||||
DWORD ret = GetLastError();
|
||||
OutputDebugString("SetPixelFormat() failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get a copy of the newly set PFD
|
||||
if(DescribePixelFormat(hOpenGLDC, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd_copy)==0)
|
||||
{
|
||||
OutputDebugString("DescribePixelFormat() failed.\n");
|
||||
return;
|
||||
}
|
||||
// Get a copy of the newly set PFD
|
||||
if (DescribePixelFormat(hOpenGLDC, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd_copy) == 0) {
|
||||
OutputDebugString("DescribePixelFormat() failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the returned PFD to see if it is hardware accelerated
|
||||
if((pfd_copy.dwFlags & PFD_GENERIC_ACCELERATED)==0 && (pfd_copy.dwFlags & PFD_GENERIC_FORMAT)!=0) {
|
||||
OutputDebugString("Returned OpenGL device is not hardware accelerated.\n");
|
||||
return;
|
||||
}
|
||||
// Check the returned PFD to see if it is hardware accelerated
|
||||
if ((pfd_copy.dwFlags & PFD_GENERIC_ACCELERATED) == 0 && (pfd_copy.dwFlags & PFD_GENERIC_FORMAT) != 0) {
|
||||
OutputDebugString("Returned OpenGL device is not hardware accelerated.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create an OpenGL context, and make it the current context
|
||||
HGLRC ResourceContext;
|
||||
ResourceContext = pfn_wglCreateContext((HDC)hOpenGLDC);
|
||||
if(ResourceContext==NULL) {
|
||||
DWORD ret=GetLastError();
|
||||
OutputDebugString("wglCreateContext() failed.\n");
|
||||
return;
|
||||
}
|
||||
pfn_wglMakeCurrent((HDC)hOpenGLDC, ResourceContext);
|
||||
// Create an OpenGL context, and make it the current context
|
||||
HGLRC ResourceContext;
|
||||
ResourceContext = pfn_wglCreateContext((HDC)hOpenGLDC);
|
||||
if (ResourceContext == NULL) {
|
||||
DWORD ret = GetLastError();
|
||||
OutputDebugString("wglCreateContext() failed.\n");
|
||||
return;
|
||||
}
|
||||
pfn_wglMakeCurrent((HDC)hOpenGLDC, ResourceContext);
|
||||
|
||||
// Add the OpenGL type to card list
|
||||
Cards[Num_cards].renderer_type=RENDERER_OPENGL;
|
||||
sprintf(Cards[Num_cards].name,"%s",pfn_glGetString(GL_RENDERER));
|
||||
Num_cards++;
|
||||
// Add the OpenGL type to card list
|
||||
Cards[Num_cards].renderer_type = RENDERER_OPENGL;
|
||||
sprintf(Cards[Num_cards].name, "%s", pfn_glGetString(GL_RENDERER));
|
||||
Num_cards++;
|
||||
|
||||
// Clean up
|
||||
pfn_wglMakeCurrent(NULL, NULL);
|
||||
pfn_wglDeleteContext(ResourceContext);
|
||||
ReleaseDC(CurrentVideoTab->m_hWnd,hOpenGLDC);
|
||||
// Clean up
|
||||
pfn_wglMakeCurrent(NULL, NULL);
|
||||
pfn_wglDeleteContext(ResourceContext);
|
||||
ReleaseDC(CurrentVideoTab->m_hWnd, hOpenGLDC);
|
||||
}
|
||||
|
||||
|
||||
// Fills in Cards and Num_cards
|
||||
void detect_3dcards(int detect_direct3d, int detect_glide, int detect_opengl)
|
||||
{
|
||||
if(VideoCardsDetected) return;
|
||||
void detect_3dcards(int detect_direct3d, int detect_glide, int detect_opengl) {
|
||||
if (VideoCardsDetected)
|
||||
return;
|
||||
|
||||
Num_cards = 0;
|
||||
Num_cards = 0;
|
||||
|
||||
//CString no_3d_msg;
|
||||
//no_3d_msg.LoadString(IDS_3D_DETECT_NO3D);
|
||||
//strcpy( Cards[Num_cards++].name, no_3d_msg );
|
||||
// CString no_3d_msg;
|
||||
// no_3d_msg.LoadString(IDS_3D_DETECT_NO3D);
|
||||
// strcpy( Cards[Num_cards++].name, no_3d_msg );
|
||||
|
||||
// Put in the "none" option
|
||||
Cards[Num_cards].renderer_type=RENDERER_NONE;
|
||||
strcpy(Cards[Num_cards].name,"");
|
||||
Num_cards++;
|
||||
// Put in the "none" option
|
||||
Cards[Num_cards].renderer_type = RENDERER_NONE;
|
||||
strcpy(Cards[Num_cards].name, "");
|
||||
Num_cards++;
|
||||
|
||||
// Check for the other types
|
||||
if(detect_opengl) check_openGL();
|
||||
if(detect_glide) check_glide();
|
||||
if(detect_direct3d) check_direct3d();
|
||||
// Check for the other types
|
||||
if (detect_opengl)
|
||||
check_openGL();
|
||||
if (detect_glide)
|
||||
check_glide();
|
||||
if (detect_direct3d)
|
||||
check_direct3d();
|
||||
|
||||
//VideoCardsDetected=TRUE;
|
||||
// VideoCardsDetected=TRUE;
|
||||
}
|
||||
|
||||
// Creates a string suitable for the list box
|
||||
// (combines the renderer_type and the device name)
|
||||
char *GetFullName(card3d *card)
|
||||
{
|
||||
static char name[1024];
|
||||
CString temp;
|
||||
char *GetFullName(card3d *card) {
|
||||
static char name[1024];
|
||||
CString temp;
|
||||
|
||||
// empty out the name
|
||||
strcpy(name,"");
|
||||
// empty out the name
|
||||
strcpy(name, "");
|
||||
|
||||
// Copy the renderer type in
|
||||
switch(card->renderer_type) {
|
||||
case RENDERER_SOFTWARE_8BIT:
|
||||
strcpy(name,"Software (8 bit)");
|
||||
break;
|
||||
case RENDERER_SOFTWARE_16BIT:
|
||||
strcpy(name,"Software (16 bit)");
|
||||
break;
|
||||
case RENDERER_OPENGL:
|
||||
strcpy(name,"OpenGL");
|
||||
break;
|
||||
case RENDERER_DIRECT3D:
|
||||
strcpy(name,"Direct3D");
|
||||
break;
|
||||
case RENDERER_GLIDE:
|
||||
strcpy(name,"3Dfx Glide");
|
||||
break;
|
||||
default:
|
||||
temp.LoadString(IDS_3D_DETECT_NO3D);
|
||||
strcpy(name,temp.GetBuffer(0));
|
||||
break;
|
||||
}
|
||||
// Copy the renderer type in
|
||||
switch (card->renderer_type) {
|
||||
case RENDERER_SOFTWARE_8BIT:
|
||||
strcpy(name, "Software (8 bit)");
|
||||
break;
|
||||
case RENDERER_SOFTWARE_16BIT:
|
||||
strcpy(name, "Software (16 bit)");
|
||||
break;
|
||||
case RENDERER_OPENGL:
|
||||
strcpy(name, "OpenGL");
|
||||
break;
|
||||
case RENDERER_DIRECT3D:
|
||||
strcpy(name, "Direct3D");
|
||||
break;
|
||||
case RENDERER_GLIDE:
|
||||
strcpy(name, "3Dfx Glide");
|
||||
break;
|
||||
default:
|
||||
temp.LoadString(IDS_3D_DETECT_NO3D);
|
||||
strcpy(name, temp.GetBuffer(0));
|
||||
break;
|
||||
}
|
||||
|
||||
// tack on the Device name (if there is one)
|
||||
if(strlen(card->name)>0) {
|
||||
strcat(name," - ");
|
||||
strcat(name,card->name);
|
||||
}
|
||||
// tack on the Device name (if there is one)
|
||||
if (strlen(card->name) > 0) {
|
||||
strcat(name, " - ");
|
||||
strcat(name, card->name);
|
||||
}
|
||||
|
||||
return(name);
|
||||
return (name);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _3D_DETECT_H
|
||||
#define _3D_DETECT_H
|
||||
|
||||
@@ -59,20 +58,19 @@
|
||||
#define MAX_CARDS 16
|
||||
|
||||
// The list of rendering device types
|
||||
enum RendererType
|
||||
{
|
||||
RENDERER_SOFTWARE_8BIT,
|
||||
RENDERER_SOFTWARE_16BIT,
|
||||
RENDERER_OPENGL,
|
||||
RENDERER_DIRECT3D,
|
||||
RENDERER_GLIDE,
|
||||
RENDERER_NONE
|
||||
enum RendererType {
|
||||
RENDERER_SOFTWARE_8BIT,
|
||||
RENDERER_SOFTWARE_16BIT,
|
||||
RENDERER_OPENGL,
|
||||
RENDERER_DIRECT3D,
|
||||
RENDERER_GLIDE,
|
||||
RENDERER_NONE
|
||||
};
|
||||
|
||||
// The structure for a 3D device
|
||||
struct card3d {
|
||||
char name[1024];
|
||||
RendererType renderer_type;
|
||||
char name[1024];
|
||||
RendererType renderer_type;
|
||||
};
|
||||
|
||||
extern card3d Cards[MAX_CARDS];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -67,54 +67,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAudioTab dialog
|
||||
|
||||
class CAudioTab : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CAudioTab)
|
||||
class CAudioTab : public CPropertyPage {
|
||||
DECLARE_DYNCREATE(CAudioTab)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CAudioTab();
|
||||
~CAudioTab();
|
||||
void EnableMixerSettings(UINT mixers);
|
||||
int GetMixerButton(void);
|
||||
void SetMixerButton(int mixer_id, UINT mixer_flags);
|
||||
UINT DetermineDefaultMixer(int card_index);
|
||||
int DetermineBestCard(void);
|
||||
CAudioTab();
|
||||
~CAudioTab();
|
||||
void EnableMixerSettings(UINT mixers);
|
||||
int GetMixerButton(void);
|
||||
void SetMixerButton(int mixer_id, UINT mixer_flags);
|
||||
UINT DetermineDefaultMixer(int card_index);
|
||||
int DetermineBestCard(void);
|
||||
|
||||
CMsgDlg m_MsgDlg;
|
||||
CMsgDlg m_MsgDlg;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAudioTab)
|
||||
enum { IDD = IDD_PROPPAGE_AUDIO };
|
||||
CButton m_LauncherSndCheck;
|
||||
CComboBox m_audio_list;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAudioTab)
|
||||
enum { IDD = IDD_PROPPAGE_AUDIO };
|
||||
CButton m_LauncherSndCheck;
|
||||
CComboBox m_audio_list;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAudioTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAudioTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CAudioTab)
|
||||
afx_msg void OnBtnAudioDetect();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnSelchangeAudioList();
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CAudioTab)
|
||||
afx_msg void OnBtnAudioDetect();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnSelchangeAudioList();
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
|
||||
@@ -113,408 +113,378 @@ static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// Text position values for the standard option button
|
||||
#define LEFTBUTTON_TEXT_XOFFSET 85
|
||||
#define RIGHTBUTTON_TEXT_XOFFSET 85
|
||||
#define BUTTON_TEXT_YOFFSET 17
|
||||
#define BUTTON_TEXT_WIDTH 132
|
||||
#define BUTTON_TEXT_HEIGHT 17
|
||||
#define LEFTBUTTON_TEXT_XOFFSET 85
|
||||
#define RIGHTBUTTON_TEXT_XOFFSET 85
|
||||
#define BUTTON_TEXT_YOFFSET 17
|
||||
#define BUTTON_TEXT_WIDTH 132
|
||||
#define BUTTON_TEXT_HEIGHT 17
|
||||
|
||||
// Text position values for the logo button
|
||||
#define TOPBUTTON_TEXT_XOFFSET 86
|
||||
#define TOPBUTTON_TEXT_YOFFSET 80
|
||||
#define TOPBUTTON_TEXT_WIDTH 135
|
||||
#define TOPBUTTON_TEXT_HEIGHT 17
|
||||
#define TOPBUTTON_TEXT_XOFFSET 86
|
||||
#define TOPBUTTON_TEXT_YOFFSET 80
|
||||
#define TOPBUTTON_TEXT_WIDTH 135
|
||||
#define TOPBUTTON_TEXT_HEIGHT 17
|
||||
|
||||
// Define text colors for button states
|
||||
#define UP_TEXT_COLOR PALETTERGB(162,167,204)
|
||||
#define UP_TEXT_SHADOW_COLOR PALETTERGB(139,146,190)
|
||||
#define DOWN_TEXT_COLOR PALETTERGB(255,255,255)
|
||||
#define DOWN_TEXT_SHADOW_COLOR PALETTERGB(192,192,192)
|
||||
#define LIT_TEXT_COLOR PALETTERGB(255,255,255)
|
||||
#define LIT_TEXT_SHADOW_COLOR PALETTERGB(192,192,192)
|
||||
#define DISABLED_TEXT_COLOR PALETTERGB(128,128,128)
|
||||
#define DISABLED_TEXT_SHADOW_COLOR PALETTERGB(128,128,128)
|
||||
|
||||
#define UP_TEXT_COLOR PALETTERGB(162, 167, 204)
|
||||
#define UP_TEXT_SHADOW_COLOR PALETTERGB(139, 146, 190)
|
||||
#define DOWN_TEXT_COLOR PALETTERGB(255, 255, 255)
|
||||
#define DOWN_TEXT_SHADOW_COLOR PALETTERGB(192, 192, 192)
|
||||
#define LIT_TEXT_COLOR PALETTERGB(255, 255, 255)
|
||||
#define LIT_TEXT_SHADOW_COLOR PALETTERGB(192, 192, 192)
|
||||
#define DISABLED_TEXT_COLOR PALETTERGB(128, 128, 128)
|
||||
#define DISABLED_TEXT_SHADOW_COLOR PALETTERGB(128, 128, 128)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBitmapButtonEx
|
||||
|
||||
CBitmapButtonEx::CBitmapButtonEx()
|
||||
{
|
||||
m_MouseOverBtn=FALSE;
|
||||
m_Hidden=FALSE;
|
||||
CBitmapButtonEx::CBitmapButtonEx() {
|
||||
m_MouseOverBtn = FALSE;
|
||||
m_Hidden = FALSE;
|
||||
|
||||
m_TextMessage=""; // Default to no string message
|
||||
m_Orientation=LEFT_ORIENTED_BTN; // Default to left orientation
|
||||
m_TextMessage = ""; // Default to no string message
|
||||
m_Orientation = LEFT_ORIENTED_BTN; // Default to left orientation
|
||||
|
||||
m_AnimBitmaps=NULL;
|
||||
m_NumAnimFrames=0;
|
||||
m_CurrAnimFrame=0;
|
||||
m_IgnoreDisabled=FALSE;
|
||||
m_AnimBitmaps = NULL;
|
||||
m_NumAnimFrames = 0;
|
||||
m_CurrAnimFrame = 0;
|
||||
m_IgnoreDisabled = FALSE;
|
||||
}
|
||||
|
||||
CBitmapButtonEx::~CBitmapButtonEx()
|
||||
{
|
||||
// Delete the allocated bitmaps
|
||||
if(m_AnimBitmaps!=NULL) delete[] m_AnimBitmaps;
|
||||
CBitmapButtonEx::~CBitmapButtonEx() {
|
||||
// Delete the allocated bitmaps
|
||||
if (m_AnimBitmaps != NULL)
|
||||
delete[] m_AnimBitmaps;
|
||||
|
||||
// Detach this from the button object
|
||||
Detach();
|
||||
// Detach this from the button object
|
||||
Detach();
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CBitmapButtonEx, CBitmapButton)
|
||||
//{{AFX_MSG_MAP(CBitmapButtonEx)
|
||||
ON_WM_ERASEBKGND()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CBitmapButtonEx)
|
||||
ON_WM_ERASEBKGND()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBitmapButtonEx message handlers
|
||||
|
||||
// Draw the button
|
||||
void CBitmapButtonEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
{
|
||||
// TODO: Add your code to draw the specified item
|
||||
CBitmap *bitmap;
|
||||
CPalette *palette;
|
||||
COLORREF old_color, new_color, new_shadow_color;
|
||||
CFont *old_font=NULL;
|
||||
CBitmap *old_bitmap=NULL;
|
||||
CPalette *old_palette=NULL;
|
||||
int old_mode=0;
|
||||
UINT old_alignment=0;
|
||||
void CBitmapButtonEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {
|
||||
// TODO: Add your code to draw the specified item
|
||||
CBitmap *bitmap;
|
||||
CPalette *palette;
|
||||
COLORREF old_color, new_color, new_shadow_color;
|
||||
CFont *old_font = NULL;
|
||||
CBitmap *old_bitmap = NULL;
|
||||
CPalette *old_palette = NULL;
|
||||
int old_mode = 0;
|
||||
UINT old_alignment = 0;
|
||||
|
||||
// If button is hidden, don't draw it
|
||||
if(m_Hidden) return;
|
||||
// If button is hidden, don't draw it
|
||||
if (m_Hidden)
|
||||
return;
|
||||
|
||||
// Get button's state and draw appropriate bitmap
|
||||
if(m_AnimBitmaps!=NULL) {
|
||||
bitmap=&m_AnimBitmaps[m_CurrAnimFrame];
|
||||
new_color=DOWN_TEXT_COLOR;
|
||||
new_shadow_color=DOWN_TEXT_SHADOW_COLOR;
|
||||
}
|
||||
else if(lpDrawItemStruct->itemState & ODS_SELECTED) {
|
||||
bitmap=&m_DownBitmap;
|
||||
new_color=DOWN_TEXT_COLOR;
|
||||
new_shadow_color=DOWN_TEXT_SHADOW_COLOR;
|
||||
}
|
||||
else if(!m_IgnoreDisabled && lpDrawItemStruct->itemState & ODS_DISABLED) {
|
||||
bitmap=&m_DisabledBitmap;
|
||||
new_color=DISABLED_TEXT_COLOR;
|
||||
new_shadow_color=DISABLED_TEXT_SHADOW_COLOR;
|
||||
}
|
||||
else if(m_MouseOverBtn || lpDrawItemStruct->itemState & ODS_FOCUS) {
|
||||
bitmap=&m_MouseBitmap;
|
||||
new_color=LIT_TEXT_COLOR;
|
||||
new_shadow_color=LIT_TEXT_SHADOW_COLOR;
|
||||
}
|
||||
else {
|
||||
bitmap=&m_UpBitmap;
|
||||
new_color=UP_TEXT_COLOR;
|
||||
new_shadow_color=UP_TEXT_SHADOW_COLOR;
|
||||
}
|
||||
// Get button's state and draw appropriate bitmap
|
||||
if (m_AnimBitmaps != NULL) {
|
||||
bitmap = &m_AnimBitmaps[m_CurrAnimFrame];
|
||||
new_color = DOWN_TEXT_COLOR;
|
||||
new_shadow_color = DOWN_TEXT_SHADOW_COLOR;
|
||||
} else if (lpDrawItemStruct->itemState & ODS_SELECTED) {
|
||||
bitmap = &m_DownBitmap;
|
||||
new_color = DOWN_TEXT_COLOR;
|
||||
new_shadow_color = DOWN_TEXT_SHADOW_COLOR;
|
||||
} else if (!m_IgnoreDisabled && lpDrawItemStruct->itemState & ODS_DISABLED) {
|
||||
bitmap = &m_DisabledBitmap;
|
||||
new_color = DISABLED_TEXT_COLOR;
|
||||
new_shadow_color = DISABLED_TEXT_SHADOW_COLOR;
|
||||
} else if (m_MouseOverBtn || lpDrawItemStruct->itemState & ODS_FOCUS) {
|
||||
bitmap = &m_MouseBitmap;
|
||||
new_color = LIT_TEXT_COLOR;
|
||||
new_shadow_color = LIT_TEXT_SHADOW_COLOR;
|
||||
} else {
|
||||
bitmap = &m_UpBitmap;
|
||||
new_color = UP_TEXT_COLOR;
|
||||
new_shadow_color = UP_TEXT_SHADOW_COLOR;
|
||||
}
|
||||
|
||||
// Use the Application default palette (speeds things up in 256 color)
|
||||
palette=&theApp.m_palette;
|
||||
// Use the Application default palette (speeds things up in 256 color)
|
||||
palette = &theApp.m_palette;
|
||||
|
||||
//RECT rect=lpDrawItemStruct->rcItem;
|
||||
// RECT rect=lpDrawItemStruct->rcItem;
|
||||
|
||||
// Obtain the client window for this button
|
||||
CClientDC *dc;
|
||||
try {
|
||||
dc=new CClientDC(this);
|
||||
}
|
||||
catch(CResourceException) {
|
||||
OutputDebugString("Could not get ClientDC for bitmap button!\n");
|
||||
}
|
||||
// Obtain the client window for this button
|
||||
CClientDC *dc;
|
||||
try {
|
||||
dc = new CClientDC(this);
|
||||
} catch (CResourceException) {
|
||||
OutputDebugString("Could not get ClientDC for bitmap button!\n");
|
||||
}
|
||||
|
||||
CDC memDC;
|
||||
CDC memDC;
|
||||
|
||||
CRect crect;
|
||||
GetClientRect(&crect);
|
||||
CRect crect;
|
||||
GetClientRect(&crect);
|
||||
|
||||
BITMAP m_bmInfo; // Bitmap info
|
||||
bitmap->GetObject(sizeof(BITMAP), &m_bmInfo);
|
||||
BITMAP m_bmInfo; // Bitmap info
|
||||
bitmap->GetObject(sizeof(BITMAP), &m_bmInfo);
|
||||
|
||||
// Select and realize the palette
|
||||
if( dc->GetDeviceCaps(RASTERCAPS) & RC_PALETTE && palette->m_hObject != NULL ) {
|
||||
old_palette=dc->SelectPalette( palette, TRUE );
|
||||
dc->RealizePalette();
|
||||
}
|
||||
// Select and realize the palette
|
||||
if (dc->GetDeviceCaps(RASTERCAPS) & RC_PALETTE && palette->m_hObject != NULL) {
|
||||
old_palette = dc->SelectPalette(palette, TRUE);
|
||||
dc->RealizePalette();
|
||||
}
|
||||
|
||||
if(memDC.CreateCompatibleDC(dc)==0)
|
||||
OutputDebugString("CreateCompatibleDC() failed.\n");
|
||||
if (memDC.CreateCompatibleDC(dc) == 0)
|
||||
OutputDebugString("CreateCompatibleDC() failed.\n");
|
||||
|
||||
if((old_bitmap=memDC.SelectObject( bitmap )) == NULL)
|
||||
OutputDebugString("SelectObject() failed!\n");
|
||||
if ((old_bitmap = memDC.SelectObject(bitmap)) == NULL)
|
||||
OutputDebugString("SelectObject() failed!\n");
|
||||
|
||||
dc->StretchBlt( 0, 0,crect.Width(),crect.Height(), &memDC, 0, 0, m_bmInfo.bmWidth,m_bmInfo.bmHeight,SRCCOPY );
|
||||
dc->StretchBlt(0, 0, crect.Width(), crect.Height(), &memDC, 0, 0, m_bmInfo.bmWidth, m_bmInfo.bmHeight, SRCCOPY);
|
||||
|
||||
// If the button contains a text message, display it
|
||||
if(!m_TextMessage.IsEmpty()) {
|
||||
// If the button contains a text message, display it
|
||||
if (!m_TextMessage.IsEmpty()) {
|
||||
|
||||
//old_font = (CFont *)dc->SelectStockObject( ANSI_VAR_FONT );
|
||||
old_font = dc->SelectObject( &m_btn_font );
|
||||
old_mode=dc->SetBkMode(TRANSPARENT);
|
||||
old_alignment=dc->SetTextAlign(TA_CENTER | TA_TOP);
|
||||
old_color=dc->SetTextColor(new_shadow_color);
|
||||
// old_font = (CFont *)dc->SelectStockObject( ANSI_VAR_FONT );
|
||||
old_font = dc->SelectObject(&m_btn_font);
|
||||
old_mode = dc->SetBkMode(TRANSPARENT);
|
||||
old_alignment = dc->SetTextAlign(TA_CENTER | TA_TOP);
|
||||
old_color = dc->SetTextColor(new_shadow_color);
|
||||
|
||||
dc->ExtTextOut( m_TextStartPoint.x-1,m_TextStartPoint.y,
|
||||
ETO_CLIPPED,&m_TextClipBox,m_TextMessage,NULL);
|
||||
dc->SetTextColor(new_color);
|
||||
dc->ExtTextOut(m_TextStartPoint.x - 1, m_TextStartPoint.y, ETO_CLIPPED, &m_TextClipBox, m_TextMessage, NULL);
|
||||
dc->SetTextColor(new_color);
|
||||
|
||||
//dc->Rectangle(&m_TextClipBox);
|
||||
dc->ExtTextOut( m_TextStartPoint.x,m_TextStartPoint.y,
|
||||
ETO_CLIPPED,&m_TextClipBox,m_TextMessage,NULL);
|
||||
//dc->DrawText(m_TextMessage,&m_TextClipBox,DT_CENTER);
|
||||
// dc->Rectangle(&m_TextClipBox);
|
||||
dc->ExtTextOut(m_TextStartPoint.x, m_TextStartPoint.y, ETO_CLIPPED, &m_TextClipBox, m_TextMessage, NULL);
|
||||
// dc->DrawText(m_TextMessage,&m_TextClipBox,DT_CENTER);
|
||||
|
||||
dc->SetTextColor(old_color);
|
||||
dc->SetTextAlign(old_alignment);
|
||||
dc->SetBkMode(old_mode);
|
||||
dc->SetTextColor(old_color);
|
||||
dc->SetTextAlign(old_alignment);
|
||||
dc->SetBkMode(old_mode);
|
||||
|
||||
if(old_font!=NULL)
|
||||
dc->SelectObject(old_font);
|
||||
}
|
||||
if (old_font != NULL)
|
||||
dc->SelectObject(old_font);
|
||||
}
|
||||
|
||||
if(old_bitmap!=NULL)
|
||||
memDC.SelectObject(old_bitmap);
|
||||
if (old_bitmap != NULL)
|
||||
memDC.SelectObject(old_bitmap);
|
||||
|
||||
if(old_palette!=NULL)
|
||||
dc->SelectPalette(old_palette,FALSE);
|
||||
if (old_palette != NULL)
|
||||
dc->SelectPalette(old_palette, FALSE);
|
||||
|
||||
if(memDC.DeleteDC()==0)
|
||||
OutputDebugString("DeleteDC() failed!\n");
|
||||
if (memDC.DeleteDC() == 0)
|
||||
OutputDebugString("DeleteDC() failed!\n");
|
||||
|
||||
delete dc;
|
||||
delete dc;
|
||||
|
||||
//CBitmapButton::DrawItem(lpDrawItemStruct);
|
||||
// CBitmapButton::DrawItem(lpDrawItemStruct);
|
||||
}
|
||||
|
||||
// Sets up the button for use
|
||||
bool CBitmapButtonEx::Setup(UINT nID, CWnd *parent, int orient /*=LEFT_ORIENTED_BTN*/)
|
||||
{
|
||||
CString res_name, title;
|
||||
bool CBitmapButtonEx::Setup(UINT nID, CWnd *parent, int orient /*=LEFT_ORIENTED_BTN*/) {
|
||||
CString res_name, title;
|
||||
|
||||
if(parent==NULL) return FALSE;
|
||||
if (parent == NULL)
|
||||
return FALSE;
|
||||
|
||||
// Let the bitmap class set things up for us
|
||||
// NOTE:this function will also cause a redundant loading of bitmaps
|
||||
// since CBitmapButton will store copies for itself, however,
|
||||
// it is this funciton which automatically sets up the button's
|
||||
// size, position, etc. from the resources...
|
||||
//AutoLoad(nID,parent);
|
||||
// Let the bitmap class set things up for us
|
||||
// NOTE:this function will also cause a redundant loading of bitmaps
|
||||
// since CBitmapButton will store copies for itself, however,
|
||||
// it is this funciton which automatically sets up the button's
|
||||
// size, position, etc. from the resources...
|
||||
// AutoLoad(nID,parent);
|
||||
|
||||
// Attach this button instance to the proper button resource
|
||||
HWND hwnd;
|
||||
parent->GetDlgItem(nID,&hwnd);
|
||||
if(Attach(hwnd)==0)
|
||||
OutputDebugString("Attach() failed!\n");
|
||||
// Attach this button instance to the proper button resource
|
||||
HWND hwnd;
|
||||
parent->GetDlgItem(nID, &hwnd);
|
||||
if (Attach(hwnd) == 0)
|
||||
OutputDebugString("Attach() failed!\n");
|
||||
|
||||
// Setup the text alignment values
|
||||
m_Orientation = orient;
|
||||
// Setup the text alignment values
|
||||
m_Orientation = orient;
|
||||
|
||||
// Fill in text parameters for different button orientations
|
||||
int width, height;
|
||||
if(m_Orientation==TOP_ORIENTED_BTN) {
|
||||
// Fill in text parameters for different button orientations
|
||||
int width, height;
|
||||
if (m_Orientation == TOP_ORIENTED_BTN) {
|
||||
|
||||
// top oriented button
|
||||
m_TextStartPoint.x=int(TOPBUTTON_TEXT_XOFFSET*DlgWidthModifier);
|
||||
m_TextStartPoint.y=int(TOPBUTTON_TEXT_YOFFSET*DlgHeightModifier);
|
||||
// top oriented button
|
||||
m_TextStartPoint.x = int(TOPBUTTON_TEXT_XOFFSET * DlgWidthModifier);
|
||||
m_TextStartPoint.y = int(TOPBUTTON_TEXT_YOFFSET * DlgHeightModifier);
|
||||
|
||||
width=int(TOPBUTTON_TEXT_WIDTH*DlgWidthModifier);
|
||||
height=int(TOPBUTTON_TEXT_HEIGHT*DlgHeightModifier);
|
||||
width = int(TOPBUTTON_TEXT_WIDTH * DlgWidthModifier);
|
||||
height = int(TOPBUTTON_TEXT_HEIGHT * DlgHeightModifier);
|
||||
|
||||
}
|
||||
else if(m_Orientation==LEFT_ORIENTED_BTN) {
|
||||
} else if (m_Orientation == LEFT_ORIENTED_BTN) {
|
||||
|
||||
// left oriented button
|
||||
m_TextStartPoint.x=int(LEFTBUTTON_TEXT_XOFFSET*DlgWidthModifier);
|
||||
m_TextStartPoint.y=int(BUTTON_TEXT_YOFFSET*DlgHeightModifier);
|
||||
// left oriented button
|
||||
m_TextStartPoint.x = int(LEFTBUTTON_TEXT_XOFFSET * DlgWidthModifier);
|
||||
m_TextStartPoint.y = int(BUTTON_TEXT_YOFFSET * DlgHeightModifier);
|
||||
|
||||
width=int(BUTTON_TEXT_WIDTH*DlgWidthModifier);
|
||||
height=int(BUTTON_TEXT_HEIGHT*DlgHeightModifier);
|
||||
width = int(BUTTON_TEXT_WIDTH * DlgWidthModifier);
|
||||
height = int(BUTTON_TEXT_HEIGHT * DlgHeightModifier);
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
// right oriented button
|
||||
m_TextStartPoint.x=int(RIGHTBUTTON_TEXT_XOFFSET*DlgWidthModifier);
|
||||
m_TextStartPoint.y=int(BUTTON_TEXT_YOFFSET*DlgHeightModifier);
|
||||
// right oriented button
|
||||
m_TextStartPoint.x = int(RIGHTBUTTON_TEXT_XOFFSET * DlgWidthModifier);
|
||||
m_TextStartPoint.y = int(BUTTON_TEXT_YOFFSET * DlgHeightModifier);
|
||||
|
||||
width=int(BUTTON_TEXT_WIDTH*DlgWidthModifier);
|
||||
height=int(BUTTON_TEXT_HEIGHT*DlgHeightModifier);
|
||||
}
|
||||
width = int(BUTTON_TEXT_WIDTH * DlgWidthModifier);
|
||||
height = int(BUTTON_TEXT_HEIGHT * DlgHeightModifier);
|
||||
}
|
||||
|
||||
// Now compute the text bounding box from the button parameters
|
||||
m_TextClipBox.left=m_TextStartPoint.x - (width/2);
|
||||
m_TextClipBox.top=m_TextStartPoint.y;
|
||||
// Now compute the text bounding box from the button parameters
|
||||
m_TextClipBox.left = m_TextStartPoint.x - (width / 2);
|
||||
m_TextClipBox.top = m_TextStartPoint.y;
|
||||
|
||||
m_TextClipBox.right=m_TextClipBox.left+width;
|
||||
m_TextClipBox.bottom=m_TextClipBox.top+height;
|
||||
m_TextClipBox.right = m_TextClipBox.left + width;
|
||||
m_TextClipBox.bottom = m_TextClipBox.top + height;
|
||||
|
||||
// Set the font for the normal option buttons
|
||||
m_btn_font.CreateFont(
|
||||
int(14*DlgHeightModifier),
|
||||
int(8*DlgWidthModifier),
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, PROOF_QUALITY,
|
||||
0, _T("Arial Bold") );
|
||||
// Set the font for the normal option buttons
|
||||
m_btn_font.CreateFont(int(14 * DlgHeightModifier), int(8 * DlgWidthModifier), 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
PROOF_QUALITY, 0, _T("Arial Bold"));
|
||||
|
||||
// Set the font for the logo buttons
|
||||
m_logobtn_font.CreateFont(
|
||||
int(14*DlgHeightModifier),
|
||||
int(8*DlgWidthModifier),
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, PROOF_QUALITY,
|
||||
0, _T("Arial Bold") );
|
||||
// Set the font for the logo buttons
|
||||
m_logobtn_font.CreateFont(int(14 * DlgHeightModifier), int(8 * DlgWidthModifier), 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
PROOF_QUALITY, 0, _T("Arial Bold"));
|
||||
|
||||
// Load the bitmaps and palettes that we will use
|
||||
Load(nID,parent);
|
||||
// Load the bitmaps and palettes that we will use
|
||||
Load(nID, parent);
|
||||
|
||||
// Resize the buttons to match the proportions of the dialog
|
||||
BITMAP bm;
|
||||
m_UpBitmap.GetObject(sizeof(BITMAP), &bm);
|
||||
SetWindowPos(NULL,0,0,int(bm.bmWidth*DlgWidthModifier),int(bm.bmHeight*DlgHeightModifier),SWP_NOMOVE|SWP_NOZORDER);
|
||||
// Resize the buttons to match the proportions of the dialog
|
||||
BITMAP bm;
|
||||
m_UpBitmap.GetObject(sizeof(BITMAP), &bm);
|
||||
SetWindowPos(NULL, 0, 0, int(bm.bmWidth * DlgWidthModifier), int(bm.bmHeight * DlgHeightModifier),
|
||||
SWP_NOMOVE | SWP_NOZORDER);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Sets up the animation button for use
|
||||
bool CBitmapButtonEx::AnimSetup(UINT nID, CWnd *parent, int num_frames)
|
||||
{
|
||||
CString res_name, title;
|
||||
bool CBitmapButtonEx::AnimSetup(UINT nID, CWnd *parent, int num_frames) {
|
||||
CString res_name, title;
|
||||
|
||||
if(num_frames==0) return FALSE;
|
||||
if (num_frames == 0)
|
||||
return FALSE;
|
||||
|
||||
if(parent==NULL) return FALSE;
|
||||
if (parent == NULL)
|
||||
return FALSE;
|
||||
|
||||
// Let the bitmap class set things up for us
|
||||
// NOTE:this function will also cause a redundant loading of bitmaps
|
||||
// since CBitmapButton will store copies for itself, however,
|
||||
// it is this funciton which automatically sets up the button's
|
||||
// size, position, etc. from the resources...
|
||||
//AutoLoad(nID,parent);
|
||||
// Let the bitmap class set things up for us
|
||||
// NOTE:this function will also cause a redundant loading of bitmaps
|
||||
// since CBitmapButton will store copies for itself, however,
|
||||
// it is this funciton which automatically sets up the button's
|
||||
// size, position, etc. from the resources...
|
||||
// AutoLoad(nID,parent);
|
||||
|
||||
// Set the number of frames
|
||||
m_NumAnimFrames=num_frames;
|
||||
// Set the number of frames
|
||||
m_NumAnimFrames = num_frames;
|
||||
|
||||
// Attach this button instance to the proper button resource
|
||||
HWND hwnd;
|
||||
parent->GetDlgItem(nID,&hwnd);
|
||||
if(Attach(hwnd)==0)
|
||||
OutputDebugString("Attach() failed!\n");
|
||||
// Attach this button instance to the proper button resource
|
||||
HWND hwnd;
|
||||
parent->GetDlgItem(nID, &hwnd);
|
||||
if (Attach(hwnd) == 0)
|
||||
OutputDebugString("Attach() failed!\n");
|
||||
|
||||
// Load the bitmaps and palettes that we will use
|
||||
AnimLoad(nID,parent);
|
||||
// Load the bitmaps and palettes that we will use
|
||||
AnimLoad(nID, parent);
|
||||
|
||||
// Resize the buttons to match the proportions of the dialog
|
||||
BITMAP bm;
|
||||
m_AnimBitmaps[0].GetObject(sizeof(BITMAP), &bm);
|
||||
SetWindowPos(NULL,0,0,int(bm.bmWidth*DlgWidthModifier),int(bm.bmHeight*DlgHeightModifier),SWP_NOMOVE|SWP_NOZORDER);
|
||||
// Resize the buttons to match the proportions of the dialog
|
||||
BITMAP bm;
|
||||
m_AnimBitmaps[0].GetObject(sizeof(BITMAP), &bm);
|
||||
SetWindowPos(NULL, 0, 0, int(bm.bmWidth * DlgWidthModifier), int(bm.bmHeight * DlgHeightModifier),
|
||||
SWP_NOMOVE | SWP_NOZORDER);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// Loads the bitmaps for the button given
|
||||
// U - up position
|
||||
// D - down position
|
||||
// M - lit (mouse is over it) position
|
||||
// X - disabled
|
||||
bool CBitmapButtonEx::Load(UINT nID, CWnd *parent)
|
||||
{
|
||||
CString res_name, title;
|
||||
bool CBitmapButtonEx::Load(UINT nID, CWnd *parent) {
|
||||
CString res_name, title;
|
||||
|
||||
if(parent==NULL) return FALSE;
|
||||
if (parent == NULL)
|
||||
return FALSE;
|
||||
|
||||
parent->GetDlgItemText(nID, title);
|
||||
parent->GetDlgItemText(nID, title);
|
||||
|
||||
OutputDebugString("title =");
|
||||
OutputDebugString(title);
|
||||
OutputDebugString("\n");
|
||||
OutputDebugString("title =");
|
||||
OutputDebugString(title);
|
||||
OutputDebugString("\n");
|
||||
|
||||
res_name.Format("%s%s",title,"U");
|
||||
GetBitmapAndPalette(res_name,&m_UpBitmap,NULL);
|
||||
res_name.Format("%s%s",title,"D");
|
||||
GetBitmapAndPalette(res_name,&m_DownBitmap,NULL);
|
||||
res_name.Format("%s%s",title,"M");
|
||||
GetBitmapAndPalette(res_name,&m_MouseBitmap,NULL);
|
||||
res_name.Format("%s%s",title,"X");
|
||||
GetBitmapAndPalette(res_name,&m_DisabledBitmap,NULL);
|
||||
res_name.Format("%s%s", title, "U");
|
||||
GetBitmapAndPalette(res_name, &m_UpBitmap, NULL);
|
||||
res_name.Format("%s%s", title, "D");
|
||||
GetBitmapAndPalette(res_name, &m_DownBitmap, NULL);
|
||||
res_name.Format("%s%s", title, "M");
|
||||
GetBitmapAndPalette(res_name, &m_MouseBitmap, NULL);
|
||||
res_name.Format("%s%s", title, "X");
|
||||
GetBitmapAndPalette(res_name, &m_DisabledBitmap, NULL);
|
||||
|
||||
return(TRUE);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
// Loads the animation bitmaps for the button given
|
||||
// Format: nameX where X is the frame #
|
||||
bool CBitmapButtonEx::AnimLoad(UINT nID, CWnd *parent)
|
||||
{
|
||||
CString res_name, title;
|
||||
int j;
|
||||
bool CBitmapButtonEx::AnimLoad(UINT nID, CWnd *parent) {
|
||||
CString res_name, title;
|
||||
int j;
|
||||
|
||||
if(parent==NULL) return FALSE;
|
||||
if (parent == NULL)
|
||||
return FALSE;
|
||||
|
||||
parent->GetDlgItemText(nID, title);
|
||||
parent->GetDlgItemText(nID, title);
|
||||
|
||||
OutputDebugString("title =");
|
||||
OutputDebugString(title);
|
||||
OutputDebugString("\n");
|
||||
OutputDebugString("title =");
|
||||
OutputDebugString(title);
|
||||
OutputDebugString("\n");
|
||||
|
||||
// Allocate bitmap objects
|
||||
if(m_NumAnimFrames==0) return FALSE;
|
||||
m_AnimBitmaps=new CBitmap[m_NumAnimFrames];
|
||||
if(m_AnimBitmaps==NULL) return FALSE;
|
||||
// Allocate bitmap objects
|
||||
if (m_NumAnimFrames == 0)
|
||||
return FALSE;
|
||||
m_AnimBitmaps = new CBitmap[m_NumAnimFrames];
|
||||
if (m_AnimBitmaps == NULL)
|
||||
return FALSE;
|
||||
|
||||
// Load in the bitmaps
|
||||
for(j=0; j<m_NumAnimFrames; j++) {
|
||||
res_name.Format("%s%d",title, j);
|
||||
GetBitmapAndPalette(res_name,&m_AnimBitmaps[j],NULL);
|
||||
}
|
||||
// Load in the bitmaps
|
||||
for (j = 0; j < m_NumAnimFrames; j++) {
|
||||
res_name.Format("%s%d", title, j);
|
||||
GetBitmapAndPalette(res_name, &m_AnimBitmaps[j], NULL);
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
// Lights/un-Lights the button
|
||||
void CBitmapButtonEx::Light(bool bLight)
|
||||
{
|
||||
m_MouseOverBtn = (bLight) ? TRUE : FALSE;
|
||||
}
|
||||
void CBitmapButtonEx::Light(bool bLight) { m_MouseOverBtn = (bLight) ? TRUE : FALSE; }
|
||||
|
||||
// Hides/un-Hides the button (and disables/enables it)
|
||||
void CBitmapButtonEx::Hide(bool bHide)
|
||||
{
|
||||
m_Hidden = (bHide) ? TRUE : FALSE;
|
||||
EnableWindow(!m_Hidden);
|
||||
void CBitmapButtonEx::Hide(bool bHide) {
|
||||
m_Hidden = (bHide) ? TRUE : FALSE;
|
||||
EnableWindow(!m_Hidden);
|
||||
}
|
||||
|
||||
// Sets the button's text message
|
||||
void CBitmapButtonEx::SetText(UINT nID)
|
||||
{
|
||||
m_TextMessage.LoadString(nID);
|
||||
}
|
||||
void CBitmapButtonEx::SetText(UINT nID) { m_TextMessage.LoadString(nID); }
|
||||
|
||||
// Increments the animation frame
|
||||
void CBitmapButtonEx::DoNextAnimFrame(void)
|
||||
{
|
||||
m_CurrAnimFrame++;
|
||||
if(m_CurrAnimFrame==m_NumAnimFrames)
|
||||
m_CurrAnimFrame=0;
|
||||
void CBitmapButtonEx::DoNextAnimFrame(void) {
|
||||
m_CurrAnimFrame++;
|
||||
if (m_CurrAnimFrame == m_NumAnimFrames)
|
||||
m_CurrAnimFrame = 0;
|
||||
}
|
||||
|
||||
|
||||
// This function is called whenever the button's background needs to
|
||||
// be erased. It simply returns saying that the button's background has already
|
||||
// been erased - this is necessary to prevent the "gray-button-background"
|
||||
// flicker during window updates
|
||||
BOOL CBitmapButtonEx::OnEraseBkgnd(CDC* pDC)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
BOOL CBitmapButtonEx::OnEraseBkgnd(CDC *pDC) {
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
|
||||
//return CBitmapButton::OnEraseBkgnd(pDC);
|
||||
return 1;
|
||||
// return CBitmapButton::OnEraseBkgnd(pDC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -76,84 +76,82 @@
|
||||
//
|
||||
|
||||
// Button orientation values (only used for option button text alignment)
|
||||
#define LEFT_ORIENTED_BTN 0
|
||||
#define RIGHT_ORIENTED_BTN 1
|
||||
#define TOP_ORIENTED_BTN 2
|
||||
|
||||
#define LEFT_ORIENTED_BTN 0
|
||||
#define RIGHT_ORIENTED_BTN 1
|
||||
#define TOP_ORIENTED_BTN 2
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBitmapButtonEx window
|
||||
|
||||
class CBitmapButtonEx : public CBitmapButton
|
||||
{
|
||||
// Construction
|
||||
class CBitmapButtonEx : public CBitmapButton {
|
||||
// Construction
|
||||
public:
|
||||
CBitmapButtonEx();
|
||||
CBitmapButtonEx();
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
public:
|
||||
// Button state bitmaps
|
||||
CBitmap m_UpBitmap;
|
||||
CBitmap m_DownBitmap;
|
||||
CBitmap m_DisabledBitmap;
|
||||
CBitmap m_MouseBitmap;
|
||||
// Button state bitmaps
|
||||
CBitmap m_UpBitmap;
|
||||
CBitmap m_DownBitmap;
|
||||
CBitmap m_DisabledBitmap;
|
||||
CBitmap m_MouseBitmap;
|
||||
|
||||
// Bitmaps for an animated button (doesn't behave as a button however)
|
||||
CBitmap *m_AnimBitmaps;
|
||||
int m_NumAnimFrames;
|
||||
int m_CurrAnimFrame;
|
||||
// Bitmaps for an animated button (doesn't behave as a button however)
|
||||
CBitmap *m_AnimBitmaps;
|
||||
int m_NumAnimFrames;
|
||||
int m_CurrAnimFrame;
|
||||
|
||||
private:
|
||||
CString m_TextMessage; // The text to be displayed over the button
|
||||
RECT m_TextClipBox; // The clipping rectangle for the text
|
||||
POINT m_TextStartPoint; // The starting point offset for the text
|
||||
CString m_TextMessage; // The text to be displayed over the button
|
||||
RECT m_TextClipBox; // The clipping rectangle for the text
|
||||
POINT m_TextStartPoint; // The starting point offset for the text
|
||||
|
||||
bool m_MouseOverBtn; // Is the mouse currently over the button?
|
||||
bool m_Hidden; // Is the button hidden?
|
||||
int m_Orientation; // Is the button a left or right option button
|
||||
bool m_MouseOverBtn; // Is the mouse currently over the button?
|
||||
bool m_Hidden; // Is the button hidden?
|
||||
int m_Orientation; // Is the button a left or right option button
|
||||
|
||||
CFont m_btn_font; // Font to be used by the button text
|
||||
CFont m_logobtn_font; // Font to be used by the logo buttons
|
||||
CFont m_btn_font; // Font to be used by the button text
|
||||
CFont m_logobtn_font; // Font to be used by the logo buttons
|
||||
|
||||
bool m_IgnoreDisabled; // Allows buttons to be disabled functionality-wise,
|
||||
// but not bitmap-wise
|
||||
bool m_IgnoreDisabled; // Allows buttons to be disabled functionality-wise,
|
||||
// but not bitmap-wise
|
||||
|
||||
// Operations
|
||||
// Operations
|
||||
public:
|
||||
// Sets up and loads the hi-color bitmaps and palettes
|
||||
bool Setup(UINT nID, CWnd *parent, int orient=LEFT_ORIENTED_BTN);
|
||||
bool AnimSetup(UINT nID, CWnd *parent, int num_frames);
|
||||
// Sets up and loads the hi-color bitmaps and palettes
|
||||
bool Setup(UINT nID, CWnd *parent, int orient = LEFT_ORIENTED_BTN);
|
||||
bool AnimSetup(UINT nID, CWnd *parent, int num_frames);
|
||||
|
||||
bool Load(UINT nID, CWnd *parent); // Loads the hi-color bitmaps and palettes
|
||||
bool AnimLoad(UINT nID, CWnd *parent); // Loads bitmaps for animation
|
||||
void Light(bool bLight); // Lights/un-Lights the button
|
||||
void Hide(bool bHide); // Hides/un-Hides a button
|
||||
void SetText(UINT nID); // Sets the button's text message
|
||||
void DoNextAnimFrame(void); // Points button to next animation frame
|
||||
bool Load(UINT nID, CWnd *parent); // Loads the hi-color bitmaps and palettes
|
||||
bool AnimLoad(UINT nID, CWnd *parent); // Loads bitmaps for animation
|
||||
void Light(bool bLight); // Lights/un-Lights the button
|
||||
void Hide(bool bHide); // Hides/un-Hides a button
|
||||
void SetText(UINT nID); // Sets the button's text message
|
||||
void DoNextAnimFrame(void); // Points button to next animation frame
|
||||
|
||||
bool IsLit(void) { return(m_MouseOverBtn); } // checks if button is lit
|
||||
bool IsHidden(void) { return(m_Hidden); } // checks if button is hidden
|
||||
bool IsLit(void) { return (m_MouseOverBtn); } // checks if button is lit
|
||||
bool IsHidden(void) { return (m_Hidden); } // checks if button is hidden
|
||||
|
||||
void IgnoreDisabled(bool value) { m_IgnoreDisabled=value; } // sets the ignore disabled flag
|
||||
void IgnoreDisabled(bool value) { m_IgnoreDisabled = value; } // sets the ignore disabled flag
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CBitmapButtonEx)
|
||||
public:
|
||||
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CBitmapButtonEx)
|
||||
public:
|
||||
virtual ~CBitmapButtonEx();
|
||||
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CBitmapButtonEx();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CBitmapButtonEx)
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
//}}AFX_MSG
|
||||
//{{AFX_MSG(CBitmapButtonEx)
|
||||
afx_msg BOOL OnEraseBkgnd(CDC *pDC);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -158,36 +158,36 @@
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
/******************************
|
||||
** The Launcher Version ID's **
|
||||
******************************/
|
||||
#define LAUNCHER_VERSION_ID 1.0
|
||||
#define LAUNCHER_DEMO_VERSION_ID 1.0
|
||||
#define LAUNCHER_VERSION_ID 1.0
|
||||
#define LAUNCHER_DEMO_VERSION_ID 1.0
|
||||
|
||||
// Uncomment this if you want to use the HTML help system for the launcher
|
||||
//#define USE_HTML_HELP_SYSTEM
|
||||
// #define USE_HTML_HELP_SYSTEM
|
||||
|
||||
// Uncomment one of the following if you want to do a special build
|
||||
//#define DEMO
|
||||
//#define DEMO2
|
||||
//#define OEM_GENERIC
|
||||
//#define OEM_VOODOO3
|
||||
//#define OEM_KATMAI
|
||||
//#define FULL_US_RELEASE
|
||||
// #define DEMO
|
||||
// #define DEMO2
|
||||
// #define OEM_GENERIC
|
||||
// #define OEM_VOODOO3
|
||||
// #define OEM_KATMAI
|
||||
// #define FULL_US_RELEASE
|
||||
#define FULL_ROW_RELEASE
|
||||
//#define FULL_AUSSIE_RELEASE
|
||||
// #define FULL_AUSSIE_RELEASE
|
||||
|
||||
// Uncomment this if you are doing an initial UK version build
|
||||
//#define INITIAL_UK_RELEASE
|
||||
// #define INITIAL_UK_RELEASE
|
||||
|
||||
// Uncomment this if you are doing a non-LaserLock version (full ROW variation)
|
||||
//#define ROW_NLL_RELEASE
|
||||
// #define ROW_NLL_RELEASE
|
||||
|
||||
// Uncomment this is you are doing an OEM_VOODOO3 build but want it to support all API's
|
||||
//#define USE_ALL_VIDEO_OPTIONS
|
||||
// #define USE_ALL_VIDEO_OPTIONS
|
||||
|
||||
// Uncomment this if you want multi-language support
|
||||
#define USE_MULTI_LANGUAGES
|
||||
@@ -196,71 +196,70 @@
|
||||
#define ENABLE_ITALIAN
|
||||
|
||||
// Uncomment this if you want GLSetup to be a non-selectable option
|
||||
//#define DISABLE_GLSETUP
|
||||
// #define DISABLE_GLSETUP
|
||||
|
||||
// Macro for computing a "comparable" version ID
|
||||
#define VER(major, minor, build) (100*100*major+100*minor+build)
|
||||
#define VER(major, minor, build) (100 * 100 * major + 100 * minor + build)
|
||||
|
||||
// Comment char to be used in version files
|
||||
#define VERSION_FILE_COMMENT_CHAR ';'
|
||||
#define VERSION_FILE_COMMENT_CHAR ';'
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
// Help Files
|
||||
#define MAIN_MENU_HELP "D3L_hlp1.htm"
|
||||
#define UPDATE_HELP "D3L_hlp2.htm"
|
||||
#define DIRECTXTAB_HELP "D3L_hlp3.htm"
|
||||
#define VIDEOTAB_HELP "D3L_hlp4.htm"
|
||||
#define AUDIOTAB_HELP "D3L_hlp5.htm"
|
||||
#define JOYSTICKTAB_HELP "D3L_hlp6.htm"
|
||||
#define SPEEDTAB_HELP "D3L_hlp7.htm"
|
||||
#define NETWORKTAB_HELP "D3L_hlp8.htm"
|
||||
#define KEYBOARDTAB_HELP "D3L_hlp9.htm"
|
||||
#define MAIN_MENU_HELP "D3L_hlp1.htm"
|
||||
#define UPDATE_HELP "D3L_hlp2.htm"
|
||||
#define DIRECTXTAB_HELP "D3L_hlp3.htm"
|
||||
#define VIDEOTAB_HELP "D3L_hlp4.htm"
|
||||
#define AUDIOTAB_HELP "D3L_hlp5.htm"
|
||||
#define JOYSTICKTAB_HELP "D3L_hlp6.htm"
|
||||
#define SPEEDTAB_HELP "D3L_hlp7.htm"
|
||||
#define NETWORKTAB_HELP "D3L_hlp8.htm"
|
||||
#define KEYBOARDTAB_HELP "D3L_hlp9.htm"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CD3LaunchApp:
|
||||
// See D3Launch.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CD3LaunchApp : public CWinApp
|
||||
{
|
||||
class CD3LaunchApp : public CWinApp {
|
||||
public:
|
||||
CD3LaunchApp();
|
||||
CD3LaunchApp();
|
||||
|
||||
HINSTANCE m_hResInst;
|
||||
HINSTANCE m_hDefResInst;
|
||||
HINSTANCE m_hResInst;
|
||||
HINSTANCE m_hDefResInst;
|
||||
|
||||
CBitmap m_bkBmap;
|
||||
CPalette m_palette;
|
||||
CBitmap m_bkBmap;
|
||||
CPalette m_palette;
|
||||
|
||||
CBitmap m_bkBmapBig;
|
||||
int m_straight_to_update; // NOTE : this is for going right to the autoupdate feature from the PXO screen
|
||||
// it should only ever be set from the command line parser
|
||||
CBitmap m_bkBmapBig;
|
||||
int m_straight_to_update; // NOTE : this is for going right to the autoupdate feature from the PXO screen
|
||||
// it should only ever be set from the command line parser
|
||||
|
||||
int m_straight_to_setup; // NOTE : this is for going straight to the setup if this is
|
||||
// the first time (after D3 is installed) that the
|
||||
// launcher has been run
|
||||
int m_straight_to_setup; // NOTE : this is for going straight to the setup if this is
|
||||
// the first time (after D3 is installed) that the
|
||||
// launcher has been run
|
||||
|
||||
BOOL FirstInstance();
|
||||
BOOL FirstInstance();
|
||||
|
||||
// parse for special (outrage) command-line arguments
|
||||
void OutrageParseCommandLine();
|
||||
// parse for special (outrage) command-line arguments
|
||||
void OutrageParseCommandLine();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CD3LaunchApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
virtual int ExitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CD3LaunchApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
virtual int ExitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Implementation
|
||||
|
||||
//{{AFX_MSG(CD3LaunchApp)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CD3LaunchApp)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CD3LaunchApp theApp;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -123,119 +123,119 @@
|
||||
#include "BitmapButtonEx.h"
|
||||
|
||||
// Main timer delay (in msecs)
|
||||
#define MAIN_TIMER_DELAY 50
|
||||
#define MAIN_TIMER_DELAY 50
|
||||
|
||||
// Launcher shutdown code
|
||||
#define IDSHUTDOWN -1
|
||||
#define IDSHUTDOWN -1
|
||||
|
||||
// Time between animation frames (in msecs)
|
||||
#define MAX_ANIM_FRAME_TIME 100
|
||||
#define MAX_ANIM_FRAME_TIME 100
|
||||
|
||||
// Number of animation frames
|
||||
#define NUM_ANIM_FRAMES 9
|
||||
#define NUM_ANIM_FRAMES 9
|
||||
|
||||
// Chance of flicker is 1 in [ODDS VALUE]
|
||||
#define LIGHT_FLICKER_OFF_ODDS 40
|
||||
#define LIGHT_FLICKER_OFF_ODDS 40
|
||||
|
||||
// Time light is off during flicker (in msecs)
|
||||
#define MAX_LIGHT_OFF_TIME 100
|
||||
#define MAX_LIGHT_OFF_TIME 100
|
||||
|
||||
// Delay time for light (it can't flicker for this long during startup)
|
||||
#define STARTUP_DELAY_TIME 1500
|
||||
#define STARTUP_DELAY_TIME 1500
|
||||
|
||||
#define MOUSE_TIMER_ID 1
|
||||
#define MOUSE_TIMER_ID 1
|
||||
|
||||
#define NUM_BITMAP_BUTTONS 10
|
||||
#define NUM_BITMAP_BUTTONS 10
|
||||
|
||||
|
||||
class CD3LaunchDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CD3LaunchDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CD3LaunchDlg(CWnd* pParent = NULL); // standard constructor
|
||||
bool MouseOverButton(CButton *button); // checks if mouse is over button
|
||||
void RedrawButton(CButton *button); // marks button region for redraw
|
||||
void RefreshDialog(void); // sets up launcher for new language
|
||||
bool SetLanguageDLL(int lang_type); // sets up the new language resource DLL
|
||||
CD3LaunchDlg(CWnd *pParent = NULL); // standard constructor
|
||||
bool MouseOverButton(CButton *button); // checks if mouse is over button
|
||||
void RedrawButton(CButton *button); // marks button region for redraw
|
||||
void RefreshDialog(void); // sets up launcher for new language
|
||||
bool SetLanguageDLL(int lang_type); // sets up the new language resource DLL
|
||||
|
||||
void PlaySound(LPSTR lpName, bool OnlyPlayIfActiveWnd, bool WaitUntilDone, bool WaitForStartup=TRUE); // Plays a sound
|
||||
void PlaySound(LPSTR lpName, bool OnlyPlayIfActiveWnd, bool WaitUntilDone,
|
||||
bool WaitForStartup = TRUE); // Plays a sound
|
||||
|
||||
void HideButton(CBitmapButtonEx *button, bool mHide); // Hides (or un-hides) a button
|
||||
void HideButton(CBitmapButtonEx *button, bool mHide); // Hides (or un-hides) a button
|
||||
|
||||
void DisplayTournamentPrompt(void); // displays tournament contest web link prompt
|
||||
void DisplayTournamentPrompt(void); // displays tournament contest web link prompt
|
||||
|
||||
int launcher_get_CD_path(char *path, int prompt_for_cd, char *subdir);
|
||||
int find_cd_drive(char *subdir);
|
||||
int launcher_get_CD_path(char *path, int prompt_for_cd, char *subdir);
|
||||
int find_cd_drive(char *subdir);
|
||||
|
||||
void InstallDirectX(void); // runs DirectXSetup from CD#1
|
||||
void InstallDirectX(void); // runs DirectXSetup from CD#1
|
||||
|
||||
void RunOpenGLSetup(void); // runs the GLSetup executable from CD#1
|
||||
void RunOpenGLSetup(void); // runs the GLSetup executable from CD#1
|
||||
|
||||
//CDC m_dcMem; // Compatible memory DC for dialog
|
||||
//CBrush m_brush; // Handle of hollow brush
|
||||
//CBrush m_bkBrush; // Handle of background brush
|
||||
BITMAP m_bmInfo; // Bitmap info
|
||||
CPoint m_pt; // Position of bitmap
|
||||
CSize m_size; // Size of bitmap
|
||||
// CDC m_dcMem; // Compatible memory DC for dialog
|
||||
// CBrush m_brush; // Handle of hollow brush
|
||||
// CBrush m_bkBrush; // Handle of background brush
|
||||
BITMAP m_bmInfo; // Bitmap info
|
||||
CPoint m_pt; // Position of bitmap
|
||||
CSize m_size; // Size of bitmap
|
||||
|
||||
// Define all "pushable" bitmap buttons
|
||||
CBitmapButtonEx m_Buttons[NUM_BITMAP_BUTTONS];
|
||||
// Define all "pushable" bitmap buttons
|
||||
CBitmapButtonEx m_Buttons[NUM_BITMAP_BUTTONS];
|
||||
|
||||
// Keep blinking light bitmap separate
|
||||
CBitmapButtonEx m_Light;
|
||||
// Keep blinking light bitmap separate
|
||||
CBitmapButtonEx m_Light;
|
||||
|
||||
// Keep animation bitmap separate
|
||||
CBitmapButtonEx m_Anim;
|
||||
// Keep animation bitmap separate
|
||||
CBitmapButtonEx m_Anim;
|
||||
|
||||
// Timer ID variable
|
||||
UINT m_timerID;
|
||||
// Timer ID variable
|
||||
UINT m_timerID;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CD3LaunchDlg)
|
||||
enum { IDD = IDD_D3LAUNCH_DIALOG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CD3LaunchDlg)
|
||||
enum { IDD = IDD_D3LAUNCH_DIALOG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CD3LaunchDlg)
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CD3LaunchDlg)
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CD3LaunchDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnPaint();
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnBtnQuit();
|
||||
afx_msg void OnBtnSetup();
|
||||
afx_msg void OnBtnWebpage();
|
||||
afx_msg void OnBtnReadme();
|
||||
afx_msg void OnBtnPlay();
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnBtnUpdate();
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
afx_msg void OnBtnPxo();
|
||||
afx_msg void OnBtnUninstall();
|
||||
afx_msg void OnBtnLight();
|
||||
afx_msg void OnBtnDirectx();
|
||||
afx_msg BOOL OnQueryNewPalette();
|
||||
afx_msg void OnPaletteChanged( CWnd* pFocusWnd );
|
||||
afx_msg LONG OnStraightToSetup(UINT, LONG);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
virtual void OnOK();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CD3LaunchDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnPaint();
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnBtnQuit();
|
||||
afx_msg void OnBtnSetup();
|
||||
afx_msg void OnBtnWebpage();
|
||||
afx_msg void OnBtnReadme();
|
||||
afx_msg void OnBtnPlay();
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnBtnUpdate();
|
||||
afx_msg BOOL OnEraseBkgnd(CDC *pDC);
|
||||
afx_msg void OnBtnPxo();
|
||||
afx_msg void OnBtnUninstall();
|
||||
afx_msg void OnBtnLight();
|
||||
afx_msg void OnBtnDirectx();
|
||||
afx_msg BOOL OnQueryNewPalette();
|
||||
afx_msg void OnPaletteChanged(CWnd *pFocusWnd);
|
||||
afx_msg LONG OnStraightToSetup(UINT, LONG);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
virtual void OnOK();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CString szTitle;
|
||||
@@ -243,7 +243,7 @@ extern CD3LaunchDlg *pLaunchDlg;
|
||||
|
||||
// pass this message to myself when initializing if I should go straight to the
|
||||
// update dialog
|
||||
#define WM_STRAIGHT_TO_SETUP (WM_USER + 10)
|
||||
#define WM_STRAIGHT_TO_SETUP (WM_USER + 10)
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
@@ -78,152 +78,133 @@ extern HINSTANCE Dd_dll_handle;
|
||||
|
||||
IMPLEMENT_DYNCREATE(CDirectXTab, CPropertyPage)
|
||||
|
||||
CDirectXTab::CDirectXTab() : CPropertyPage(CDirectXTab::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDirectXTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CDirectXTab::CDirectXTab() : CPropertyPage(CDirectXTab::IDD) {
|
||||
//{{AFX_DATA_INIT(CDirectXTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
CDirectXTab::~CDirectXTab()
|
||||
{
|
||||
}
|
||||
CDirectXTab::~CDirectXTab() {}
|
||||
|
||||
void CDirectXTab::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDirectXTab)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
void CDirectXTab::DoDataExchange(CDataExchange *pDX) {
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDirectXTab)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDirectXTab, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CDirectXTab)
|
||||
ON_BN_CLICKED(IDC_GET_DX, OnGetDx)
|
||||
ON_MESSAGE(WM_COMMANDHELP,OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CDirectXTab)
|
||||
ON_BN_CLICKED(IDC_GET_DX, OnGetDx)
|
||||
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDirectXTab message handlers
|
||||
|
||||
BOOL CDirectXTab::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
BOOL CDirectXTab::OnInitDialog() {
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
LONG lResult;
|
||||
HKEY hKey = NULL;
|
||||
// TODO: Add extra initialization here
|
||||
LONG lResult;
|
||||
HKEY hKey = NULL;
|
||||
|
||||
if (Dd_dll_handle) {
|
||||
lResult = RegOpenKeyEx(
|
||||
HKEY_LOCAL_MACHINE, // Where it is
|
||||
"Software\\Microsoft\\DirectX", // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey // Location to store key
|
||||
);
|
||||
if (Dd_dll_handle) {
|
||||
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, // Where it is
|
||||
"Software\\Microsoft\\DirectX", // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey // Location to store key
|
||||
);
|
||||
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
char version[32];
|
||||
DWORD dwType, dwLen;
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
char version[32];
|
||||
DWORD dwType, dwLen;
|
||||
|
||||
dwLen = 32;
|
||||
lResult = RegQueryValueEx(
|
||||
hKey, // Handle to key
|
||||
"Version", // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *) version, // value to set
|
||||
&dwLen // How many bytes to set
|
||||
);
|
||||
dwLen = 32;
|
||||
lResult = RegQueryValueEx(hKey, // Handle to key
|
||||
"Version", // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)version, // value to set
|
||||
&dwLen // How many bytes to set
|
||||
);
|
||||
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
CString str;
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
CString str;
|
||||
|
||||
Dx_version = atoi(strstr(version, ".") + 1);
|
||||
str.Format("%d.x (%s)", Dx_version, version);
|
||||
GetDlgItem(IDC_DX_VERSION)->SetWindowText(str);
|
||||
Dx_version = atoi(strstr(version, ".") + 1);
|
||||
str.Format("%d.x (%s)", Dx_version, version);
|
||||
GetDlgItem(IDC_DX_VERSION)->SetWindowText(str);
|
||||
|
||||
} else {
|
||||
int val;
|
||||
DWORD dwType, dwLen;
|
||||
} else {
|
||||
int val;
|
||||
DWORD dwType, dwLen;
|
||||
|
||||
dwLen = 4;
|
||||
lResult = RegQueryValueEx(
|
||||
hKey, // Handle to key
|
||||
"InstalledVersion", // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *) &val, // value to set
|
||||
&dwLen // How many bytes to set
|
||||
);
|
||||
dwLen = 4;
|
||||
lResult = RegQueryValueEx(hKey, // Handle to key
|
||||
"InstalledVersion", // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&val, // value to set
|
||||
&dwLen // How many bytes to set
|
||||
);
|
||||
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
CString str;
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
CString str;
|
||||
|
||||
Dx_version = val;
|
||||
str.Format("%d.x", Dx_version);
|
||||
GetDlgItem(IDC_DX_VERSION)->SetWindowText(str);
|
||||
Dx_version = val;
|
||||
str.Format("%d.x", Dx_version);
|
||||
GetDlgItem(IDC_DX_VERSION)->SetWindowText(str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
if (Dx_version >= 6) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_DIRECTXTAB_OK);
|
||||
GetDlgItem(IDC_DX_STATUS)->SetWindowText(msg.GetBuffer(0));
|
||||
} else if (Dx_version >= 3) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_DIRECTXTAB_UPD_REC);
|
||||
GetDlgItem(IDC_DX_STATUS)->SetWindowText(msg.GetBuffer(0));
|
||||
}
|
||||
|
||||
if (Dx_version >= 6) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_DIRECTXTAB_OK);
|
||||
GetDlgItem(IDC_DX_STATUS)->SetWindowText(msg.GetBuffer(0));
|
||||
}
|
||||
else if (Dx_version >= 3) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_DIRECTXTAB_UPD_REC);
|
||||
GetDlgItem(IDC_DX_STATUS)->SetWindowText(msg.GetBuffer(0));
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
// Takes user to DirectX web page
|
||||
void CDirectXTab::OnGetDx()
|
||||
{
|
||||
url_launch("http://www.microsoft.com/directx/download.asp");
|
||||
void CDirectXTab::OnGetDx() { url_launch("http://www.microsoft.com/directx/download.asp"); }
|
||||
|
||||
void CDirectXTab::OnOK() {
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
|
||||
CPropertyPage::OnOK();
|
||||
}
|
||||
|
||||
|
||||
void CDirectXTab::OnOK()
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
|
||||
CPropertyPage::OnOK();
|
||||
}
|
||||
|
||||
BOOL CDirectXTab::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
BOOL CDirectXTab::OnHelpInfo(HELPINFO *pHelpInfo) {
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
CWaitCursor wc;
|
||||
help_launch(DIRECTXTAB_HELP);
|
||||
return 1;
|
||||
CWaitCursor wc;
|
||||
help_launch(DIRECTXTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Display the html help file
|
||||
afx_msg LRESULT CDirectXTab::OnCommandHelp(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
afx_msg LRESULT CDirectXTab::OnCommandHelp(WPARAM wParam, LPARAM lParam) {
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
help_launch(DIRECTXTAB_HELP);
|
||||
return 1;
|
||||
help_launch(DIRECTXTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnCommandHelp(wParam,lParam);
|
||||
return CPropertyPage::OnCommandHelp(wParam, lParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -50,43 +50,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDirectXTab dialog
|
||||
|
||||
class CDirectXTab : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CDirectXTab)
|
||||
class CDirectXTab : public CPropertyPage {
|
||||
DECLARE_DYNCREATE(CDirectXTab)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CDirectXTab();
|
||||
~CDirectXTab();
|
||||
CDirectXTab();
|
||||
~CDirectXTab();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDirectXTab)
|
||||
enum { IDD = IDD_PROPPAGE_DIRECTX };
|
||||
// NOTE - ClassWizard will add data members here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDirectXTab)
|
||||
enum { IDD = IDD_PROPPAGE_DIRECTX };
|
||||
// NOTE - ClassWizard will add data members here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDirectXTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDirectXTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDirectXTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnGetDx();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDirectXTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnGetDx();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// DriversDlg.cpp : implementation file
|
||||
//
|
||||
@@ -32,66 +32,57 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDriversDlg dialog
|
||||
|
||||
|
||||
CDriversDlg::CDriversDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CDriversDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDriversDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
m_Selection=INSTALL_NONE;
|
||||
CDriversDlg::CDriversDlg(CWnd *pParent /*=NULL*/) : CDialog(CDriversDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CDriversDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
m_Selection = INSTALL_NONE;
|
||||
}
|
||||
|
||||
|
||||
void CDriversDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDriversDlg)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
void CDriversDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDriversDlg)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDriversDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CDriversDlg)
|
||||
ON_BN_CLICKED(IDC_DIRECTX_BUTTON, OnDirectxButton)
|
||||
ON_BN_CLICKED(IDC_GLSETUP_BUTTON, OnGlsetupButton)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CDriversDlg)
|
||||
ON_BN_CLICKED(IDC_DIRECTX_BUTTON, OnDirectxButton)
|
||||
ON_BN_CLICKED(IDC_GLSETUP_BUTTON, OnGlsetupButton)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDriversDlg message handlers
|
||||
|
||||
BOOL CDriversDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
BOOL CDriversDlg::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
m_Selection=INSTALL_NONE;
|
||||
m_Selection = INSTALL_NONE;
|
||||
|
||||
#if (defined(OEM_VOODOO3) || defined(DISABLE_GLSETUP))
|
||||
CWnd *button;
|
||||
button=GetDlgItem(IDC_GLSETUP_BUTTON);
|
||||
if(button!=NULL) button->EnableWindow(FALSE);
|
||||
CWnd *button;
|
||||
button = GetDlgItem(IDC_GLSETUP_BUTTON);
|
||||
if (button != NULL)
|
||||
button->EnableWindow(FALSE);
|
||||
#endif
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CDriversDlg::OnDirectxButton()
|
||||
{
|
||||
m_Selection=INSTALL_DIRECTX;
|
||||
CDialog::OnOK();
|
||||
void CDriversDlg::OnDirectxButton() {
|
||||
m_Selection = INSTALL_DIRECTX;
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CDriversDlg::OnGlsetupButton()
|
||||
{
|
||||
m_Selection=INSTALL_GLSETUP;
|
||||
CDialog::OnOK();
|
||||
void CDriversDlg::OnGlsetupButton() {
|
||||
m_Selection = INSTALL_GLSETUP;
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CDriversDlg::OnOK()
|
||||
{
|
||||
m_Selection=INSTALL_NONE;
|
||||
CDialog::OnOK();
|
||||
void CDriversDlg::OnOK() {
|
||||
m_Selection = INSTALL_NONE;
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_DRIVERSDLG_H__0325ACC0_CC01_11D2_A4E0_00A0C96ED60D__INCLUDED_)
|
||||
#define AFX_DRIVERSDLG_H__0325ACC0_CC01_11D2_A4E0_00A0C96ED60D__INCLUDED_
|
||||
@@ -25,48 +25,44 @@
|
||||
// DriversDlg.h : header file
|
||||
//
|
||||
|
||||
|
||||
// Installation selections
|
||||
#define INSTALL_NONE 0
|
||||
#define INSTALL_DIRECTX 1
|
||||
#define INSTALL_GLSETUP 2
|
||||
#define INSTALL_NONE 0
|
||||
#define INSTALL_DIRECTX 1
|
||||
#define INSTALL_GLSETUP 2
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDriversDlg dialog
|
||||
|
||||
class CDriversDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CDriversDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CDriversDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CDriversDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
int m_Selection;
|
||||
int m_Selection;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDriversDlg)
|
||||
enum { IDD = IDD_DRIVERS_DIALOG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDriversDlg)
|
||||
enum { IDD = IDD_DRIVERS_DIALOG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDriversDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDriversDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDriversDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDirectxButton();
|
||||
afx_msg void OnGlsetupButton();
|
||||
virtual void OnOK();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDriversDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDirectxButton();
|
||||
afx_msg void OnGlsetupButton();
|
||||
virtual void OnOK();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// FindFastDlg.cpp : implementation file
|
||||
//
|
||||
@@ -32,58 +32,48 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFindFastDlg dialog
|
||||
|
||||
|
||||
CFindFastDlg::CFindFastDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CFindFastDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CFindFastDlg)
|
||||
m_AlwaysTerminateFF = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
CFindFastDlg::CFindFastDlg(CWnd *pParent /*=NULL*/) : CDialog(CFindFastDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CFindFastDlg)
|
||||
m_AlwaysTerminateFF = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CFindFastDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CFindFastDlg)
|
||||
DDX_Check(pDX, IDC_FINDFASTCHKBOX, m_AlwaysTerminateFF);
|
||||
//}}AFX_DATA_MAP
|
||||
void CFindFastDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CFindFastDlg)
|
||||
DDX_Check(pDX, IDC_FINDFASTCHKBOX, m_AlwaysTerminateFF);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFindFastDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CFindFastDlg)
|
||||
ON_BN_CLICKED(IDC_FINDFASTCHKBOX, OnFindfastchkbox)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CFindFastDlg)
|
||||
ON_BN_CLICKED(IDC_FINDFASTCHKBOX, OnFindfastchkbox)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFindFastDlg message handlers
|
||||
|
||||
void CFindFastDlg::OnFindfastchkbox()
|
||||
{
|
||||
CButton *chkbox = (CButton *)GetDlgItem(IDC_FINDFASTCHKBOX);
|
||||
CButton *no_btn = (CButton *)GetDlgItem(IDCANCEL);
|
||||
void CFindFastDlg::OnFindfastchkbox() {
|
||||
CButton *chkbox = (CButton *)GetDlgItem(IDC_FINDFASTCHKBOX);
|
||||
CButton *no_btn = (CButton *)GetDlgItem(IDCANCEL);
|
||||
|
||||
if (chkbox->GetCheck() == 1) {
|
||||
no_btn->EnableWindow(FALSE);
|
||||
}
|
||||
else {
|
||||
no_btn->EnableWindow(TRUE);
|
||||
}
|
||||
if (chkbox->GetCheck() == 1) {
|
||||
no_btn->EnableWindow(FALSE);
|
||||
} else {
|
||||
no_btn->EnableWindow(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CFindFastDlg::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
BOOL CFindFastDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
CButton *no_btn = (CButton *)GetDlgItem(IDCANCEL);
|
||||
|
||||
CButton *no_btn = (CButton *)GetDlgItem(IDCANCEL);
|
||||
if (m_AlwaysTerminateFF) {
|
||||
no_btn->EnableWindow(FALSE); // this should never happen anyway, but just in case.
|
||||
}
|
||||
|
||||
if (m_AlwaysTerminateFF) {
|
||||
no_btn->EnableWindow(FALSE); // this should never happen anyway, but just in case.
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_FINDFASTDLG_H__261D1580_0FD4_11D3_AF2D_00A0C94B8467__INCLUDED_)
|
||||
#define AFX_FINDFASTDLG_H__261D1580_0FD4_11D3_AF2D_00A0C94B8467__INCLUDED_
|
||||
@@ -28,35 +28,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFindFastDlg dialog
|
||||
|
||||
class CFindFastDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CFindFastDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CFindFastDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CFindFastDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CFindFastDlg)
|
||||
enum { IDD = IDD_FINDFASTDLG };
|
||||
BOOL m_AlwaysTerminateFF;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CFindFastDlg)
|
||||
enum { IDD = IDD_FINDFASTDLG };
|
||||
BOOL m_AlwaysTerminateFF;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CFindFastDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CFindFastDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CFindFastDlg)
|
||||
afx_msg void OnFindfastchkbox();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CFindFastDlg)
|
||||
afx_msg void OnFindfastchkbox();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -51,76 +51,60 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGLSetupDlg dialog
|
||||
|
||||
|
||||
CGLSetupDlg::CGLSetupDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CGLSetupDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CGLSetupDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CGLSetupDlg::CGLSetupDlg(CWnd *pParent /*=NULL*/) : CDialog(CGLSetupDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CGLSetupDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CGLSetupDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CGLSetupDlg)
|
||||
DDX_Control(pDX, IDC_INSTALL_BUTTON, m_InstallButton);
|
||||
DDX_Control(pDX, IDC_INFO3_STATIC, m_Info3Text);
|
||||
DDX_Control(pDX, IDC_INFO2_STATIC, m_Info2Text);
|
||||
DDX_Control(pDX, IDC_INFO_STATIC, m_Info1Text);
|
||||
//}}AFX_DATA_MAP
|
||||
void CGLSetupDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CGLSetupDlg)
|
||||
DDX_Control(pDX, IDC_INSTALL_BUTTON, m_InstallButton);
|
||||
DDX_Control(pDX, IDC_INFO3_STATIC, m_Info3Text);
|
||||
DDX_Control(pDX, IDC_INFO2_STATIC, m_Info2Text);
|
||||
DDX_Control(pDX, IDC_INFO_STATIC, m_Info1Text);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGLSetupDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CGLSetupDlg)
|
||||
ON_BN_CLICKED(IDC_INSTALL_BUTTON, OnInstallButton)
|
||||
ON_BN_CLICKED(IDC_VISIT_BUTTON, OnVisitButton)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CGLSetupDlg)
|
||||
ON_BN_CLICKED(IDC_INSTALL_BUTTON, OnInstallButton)
|
||||
ON_BN_CLICKED(IDC_VISIT_BUTTON, OnVisitButton)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGLSetupDlg message handlers
|
||||
|
||||
BOOL CGLSetupDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
BOOL CGLSetupDlg::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// Check the system date, if it is after July 1999, the beta has expired
|
||||
bool beta_expired=FALSE;
|
||||
SYSTEMTIME sys_time;
|
||||
// Check the system date, if it is after July 1999, the beta has expired
|
||||
bool beta_expired = FALSE;
|
||||
SYSTEMTIME sys_time;
|
||||
|
||||
GetSystemTime(&sys_time);
|
||||
if(sys_time.wYear>1999)
|
||||
beta_expired=TRUE;
|
||||
else if(sys_time.wYear==1999 && sys_time.wMonth>7)
|
||||
beta_expired=TRUE;
|
||||
GetSystemTime(&sys_time);
|
||||
if (sys_time.wYear > 1999)
|
||||
beta_expired = TRUE;
|
||||
else if (sys_time.wYear == 1999 && sys_time.wMonth > 7)
|
||||
beta_expired = TRUE;
|
||||
|
||||
if(beta_expired) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_GLSETUP_EXPIRED_MSG);
|
||||
m_Info1Text.SetWindowText(msg.GetBuffer(0));
|
||||
m_Info2Text.SetWindowText("");
|
||||
m_Info3Text.SetWindowText("");
|
||||
m_InstallButton.EnableWindow(FALSE);
|
||||
}
|
||||
if (beta_expired) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_GLSETUP_EXPIRED_MSG);
|
||||
m_Info1Text.SetWindowText(msg.GetBuffer(0));
|
||||
m_Info2Text.SetWindowText("");
|
||||
m_Info3Text.SetWindowText("");
|
||||
m_InstallButton.EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CGLSetupDlg::OnInstallButton()
|
||||
{
|
||||
CDialog::OnOK();
|
||||
}
|
||||
void CGLSetupDlg::OnInstallButton() { CDialog::OnOK(); }
|
||||
|
||||
void CGLSetupDlg::OnVisitButton()
|
||||
{
|
||||
url_launch("http://www.glsetup.com/");
|
||||
}
|
||||
void CGLSetupDlg::OnVisitButton() { url_launch("http://www.glsetup.com/"); }
|
||||
|
||||
void CGLSetupDlg::OnCancel()
|
||||
{
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
void CGLSetupDlg::OnCancel() { CDialog::OnCancel(); }
|
||||
|
||||
@@ -45,40 +45,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGLSetupDlg dialog
|
||||
|
||||
class CGLSetupDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CGLSetupDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CGLSetupDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CGLSetupDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CGLSetupDlg)
|
||||
enum { IDD = IDD_GLSETUP_DIALOG };
|
||||
CButton m_InstallButton;
|
||||
CStatic m_Info3Text;
|
||||
CStatic m_Info2Text;
|
||||
CStatic m_Info1Text;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CGLSetupDlg)
|
||||
enum { IDD = IDD_GLSETUP_DIALOG };
|
||||
CButton m_InstallButton;
|
||||
CStatic m_Info3Text;
|
||||
CStatic m_Info2Text;
|
||||
CStatic m_Info1Text;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CGLSetupDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CGLSetupDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CGLSetupDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnInstallButton();
|
||||
afx_msg void OnVisitButton();
|
||||
virtual void OnCancel();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CGLSetupDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnInstallButton();
|
||||
afx_msg void OnVisitButton();
|
||||
virtual void OnCancel();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
@@ -32,8 +32,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
extern HRESULT A3dInitialize(void);
|
||||
extern void A3dUninitialize(void);
|
||||
extern HRESULT A3dCreate(GUID *,void **,IUnknown FAR *,DWORD);
|
||||
extern void A3dUninitialize(void);
|
||||
extern HRESULT A3dCreate(GUID *, void **, IUnknown FAR *, DWORD);
|
||||
extern HRESULT A3dRegister(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -62,62 +62,61 @@
|
||||
|
||||
#include "MsgDlg.h"
|
||||
|
||||
#define JOYSTICK_NONE_ID 99999
|
||||
#define MAX_NUM_JOYSTICKS 16
|
||||
#define JOYSTICK_NONE_ID 99999
|
||||
#define MAX_NUM_JOYSTICKS 16
|
||||
|
||||
struct JoystickData {
|
||||
int ID;
|
||||
char name[1024];
|
||||
bool FF_capable;
|
||||
int ID;
|
||||
char name[1024];
|
||||
bool FF_capable;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CJoystickTab dialog
|
||||
|
||||
class CJoystickTab : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CJoystickTab)
|
||||
class CJoystickTab : public CPropertyPage {
|
||||
DECLARE_DYNCREATE(CJoystickTab)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CJoystickTab();
|
||||
~CJoystickTab();
|
||||
CJoystickTab();
|
||||
~CJoystickTab();
|
||||
|
||||
CMsgDlg m_MsgDlg;
|
||||
CMsgDlg m_MsgDlg;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CJoystickTab)
|
||||
enum { IDD = IDD_PROPPAGE_JOYSTICK };
|
||||
CButton m_CHFlightEnabled;
|
||||
CButton m_MousemanEnabled;
|
||||
CComboBox m_joystick_list;
|
||||
CButton m_ff_enabled;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CJoystickTab)
|
||||
enum { IDD = IDD_PROPPAGE_JOYSTICK };
|
||||
CButton m_CHFlightEnabled;
|
||||
CButton m_MousemanEnabled;
|
||||
CComboBox m_joystick_list;
|
||||
CButton m_ff_enabled;
|
||||
//}}AFX_DATA
|
||||
|
||||
void DetectSticks();
|
||||
void DetectSticks();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CJoystickTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CJoystickTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CJoystickTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnBtnCalibrate();
|
||||
afx_msg void OnBtnDetect();
|
||||
afx_msg void OnSelchangeJoystickList();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CJoystickTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnBtnCalibrate();
|
||||
afx_msg void OnBtnDetect();
|
||||
afx_msg void OnSelchangeJoystickList();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -78,203 +78,195 @@
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define KEYBOARD_US "United States"
|
||||
#define KEYBOARD_FRENCH "French"
|
||||
#define KEYBOARD_GERMAN "German"
|
||||
#define KEYBOARD_US "United States"
|
||||
#define KEYBOARD_FRENCH "French"
|
||||
#define KEYBOARD_GERMAN "German"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CKeyboardTab property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CKeyboardTab, CPropertyPage)
|
||||
|
||||
CKeyboardTab::CKeyboardTab() : CPropertyPage(CKeyboardTab::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CKeyboardTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CKeyboardTab::CKeyboardTab() : CPropertyPage(CKeyboardTab::IDD) {
|
||||
//{{AFX_DATA_INIT(CKeyboardTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
CKeyboardTab::~CKeyboardTab()
|
||||
{
|
||||
}
|
||||
CKeyboardTab::~CKeyboardTab() {}
|
||||
|
||||
void CKeyboardTab::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CKeyboardTab)
|
||||
DDX_Control(pDX, IDC_FINDFAST_CHECK, m_FindFastCheck);
|
||||
DDX_Control(pDX, IDC_LANGUAGE_COMBO, m_LanguageCombo);
|
||||
DDX_Control(pDX, IDC_COMMANDLINE_EDIT, m_CommandLineEdit);
|
||||
//}}AFX_DATA_MAP
|
||||
void CKeyboardTab::DoDataExchange(CDataExchange *pDX) {
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CKeyboardTab)
|
||||
DDX_Control(pDX, IDC_FINDFAST_CHECK, m_FindFastCheck);
|
||||
DDX_Control(pDX, IDC_LANGUAGE_COMBO, m_LanguageCombo);
|
||||
DDX_Control(pDX, IDC_COMMANDLINE_EDIT, m_CommandLineEdit);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CKeyboardTab, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CKeyboardTab)
|
||||
ON_MESSAGE(WM_COMMANDHELP,OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CKeyboardTab)
|
||||
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CKeyboardTab message handlers
|
||||
|
||||
BOOL CKeyboardTab::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
BOOL CKeyboardTab::OnInitDialog() {
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
// Setup the language selection list
|
||||
int lang_id;
|
||||
// Setup the language selection list
|
||||
int lang_id;
|
||||
|
||||
AddLangToList(IDS_LANG_ENGLISH,LANGUAGE_ENGLISH);
|
||||
AddLangToList(IDS_LANG_ENGLISH, LANGUAGE_ENGLISH);
|
||||
#ifdef USE_MULTI_LANGUAGES
|
||||
AddLangToList(IDS_LANG_FRENCH,LANGUAGE_FRENCH);
|
||||
AddLangToList(IDS_LANG_GERMAN,LANGUAGE_GERMAN);
|
||||
AddLangToList(IDS_LANG_FRENCH, LANGUAGE_FRENCH);
|
||||
AddLangToList(IDS_LANG_GERMAN, LANGUAGE_GERMAN);
|
||||
#ifdef ENABLE_ITALIAN
|
||||
AddLangToList(IDS_LANG_ITALIAN,LANGUAGE_ITALIAN);
|
||||
AddLangToList(IDS_LANG_ITALIAN, LANGUAGE_ITALIAN);
|
||||
#endif
|
||||
AddLangToList(IDS_LANG_SPANISH,LANGUAGE_SPANISH);
|
||||
lang_id = os_config_read_uint(szSectionName, "LanguageType", LANGUAGE_ENGLISH);
|
||||
AddLangToList(IDS_LANG_SPANISH, LANGUAGE_SPANISH);
|
||||
lang_id = os_config_read_uint(szSectionName, "LanguageType", LANGUAGE_ENGLISH);
|
||||
#else
|
||||
lang_id = LANGUAGE_ENGLISH;
|
||||
lang_id = LANGUAGE_ENGLISH;
|
||||
#endif
|
||||
|
||||
SelectLangInList(lang_id);
|
||||
SelectLangInList(lang_id);
|
||||
|
||||
// Disable the language selection box
|
||||
if(!LanguageSelectionEnabled) {
|
||||
m_LanguageCombo.EnableWindow(FALSE);
|
||||
}
|
||||
// Disable the language selection box
|
||||
if (!LanguageSelectionEnabled) {
|
||||
m_LanguageCombo.EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
// Setup the keyboard type
|
||||
char *keyboard_type = KEYBOARD_US;
|
||||
keyboard_type = os_config_read_string(szSectionName, "KeyboardType", "");
|
||||
// Setup the keyboard type
|
||||
char *keyboard_type = KEYBOARD_US;
|
||||
keyboard_type = os_config_read_string(szSectionName, "KeyboardType", "");
|
||||
|
||||
if (!stricmp(keyboard_type, KEYBOARD_FRENCH))
|
||||
((CButton *) GetDlgItem(IDC_FRENCH_KEYBOARD))->SetCheck(1);
|
||||
else if (!stricmp(keyboard_type, KEYBOARD_GERMAN))
|
||||
((CButton *) GetDlgItem(IDC_GERMAN_KEYBOARD))->SetCheck(1);
|
||||
else {
|
||||
((CButton *) GetDlgItem(IDC_US_KEYBOARD))->SetCheck(1);
|
||||
}
|
||||
if (!stricmp(keyboard_type, KEYBOARD_FRENCH))
|
||||
((CButton *)GetDlgItem(IDC_FRENCH_KEYBOARD))->SetCheck(1);
|
||||
else if (!stricmp(keyboard_type, KEYBOARD_GERMAN))
|
||||
((CButton *)GetDlgItem(IDC_GERMAN_KEYBOARD))->SetCheck(1);
|
||||
else {
|
||||
((CButton *)GetDlgItem(IDC_US_KEYBOARD))->SetCheck(1);
|
||||
}
|
||||
|
||||
// Set the FindFast checkbox
|
||||
if(os_config_read_uint(szSectionName, "FindFastDisable",1))
|
||||
m_FindFastCheck.SetCheck(1);
|
||||
else
|
||||
m_FindFastCheck.SetCheck(0);
|
||||
// Set the FindFast checkbox
|
||||
if (os_config_read_uint(szSectionName, "FindFastDisable", 1))
|
||||
m_FindFastCheck.SetCheck(1);
|
||||
else
|
||||
m_FindFastCheck.SetCheck(0);
|
||||
|
||||
// Read the command line
|
||||
char *command_line;
|
||||
command_line = os_config_read_string(szSectionName, "CmdLineOptions", "");
|
||||
m_CommandLineEdit.SetWindowText(command_line);
|
||||
// Read the command line
|
||||
char *command_line;
|
||||
command_line = os_config_read_string(szSectionName, "CmdLineOptions", "");
|
||||
m_CommandLineEdit.SetWindowText(command_line);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CKeyboardTab::OnOK()
|
||||
{
|
||||
// Get the selected language
|
||||
int prev_lang_id, lang_id;
|
||||
lang_id=GetSelectedLangFromList();
|
||||
if(lang_id<0) lang_id=LANGUAGE_ENGLISH;
|
||||
void CKeyboardTab::OnOK() {
|
||||
// Get the selected language
|
||||
int prev_lang_id, lang_id;
|
||||
lang_id = GetSelectedLangFromList();
|
||||
if (lang_id < 0)
|
||||
lang_id = LANGUAGE_ENGLISH;
|
||||
|
||||
prev_lang_id=os_config_read_uint(szSectionName, "LanguageType", LANGUAGE_ENGLISH);
|
||||
if(prev_lang_id!=lang_id) NewLanguageSelected=TRUE;
|
||||
os_config_write_uint(szSectionName, "LanguageType", lang_id);
|
||||
prev_lang_id = os_config_read_uint(szSectionName, "LanguageType", LANGUAGE_ENGLISH);
|
||||
if (prev_lang_id != lang_id)
|
||||
NewLanguageSelected = TRUE;
|
||||
os_config_write_uint(szSectionName, "LanguageType", lang_id);
|
||||
|
||||
// Get the keyboard type
|
||||
char *keyboard_type = KEYBOARD_US;
|
||||
// Get the keyboard type
|
||||
char *keyboard_type = KEYBOARD_US;
|
||||
|
||||
if ( ((CButton *) GetDlgItem(IDC_FRENCH_KEYBOARD))->GetCheck() == 1 )
|
||||
keyboard_type = KEYBOARD_FRENCH;
|
||||
else if ( ((CButton *) GetDlgItem(IDC_GERMAN_KEYBOARD))->GetCheck() == 1 )
|
||||
keyboard_type = KEYBOARD_GERMAN;
|
||||
if (((CButton *)GetDlgItem(IDC_FRENCH_KEYBOARD))->GetCheck() == 1)
|
||||
keyboard_type = KEYBOARD_FRENCH;
|
||||
else if (((CButton *)GetDlgItem(IDC_GERMAN_KEYBOARD))->GetCheck() == 1)
|
||||
keyboard_type = KEYBOARD_GERMAN;
|
||||
|
||||
os_config_write_string(szSectionName, "KeyboardType", keyboard_type);
|
||||
os_config_write_string(szSectionName, "KeyboardType", keyboard_type);
|
||||
|
||||
// save the findfast checkbox setting
|
||||
if(m_FindFastCheck.GetCheck())
|
||||
os_config_write_uint(szSectionName, "FindFastDisable",1);
|
||||
else
|
||||
os_config_write_uint(szSectionName, "FindFastDisable",0);
|
||||
// save the findfast checkbox setting
|
||||
if (m_FindFastCheck.GetCheck())
|
||||
os_config_write_uint(szSectionName, "FindFastDisable", 1);
|
||||
else
|
||||
os_config_write_uint(szSectionName, "FindFastDisable", 0);
|
||||
|
||||
// write the command line
|
||||
CString command_line;
|
||||
m_CommandLineEdit.GetWindowText(command_line);
|
||||
os_config_write_string(szSectionName, "CmdLineOptions", command_line.GetBuffer(0));
|
||||
// write the command line
|
||||
CString command_line;
|
||||
m_CommandLineEdit.GetWindowText(command_line);
|
||||
os_config_write_string(szSectionName, "CmdLineOptions", command_line.GetBuffer(0));
|
||||
|
||||
CPropertyPage::OnOK();
|
||||
CPropertyPage::OnOK();
|
||||
}
|
||||
|
||||
BOOL CKeyboardTab::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
BOOL CKeyboardTab::OnHelpInfo(HELPINFO *pHelpInfo) {
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
CWaitCursor wc;
|
||||
help_launch(KEYBOARDTAB_HELP);
|
||||
return 1;
|
||||
CWaitCursor wc;
|
||||
help_launch(KEYBOARDTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Display the html help file
|
||||
afx_msg LRESULT CKeyboardTab::OnCommandHelp(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
afx_msg LRESULT CKeyboardTab::OnCommandHelp(WPARAM wParam, LPARAM lParam) {
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
help_launch(KEYBOARDTAB_HELP);
|
||||
return 1;
|
||||
help_launch(KEYBOARDTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnCommandHelp(wParam,lParam);
|
||||
return CPropertyPage::OnCommandHelp(wParam, lParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CKeyboardTab::AddLangToList(int stringID, int langID) {
|
||||
int index;
|
||||
CString lang_string;
|
||||
|
||||
bool CKeyboardTab::AddLangToList(int stringID, int langID)
|
||||
{
|
||||
int index;
|
||||
CString lang_string;
|
||||
if (!lang_string.LoadString(stringID))
|
||||
return FALSE;
|
||||
|
||||
if(!lang_string.LoadString(stringID)) return FALSE;
|
||||
index = m_LanguageCombo.AddString(lang_string.GetBuffer(0));
|
||||
if (index < 0)
|
||||
return FALSE;
|
||||
|
||||
index=m_LanguageCombo.AddString(lang_string.GetBuffer(0));
|
||||
if(index<0) return FALSE;
|
||||
if (m_LanguageCombo.SetItemData(index, langID) == CB_ERR)
|
||||
return FALSE;
|
||||
|
||||
if(m_LanguageCombo.SetItemData(index,langID)==CB_ERR) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CKeyboardTab::SelectLangInList(int langID) {
|
||||
int index, num_items;
|
||||
|
||||
bool CKeyboardTab::SelectLangInList(int langID)
|
||||
{
|
||||
int index, num_items;
|
||||
num_items = m_LanguageCombo.GetCount();
|
||||
for (index = 0; index < num_items; index++) {
|
||||
int data;
|
||||
data = m_LanguageCombo.GetItemData(index);
|
||||
if (data != CB_ERR && data == langID) {
|
||||
m_LanguageCombo.SetCurSel(index);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
num_items=m_LanguageCombo.GetCount();
|
||||
for(index=0;index<num_items;index++) {
|
||||
int data;
|
||||
data=m_LanguageCombo.GetItemData(index);
|
||||
if(data!=CB_ERR && data==langID) {
|
||||
m_LanguageCombo.SetCurSel(index);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CKeyboardTab::GetSelectedLangFromList(void) {
|
||||
int index, data;
|
||||
|
||||
int CKeyboardTab::GetSelectedLangFromList(void)
|
||||
{
|
||||
int index, data;
|
||||
index = m_LanguageCombo.GetCurSel();
|
||||
if (index < 0)
|
||||
return (-1);
|
||||
|
||||
index=m_LanguageCombo.GetCurSel();
|
||||
if(index<0) return(-1);
|
||||
data = m_LanguageCombo.GetItemData(index);
|
||||
if (data == CB_ERR)
|
||||
return (-1);
|
||||
|
||||
data=m_LanguageCombo.GetItemData(index);
|
||||
if(data==CB_ERR) return(-1);
|
||||
|
||||
return(data);
|
||||
return (data);
|
||||
}
|
||||
|
||||
@@ -56,47 +56,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CKeyboardTab dialog
|
||||
|
||||
class CKeyboardTab : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CKeyboardTab)
|
||||
class CKeyboardTab : public CPropertyPage {
|
||||
DECLARE_DYNCREATE(CKeyboardTab)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CKeyboardTab();
|
||||
~CKeyboardTab();
|
||||
CKeyboardTab();
|
||||
~CKeyboardTab();
|
||||
|
||||
bool AddLangToList(int stringID, int langID);
|
||||
bool SelectLangInList(int langID);
|
||||
int GetSelectedLangFromList(void);
|
||||
bool AddLangToList(int stringID, int langID);
|
||||
bool SelectLangInList(int langID);
|
||||
int GetSelectedLangFromList(void);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CKeyboardTab)
|
||||
enum { IDD = IDD_PROPPAGE_KEYBOARD };
|
||||
CButton m_FindFastCheck;
|
||||
CComboBox m_LanguageCombo;
|
||||
CEdit m_CommandLineEdit;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CKeyboardTab)
|
||||
enum { IDD = IDD_PROPPAGE_KEYBOARD };
|
||||
CButton m_FindFastCheck;
|
||||
CComboBox m_LanguageCombo;
|
||||
CEdit m_CommandLineEdit;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CKeyboardTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CKeyboardTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CKeyboardTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CKeyboardTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Label.cpp : implementation file
|
||||
//
|
||||
@@ -32,258 +32,223 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLabel
|
||||
|
||||
CLabel::CLabel()
|
||||
{
|
||||
m_crText = GetSysColor(COLOR_WINDOWTEXT);
|
||||
m_hBrush = ::CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
||||
CLabel::CLabel() {
|
||||
m_crText = GetSysColor(COLOR_WINDOWTEXT);
|
||||
m_hBrush = ::CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
||||
|
||||
::GetObject((HFONT)GetStockObject(DEFAULT_GUI_FONT),sizeof(m_lf),&m_lf);
|
||||
::GetObject((HFONT)GetStockObject(DEFAULT_GUI_FONT), sizeof(m_lf), &m_lf);
|
||||
|
||||
m_font.CreateFontIndirect(&m_lf);
|
||||
m_bTimer = FALSE;
|
||||
m_bState = FALSE;
|
||||
m_bLink = TRUE;
|
||||
m_hCursor = NULL;
|
||||
m_Type = None;
|
||||
m_font.CreateFontIndirect(&m_lf);
|
||||
m_bTimer = FALSE;
|
||||
m_bState = FALSE;
|
||||
m_bLink = TRUE;
|
||||
m_hCursor = NULL;
|
||||
m_Type = None;
|
||||
|
||||
m_hwndBrush = ::CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
||||
m_hwndBrush = ::CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
||||
}
|
||||
|
||||
|
||||
CLabel::~CLabel()
|
||||
{
|
||||
m_font.DeleteObject();
|
||||
::DeleteObject(m_hBrush);
|
||||
CLabel::~CLabel() {
|
||||
m_font.DeleteObject();
|
||||
::DeleteObject(m_hBrush);
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetText(const CString& strText)
|
||||
{
|
||||
SetWindowText(strText);
|
||||
return *this;
|
||||
CLabel &CLabel::SetText(const CString &strText) {
|
||||
SetWindowText(strText);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetTextColor(COLORREF crText)
|
||||
{
|
||||
m_crText = crText;
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
CLabel &CLabel::SetTextColor(COLORREF crText) {
|
||||
m_crText = crText;
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetFontBold(BOOL bBold)
|
||||
{
|
||||
m_lf.lfWeight = bBold ? FW_BOLD : FW_NORMAL;
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
CLabel &CLabel::SetFontBold(BOOL bBold) {
|
||||
m_lf.lfWeight = bBold ? FW_BOLD : FW_NORMAL;
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetFontUnderline(BOOL bSet)
|
||||
{
|
||||
m_lf.lfUnderline = bSet;
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
CLabel &CLabel::SetFontUnderline(BOOL bSet) {
|
||||
m_lf.lfUnderline = bSet;
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetFontItalic(BOOL bSet)
|
||||
{
|
||||
m_lf.lfItalic = bSet;
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
CLabel &CLabel::SetFontItalic(BOOL bSet) {
|
||||
m_lf.lfItalic = bSet;
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetSunken(BOOL bSet)
|
||||
{
|
||||
if (!bSet)
|
||||
ModifyStyleEx(WS_EX_STATICEDGE,0,SWP_DRAWFRAME);
|
||||
else
|
||||
ModifyStyleEx(0,WS_EX_STATICEDGE,SWP_DRAWFRAME);
|
||||
CLabel &CLabel::SetSunken(BOOL bSet) {
|
||||
if (!bSet)
|
||||
ModifyStyleEx(WS_EX_STATICEDGE, 0, SWP_DRAWFRAME);
|
||||
else
|
||||
ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_DRAWFRAME);
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetBorder(BOOL bSet)
|
||||
{
|
||||
if (!bSet)
|
||||
ModifyStyle(WS_BORDER,0,SWP_DRAWFRAME);
|
||||
else
|
||||
ModifyStyle(0,WS_BORDER,SWP_DRAWFRAME);
|
||||
CLabel &CLabel::SetBorder(BOOL bSet) {
|
||||
if (!bSet)
|
||||
ModifyStyle(WS_BORDER, 0, SWP_DRAWFRAME);
|
||||
else
|
||||
ModifyStyle(0, WS_BORDER, SWP_DRAWFRAME);
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetFontSize(int nSize)
|
||||
{
|
||||
nSize*=-1;
|
||||
m_lf.lfHeight = nSize;
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
CLabel &CLabel::SetFontSize(int nSize) {
|
||||
nSize *= -1;
|
||||
m_lf.lfHeight = nSize;
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel &CLabel::SetBkColor(COLORREF crBkgnd) {
|
||||
if (m_hBrush)
|
||||
::DeleteObject(m_hBrush);
|
||||
|
||||
CLabel& CLabel::SetBkColor(COLORREF crBkgnd)
|
||||
{
|
||||
if (m_hBrush)
|
||||
::DeleteObject(m_hBrush);
|
||||
|
||||
m_hBrush = ::CreateSolidBrush(crBkgnd);
|
||||
return *this;
|
||||
m_hBrush = ::CreateSolidBrush(crBkgnd);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetFontName(const CString& strFont)
|
||||
{
|
||||
strcpy(m_lf.lfFaceName,strFont);
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
CLabel &CLabel::SetFontName(const CString &strFont) {
|
||||
strcpy(m_lf.lfFaceName, strFont);
|
||||
ReconstructFont();
|
||||
RedrawWindow();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CLabel, CStatic)
|
||||
//{{AFX_MSG_MAP(CLabel)
|
||||
ON_WM_CTLCOLOR_REFLECT()
|
||||
ON_WM_TIMER()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_SETCURSOR()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CLabel)
|
||||
ON_WM_CTLCOLOR_REFLECT()
|
||||
ON_WM_TIMER()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_SETCURSOR()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLabel message handlers
|
||||
|
||||
HBRUSH CLabel::CtlColor(CDC* pDC, UINT nCtlColor)
|
||||
{
|
||||
// TODO: Change any attributes of the DC here
|
||||
HBRUSH CLabel::CtlColor(CDC *pDC, UINT nCtlColor) {
|
||||
// TODO: Change any attributes of the DC here
|
||||
|
||||
// TODO: Return a non-NULL brush if the parent's handler should not be called
|
||||
// TODO: Return a non-NULL brush if the parent's handler should not be called
|
||||
|
||||
if (CTLCOLOR_STATIC == nCtlColor)
|
||||
{
|
||||
pDC->SelectObject(&m_font);
|
||||
pDC->SetTextColor(m_crText);
|
||||
pDC->SetBkMode(TRANSPARENT);
|
||||
}
|
||||
if (CTLCOLOR_STATIC == nCtlColor) {
|
||||
pDC->SelectObject(&m_font);
|
||||
pDC->SetTextColor(m_crText);
|
||||
pDC->SetBkMode(TRANSPARENT);
|
||||
}
|
||||
|
||||
if (m_Type == Background) {
|
||||
if (!m_bState)
|
||||
return m_hwndBrush;
|
||||
}
|
||||
|
||||
if (m_Type == Background)
|
||||
{
|
||||
if (!m_bState)
|
||||
return m_hwndBrush;
|
||||
}
|
||||
|
||||
return m_hBrush;
|
||||
return m_hBrush;
|
||||
}
|
||||
|
||||
void CLabel::ReconstructFont()
|
||||
{
|
||||
m_font.DeleteObject();
|
||||
BOOL bCreated = m_font.CreateFontIndirect(&m_lf);
|
||||
void CLabel::ReconstructFont() {
|
||||
m_font.DeleteObject();
|
||||
BOOL bCreated = m_font.CreateFontIndirect(&m_lf);
|
||||
|
||||
ASSERT(bCreated);
|
||||
ASSERT(bCreated);
|
||||
}
|
||||
|
||||
CLabel &CLabel::FlashText(BOOL bActivate) {
|
||||
if (m_bTimer) {
|
||||
SetWindowText(m_strText);
|
||||
KillTimer(1);
|
||||
}
|
||||
|
||||
CLabel& CLabel::FlashText(BOOL bActivate)
|
||||
{
|
||||
if (m_bTimer)
|
||||
{
|
||||
SetWindowText(m_strText);
|
||||
KillTimer(1);
|
||||
}
|
||||
if (bActivate) {
|
||||
GetWindowText(m_strText);
|
||||
m_bState = FALSE;
|
||||
|
||||
if (bActivate)
|
||||
{
|
||||
GetWindowText(m_strText);
|
||||
m_bState = FALSE;
|
||||
m_bTimer = TRUE;
|
||||
SetTimer(1, 500, NULL);
|
||||
m_Type = Text;
|
||||
}
|
||||
|
||||
m_bTimer = TRUE;
|
||||
SetTimer(1,500,NULL);
|
||||
m_Type = Text;
|
||||
}
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CLabel& CLabel::FlashBackground(BOOL bActivate)
|
||||
{
|
||||
CLabel &CLabel::FlashBackground(BOOL bActivate) {
|
||||
|
||||
if (m_bTimer)
|
||||
KillTimer(1);
|
||||
if (m_bTimer)
|
||||
KillTimer(1);
|
||||
|
||||
if (bActivate)
|
||||
{
|
||||
m_bState = FALSE;
|
||||
if (bActivate) {
|
||||
m_bState = FALSE;
|
||||
|
||||
m_bTimer = TRUE;
|
||||
SetTimer(1,500,NULL);
|
||||
m_bTimer = TRUE;
|
||||
SetTimer(1, 500, NULL);
|
||||
|
||||
m_Type = Background;
|
||||
}
|
||||
m_Type = Background;
|
||||
}
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CLabel::OnTimer(UINT nIDEvent) {
|
||||
m_bState = !m_bState;
|
||||
|
||||
void CLabel::OnTimer(UINT nIDEvent)
|
||||
{
|
||||
m_bState = !m_bState;
|
||||
switch (m_Type) {
|
||||
case Text:
|
||||
if (m_bState)
|
||||
SetWindowText("");
|
||||
else
|
||||
SetWindowText(m_strText);
|
||||
break;
|
||||
|
||||
switch (m_Type)
|
||||
{
|
||||
case Text:
|
||||
if (m_bState)
|
||||
SetWindowText("");
|
||||
else
|
||||
SetWindowText(m_strText);
|
||||
break;
|
||||
case Background:
|
||||
InvalidateRect(NULL, FALSE);
|
||||
UpdateWindow();
|
||||
break;
|
||||
}
|
||||
|
||||
case Background:
|
||||
InvalidateRect(NULL,FALSE);
|
||||
UpdateWindow();
|
||||
break;
|
||||
}
|
||||
|
||||
CStatic::OnTimer(nIDEvent);
|
||||
CStatic::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetLink(BOOL bLink)
|
||||
{
|
||||
m_bLink = bLink;
|
||||
CLabel &CLabel::SetLink(BOOL bLink) {
|
||||
m_bLink = bLink;
|
||||
|
||||
if (bLink)
|
||||
ModifyStyle(0,SS_NOTIFY);
|
||||
else
|
||||
ModifyStyle(SS_NOTIFY,0);
|
||||
if (bLink)
|
||||
ModifyStyle(0, SS_NOTIFY);
|
||||
else
|
||||
ModifyStyle(SS_NOTIFY, 0);
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CLabel::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
CString strLink;
|
||||
void CLabel::OnLButtonDown(UINT nFlags, CPoint point) {
|
||||
CString strLink;
|
||||
|
||||
GetWindowText(strLink);
|
||||
ShellExecute(NULL,"open",strLink,NULL,NULL,SW_SHOWNORMAL);
|
||||
GetWindowText(strLink);
|
||||
ShellExecute(NULL, "open", strLink, NULL, NULL, SW_SHOWNORMAL);
|
||||
|
||||
CStatic::OnLButtonDown(nFlags, point);
|
||||
CStatic::OnLButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
BOOL CLabel::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
|
||||
{
|
||||
if (m_hCursor)
|
||||
{
|
||||
::SetCursor(m_hCursor);
|
||||
return TRUE;
|
||||
}
|
||||
BOOL CLabel::OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) {
|
||||
if (m_hCursor) {
|
||||
::SetCursor(m_hCursor);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return CStatic::OnSetCursor(pWnd, nHitTest, message);
|
||||
return CStatic::OnSetCursor(pWnd, nHitTest, message);
|
||||
}
|
||||
|
||||
CLabel& CLabel::SetLinkCursor(HCURSOR hCursor)
|
||||
{
|
||||
m_hCursor = hCursor;
|
||||
return *this;
|
||||
CLabel &CLabel::SetLinkCursor(HCURSOR hCursor) {
|
||||
m_hCursor = hCursor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_LABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
|
||||
#define AFX_LABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_
|
||||
@@ -27,64 +27,63 @@
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLabel window
|
||||
enum FlashType {None, Text, Background };
|
||||
enum FlashType { None, Text, Background };
|
||||
|
||||
class CLabel : public CStatic
|
||||
{
|
||||
// Construction
|
||||
class CLabel : public CStatic {
|
||||
// Construction
|
||||
public:
|
||||
CLabel();
|
||||
CLabel& SetBkColor(COLORREF crBkgnd);
|
||||
CLabel& SetTextColor(COLORREF crText);
|
||||
CLabel& SetText(const CString& strText);
|
||||
CLabel& SetFontBold(BOOL bBold);
|
||||
CLabel& SetFontName(const CString& strFont);
|
||||
CLabel& SetFontUnderline(BOOL bSet);
|
||||
CLabel& SetFontItalic(BOOL bSet);
|
||||
CLabel& SetFontSize(int nSize);
|
||||
CLabel& SetSunken(BOOL bSet);
|
||||
CLabel& SetBorder(BOOL bSet);
|
||||
CLabel& FlashText(BOOL bActivate);
|
||||
CLabel& FlashBackground(BOOL bActivate);
|
||||
CLabel& SetLink(BOOL bLink);
|
||||
CLabel& SetLinkCursor(HCURSOR hCursor);
|
||||
CLabel();
|
||||
CLabel &SetBkColor(COLORREF crBkgnd);
|
||||
CLabel &SetTextColor(COLORREF crText);
|
||||
CLabel &SetText(const CString &strText);
|
||||
CLabel &SetFontBold(BOOL bBold);
|
||||
CLabel &SetFontName(const CString &strFont);
|
||||
CLabel &SetFontUnderline(BOOL bSet);
|
||||
CLabel &SetFontItalic(BOOL bSet);
|
||||
CLabel &SetFontSize(int nSize);
|
||||
CLabel &SetSunken(BOOL bSet);
|
||||
CLabel &SetBorder(BOOL bSet);
|
||||
CLabel &FlashText(BOOL bActivate);
|
||||
CLabel &FlashBackground(BOOL bActivate);
|
||||
CLabel &SetLink(BOOL bLink);
|
||||
CLabel &SetLinkCursor(HCURSOR hCursor);
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
public:
|
||||
protected:
|
||||
void ReconstructFont();
|
||||
COLORREF m_crText;
|
||||
HBRUSH m_hBrush;
|
||||
HBRUSH m_hwndBrush;
|
||||
LOGFONT m_lf;
|
||||
CFont m_font;
|
||||
CString m_strText;
|
||||
BOOL m_bState;
|
||||
BOOL m_bTimer;
|
||||
BOOL m_bLink;
|
||||
FlashType m_Type;
|
||||
HCURSOR m_hCursor;
|
||||
// Operations
|
||||
void ReconstructFont();
|
||||
COLORREF m_crText;
|
||||
HBRUSH m_hBrush;
|
||||
HBRUSH m_hwndBrush;
|
||||
LOGFONT m_lf;
|
||||
CFont m_font;
|
||||
CString m_strText;
|
||||
BOOL m_bState;
|
||||
BOOL m_bTimer;
|
||||
BOOL m_bLink;
|
||||
FlashType m_Type;
|
||||
HCURSOR m_hCursor;
|
||||
// Operations
|
||||
public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CLabel)
|
||||
//}}AFX_VIRTUAL
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CLabel)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CLabel();
|
||||
virtual ~CLabel();
|
||||
|
||||
// Generated message map functions
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CLabel)
|
||||
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
|
||||
//}}AFX_MSG
|
||||
//{{AFX_MSG(CLabel)
|
||||
afx_msg HBRUSH CtlColor(CDC *pDC, UINT nCtlColor);
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg BOOL OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -95,185 +95,185 @@
|
||||
#define LAUNCHNAMES_H
|
||||
|
||||
// Localization defines
|
||||
#define LANGUAGE_ENGLISH 0
|
||||
#define LANGUAGE_GERMAN 1
|
||||
#define LANGUAGE_SPANISH 2
|
||||
#define LANGUAGE_ITALIAN 3
|
||||
#define LANGUAGE_FRENCH 4
|
||||
#define LANGUAGE_ENGLISH 0
|
||||
#define LANGUAGE_GERMAN 1
|
||||
#define LANGUAGE_SPANISH 2
|
||||
#define LANGUAGE_ITALIAN 3
|
||||
#define LANGUAGE_FRENCH 4
|
||||
|
||||
// Launcher's satellite resource DLL's
|
||||
#define FRENCH_RESOURCE_DLL "language\\launcher\\D3Launch_FRN.dll"
|
||||
#define GERMAN_RESOURCE_DLL "language\\launcher\\D3Launch_GER.dll"
|
||||
#define ITALIAN_RESOURCE_DLL "language\\launcher\\D3Launch_ITN.dll"
|
||||
#define SPANISH_RESOURCE_DLL "language\\launcher\\D3Launch_SPN.dll"
|
||||
#define FRENCH_RESOURCE_DLL "language\\launcher\\D3Launch_FRN.dll"
|
||||
#define GERMAN_RESOURCE_DLL "language\\launcher\\D3Launch_GER.dll"
|
||||
#define ITALIAN_RESOURCE_DLL "language\\launcher\\D3Launch_ITN.dll"
|
||||
#define SPANISH_RESOURCE_DLL "language\\launcher\\D3Launch_SPN.dll"
|
||||
|
||||
// LauncherUpdater's satellite resource DLL's
|
||||
#define LU_FRENCH_RES_DLL "language\\lnchupdr\\lnchupdr_FRN.dll"
|
||||
#define LU_GERMAN_RES_DLL "language\\lnchupdr\\lnchupdr_GER.dll"
|
||||
#define LU_ITALIAN_RES_DLL "language\\lnchupdr\\lnchupdr_ITN.dll"
|
||||
#define LU_SPANISH_RES_DLL "language\\lnchupdr\\lnchupdr_SPN.dll"
|
||||
#define LU_FRENCH_RES_DLL "language\\lnchupdr\\lnchupdr_FRN.dll"
|
||||
#define LU_GERMAN_RES_DLL "language\\lnchupdr\\lnchupdr_GER.dll"
|
||||
#define LU_ITALIAN_RES_DLL "language\\lnchupdr\\lnchupdr_ITN.dll"
|
||||
#define LU_SPANISH_RES_DLL "language\\lnchupdr\\lnchupdr_SPN.dll"
|
||||
|
||||
// Launcher help file info
|
||||
#define LANGUAGE_HELP_PATH "language\\launcher\\hlp\\"
|
||||
#define LANGUAGE_HELP_PATH "language\\launcher\\hlp\\"
|
||||
|
||||
// Language identification extensions
|
||||
#define FRENCH_EXT "_FRN"
|
||||
#define GERMAN_EXT "_GER"
|
||||
#define ITALIAN_EXT "_ITN"
|
||||
#define SPANISH_EXT "_SPN"
|
||||
#define FRENCH_EXT "_FRN"
|
||||
#define GERMAN_EXT "_GER"
|
||||
#define ITALIAN_EXT "_ITN"
|
||||
#define SPANISH_EXT "_SPN"
|
||||
|
||||
// Launcher config file info
|
||||
#define LANGUAGE_LAUNCHER_PATH "language\\launcher\\"
|
||||
#define LAUNCHER_CONFIG_FNAME "d3launch.cfg"
|
||||
#define LANGUAGE_LAUNCHER_PATH "language\\launcher\\"
|
||||
#define LAUNCHER_CONFIG_FNAME "d3launch.cfg"
|
||||
|
||||
// Readme file info
|
||||
#define LANGUAGE_README_PATH "language\\readmes\\"
|
||||
#define README_CONFIG_FNAME "d3rmv.cfg"
|
||||
#define LANGUAGE_README_PATH "language\\readmes\\"
|
||||
#define README_CONFIG_FNAME "d3rmv.cfg"
|
||||
|
||||
// The Mutex identification name for the D3 Launcher process
|
||||
#define D3_LAUNCHER_MUTEX_NAME "D3LauncherMutexName"
|
||||
#define D3_LAUNCHER_MUTEX_NAME "D3LauncherMutexName"
|
||||
|
||||
// The filename of .RTPatch DLL
|
||||
#define PATCH_DLL_FNAME "patchw32.dll"
|
||||
#define PATCH_DLL_FNAME "patchw32.dll"
|
||||
|
||||
// The CD volume names
|
||||
#if defined(DEMO)
|
||||
#define CD1_VOLUME_NAME "D3DEMO_1"
|
||||
#define CD2_VOLUME_NAME "D3DEMO_2"
|
||||
#define CD1_VOLUME_NAME "D3DEMO_1"
|
||||
#define CD2_VOLUME_NAME "D3DEMO_2"
|
||||
#elif defined(DEMO2)
|
||||
#define CD1_VOLUME_NAME "D3DEMO_1"
|
||||
#define CD2_VOLUME_NAME "D3DEMO_2"
|
||||
#define CD1_VOLUME_NAME "D3DEMO_1"
|
||||
#define CD2_VOLUME_NAME "D3DEMO_2"
|
||||
#elif defined(OEM_GENERIC)
|
||||
#define CD1_VOLUME_NAME "D3OEM_1"
|
||||
#define CD2_VOLUME_NAME "D3OEM_2"
|
||||
#define CD1_VOLUME_NAME "D3OEM_1"
|
||||
#define CD2_VOLUME_NAME "D3OEM_2"
|
||||
#elif defined(OEM_VOODOO3)
|
||||
#define CD1_VOLUME_NAME "D3OEM_1"
|
||||
#define CD2_VOLUME_NAME "D3OEM_2"
|
||||
#define CD1_VOLUME_NAME "D3OEM_1"
|
||||
#define CD2_VOLUME_NAME "D3OEM_2"
|
||||
#elif defined(OEM_KATMAI)
|
||||
#define CD1_VOLUME_NAME "D3OEM_1"
|
||||
#define CD2_VOLUME_NAME "D3OEM_2"
|
||||
#define CD1_VOLUME_NAME "D3OEM_1"
|
||||
#define CD2_VOLUME_NAME "D3OEM_2"
|
||||
#else
|
||||
#define CD1_VOLUME_NAME "D3_1"
|
||||
#define CD2_VOLUME_NAME "D3_2"
|
||||
#define CD1_VOLUME_NAME "D3_1"
|
||||
#define CD2_VOLUME_NAME "D3_2"
|
||||
#endif
|
||||
|
||||
// The filename of the ReadmeViewer
|
||||
#define README_VIEWER_FNAME "ReadmeViewer.exe"
|
||||
#define README_VIEWER_FNAME "ReadmeViewer.exe"
|
||||
|
||||
// The filename of the Launcher executable (and help files)
|
||||
#if defined(DEMO)
|
||||
#define LAUNCHER_FNAME "Descent 3 Demo.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 Demo.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 Demo.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 DEMO.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 DEMO.FTS"
|
||||
#define LAUNCHER_FNAME "Descent 3 Demo.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 Demo.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 Demo.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 DEMO.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 DEMO.FTS"
|
||||
#elif defined(DEMO2)
|
||||
#define LAUNCHER_FNAME "Descent 3 Demo 2.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 Demo 2.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 Demo 2.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 DEMO 2.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 DEMO 2.FTS"
|
||||
#define LAUNCHER_FNAME "Descent 3 Demo 2.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 Demo 2.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 Demo 2.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 DEMO 2.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 DEMO 2.FTS"
|
||||
#elif defined(OEM_GENERIC)
|
||||
#define LAUNCHER_FNAME "Descent 3 SOL ASCENT.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 SOL ASCENT.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 SOL ASCENT.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 SOL ASCENT.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 SOL ASCENT.FTS"
|
||||
#define LAUNCHER_FNAME "Descent 3 SOL ASCENT.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 SOL ASCENT.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 SOL ASCENT.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 SOL ASCENT.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 SOL ASCENT.FTS"
|
||||
#elif (defined(OEM_VOODOO3) && !defined(USE_ALL_VIDEO_OPTIONS))
|
||||
#define LAUNCHER_FNAME "Descent 3 SOL ASCENT for Voodoo3.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 SOL ASCENT for Voodoo3.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 SOL ASCENT for Voodoo3.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 SOL ASCENT FOR VOODOO3.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 SOL ASCENT FOR VOODOO3.FTS"
|
||||
#define LAUNCHER_FNAME "Descent 3 SOL ASCENT for Voodoo3.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 SOL ASCENT for Voodoo3.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 SOL ASCENT for Voodoo3.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 SOL ASCENT FOR VOODOO3.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 SOL ASCENT FOR VOODOO3.FTS"
|
||||
#elif (defined(OEM_VOODOO3) && defined(USE_ALL_VIDEO_OPTIONS))
|
||||
#define LAUNCHER_FNAME "Descent 3 SOL ASCENT.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 SOL ASCENT.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 SOL ASCENT.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 SOL ASCENT.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 SOL ASCENT.FTS"
|
||||
#define LAUNCHER_FNAME "Descent 3 SOL ASCENT.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 SOL ASCENT.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 SOL ASCENT.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 SOL ASCENT.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 SOL ASCENT.FTS"
|
||||
#elif defined(OEM_KATMAI)
|
||||
#define LAUNCHER_FNAME "Descent 3 SOL ASCENT for Pentium III.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 SOL ASCENT for Pentium III.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 SOL ASCENT for Pentium III.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 SOL ASCENT FOR PENTIUM III.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 SOL ASCENT FOR PENTIUM III.FTS"
|
||||
#define LAUNCHER_FNAME "Descent 3 SOL ASCENT for Pentium III.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3 SOL ASCENT for Pentium III.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3 SOL ASCENT for Pentium III.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3 SOL ASCENT FOR PENTIUM III.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3 SOL ASCENT FOR PENTIUM III.FTS"
|
||||
#else
|
||||
#define LAUNCHER_FNAME "Descent 3.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3.FTS"
|
||||
#define LAUNCHER_FNAME "Descent 3.exe"
|
||||
#define HELP_HLP_FNAME "Descent 3.hlp"
|
||||
#define HELP_CNT_FNAME "Descent 3.cnt"
|
||||
#define HELP_GID_FNAME "DESCENT 3.GID"
|
||||
#define HELP_FTS_FNAME "DESCENT 3.FTS"
|
||||
#endif
|
||||
|
||||
// The filenames of the game executables
|
||||
#define GAME_EXECUTABLE_FNAME "main.exe"
|
||||
#define KATMAI_EXECUTABLE_FNAME "main_p3.exe"
|
||||
#define GAME_EXECUTABLE_SWITCH "-launched"
|
||||
#define GAME_EXECUTABLE_FNAME "main.exe"
|
||||
#define KATMAI_EXECUTABLE_FNAME "main_p3.exe"
|
||||
#define GAME_EXECUTABLE_SWITCH "-launched"
|
||||
|
||||
// The filename of the replacement Launcher executable
|
||||
#define NEW_LAUNCHER_FNAME "launcher.new"
|
||||
#define NEW_LAUNCHER_FNAME "launcher.new"
|
||||
|
||||
// The filename of the replacement Launcher executable
|
||||
#define LAUNCHER_PATCH_FNAME "launcher.rtp"
|
||||
#define LAUNCHER_PATCH_FNAME "launcher.rtp"
|
||||
|
||||
// The filename of the Launcher replacement program
|
||||
#define REPLACER_FNAME "lnchupdr.exe"
|
||||
#define REPLACER_FNAME "lnchupdr.exe"
|
||||
|
||||
// the local version, MOTD, sites, and patch filenames
|
||||
#define VERSION_LOC_FNAME "version.nfo"
|
||||
#define PATCH_LOC_FNAME "patch.rtp"
|
||||
#define SITES_LOC_FNAME "sites.nfo"
|
||||
#define MOTD_LOC_FNAME "motd.txt"
|
||||
#define VERSION_LOC_FNAME "version.nfo"
|
||||
#define PATCH_LOC_FNAME "patch.rtp"
|
||||
#define SITES_LOC_FNAME "sites.nfo"
|
||||
#define MOTD_LOC_FNAME "motd.txt"
|
||||
|
||||
// the Updated Version text file name
|
||||
#define UPDATED_VERSION_FNAME "version.new"
|
||||
#define UPDATED_VERSION_FNAME "version.new"
|
||||
|
||||
// the AutoUpdate source file paths (URLs)
|
||||
#if defined(DEMO)
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3demo/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3demo/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3demo/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3demo/version.nfo"
|
||||
#elif defined(DEMO2)
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3demo2/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3demo2/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3demo2/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3demo2/version.nfo"
|
||||
#elif defined(OEM_GENERIC)
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_oem/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_oem/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_oem/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_oem/version.nfo"
|
||||
#elif defined(OEM_VOODOO3)
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_oem_v3/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_oem_v3/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_oem_v3/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_oem_v3/version.nfo"
|
||||
#elif defined(OEM_KATMAI)
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_oem_km/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_oem_km/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_oem_km/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_oem_km/version.nfo"
|
||||
#elif (defined(FULL_ROW_RELEASE) && !defined(ROW_NLL_RELEASE))
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_row/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_row/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_row/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_row/version.nfo"
|
||||
#elif (defined(FULL_ROW_RELEASE) && defined(ROW_NLL_RELEASE))
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_row_nll/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_row_nll/version.nfo"
|
||||
#elif defined(FULL_AUSSIE_RELEASE)
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_aussie/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_aussie/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3_aussie/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3_aussie/version.nfo"
|
||||
#else
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3/version.nfo"
|
||||
#define MOTD_PATH "http://www.outrage.com/update/descent3/motd.txt"
|
||||
#define VERSION_PATH "http://www.outrage.com/update/descent3/version.nfo"
|
||||
#endif
|
||||
|
||||
// Localized motd paths (for full release only)
|
||||
#if (defined(FULL_ROW_RELEASE) && !defined(ROW_NLL_RELEASE))
|
||||
#define FRN_MOTD_PATH "http://www.outrage.com/update/descent3_row/motd_FRN.txt"
|
||||
#define GER_MOTD_PATH "http://www.outrage.com/update/descent3_row/motd_GER.txt"
|
||||
#define ITN_MOTD_PATH "http://www.outrage.com/update/descent3_row/motd_ITN.txt"
|
||||
#define SPN_MOTD_PATH "http://www.outrage.com/update/descent3_row/motd_SPN.txt"
|
||||
#define FRN_MOTD_PATH "http://www.outrage.com/update/descent3_row/motd_FRN.txt"
|
||||
#define GER_MOTD_PATH "http://www.outrage.com/update/descent3_row/motd_GER.txt"
|
||||
#define ITN_MOTD_PATH "http://www.outrage.com/update/descent3_row/motd_ITN.txt"
|
||||
#define SPN_MOTD_PATH "http://www.outrage.com/update/descent3_row/motd_SPN.txt"
|
||||
#elif (defined(FULL_ROW_RELEASE) && defined(ROW_NLL_RELEASE))
|
||||
#define FRN_MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd_FRN.txt"
|
||||
#define GER_MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd_GER.txt"
|
||||
#define ITN_MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd_ITN.txt"
|
||||
#define SPN_MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd_SPN.txt"
|
||||
#define FRN_MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd_FRN.txt"
|
||||
#define GER_MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd_GER.txt"
|
||||
#define ITN_MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd_ITN.txt"
|
||||
#define SPN_MOTD_PATH "http://www.outrage.com/update/descent3_row_nll/motd_SPN.txt"
|
||||
#else
|
||||
#define FRN_MOTD_PATH "http://www.outrage.com/update/descent3/motd_FRN.txt"
|
||||
#define GER_MOTD_PATH "http://www.outrage.com/update/descent3/motd_GER.txt"
|
||||
#define ITN_MOTD_PATH "http://www.outrage.com/update/descent3/motd_ITN.txt"
|
||||
#define SPN_MOTD_PATH "http://www.outrage.com/update/descent3/motd_SPN.txt"
|
||||
#define FRN_MOTD_PATH "http://www.outrage.com/update/descent3/motd_FRN.txt"
|
||||
#define GER_MOTD_PATH "http://www.outrage.com/update/descent3/motd_GER.txt"
|
||||
#define ITN_MOTD_PATH "http://www.outrage.com/update/descent3/motd_ITN.txt"
|
||||
#define SPN_MOTD_PATH "http://www.outrage.com/update/descent3/motd_SPN.txt"
|
||||
#endif
|
||||
|
||||
// the Uninstallation path
|
||||
@@ -292,23 +292,22 @@
|
||||
#endif
|
||||
|
||||
// Registry Value Names
|
||||
#define REG_COMPANY_NAME "Outrage"
|
||||
#define REG_COMPANY_NAME "Outrage"
|
||||
|
||||
#if defined(DEMO)
|
||||
#define REG_APP_NAME "Descent3Demo";
|
||||
#define REG_APP_NAME "Descent3Demo";
|
||||
#elif defined(DEMO2)
|
||||
#define REG_APP_NAME "Descent3Demo2";
|
||||
#define REG_APP_NAME "Descent3Demo2";
|
||||
#elif defined(OEM_GENERIC)
|
||||
#define REG_APP_NAME "Descent3_OEM";
|
||||
#define REG_APP_NAME "Descent3_OEM";
|
||||
#elif defined(OEM_VOODOO3)
|
||||
#define REG_APP_NAME "Descent3_OEM_V3";
|
||||
#define REG_APP_NAME "Descent3_OEM_V3";
|
||||
#elif defined(OEM_KATMAI)
|
||||
#define REG_APP_NAME "Descent3_OEM_KM";
|
||||
#define REG_APP_NAME "Descent3_OEM_KM";
|
||||
#elif defined(GAMEGAUGE)
|
||||
#define REG_APP_NAME "Descent3_GG";
|
||||
#define REG_APP_NAME "Descent3_GG";
|
||||
#else
|
||||
#define REG_APP_NAME "Descent3";
|
||||
#define REG_APP_NAME "Descent3";
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* LAUNCHNAMES_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/******************************************************************************\
|
||||
* file : ListCtrl.h
|
||||
@@ -32,89 +32,88 @@
|
||||
#define LVNU_SELCHANGED 0x1000
|
||||
|
||||
/**
|
||||
* A super CListControl.
|
||||
* <P>features:
|
||||
* <UL>
|
||||
* <LI>Title Tip item expantion
|
||||
* <LI>full row selection
|
||||
* <LI>notifies parent selection has changed
|
||||
* <LI>
|
||||
* </UL>
|
||||
*/
|
||||
* A super CListControl.
|
||||
* <P>features:
|
||||
* <UL>
|
||||
* <LI>Title Tip item expantion
|
||||
* <LI>full row selection
|
||||
* <LI>notifies parent selection has changed
|
||||
* <LI>
|
||||
* </UL>
|
||||
*/
|
||||
|
||||
class CListCtrlEx : public CListCtrl
|
||||
{
|
||||
typedef CListCtrl inherited;
|
||||
class CListCtrlEx : public CListCtrl {
|
||||
typedef CListCtrl inherited;
|
||||
|
||||
DECLARE_DYNCREATE(CListCtrlEx)
|
||||
DECLARE_DYNCREATE(CListCtrlEx)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CListCtrlEx();
|
||||
virtual ~CListCtrlEx();
|
||||
CListCtrlEx();
|
||||
virtual ~CListCtrlEx();
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
protected:
|
||||
BOOL m_bFullRowSel;
|
||||
BOOL m_bClientWidthSel;
|
||||
BOOL m_bFullRowSel;
|
||||
BOOL m_bClientWidthSel;
|
||||
|
||||
public:
|
||||
BOOL SetFullRowSel(BOOL bFillRowSel);
|
||||
BOOL GetFullRowSel();
|
||||
BOOL SetFullRowSel(BOOL bFillRowSel);
|
||||
BOOL GetFullRowSel();
|
||||
|
||||
// Overrides
|
||||
// Overrides
|
||||
protected:
|
||||
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CListCtrlEx)
|
||||
public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
protected:
|
||||
virtual void PreSubclassWindow();
|
||||
//}}AFX_VIRTUAL
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CListCtrlEx)
|
||||
public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual void PreSubclassWindow();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
#ifdef _DEBUG
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void RepaintSelectedItems();
|
||||
void RepaintSelectedItems();
|
||||
|
||||
// Implementation - list view colors
|
||||
COLORREF m_clrText;
|
||||
COLORREF m_clrTextBk;
|
||||
COLORREF m_clrBkgnd;
|
||||
CTitleTip m_titletip;
|
||||
// Implementation - list view colors
|
||||
COLORREF m_clrText;
|
||||
COLORREF m_clrTextBk;
|
||||
COLORREF m_clrBkgnd;
|
||||
CTitleTip m_titletip;
|
||||
|
||||
afx_msg LRESULT OnSetTextColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetTextBkColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetBkColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetTextColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetTextBkColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetBkColor(WPARAM wParam, LPARAM lParam);
|
||||
|
||||
bool HitTestRowCol(CPoint& point, int& iRow, int& iColumn)const;
|
||||
CRect GetCellRect(int iRow, int iColumn)const;
|
||||
bool HitTestRowCol(CPoint &point, int &iRow, int &iColumn) const;
|
||||
CRect GetCellRect(int iRow, int iColumn) const;
|
||||
|
||||
int GetTrueColumnWidth(int nCurrentPosition)const;
|
||||
CString GetTrueItemText(int row, int col)const;
|
||||
void HideTitleTip();
|
||||
void SendSelChangedNotification();
|
||||
void ShowTitleTip(CPoint point);
|
||||
int GetTrueColumnWidth(int nCurrentPosition) const;
|
||||
CString GetTrueItemText(int row, int col) const;
|
||||
void HideTitleTip();
|
||||
void SendSelChangedNotification();
|
||||
void ShowTitleTip(CPoint point);
|
||||
|
||||
|
||||
// Generated message map functions
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CListCtrlEx)
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnSetFocus(CWnd* pOldWnd);
|
||||
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CListCtrlEx)
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnSetFocus(CWnd *pOldWnd);
|
||||
afx_msg void OnKillFocus(CWnd *pNewWnd);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// MOTDDlg.cpp : implementation file
|
||||
//
|
||||
@@ -34,79 +34,69 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMOTDDlg dialog
|
||||
|
||||
|
||||
CMOTDDlg::CMOTDDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CMOTDDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CMOTDDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CMOTDDlg::CMOTDDlg(CWnd *pParent /*=NULL*/) : CDialog(CMOTDDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CMOTDDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CMOTDDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMOTDDlg)
|
||||
DDX_Control(pDX, IDC_LIST1, m_TextList);
|
||||
//}}AFX_DATA_MAP
|
||||
void CMOTDDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMOTDDlg)
|
||||
DDX_Control(pDX, IDC_LIST1, m_TextList);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMOTDDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CMOTDDlg)
|
||||
ON_WM_SHOWWINDOW()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CMOTDDlg)
|
||||
ON_WM_SHOWWINDOW()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMOTDDlg message handlers
|
||||
|
||||
BOOL CMOTDDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
BOOL CMOTDDlg::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
m_TextList.ResetContent();
|
||||
// TODO: Add extra initialization here
|
||||
m_TextList.ResetContent();
|
||||
|
||||
if(!ParseMOTDFile())
|
||||
return FALSE;
|
||||
if (!ParseMOTDFile())
|
||||
return FALSE;
|
||||
|
||||
m_TextList.SetTopIndex(0);
|
||||
m_TextList.SetTopIndex(0);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
// Reads the message of the day text into the list box
|
||||
BOOL CMOTDDlg::ParseMOTDFile(void)
|
||||
{
|
||||
char filebuffer[_MAX_PATH+1];
|
||||
FILE *f;
|
||||
BOOL CMOTDDlg::ParseMOTDFile(void) {
|
||||
char filebuffer[_MAX_PATH + 1];
|
||||
FILE *f;
|
||||
|
||||
f = fopen(MOTD_LOC_FNAME, "rt");
|
||||
if(f == NULL){
|
||||
return FALSE;
|
||||
}
|
||||
f = fopen(MOTD_LOC_FNAME, "rt");
|
||||
if (f == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while (!feof(f)) {
|
||||
fgets(filebuffer, _MAX_PATH, f);
|
||||
if(strlen(filebuffer)>0 && filebuffer[strlen(filebuffer) - 1] == '\n')
|
||||
filebuffer[strlen(filebuffer) - 1] = '\0';
|
||||
m_TextList.AddString(filebuffer);
|
||||
}
|
||||
fclose(f);
|
||||
while (!feof(f)) {
|
||||
fgets(filebuffer, _MAX_PATH, f);
|
||||
if (strlen(filebuffer) > 0 && filebuffer[strlen(filebuffer) - 1] == '\n')
|
||||
filebuffer[strlen(filebuffer) - 1] = '\0';
|
||||
m_TextList.AddString(filebuffer);
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CMOTDDlg::OnShowWindow(BOOL bShow, UINT nStatus)
|
||||
{
|
||||
CDialog::OnShowWindow(bShow, nStatus);
|
||||
void CMOTDDlg::OnShowWindow(BOOL bShow, UINT nStatus) {
|
||||
CDialog::OnShowWindow(bShow, nStatus);
|
||||
|
||||
// TODO: Add your message handler code here
|
||||
//if(bShow==TRUE && nStatus==SW_PARENTOPENING) {
|
||||
// OutputDebugString("Update dlg has opened\n");
|
||||
//}
|
||||
// TODO: Add your message handler code here
|
||||
// if(bShow==TRUE && nStatus==SW_PARENTOPENING) {
|
||||
// OutputDebugString("Update dlg has opened\n");
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_MOTDDLG_H__C5900F80_3B79_11D2_8CBD_00A0C96ED60D__INCLUDED_)
|
||||
#define AFX_MOTDDLG_H__C5900F80_3B79_11D2_8CBD_00A0C96ED60D__INCLUDED_
|
||||
@@ -28,36 +28,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMOTDDlg dialog
|
||||
|
||||
class CMOTDDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CMOTDDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CMOTDDlg(CWnd* pParent = NULL); // standard constructor
|
||||
BOOL ParseMOTDFile(void);
|
||||
CMOTDDlg(CWnd *pParent = NULL); // standard constructor
|
||||
BOOL ParseMOTDFile(void);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMOTDDlg)
|
||||
enum { IDD = IDD_MOTD_DIALOG };
|
||||
CListBox m_TextList;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMOTDDlg)
|
||||
enum { IDD = IDD_MOTD_DIALOG };
|
||||
CListBox m_TextList;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMOTDDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMOTDDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMOTDDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMOTDDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// MessageWindowDlg.cpp : implementation file
|
||||
//
|
||||
@@ -35,46 +35,38 @@ CMessageWindowDlg *message_window;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMessageWindowDlg dialog
|
||||
|
||||
|
||||
CMessageWindowDlg::CMessageWindowDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CMessageWindowDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CMessageWindowDlg)
|
||||
m_WndMsgMain = _T("");
|
||||
m_WndMsgStatus = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
CMessageWindowDlg::CMessageWindowDlg(CWnd *pParent /*=NULL*/) : CDialog(CMessageWindowDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CMessageWindowDlg)
|
||||
m_WndMsgMain = _T("");
|
||||
m_WndMsgStatus = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CMessageWindowDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMessageWindowDlg)
|
||||
DDX_Text(pDX, IDC_WND_MSG_MAIN, m_WndMsgMain);
|
||||
DDX_Text(pDX, IDC_WND_MSG_STATUS, m_WndMsgStatus);
|
||||
//}}AFX_DATA_MAP
|
||||
void CMessageWindowDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMessageWindowDlg)
|
||||
DDX_Text(pDX, IDC_WND_MSG_MAIN, m_WndMsgMain);
|
||||
DDX_Text(pDX, IDC_WND_MSG_STATUS, m_WndMsgStatus);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMessageWindowDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CMessageWindowDlg)
|
||||
ON_BN_CLICKED(IDC_BTN_CANCEL, OnBtnCancel)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CMessageWindowDlg)
|
||||
ON_BN_CLICKED(IDC_BTN_CANCEL, OnBtnCancel)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMessageWindowDlg message handlers
|
||||
|
||||
void CMessageWindowDlg::OnBtnCancel() {
|
||||
// TODO: Add your control notification handler code here
|
||||
// Dim the button once pressed
|
||||
HWND hwnd;
|
||||
|
||||
void CMessageWindowDlg::OnBtnCancel()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
// Dim the button once pressed
|
||||
HWND hwnd;
|
||||
GetDlgItem(IDC_BTN_CANCEL, &hwnd);
|
||||
::EnableWindow(hwnd, FALSE);
|
||||
|
||||
GetDlgItem(IDC_BTN_CANCEL,&hwnd);
|
||||
::EnableWindow(hwnd,FALSE);
|
||||
|
||||
// Mark cancel pressed global variable
|
||||
CancelPressed=TRUE;
|
||||
// Mark cancel pressed global variable
|
||||
CancelPressed = TRUE;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_MESSAGEWINDOWDLG_H__65671E22_38F7_11D2_8CBD_00A0C96ED60D__INCLUDED_)
|
||||
#define AFX_MESSAGEWINDOWDLG_H__65671E22_38F7_11D2_8CBD_00A0C96ED60D__INCLUDED_
|
||||
@@ -25,39 +25,35 @@
|
||||
// MessageWindowDlg.h : header file
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMessageWindowDlg dialog
|
||||
|
||||
class CMessageWindowDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CMessageWindowDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CMessageWindowDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CMessageWindowDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMessageWindowDlg)
|
||||
enum { IDD = IDD_MESSAGE_WINDOW };
|
||||
CString m_WndMsgMain;
|
||||
CString m_WndMsgStatus;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMessageWindowDlg)
|
||||
enum { IDD = IDD_MESSAGE_WINDOW };
|
||||
CString m_WndMsgMain;
|
||||
CString m_WndMsgStatus;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMessageWindowDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMessageWindowDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMessageWindowDlg)
|
||||
afx_msg void OnBtnCancel();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMessageWindowDlg)
|
||||
afx_msg void OnBtnCancel();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CMessageWindowDlg *message_window;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// MsgDlg.cpp : implementation file
|
||||
//
|
||||
@@ -32,31 +32,25 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMsgDlg dialog
|
||||
|
||||
|
||||
CMsgDlg::CMsgDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CMsgDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CMsgDlg)
|
||||
m_ScanningMsg = _T("");
|
||||
m_WaitMsg = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
CMsgDlg::CMsgDlg(CWnd *pParent /*=NULL*/) : CDialog(CMsgDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CMsgDlg)
|
||||
m_ScanningMsg = _T("");
|
||||
m_WaitMsg = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CMsgDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMsgDlg)
|
||||
DDX_Text(pDX, IDC_SCANNING_TEXT, m_ScanningMsg);
|
||||
DDX_Text(pDX, IDC_WAIT_TEXT, m_WaitMsg);
|
||||
//}}AFX_DATA_MAP
|
||||
void CMsgDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMsgDlg)
|
||||
DDX_Text(pDX, IDC_SCANNING_TEXT, m_ScanningMsg);
|
||||
DDX_Text(pDX, IDC_WAIT_TEXT, m_WaitMsg);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMsgDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CMsgDlg)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CMsgDlg)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_MSGDLG_H__E14B21A1_5F9C_11D2_A4E0_00A0C96ED60D__INCLUDED_)
|
||||
#define AFX_MSGDLG_H__E14B21A1_5F9C_11D2_A4E0_00A0C96ED60D__INCLUDED_
|
||||
@@ -28,35 +28,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMsgDlg dialog
|
||||
|
||||
class CMsgDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CMsgDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CMsgDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CMsgDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMsgDlg)
|
||||
enum { IDD = IDD_MSG_DLG };
|
||||
CString m_ScanningMsg;
|
||||
CString m_WaitMsg;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMsgDlg)
|
||||
enum { IDD = IDD_MSG_DLG };
|
||||
CString m_ScanningMsg;
|
||||
CString m_WaitMsg;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMsgDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMsgDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMsgDlg)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMsgDlg)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -67,182 +67,168 @@
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define CONNECTION_DIALUP "Dialup"
|
||||
#define CONNECTION_LAN "LAN"
|
||||
#define CONNECTION_NONE "None"
|
||||
#define CONNECTION_DIALUP "Dialup"
|
||||
#define CONNECTION_LAN "LAN"
|
||||
#define CONNECTION_NONE "None"
|
||||
|
||||
// defines for connection type
|
||||
#define CONNECTION_SPEED_28K "28K"
|
||||
#define CONNECTION_SPEED_33K "33K"
|
||||
#define CONNECTION_SPEED_56K "56K"
|
||||
#define CONNECTION_SPEED_SISDN "ISDN"
|
||||
#define CONNECTION_SPEED_CABLE "Cable"
|
||||
#define CONNECTION_SPEED_FAST "Fast"
|
||||
#define CONNECTION_SPEED_28K "28K"
|
||||
#define CONNECTION_SPEED_33K "33K"
|
||||
#define CONNECTION_SPEED_56K "56K"
|
||||
#define CONNECTION_SPEED_SISDN "ISDN"
|
||||
#define CONNECTION_SPEED_CABLE "Cable"
|
||||
#define CONNECTION_SPEED_FAST "Fast"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNetworkTab property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CNetworkTab, CPropertyPage)
|
||||
|
||||
CNetworkTab::CNetworkTab() : CPropertyPage(CNetworkTab::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CNetworkTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CNetworkTab::CNetworkTab() : CPropertyPage(CNetworkTab::IDD) {
|
||||
//{{AFX_DATA_INIT(CNetworkTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
CNetworkTab::~CNetworkTab()
|
||||
{
|
||||
}
|
||||
CNetworkTab::~CNetworkTab() {}
|
||||
|
||||
void CNetworkTab::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CNetworkTab)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
void CNetworkTab::DoDataExchange(CDataExchange *pDX) {
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CNetworkTab)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CNetworkTab, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CNetworkTab)
|
||||
ON_BN_CLICKED(IDC_DIALUP, OnDialup)
|
||||
ON_BN_CLICKED(IDC_LAN, OnLan)
|
||||
ON_BN_CLICKED(IDC_NONE, OnNone)
|
||||
ON_MESSAGE(WM_COMMANDHELP,OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CNetworkTab)
|
||||
ON_BN_CLICKED(IDC_DIALUP, OnDialup)
|
||||
ON_BN_CLICKED(IDC_LAN, OnLan)
|
||||
ON_BN_CLICKED(IDC_NONE, OnNone)
|
||||
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNetworkTab message handlers
|
||||
|
||||
void CNetworkTab::OnOK()
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
char *internet_connection = CONNECTION_NONE;
|
||||
char *connection_speed = CONNECTION_SPEED_28K;
|
||||
void CNetworkTab::OnOK() {
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
char *internet_connection = CONNECTION_NONE;
|
||||
char *connection_speed = CONNECTION_SPEED_28K;
|
||||
|
||||
if ( ((CButton *) GetDlgItem(IDC_DIALUP))->GetCheck() == 1 )
|
||||
internet_connection = CONNECTION_DIALUP;
|
||||
else if ( ((CButton *) GetDlgItem(IDC_LAN))->GetCheck() == 1 )
|
||||
internet_connection = CONNECTION_LAN;
|
||||
if (((CButton *)GetDlgItem(IDC_DIALUP))->GetCheck() == 1)
|
||||
internet_connection = CONNECTION_DIALUP;
|
||||
else if (((CButton *)GetDlgItem(IDC_LAN))->GetCheck() == 1)
|
||||
internet_connection = CONNECTION_LAN;
|
||||
|
||||
os_config_write_string(szSectionName, "NetworkConnection", internet_connection);
|
||||
os_config_write_string(szSectionName, "NetworkConnection", internet_connection);
|
||||
|
||||
// deal with the connection speed
|
||||
if ( ((CButton *) GetDlgItem(IDC_FAST_CONNECTION))->GetCheck() == 1 )
|
||||
connection_speed = CONNECTION_SPEED_FAST;
|
||||
else if ( ((CButton *) GetDlgItem(IDC_CABLE_CONNECTION))->GetCheck() == 1 )
|
||||
connection_speed = CONNECTION_SPEED_CABLE;
|
||||
else if ( ((CButton *) GetDlgItem(IDC_SINGLE_ISDN_CONNECTION))->GetCheck() == 1 )
|
||||
connection_speed = CONNECTION_SPEED_SISDN;
|
||||
else if ( ((CButton *) GetDlgItem(IDC_56K_CONNECTION))->GetCheck() == 1 )
|
||||
connection_speed = CONNECTION_SPEED_56K;
|
||||
else if ( ((CButton *) GetDlgItem(IDC_33K_CONNECTION))->GetCheck() == 1 )
|
||||
connection_speed = CONNECTION_SPEED_33K;
|
||||
else if ( ((CButton *) GetDlgItem(IDC_28K_CONNECTION))->GetCheck() == 1 )
|
||||
connection_speed = CONNECTION_SPEED_28K;
|
||||
// deal with the connection speed
|
||||
if (((CButton *)GetDlgItem(IDC_FAST_CONNECTION))->GetCheck() == 1)
|
||||
connection_speed = CONNECTION_SPEED_FAST;
|
||||
else if (((CButton *)GetDlgItem(IDC_CABLE_CONNECTION))->GetCheck() == 1)
|
||||
connection_speed = CONNECTION_SPEED_CABLE;
|
||||
else if (((CButton *)GetDlgItem(IDC_SINGLE_ISDN_CONNECTION))->GetCheck() == 1)
|
||||
connection_speed = CONNECTION_SPEED_SISDN;
|
||||
else if (((CButton *)GetDlgItem(IDC_56K_CONNECTION))->GetCheck() == 1)
|
||||
connection_speed = CONNECTION_SPEED_56K;
|
||||
else if (((CButton *)GetDlgItem(IDC_33K_CONNECTION))->GetCheck() == 1)
|
||||
connection_speed = CONNECTION_SPEED_33K;
|
||||
else if (((CButton *)GetDlgItem(IDC_28K_CONNECTION))->GetCheck() == 1)
|
||||
connection_speed = CONNECTION_SPEED_28K;
|
||||
|
||||
os_config_write_string(szSectionName, "ConnectionSpeed", connection_speed);
|
||||
os_config_write_string(szSectionName, "ConnectionSpeed", connection_speed);
|
||||
|
||||
CPropertyPage::OnOK();
|
||||
CPropertyPage::OnOK();
|
||||
}
|
||||
|
||||
BOOL CNetworkTab::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
BOOL CNetworkTab::OnInitDialog() {
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
char *internet_connection, *connection_speed;
|
||||
// TODO: Add extra initialization here
|
||||
char *internet_connection, *connection_speed;
|
||||
|
||||
internet_connection = os_config_read_string(szSectionName, "NetworkConnection", CONNECTION_DIALUP);
|
||||
if (!stricmp(internet_connection, CONNECTION_DIALUP))
|
||||
((CButton *) GetDlgItem(IDC_DIALUP))->SetCheck(1);
|
||||
else if (!stricmp(internet_connection, CONNECTION_LAN))
|
||||
((CButton *) GetDlgItem(IDC_LAN))->SetCheck(1);
|
||||
else {
|
||||
((CButton *) GetDlgItem(IDC_NONE))->SetCheck(1);
|
||||
EnableSpeedGroup(FALSE);
|
||||
}
|
||||
internet_connection = os_config_read_string(szSectionName, "NetworkConnection", CONNECTION_DIALUP);
|
||||
if (!stricmp(internet_connection, CONNECTION_DIALUP))
|
||||
((CButton *)GetDlgItem(IDC_DIALUP))->SetCheck(1);
|
||||
else if (!stricmp(internet_connection, CONNECTION_LAN))
|
||||
((CButton *)GetDlgItem(IDC_LAN))->SetCheck(1);
|
||||
else {
|
||||
((CButton *)GetDlgItem(IDC_NONE))->SetCheck(1);
|
||||
EnableSpeedGroup(FALSE);
|
||||
}
|
||||
|
||||
// set up the connect speed radio buttons
|
||||
connection_speed = os_config_read_string(szSectionName, "ConnectionSpeed", CONNECTION_SPEED_56K);
|
||||
if ( !stricmp(connection_speed, CONNECTION_SPEED_FAST) )
|
||||
((CButton *) GetDlgItem(IDC_FAST_CONNECTION))->SetCheck(1);
|
||||
else if ( !stricmp(connection_speed, CONNECTION_SPEED_CABLE) )
|
||||
((CButton *) GetDlgItem(IDC_CABLE_CONNECTION))->SetCheck(1);
|
||||
else if ( !stricmp(connection_speed, CONNECTION_SPEED_SISDN) )
|
||||
((CButton *) GetDlgItem(IDC_SINGLE_ISDN_CONNECTION))->SetCheck(1);
|
||||
else if ( !stricmp(connection_speed, CONNECTION_SPEED_56K) )
|
||||
((CButton *) GetDlgItem(IDC_56K_CONNECTION))->SetCheck(1);
|
||||
else if ( !stricmp(connection_speed, CONNECTION_SPEED_33K) )
|
||||
((CButton *) GetDlgItem(IDC_33K_CONNECTION))->SetCheck(1);
|
||||
else
|
||||
((CButton *) GetDlgItem(IDC_28K_CONNECTION))->SetCheck(1);
|
||||
// set up the connect speed radio buttons
|
||||
connection_speed = os_config_read_string(szSectionName, "ConnectionSpeed", CONNECTION_SPEED_56K);
|
||||
if (!stricmp(connection_speed, CONNECTION_SPEED_FAST))
|
||||
((CButton *)GetDlgItem(IDC_FAST_CONNECTION))->SetCheck(1);
|
||||
else if (!stricmp(connection_speed, CONNECTION_SPEED_CABLE))
|
||||
((CButton *)GetDlgItem(IDC_CABLE_CONNECTION))->SetCheck(1);
|
||||
else if (!stricmp(connection_speed, CONNECTION_SPEED_SISDN))
|
||||
((CButton *)GetDlgItem(IDC_SINGLE_ISDN_CONNECTION))->SetCheck(1);
|
||||
else if (!stricmp(connection_speed, CONNECTION_SPEED_56K))
|
||||
((CButton *)GetDlgItem(IDC_56K_CONNECTION))->SetCheck(1);
|
||||
else if (!stricmp(connection_speed, CONNECTION_SPEED_33K))
|
||||
((CButton *)GetDlgItem(IDC_33K_CONNECTION))->SetCheck(1);
|
||||
else
|
||||
((CButton *)GetDlgItem(IDC_28K_CONNECTION))->SetCheck(1);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CNetworkTab::EnableSpeedGroup(bool bEnable)
|
||||
{
|
||||
HWND hwnd;
|
||||
void CNetworkTab::EnableSpeedGroup(bool bEnable) {
|
||||
HWND hwnd;
|
||||
|
||||
GetDlgItem(IDC_28K_CONNECTION,&hwnd);
|
||||
::EnableWindow(hwnd,bEnable);
|
||||
GetDlgItem(IDC_33K_CONNECTION,&hwnd);
|
||||
::EnableWindow(hwnd,bEnable);
|
||||
GetDlgItem(IDC_56K_CONNECTION,&hwnd);
|
||||
::EnableWindow(hwnd,bEnable);
|
||||
GetDlgItem(IDC_SINGLE_ISDN_CONNECTION,&hwnd);
|
||||
::EnableWindow(hwnd,bEnable);
|
||||
GetDlgItem(IDC_CABLE_CONNECTION,&hwnd);
|
||||
::EnableWindow(hwnd,bEnable);
|
||||
GetDlgItem(IDC_FAST_CONNECTION,&hwnd);
|
||||
::EnableWindow(hwnd,bEnable);
|
||||
GetDlgItem(IDC_CONNECT_SPEED_GROUP,&hwnd);
|
||||
::EnableWindow(hwnd,bEnable);
|
||||
GetDlgItem(IDC_28K_CONNECTION, &hwnd);
|
||||
::EnableWindow(hwnd, bEnable);
|
||||
GetDlgItem(IDC_33K_CONNECTION, &hwnd);
|
||||
::EnableWindow(hwnd, bEnable);
|
||||
GetDlgItem(IDC_56K_CONNECTION, &hwnd);
|
||||
::EnableWindow(hwnd, bEnable);
|
||||
GetDlgItem(IDC_SINGLE_ISDN_CONNECTION, &hwnd);
|
||||
::EnableWindow(hwnd, bEnable);
|
||||
GetDlgItem(IDC_CABLE_CONNECTION, &hwnd);
|
||||
::EnableWindow(hwnd, bEnable);
|
||||
GetDlgItem(IDC_FAST_CONNECTION, &hwnd);
|
||||
::EnableWindow(hwnd, bEnable);
|
||||
GetDlgItem(IDC_CONNECT_SPEED_GROUP, &hwnd);
|
||||
::EnableWindow(hwnd, bEnable);
|
||||
}
|
||||
|
||||
void CNetworkTab::OnDialup()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
EnableSpeedGroup(TRUE);
|
||||
void CNetworkTab::OnDialup() {
|
||||
// TODO: Add your control notification handler code here
|
||||
EnableSpeedGroup(TRUE);
|
||||
}
|
||||
|
||||
void CNetworkTab::OnLan()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
EnableSpeedGroup(TRUE);
|
||||
void CNetworkTab::OnLan() {
|
||||
// TODO: Add your control notification handler code here
|
||||
EnableSpeedGroup(TRUE);
|
||||
}
|
||||
|
||||
void CNetworkTab::OnNone()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
EnableSpeedGroup(FALSE);
|
||||
void CNetworkTab::OnNone() {
|
||||
// TODO: Add your control notification handler code here
|
||||
EnableSpeedGroup(FALSE);
|
||||
}
|
||||
|
||||
BOOL CNetworkTab::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
BOOL CNetworkTab::OnHelpInfo(HELPINFO *pHelpInfo) {
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
CWaitCursor wc;
|
||||
help_launch(NETWORKTAB_HELP);
|
||||
return 1;
|
||||
CWaitCursor wc;
|
||||
help_launch(NETWORKTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Display the html help file
|
||||
afx_msg LRESULT CNetworkTab::OnCommandHelp(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
afx_msg LRESULT CNetworkTab::OnCommandHelp(WPARAM wParam, LPARAM lParam) {
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
help_launch(NETWORKTAB_HELP);
|
||||
return 1;
|
||||
help_launch(NETWORKTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnCommandHelp(wParam,lParam);
|
||||
return CPropertyPage::OnCommandHelp(wParam, lParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -47,46 +47,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNetworkTab dialog
|
||||
|
||||
class CNetworkTab : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CNetworkTab)
|
||||
class CNetworkTab : public CPropertyPage {
|
||||
DECLARE_DYNCREATE(CNetworkTab)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CNetworkTab();
|
||||
~CNetworkTab();
|
||||
void EnableSpeedGroup(bool bEnable);
|
||||
CNetworkTab();
|
||||
~CNetworkTab();
|
||||
void EnableSpeedGroup(bool bEnable);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CNetworkTab)
|
||||
enum { IDD = IDD_PROPPAGE_NETWORK };
|
||||
// NOTE - ClassWizard will add data members here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CNetworkTab)
|
||||
enum { IDD = IDD_PROPPAGE_NETWORK };
|
||||
// NOTE - ClassWizard will add data members here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CNetworkTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CNetworkTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CNetworkTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDialup();
|
||||
afx_msg void OnLan();
|
||||
afx_msg void OnNone();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CNetworkTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDialup();
|
||||
afx_msg void OnLan();
|
||||
afx_msg void OnNone();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -67,228 +67,214 @@
|
||||
|
||||
char *szCompanyName = REG_COMPANY_NAME;
|
||||
char *szAppName = REG_APP_NAME;
|
||||
char *szSectionName = NULL; // Don't use a section name for the launcher
|
||||
char *szSectionName = NULL; // Don't use a section name for the launcher
|
||||
|
||||
// Removes a value from to the INI file. Passing
|
||||
// name=NULL will delete the section.
|
||||
|
||||
void os_config_remove( char *section, char *name )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
void os_config_remove(char *section, char *name) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
|
||||
if ( section ) {
|
||||
sprintf( keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section );
|
||||
} else {
|
||||
sprintf( keyname, "Software\\%s\\%s", szCompanyName, szAppName );
|
||||
}
|
||||
if (section) {
|
||||
sprintf(keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section);
|
||||
} else {
|
||||
sprintf(keyname, "Software\\%s\\%s", szCompanyName, szAppName);
|
||||
}
|
||||
|
||||
// remove the value
|
||||
if ( !name ) {
|
||||
if ( !section ) {
|
||||
////mprintf( "Can't delete root key\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
lResult = RegDeleteKey( HKEY_LOCAL_MACHINE, keyname );
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
////mprintf( "Error removing registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
} else {
|
||||
lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE, // Where to add it
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
"", // Object class
|
||||
REG_OPTION_NON_VOLATILE, // Save to disk
|
||||
KEY_ALL_ACCESS, // Allows all changes
|
||||
NULL, // Default security attributes
|
||||
&hKey, // Location to store key
|
||||
&dwDisposition ); // Location to store status of key
|
||||
// remove the value
|
||||
if (!name) {
|
||||
if (!section) {
|
||||
////mprintf( "Can't delete root key\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
lResult = RegDeleteKey(HKEY_LOCAL_MACHINE, keyname);
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
////mprintf( "Error removing registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
} else {
|
||||
lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Where to add it
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
"", // Object class
|
||||
REG_OPTION_NON_VOLATILE, // Save to disk
|
||||
KEY_ALL_ACCESS, // Allows all changes
|
||||
NULL, // Default security attributes
|
||||
&hKey, // Location to store key
|
||||
&dwDisposition); // Location to store status of key
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
lResult = RegDeleteValue( hKey, name );
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error removing registry value '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
lResult = RegDeleteValue(hKey, name);
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error removing registry value '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
if ( hKey )
|
||||
RegCloseKey(hKey);
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
|
||||
// Writes a string to the INI file. If value is NULL,
|
||||
// removes the string. Writing a NULL value to a NULL name will delete
|
||||
// the section.
|
||||
void os_config_write_string( char *section, char *name, char *value )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
void os_config_write_string(char *section, char *name, char *value) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
|
||||
if (section) {
|
||||
sprintf(keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section);
|
||||
} else {
|
||||
sprintf(keyname, "Software\\%s\\%s", szCompanyName, szAppName);
|
||||
}
|
||||
|
||||
if ( section ) {
|
||||
sprintf( keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section );
|
||||
} else {
|
||||
sprintf( keyname, "Software\\%s\\%s", szCompanyName, szAppName );
|
||||
}
|
||||
lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Where to add it
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
"", // Object class
|
||||
REG_OPTION_NON_VOLATILE, // Save to disk
|
||||
KEY_ALL_ACCESS, // Allows all changes
|
||||
NULL, // Default security attributes
|
||||
&hKey, // Location to store key
|
||||
&dwDisposition); // Location to store status of key
|
||||
|
||||
lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE, // Where to add it
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
"", // Object class
|
||||
REG_OPTION_NON_VOLATILE, // Save to disk
|
||||
KEY_ALL_ACCESS, // Allows all changes
|
||||
NULL, // Default security attributes
|
||||
&hKey, // Location to store key
|
||||
&dwDisposition ); // Location to store status of key
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (!name) {
|
||||
// mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( !name ) {
|
||||
//mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
lResult = RegSetValueEx( hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
REG_SZ, // null terminated string
|
||||
(CONST BYTE *)value, // value to set
|
||||
strlen(value) ); // How many bytes to set
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error writing registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
lResult = RegSetValueEx(hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
REG_SZ, // null terminated string
|
||||
(CONST BYTE *)value, // value to set
|
||||
strlen(value)); // How many bytes to set
|
||||
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error writing registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
if ( hKey )
|
||||
RegCloseKey(hKey);
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
// same as previous function except we don't use the application name to build up the keyname
|
||||
void os_config_write_string2( char *section, char *name, char *value )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
void os_config_write_string2(char *section, char *name, char *value) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
|
||||
if (section) {
|
||||
sprintf(keyname, "Software\\%s\\%s", szCompanyName, section);
|
||||
} else {
|
||||
sprintf(keyname, "Software\\%s", szCompanyName);
|
||||
}
|
||||
|
||||
if ( section ) {
|
||||
sprintf( keyname, "Software\\%s\\%s", szCompanyName, section );
|
||||
} else {
|
||||
sprintf( keyname, "Software\\%s", szCompanyName );
|
||||
}
|
||||
lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Where to add it
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
"", // Object class
|
||||
REG_OPTION_NON_VOLATILE, // Save to disk
|
||||
KEY_ALL_ACCESS, // Allows all changes
|
||||
NULL, // Default security attributes
|
||||
&hKey, // Location to store key
|
||||
&dwDisposition); // Location to store status of key
|
||||
|
||||
lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE, // Where to add it
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
"", // Object class
|
||||
REG_OPTION_NON_VOLATILE, // Save to disk
|
||||
KEY_ALL_ACCESS, // Allows all changes
|
||||
NULL, // Default security attributes
|
||||
&hKey, // Location to store key
|
||||
&dwDisposition ); // Location to store status of key
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (!name) {
|
||||
// mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( !name ) {
|
||||
//mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
lResult = RegSetValueEx( hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
REG_SZ, // null terminated string
|
||||
(CONST BYTE *)value, // value to set
|
||||
strlen(value) ); // How many bytes to set
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error writing registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
lResult = RegSetValueEx(hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
REG_SZ, // null terminated string
|
||||
(CONST BYTE *)value, // value to set
|
||||
strlen(value)); // How many bytes to set
|
||||
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error writing registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
if ( hKey )
|
||||
RegCloseKey(hKey);
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
// Writes an uint32_t to the INI file.
|
||||
void os_config_write_uint( char *section, char *name, uint32_t value )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
void os_config_write_uint(char *section, char *name, uint32_t value) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
|
||||
if (section) {
|
||||
sprintf(keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section);
|
||||
} else {
|
||||
sprintf(keyname, "Software\\%s\\%s", szCompanyName, szAppName);
|
||||
}
|
||||
|
||||
if ( section ) {
|
||||
sprintf( keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section );
|
||||
} else {
|
||||
sprintf( keyname, "Software\\%s\\%s", szCompanyName, szAppName );
|
||||
}
|
||||
lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, // Where to add it
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
"", // Object class
|
||||
REG_OPTION_NON_VOLATILE, // Save to disk
|
||||
KEY_ALL_ACCESS, // Allows all changes
|
||||
NULL, // Default security attributes
|
||||
&hKey, // Location to store key
|
||||
&dwDisposition); // Location to store status of key
|
||||
|
||||
lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE, // Where to add it
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
"", // Object class
|
||||
REG_OPTION_NON_VOLATILE, // Save to disk
|
||||
KEY_ALL_ACCESS, // Allows all changes
|
||||
NULL, // Default security attributes
|
||||
&hKey, // Location to store key
|
||||
&dwDisposition ); // Location to store status of key
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (!name) {
|
||||
// mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( !name ) {
|
||||
//mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
lResult = RegSetValueEx(hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
REG_DWORD, // null terminated string
|
||||
(CONST BYTE *)&value, // value to set
|
||||
4); // How many bytes to set
|
||||
|
||||
lResult = RegSetValueEx( hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
REG_DWORD, // null terminated string
|
||||
(CONST BYTE *)&value, // value to set
|
||||
4 ); // How many bytes to set
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error writing registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error writing registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
Cleanup:
|
||||
if ( hKey )
|
||||
RegCloseKey(hKey);
|
||||
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Reads a string from the INI file. If default is passed,
|
||||
// and the string isn't found, returns ptr to default otherwise
|
||||
// returns NULL; Copy the return value somewhere before
|
||||
@@ -297,209 +283,200 @@ Cleanup:
|
||||
|
||||
static char tmp_string_data[1024];
|
||||
|
||||
char * os_config_read_string( char *section, char *name, char *default_value )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwType, dwLen;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
char *os_config_read_string(char *section, char *name, char *default_value) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwType, dwLen;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
|
||||
if (section) {
|
||||
sprintf(keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section);
|
||||
} else {
|
||||
sprintf(keyname, "Software\\%s\\%s", szCompanyName, szAppName);
|
||||
}
|
||||
|
||||
if ( section ) {
|
||||
sprintf( keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section );
|
||||
} else {
|
||||
sprintf( keyname, "Software\\%s\\%s", szCompanyName, szAppName );
|
||||
}
|
||||
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, // Where it is
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey); // Location to store key
|
||||
|
||||
lResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE, // Where it is
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey ); // Location to store key
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (!name) {
|
||||
// mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( !name ) {
|
||||
//mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
dwLen = 1024;
|
||||
lResult = RegQueryValueEx(hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&tmp_string_data, // value to set
|
||||
&dwLen); // How many bytes to set
|
||||
|
||||
dwLen = 1024;
|
||||
lResult = RegQueryValueEx( hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&tmp_string_data, // value to set
|
||||
&dwLen ); // How many bytes to set
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error reading registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error reading registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
default_value = tmp_string_data;
|
||||
default_value = tmp_string_data;
|
||||
|
||||
Cleanup:
|
||||
if ( hKey )
|
||||
RegCloseKey(hKey);
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return default_value;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
|
||||
static char tmp_string_data_ex[1024];
|
||||
|
||||
char * os_config_read_string_ex( char *keyname, char *name, char *default_value )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwType, dwLen;
|
||||
LONG lResult;
|
||||
char *os_config_read_string_ex(char *keyname, char *name, char *default_value) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwType, dwLen;
|
||||
LONG lResult;
|
||||
|
||||
lResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE, // Where it is
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey ); // Location to store key
|
||||
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, // Where it is
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey); // Location to store key
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( !name ) {
|
||||
//mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (!name) {
|
||||
// mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
dwLen = 1024;
|
||||
lResult = RegQueryValueEx( hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&tmp_string_data_ex, // value to set
|
||||
&dwLen ); // How many bytes to set
|
||||
dwLen = 1024;
|
||||
lResult = RegQueryValueEx(hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&tmp_string_data_ex, // value to set
|
||||
&dwLen); // How many bytes to set
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error reading registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error reading registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
default_value = tmp_string_data_ex;
|
||||
default_value = tmp_string_data_ex;
|
||||
|
||||
Cleanup:
|
||||
if ( hKey )
|
||||
RegCloseKey(hKey);
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return default_value;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
char * os_config_read_string2( char *section, char *name, char *default_value )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwType, dwLen;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
char *os_config_read_string2(char *section, char *name, char *default_value) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwType, dwLen;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
|
||||
if (section) {
|
||||
sprintf(keyname, "Software\\%s\\%s", szCompanyName, section);
|
||||
} else {
|
||||
sprintf(keyname, "Software\\%s", szCompanyName);
|
||||
}
|
||||
|
||||
if ( section ) {
|
||||
sprintf( keyname, "Software\\%s\\%s", szCompanyName, section );
|
||||
} else {
|
||||
sprintf( keyname, "Software\\%s", szCompanyName );
|
||||
}
|
||||
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, // Where it is
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey); // Location to store key
|
||||
|
||||
lResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE, // Where it is
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey ); // Location to store key
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (!name) {
|
||||
// mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( !name ) {
|
||||
//mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
dwLen = 1024;
|
||||
lResult = RegQueryValueEx(hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&tmp_string_data, // value to set
|
||||
&dwLen); // How many bytes to set
|
||||
|
||||
dwLen = 1024;
|
||||
lResult = RegQueryValueEx( hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&tmp_string_data, // value to set
|
||||
&dwLen ); // How many bytes to set
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error reading registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error reading registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
default_value = tmp_string_data;
|
||||
default_value = tmp_string_data;
|
||||
|
||||
Cleanup:
|
||||
if ( hKey )
|
||||
RegCloseKey(hKey);
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return default_value;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
|
||||
// Reads a string from the INI file. Default_value must
|
||||
// be passed, and if 'name' isn't found, then returns default_value
|
||||
uint32_t os_config_read_uint( char *section, char *name, uint32_t default_value )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwType, dwLen;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
uint32_t tmp_val;
|
||||
uint32_t os_config_read_uint(char *section, char *name, uint32_t default_value) {
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwType, dwLen;
|
||||
char keyname[1024];
|
||||
LONG lResult;
|
||||
uint32_t tmp_val;
|
||||
|
||||
if (section) {
|
||||
sprintf(keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section);
|
||||
} else {
|
||||
sprintf(keyname, "Software\\%s\\%s", szCompanyName, szAppName);
|
||||
}
|
||||
|
||||
if ( section ) {
|
||||
sprintf( keyname, "Software\\%s\\%s\\%s", szCompanyName, szAppName, section );
|
||||
} else {
|
||||
sprintf( keyname, "Software\\%s\\%s", szCompanyName, szAppName );
|
||||
}
|
||||
lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, // Where it is
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey); // Location to store key
|
||||
|
||||
lResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE, // Where it is
|
||||
keyname, // name of key
|
||||
NULL, // DWORD reserved
|
||||
KEY_QUERY_VALUE, // Allows all changes
|
||||
&hKey ); // Location to store key
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error opening registry key '%s'\n", keyname );
|
||||
goto Cleanup;
|
||||
}
|
||||
if (!name) {
|
||||
// mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( !name ) {
|
||||
//mprintf( "No variable name passed\n" );
|
||||
goto Cleanup;
|
||||
}
|
||||
dwLen = 4;
|
||||
lResult = RegQueryValueEx(hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&tmp_val, // value to set
|
||||
&dwLen); // How many bytes to set
|
||||
|
||||
dwLen = 4;
|
||||
lResult = RegQueryValueEx( hKey, // Handle to key
|
||||
name, // The values name
|
||||
NULL, // DWORD reserved
|
||||
&dwType, // What kind it is
|
||||
(uint8_t *)&tmp_val, // value to set
|
||||
&dwLen ); // How many bytes to set
|
||||
if (lResult != ERROR_SUCCESS) {
|
||||
// mprintf( "Error reading registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
if ( lResult != ERROR_SUCCESS ) {
|
||||
//mprintf( "Error reading registry key '%s'\n", name );
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
default_value = tmp_val;
|
||||
default_value = tmp_val;
|
||||
|
||||
Cleanup:
|
||||
if ( hKey )
|
||||
RegCloseKey(hKey);
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return default_value;
|
||||
return default_value;
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@
|
||||
|
||||
#include "PsTypes.h"
|
||||
|
||||
void os_config_write_string( char *section, char *name, char *value );
|
||||
char *os_config_read_string( char *section, char *name, char *default_value );
|
||||
uint32_t os_config_read_uint( char *section, char *name, uint32_t default_value );
|
||||
void os_config_write_uint( char *section, char *name, uint32_t value );
|
||||
char *os_config_read_string_ex( char *keyname, char *name, char *default_value );
|
||||
void os_config_write_string(char *section, char *name, char *value);
|
||||
char *os_config_read_string(char *section, char *name, char *default_value);
|
||||
uint32_t os_config_read_uint(char *section, char *name, uint32_t default_value);
|
||||
void os_config_write_uint(char *section, char *name, uint32_t value);
|
||||
char *os_config_read_string_ex(char *keyname, char *name, char *default_value);
|
||||
|
||||
extern char *szSectionName;
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// SetupPropSheet.cpp : implementation file
|
||||
//
|
||||
@@ -34,55 +34,47 @@ static char THIS_FILE[] = __FILE__;
|
||||
|
||||
IMPLEMENT_DYNAMIC(CSetupPropSheet, CPropertySheet)
|
||||
|
||||
CSetupPropSheet::CSetupPropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
|
||||
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
|
||||
{
|
||||
}
|
||||
CSetupPropSheet::CSetupPropSheet(UINT nIDCaption, CWnd *pParentWnd, UINT iSelectPage)
|
||||
: CPropertySheet(nIDCaption, pParentWnd, iSelectPage) {}
|
||||
|
||||
CSetupPropSheet::CSetupPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
|
||||
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
|
||||
{
|
||||
}
|
||||
|
||||
CSetupPropSheet::~CSetupPropSheet()
|
||||
{
|
||||
}
|
||||
CSetupPropSheet::CSetupPropSheet(LPCTSTR pszCaption, CWnd *pParentWnd, UINT iSelectPage)
|
||||
: CPropertySheet(pszCaption, pParentWnd, iSelectPage) {}
|
||||
|
||||
CSetupPropSheet::~CSetupPropSheet() {}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSetupPropSheet, CPropertySheet)
|
||||
//{{AFX_MSG_MAP(CSetupPropSheet)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CSetupPropSheet)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSetupPropSheet message handlers
|
||||
|
||||
BOOL CSetupPropSheet::OnInitDialog()
|
||||
{
|
||||
BOOL bResult = CPropertySheet::OnInitDialog();
|
||||
BOOL CSetupPropSheet::OnInitDialog() {
|
||||
BOOL bResult = CPropertySheet::OnInitDialog();
|
||||
|
||||
// TODO: Add your specialized code here
|
||||
HWND OK_btn = ::GetDlgItem(this->m_hWnd, IDOK);
|
||||
if(OK_btn!=NULL) {
|
||||
CString title;
|
||||
title.LoadString(IDS_OK);
|
||||
::SetWindowText(OK_btn, title.GetBuffer(0));
|
||||
}
|
||||
// TODO: Add your specialized code here
|
||||
HWND OK_btn = ::GetDlgItem(this->m_hWnd, IDOK);
|
||||
if (OK_btn != NULL) {
|
||||
CString title;
|
||||
title.LoadString(IDS_OK);
|
||||
::SetWindowText(OK_btn, title.GetBuffer(0));
|
||||
}
|
||||
|
||||
HWND Cancel_btn = ::GetDlgItem(this->m_hWnd, IDCANCEL);
|
||||
if(Cancel_btn!=NULL) {
|
||||
CString title;
|
||||
title.LoadString(IDS_CANCEL);
|
||||
::SetWindowText(Cancel_btn, title.GetBuffer(0));
|
||||
}
|
||||
HWND Cancel_btn = ::GetDlgItem(this->m_hWnd, IDCANCEL);
|
||||
if (Cancel_btn != NULL) {
|
||||
CString title;
|
||||
title.LoadString(IDS_CANCEL);
|
||||
::SetWindowText(Cancel_btn, title.GetBuffer(0));
|
||||
}
|
||||
|
||||
HWND Help_btn = ::GetDlgItem(this->m_hWnd, IDHELP);
|
||||
if(Help_btn!=NULL) {
|
||||
CString title;
|
||||
title.LoadString(IDS_HELP);
|
||||
::SetWindowText(Help_btn, title.GetBuffer(0));
|
||||
}
|
||||
HWND Help_btn = ::GetDlgItem(this->m_hWnd, IDHELP);
|
||||
if (Help_btn != NULL) {
|
||||
CString title;
|
||||
title.LoadString(IDS_HELP);
|
||||
::SetWindowText(Help_btn, title.GetBuffer(0));
|
||||
}
|
||||
|
||||
return bResult;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_SETUPPROPSHEET_H__00C45F60_1F5F_11D3_A4E1_00A0C96ED60D__INCLUDED_)
|
||||
#define AFX_SETUPPROPSHEET_H__00C45F60_1F5F_11D3_A4E1_00A0C96ED60D__INCLUDED_
|
||||
@@ -28,38 +28,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSetupPropSheet
|
||||
|
||||
class CSetupPropSheet : public CPropertySheet
|
||||
{
|
||||
DECLARE_DYNAMIC(CSetupPropSheet)
|
||||
class CSetupPropSheet : public CPropertySheet {
|
||||
DECLARE_DYNAMIC(CSetupPropSheet)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CSetupPropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
|
||||
CSetupPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
|
||||
CSetupPropSheet(UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
|
||||
CSetupPropSheet(LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSetupPropSheet)
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSetupPropSheet)
|
||||
public:
|
||||
virtual ~CSetupPropSheet();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CSetupPropSheet();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CSetupPropSheet)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CSetupPropSheet)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// SiteSelectDlg.cpp : implementation file
|
||||
//
|
||||
@@ -31,222 +31,205 @@ static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// Column header info
|
||||
#define SITE_NAME_COLUMN 0
|
||||
#define SITE_ADDRESS_COLUMN 1
|
||||
#define SITE_LOCATION_COLUMN 2
|
||||
|
||||
#define SITE_NAME_COLUMN_WIDTH 0.3
|
||||
#define SITE_ADDRESS_COLUMN_WIDTH 0.4
|
||||
#define SITE_LOCATION_COLUMN_WIDTH 0.3
|
||||
#define SITE_NAME_COLUMN 0
|
||||
#define SITE_ADDRESS_COLUMN 1
|
||||
#define SITE_LOCATION_COLUMN 2
|
||||
|
||||
#define SITE_NAME_COLUMN_WIDTH 0.3
|
||||
#define SITE_ADDRESS_COLUMN_WIDTH 0.4
|
||||
#define SITE_LOCATION_COLUMN_WIDTH 0.3
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSiteSelectDlg dialog
|
||||
|
||||
|
||||
CSiteSelectDlg::CSiteSelectDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CSiteSelectDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CSiteSelectDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CSiteSelectDlg::CSiteSelectDlg(CWnd *pParent /*=NULL*/) : CDialog(CSiteSelectDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CSiteSelectDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CSiteSelectDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CSiteSelectDlg)
|
||||
DDX_Control(pDX, IDC_SITE_LIST, m_SiteList);
|
||||
//}}AFX_DATA_MAP
|
||||
void CSiteSelectDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CSiteSelectDlg)
|
||||
DDX_Control(pDX, IDC_SITE_LIST, m_SiteList);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSiteSelectDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CSiteSelectDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CSiteSelectDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSiteSelectDlg message handlers
|
||||
|
||||
void CSiteSelectDlg::OnOK()
|
||||
{
|
||||
// TODO: Add extra validation here
|
||||
int num_items, j, flags;
|
||||
void CSiteSelectDlg::OnOK() {
|
||||
// TODO: Add extra validation here
|
||||
int num_items, j, flags;
|
||||
|
||||
// If no item is selected, return (user MUST select an item)
|
||||
if(m_SiteList.GetSelectedCount()==0) {
|
||||
LocalizedMessageBox(IDS_SITESELECTDLG_MUST_SELECT, IDS_SITESELECTDLG_SELECT_TITLE, MB_OK|MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
// If no item is selected, return (user MUST select an item)
|
||||
if (m_SiteList.GetSelectedCount() == 0) {
|
||||
LocalizedMessageBox(IDS_SITESELECTDLG_MUST_SELECT, IDS_SITESELECTDLG_SELECT_TITLE, MB_OK | MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
// How many items in the control list?
|
||||
num_items=m_SiteList.GetItemCount();
|
||||
// How many items in the control list?
|
||||
num_items = m_SiteList.GetItemCount();
|
||||
|
||||
// scan the item list for the selected item
|
||||
chosen_site=NO_SITE_CHOSEN;
|
||||
j=0;
|
||||
while(j<num_items) {
|
||||
// scan the item list for the selected item
|
||||
chosen_site = NO_SITE_CHOSEN;
|
||||
j = 0;
|
||||
while (j < num_items) {
|
||||
|
||||
flags=m_SiteList.GetItemState(j,LVIS_SELECTED);
|
||||
if(flags & LVIS_SELECTED)
|
||||
chosen_site=j;
|
||||
flags = m_SiteList.GetItemState(j, LVIS_SELECTED);
|
||||
if (flags & LVIS_SELECTED)
|
||||
chosen_site = j;
|
||||
|
||||
j++;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
// If no site is selected, get outta here
|
||||
if(chosen_site==NO_SITE_CHOSEN) {
|
||||
LocalizedMessageBox(IDS_SITESELECTDLG_MUST_SELECT, IDS_SITESELECTDLG_SELECT_TITLE, MB_OK|MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
// If no site is selected, get outta here
|
||||
if (chosen_site == NO_SITE_CHOSEN) {
|
||||
LocalizedMessageBox(IDS_SITESELECTDLG_MUST_SELECT, IDS_SITESELECTDLG_SELECT_TITLE, MB_OK | MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the selected download path
|
||||
sprintf(download_path,"%s%s",site_entries[chosen_site].url,site_entries[chosen_site].path);
|
||||
// Create the selected download path
|
||||
sprintf(download_path, "%s%s", site_entries[chosen_site].url, site_entries[chosen_site].path);
|
||||
|
||||
CDialog::OnOK();
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
BOOL CSiteSelectDlg::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
BOOL CSiteSelectDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
// TODO: Add extra initialization here
|
||||
CString column_name;
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
CString column_name;
|
||||
// Setup the columns
|
||||
column_name.LoadString(IDS_SITESELECTDLG_SITE_NAME);
|
||||
m_SiteList.InsertColumn(SITE_NAME_COLUMN, column_name.GetBuffer(0), LVCFMT_LEFT, -1, SITE_NAME_COLUMN);
|
||||
column_name.LoadString(IDS_SITESELECTDLG_SITE_ADDRESS);
|
||||
m_SiteList.InsertColumn(SITE_ADDRESS_COLUMN, column_name.GetBuffer(0), LVCFMT_LEFT, -1, SITE_ADDRESS_COLUMN);
|
||||
column_name.LoadString(IDS_SITESELECTDLG_SITE_LOCATION);
|
||||
m_SiteList.InsertColumn(SITE_LOCATION_COLUMN, column_name.GetBuffer(0), LVCFMT_LEFT, -1, SITE_LOCATION_COLUMN);
|
||||
SetColumnWidths();
|
||||
|
||||
// Setup the columns
|
||||
column_name.LoadString(IDS_SITESELECTDLG_SITE_NAME);
|
||||
m_SiteList.InsertColumn(SITE_NAME_COLUMN,column_name.GetBuffer(0),LVCFMT_LEFT,
|
||||
-1,SITE_NAME_COLUMN);
|
||||
column_name.LoadString(IDS_SITESELECTDLG_SITE_ADDRESS);
|
||||
m_SiteList.InsertColumn(SITE_ADDRESS_COLUMN,column_name.GetBuffer(0),LVCFMT_LEFT,
|
||||
-1,SITE_ADDRESS_COLUMN);
|
||||
column_name.LoadString(IDS_SITESELECTDLG_SITE_LOCATION);
|
||||
m_SiteList.InsertColumn(SITE_LOCATION_COLUMN,column_name.GetBuffer(0),LVCFMT_LEFT,
|
||||
-1,SITE_LOCATION_COLUMN);
|
||||
SetColumnWidths();
|
||||
// Init the site entries
|
||||
m_SiteList.SetFullRowSel(TRUE);
|
||||
m_SiteList.DeleteAllItems();
|
||||
num_sites = 0;
|
||||
chosen_site = NO_SITE_CHOSEN;
|
||||
download_path[0] = '\0';
|
||||
|
||||
// Init the site entries
|
||||
m_SiteList.SetFullRowSel(TRUE);
|
||||
m_SiteList.DeleteAllItems();
|
||||
num_sites=0;
|
||||
chosen_site=NO_SITE_CHOSEN;
|
||||
download_path[0]='\0';
|
||||
// Read in the site entry data
|
||||
if (!ParseSiteFile()) {
|
||||
LocalizedMessageBox(IDS_SITESELECTDLG_PARSE_ERROR, IDS_SITESELECTDLG_SELECT_TITLE, MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Read in the site entry data
|
||||
if(!ParseSiteFile()) {
|
||||
LocalizedMessageBox(IDS_SITESELECTDLG_PARSE_ERROR, IDS_SITESELECTDLG_SELECT_TITLE, MB_OK | MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
m_SiteList.SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
||||
|
||||
m_SiteList.SetItemState(0,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
// Calculates column widths and sets them
|
||||
void CSiteSelectDlg::SetColumnWidths(void)
|
||||
{
|
||||
uint32_t w0, w1, w2;
|
||||
void CSiteSelectDlg::SetColumnWidths(void) {
|
||||
uint32_t w0, w1, w2;
|
||||
|
||||
RECT rect;
|
||||
m_SiteList.GetClientRect(&rect);
|
||||
RECT rect;
|
||||
m_SiteList.GetClientRect(&rect);
|
||||
|
||||
w0=uint32_t(rect.right*SITE_NAME_COLUMN_WIDTH);
|
||||
w1=uint32_t(rect.right*SITE_ADDRESS_COLUMN_WIDTH);
|
||||
w2=uint32_t(rect.right*SITE_LOCATION_COLUMN_WIDTH);
|
||||
w0 = uint32_t(rect.right * SITE_NAME_COLUMN_WIDTH);
|
||||
w1 = uint32_t(rect.right * SITE_ADDRESS_COLUMN_WIDTH);
|
||||
w2 = uint32_t(rect.right * SITE_LOCATION_COLUMN_WIDTH);
|
||||
|
||||
m_SiteList.SetColumnWidth(SITE_NAME_COLUMN,w0);
|
||||
m_SiteList.SetColumnWidth(SITE_ADDRESS_COLUMN,w1);
|
||||
m_SiteList.SetColumnWidth(SITE_LOCATION_COLUMN,w2);
|
||||
m_SiteList.SetColumnWidth(SITE_NAME_COLUMN, w0);
|
||||
m_SiteList.SetColumnWidth(SITE_ADDRESS_COLUMN, w1);
|
||||
m_SiteList.SetColumnWidth(SITE_LOCATION_COLUMN, w2);
|
||||
}
|
||||
|
||||
// Reads in site entries from the site info file,
|
||||
// and adds them to the lists
|
||||
BOOL CSiteSelectDlg::ParseSiteFile(void)
|
||||
{
|
||||
SITE_ENTRY site_entry;
|
||||
char filebuffer[_MAX_PATH+1];
|
||||
int field;
|
||||
FILE *f;
|
||||
BOOL CSiteSelectDlg::ParseSiteFile(void) {
|
||||
SITE_ENTRY site_entry;
|
||||
char filebuffer[_MAX_PATH + 1];
|
||||
int field;
|
||||
FILE *f;
|
||||
|
||||
f = fopen(SITES_LOC_FNAME, "rt");
|
||||
if(f == NULL){
|
||||
return FALSE;
|
||||
}
|
||||
f = fopen(SITES_LOC_FNAME, "rt");
|
||||
if (f == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
field=0;
|
||||
strcpy(filebuffer,"");
|
||||
while (!feof(f)) {
|
||||
fgets(filebuffer, _MAX_PATH, f);
|
||||
if(strlen(filebuffer)>0 && filebuffer[strlen(filebuffer) - 1] == '\n')
|
||||
filebuffer[strlen(filebuffer) - 1] = '\0';
|
||||
field = 0;
|
||||
strcpy(filebuffer, "");
|
||||
while (!feof(f)) {
|
||||
fgets(filebuffer, _MAX_PATH, f);
|
||||
if (strlen(filebuffer) > 0 && filebuffer[strlen(filebuffer) - 1] == '\n')
|
||||
filebuffer[strlen(filebuffer) - 1] = '\0';
|
||||
|
||||
// if line is a comment, or empty, discard it
|
||||
if(strlen(filebuffer)==0 || filebuffer[0]==SITE_FILE_COMMENT_CHAR)
|
||||
continue;
|
||||
// if line is a comment, or empty, discard it
|
||||
if (strlen(filebuffer) == 0 || filebuffer[0] == SITE_FILE_COMMENT_CHAR)
|
||||
continue;
|
||||
|
||||
switch(field) {
|
||||
case 0:
|
||||
strcpy(site_entry.name,filebuffer);
|
||||
break;
|
||||
case 1:
|
||||
strcpy(site_entry.location,filebuffer);
|
||||
break;
|
||||
case 2:
|
||||
strcpy(site_entry.url,filebuffer);
|
||||
break;
|
||||
case 3:
|
||||
strcpy(site_entry.path,filebuffer);
|
||||
break;
|
||||
}
|
||||
switch (field) {
|
||||
case 0:
|
||||
strcpy(site_entry.name, filebuffer);
|
||||
break;
|
||||
case 1:
|
||||
strcpy(site_entry.location, filebuffer);
|
||||
break;
|
||||
case 2:
|
||||
strcpy(site_entry.url, filebuffer);
|
||||
break;
|
||||
case 3:
|
||||
strcpy(site_entry.path, filebuffer);
|
||||
break;
|
||||
}
|
||||
|
||||
field++;
|
||||
if(field==4) {
|
||||
AddSiteEntry(&site_entry);
|
||||
field=0;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
field++;
|
||||
if (field == 4) {
|
||||
AddSiteEntry(&site_entry);
|
||||
field = 0;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Adds an entry struct to the list array and the list control
|
||||
BOOL CSiteSelectDlg::AddSiteEntry(SITE_ENTRY *entry)
|
||||
{
|
||||
int index;
|
||||
BOOL CSiteSelectDlg::AddSiteEntry(SITE_ENTRY *entry) {
|
||||
int index;
|
||||
|
||||
// Check if too many sites have been read in
|
||||
if(num_sites>=MAX_SITES) return FALSE;
|
||||
// Check if too many sites have been read in
|
||||
if (num_sites >= MAX_SITES)
|
||||
return FALSE;
|
||||
|
||||
// Add the entry to the list control
|
||||
index=m_SiteList.GetItemCount();
|
||||
if((index=m_SiteList.InsertItem(index,entry->name))==-1)
|
||||
OutputDebugString("Didn't work!");
|
||||
// Add the entry to the list control
|
||||
index = m_SiteList.GetItemCount();
|
||||
if ((index = m_SiteList.InsertItem(index, entry->name)) == -1)
|
||||
OutputDebugString("Didn't work!");
|
||||
|
||||
m_SiteList.SetItem(index,SITE_ADDRESS_COLUMN,LVIF_TEXT,entry->url,0,0,0,0);
|
||||
m_SiteList.SetItem(index,SITE_LOCATION_COLUMN,LVIF_TEXT,entry->location,0,0,0,0);
|
||||
m_SiteList.SetItem(index, SITE_ADDRESS_COLUMN, LVIF_TEXT, entry->url, 0, 0, 0, 0);
|
||||
m_SiteList.SetItem(index, SITE_LOCATION_COLUMN, LVIF_TEXT, entry->location, 0, 0, 0, 0);
|
||||
|
||||
// Add the entry to the list array
|
||||
strcpy(site_entries[num_sites].name,entry->name);
|
||||
strcpy(site_entries[num_sites].location,entry->location);
|
||||
strcpy(site_entries[num_sites].url,entry->url);
|
||||
strcpy(site_entries[num_sites].path,entry->path);
|
||||
num_sites++;
|
||||
// Add the entry to the list array
|
||||
strcpy(site_entries[num_sites].name, entry->name);
|
||||
strcpy(site_entries[num_sites].location, entry->location);
|
||||
strcpy(site_entries[num_sites].url, entry->url);
|
||||
strcpy(site_entries[num_sites].path, entry->path);
|
||||
num_sites++;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CSiteSelectDlg::LocalizedMessageBox(UINT msgID, UINT titleID, UINT type /*=MB_OK*/)
|
||||
{
|
||||
CString msg, title;
|
||||
void CSiteSelectDlg::LocalizedMessageBox(UINT msgID, UINT titleID, UINT type /*=MB_OK*/) {
|
||||
CString msg, title;
|
||||
|
||||
msg.LoadString(msgID);
|
||||
title.LoadString(titleID);
|
||||
MessageBox(msg,title,type);
|
||||
msg.LoadString(msgID);
|
||||
title.LoadString(titleID);
|
||||
MessageBox(msg, title, type);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_SITESELECTDLG_H__65671E24_38F7_11D2_8CBD_00A0C96ED60D__INCLUDED_)
|
||||
#define AFX_SITESELECTDLG_H__65671E24_38F7_11D2_8CBD_00A0C96ED60D__INCLUDED_
|
||||
@@ -28,61 +28,58 @@
|
||||
#include "PsTypes.h"
|
||||
#include "ListCtrlEx.h"
|
||||
|
||||
#define MAX_SITES 50
|
||||
#define MAX_SITES 50
|
||||
|
||||
#define SITE_FILE_COMMENT_CHAR ';'
|
||||
#define SITE_FILE_COMMENT_CHAR ';'
|
||||
|
||||
// Structure for the site entries
|
||||
struct SITE_ENTRY {
|
||||
char name[_MAX_PATH+1]; // The name/description of the site
|
||||
char url[_MAX_PATH+1]; // Just the base http/ftp address
|
||||
char location[_MAX_PATH+1]; // Where the site is located
|
||||
char path[_MAX_PATH+1]; // The remote directory and patch filename
|
||||
char name[_MAX_PATH + 1]; // The name/description of the site
|
||||
char url[_MAX_PATH + 1]; // Just the base http/ftp address
|
||||
char location[_MAX_PATH + 1]; // Where the site is located
|
||||
char path[_MAX_PATH + 1]; // The remote directory and patch filename
|
||||
};
|
||||
|
||||
#define NO_SITE_CHOSEN -1
|
||||
#define NO_SITE_CHOSEN -1
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSiteSelectDlg dialog
|
||||
|
||||
class CSiteSelectDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CSiteSelectDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CSiteSelectDlg(CWnd* pParent = NULL); // standard constructor
|
||||
void SetColumnWidths(void);
|
||||
BOOL AddSiteEntry(SITE_ENTRY *entry);
|
||||
BOOL ParseSiteFile(void);
|
||||
void LocalizedMessageBox(UINT msgID, UINT titleID, UINT type=MB_OK);
|
||||
CSiteSelectDlg(CWnd *pParent = NULL); // standard constructor
|
||||
void SetColumnWidths(void);
|
||||
BOOL AddSiteEntry(SITE_ENTRY *entry);
|
||||
BOOL ParseSiteFile(void);
|
||||
void LocalizedMessageBox(UINT msgID, UINT titleID, UINT type = MB_OK);
|
||||
|
||||
SITE_ENTRY site_entries[MAX_SITES]; // array of site entries
|
||||
int num_sites; // the number of sites in memory
|
||||
int chosen_site; // the index of the chosen site
|
||||
char download_path[_MAX_PATH*2+1]; // the full patch download path
|
||||
SITE_ENTRY site_entries[MAX_SITES]; // array of site entries
|
||||
int num_sites; // the number of sites in memory
|
||||
int chosen_site; // the index of the chosen site
|
||||
char download_path[_MAX_PATH * 2 + 1]; // the full patch download path
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CSiteSelectDlg)
|
||||
enum { IDD = IDD_SITE_SELECTION_DIALOG };
|
||||
CListCtrlEx m_SiteList;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CSiteSelectDlg)
|
||||
enum { IDD = IDD_SITE_SELECTION_DIALOG };
|
||||
CListCtrlEx m_SiteList;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSiteSelectDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSiteSelectDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CSiteSelectDlg)
|
||||
virtual void OnOK();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CSiteSelectDlg)
|
||||
virtual void OnOK();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -109,376 +109,356 @@ static char THIS_FILE[] = __FILE__;
|
||||
|
||||
IMPLEMENT_DYNCREATE(CSpeedTab, CPropertyPage)
|
||||
|
||||
CSpeedTab::CSpeedTab() : CPropertyPage(CSpeedTab::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CSpeedTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
m_WriteDetailValues=FALSE;
|
||||
CSpeedTab::CSpeedTab() : CPropertyPage(CSpeedTab::IDD) {
|
||||
//{{AFX_DATA_INIT(CSpeedTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
m_WriteDetailValues = FALSE;
|
||||
}
|
||||
|
||||
CSpeedTab::~CSpeedTab()
|
||||
{
|
||||
}
|
||||
CSpeedTab::~CSpeedTab() {}
|
||||
|
||||
void CSpeedTab::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CSpeedTab)
|
||||
DDX_Control(pDX, IDC_SPEED_LIST, m_speed_list);
|
||||
//}}AFX_DATA_MAP
|
||||
void CSpeedTab::DoDataExchange(CDataExchange *pDX) {
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CSpeedTab)
|
||||
DDX_Control(pDX, IDC_SPEED_LIST, m_speed_list);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CSpeedTab, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CSpeedTab)
|
||||
ON_BN_CLICKED(IDC_BTN_SPEED_DETECT, OnBtnSpeedDetect)
|
||||
ON_MESSAGE(WM_COMMANDHELP,OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
ON_CBN_SELCHANGE(IDC_SPEED_LIST, OnSelchangeSpeedList)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CSpeedTab)
|
||||
ON_BN_CLICKED(IDC_BTN_SPEED_DETECT, OnBtnSpeedDetect)
|
||||
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
ON_CBN_SELCHANGE(IDC_SPEED_LIST, OnSelchangeSpeedList)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSpeedTab message handlers
|
||||
|
||||
void CSpeedTab::OnOK()
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
int cur_speed = m_speed_list.GetCurSel();
|
||||
void CSpeedTab::OnOK() {
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
int cur_speed = m_speed_list.GetCurSel();
|
||||
|
||||
if ( (cur_speed < 0) || (cur_speed>CUSTOM_DETAIL)) {
|
||||
cur_speed = 0;
|
||||
}
|
||||
if ((cur_speed < 0) || (cur_speed > CUSTOM_DETAIL)) {
|
||||
cur_speed = 0;
|
||||
}
|
||||
|
||||
os_config_write_uint(szSectionName, "PredefDetailSetting", cur_speed );
|
||||
os_config_write_uint(szSectionName, "PredefDetailSetting", cur_speed);
|
||||
|
||||
// If the user has switched to a new default detail setting,
|
||||
// then write out all the default detail levels to registry
|
||||
if(m_WriteDetailValues) {
|
||||
switch(cur_speed) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
m_WriteDetailValues=FALSE;
|
||||
}
|
||||
// If the user has switched to a new default detail setting,
|
||||
// then write out all the default detail levels to registry
|
||||
if (m_WriteDetailValues) {
|
||||
switch (cur_speed) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
m_WriteDetailValues = FALSE;
|
||||
}
|
||||
|
||||
// As long as they have viewed this page, they can get past the
|
||||
// "set detail level" message when trying to play
|
||||
DetailLevelConfigured=TRUE;
|
||||
// As long as they have viewed this page, they can get past the
|
||||
// "set detail level" message when trying to play
|
||||
DetailLevelConfigured = TRUE;
|
||||
|
||||
CPropertyPage::OnOK();
|
||||
CPropertyPage::OnOK();
|
||||
}
|
||||
|
||||
BOOL CSpeedTab::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
BOOL CSpeedTab::OnInitDialog() {
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
// 0=low, 1=medium, 2=high, 3=very high
|
||||
int cur_speed = os_config_read_uint(szSectionName, "PredefDetailSetting", MEDIUM_DETAIL );
|
||||
// TODO: Add extra initialization here
|
||||
// 0=low, 1=medium, 2=high, 3=very high
|
||||
int cur_speed = os_config_read_uint(szSectionName, "PredefDetailSetting", MEDIUM_DETAIL);
|
||||
|
||||
if ( cur_speed < 0 )
|
||||
cur_speed = 0;
|
||||
else if ( cur_speed > CUSTOM_DETAIL )
|
||||
cur_speed = VERY_HIGH_DETAIL;
|
||||
if (cur_speed < 0)
|
||||
cur_speed = 0;
|
||||
else if (cur_speed > CUSTOM_DETAIL)
|
||||
cur_speed = VERY_HIGH_DETAIL;
|
||||
|
||||
m_speed_list.ResetContent();
|
||||
m_speed_list.ResetContent();
|
||||
|
||||
CString speed_type;
|
||||
CString speed_type;
|
||||
|
||||
speed_type.LoadString(IDS_SPEEDTAB_LOW);
|
||||
m_speed_list.InsertString( LOW_DETAIL, speed_type );
|
||||
speed_type.LoadString(IDS_SPEEDTAB_MEDIUM);
|
||||
m_speed_list.InsertString( MEDIUM_DETAIL, speed_type );
|
||||
speed_type.LoadString(IDS_SPEEDTAB_HIGH);
|
||||
m_speed_list.InsertString( HIGH_DETAIL, speed_type );
|
||||
speed_type.LoadString(IDS_SPEEDTAB_VERY_HIGH);
|
||||
m_speed_list.InsertString( VERY_HIGH_DETAIL, speed_type );
|
||||
speed_type.LoadString(IDS_SPEEDTAB_LOW);
|
||||
m_speed_list.InsertString(LOW_DETAIL, speed_type);
|
||||
speed_type.LoadString(IDS_SPEEDTAB_MEDIUM);
|
||||
m_speed_list.InsertString(MEDIUM_DETAIL, speed_type);
|
||||
speed_type.LoadString(IDS_SPEEDTAB_HIGH);
|
||||
m_speed_list.InsertString(HIGH_DETAIL, speed_type);
|
||||
speed_type.LoadString(IDS_SPEEDTAB_VERY_HIGH);
|
||||
m_speed_list.InsertString(VERY_HIGH_DETAIL, speed_type);
|
||||
|
||||
if(cur_speed==CUSTOM_DETAIL) {
|
||||
speed_type.LoadString(IDS_SPEEDTAB_CUSTOM);
|
||||
m_speed_list.InsertString( CUSTOM_DETAIL, speed_type );
|
||||
}
|
||||
if (cur_speed == CUSTOM_DETAIL) {
|
||||
speed_type.LoadString(IDS_SPEEDTAB_CUSTOM);
|
||||
m_speed_list.InsertString(CUSTOM_DETAIL, speed_type);
|
||||
}
|
||||
|
||||
m_speed_list.SetCurSel(cur_speed);
|
||||
m_speed_list.SetCurSel(cur_speed);
|
||||
|
||||
m_WriteDetailValues=FALSE;
|
||||
m_WriteDetailValues = FALSE;
|
||||
|
||||
// Blank out property entries so user can watch them fill up again
|
||||
CString tmp_str;
|
||||
char tmp[1024];
|
||||
HWND hwnd;
|
||||
// Blank out property entries so user can watch them fill up again
|
||||
CString tmp_str;
|
||||
char tmp[1024];
|
||||
HWND hwnd;
|
||||
|
||||
tmp_str.LoadString(IDS_SPEEDTAB_NOT_DETECTED);
|
||||
sprintf(tmp,"%s",tmp_str.GetBuffer(0));
|
||||
GetDlgItem( IDC_CPU_TYPE, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_CPU_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_TOTAL_RAM, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_RAM_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_VRAM_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_3D_GRAPHICS_ACCELERATOR, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
tmp_str.LoadString(IDS_SPEEDTAB_NOT_DETECTED);
|
||||
sprintf(tmp, "%s", tmp_str.GetBuffer(0));
|
||||
GetDlgItem(IDC_CPU_TYPE, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_CPU_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_TOTAL_RAM, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_RAM_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_VRAM_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_3D_GRAPHICS_ACCELERATOR, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
#define CPUID _asm _emit 0fh _asm _emit 0a2h
|
||||
#define EMMS _asm _emit 0fh _asm _emit 077h
|
||||
#define RTSC _asm _emit 0fh _asm _emit 031h
|
||||
|
||||
DWORD ReadClocks()
|
||||
{
|
||||
DWORD count;
|
||||
DWORD ReadClocks() {
|
||||
DWORD count;
|
||||
|
||||
_asm {
|
||||
_asm {
|
||||
RTSC
|
||||
mov count, eax
|
||||
}
|
||||
return count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Returns cpu type.
|
||||
void detect_cpu(int *cpu, int *mmx, int *time_stamp_counter)
|
||||
{
|
||||
BOOL retval = TRUE;
|
||||
DWORD RegEDX;
|
||||
DWORD RegEAX;
|
||||
void detect_cpu(int *cpu, int *mmx, int *time_stamp_counter) {
|
||||
BOOL retval = TRUE;
|
||||
DWORD RegEDX;
|
||||
DWORD RegEAX;
|
||||
|
||||
// Set defaults
|
||||
*cpu = 0;
|
||||
*mmx = 0;
|
||||
*time_stamp_counter = 0;
|
||||
// Set defaults
|
||||
*cpu = 0;
|
||||
*mmx = 0;
|
||||
*time_stamp_counter = 0;
|
||||
|
||||
|
||||
// jmp is not allowed in try
|
||||
// jmp is not allowed in try
|
||||
|
||||
_asm {
|
||||
|
||||
// Check for prescence of
|
||||
// Check for prescence of
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
pushfd // get extended flags
|
||||
pushfd // get extended flags
|
||||
pop eax
|
||||
mov ebx, eax // save current flags
|
||||
xor eax, 200000h // toggle bit 21
|
||||
push eax // push new flags on stack
|
||||
popfd // flags updated now in flags
|
||||
pushfd // get extended flags
|
||||
pop eax // store extended flags in eax
|
||||
xor eax, ebx // if bit 21 r/w then eax <> 0
|
||||
mov ebx, eax // save current flags
|
||||
xor eax, 200000h // toggle bit 21
|
||||
push eax // push new flags on stack
|
||||
popfd // flags updated now in flags
|
||||
pushfd // get extended flags
|
||||
pop eax // store extended flags in eax
|
||||
xor eax, ebx // if bit 21 r/w then eax <> 0
|
||||
je no_cpuid
|
||||
|
||||
mov eax, 1 // setup CPUID to return features
|
||||
mov eax, 1 // setup CPUID to return features
|
||||
|
||||
CPUID // code bytes = 0fh, 0a2h
|
||||
CPUID // code bytes = 0fh, 0a2h
|
||||
|
||||
mov RegEAX, eax // family, etc returned in eax
|
||||
mov RegEDX, edx // features returned in edx
|
||||
mov RegEAX, eax // family, etc returned in eax
|
||||
mov RegEDX, edx // features returned in edx
|
||||
jmp done_checking_cpuid
|
||||
|
||||
|
||||
no_cpuid:
|
||||
mov RegEAX, 4<<8 // family, etc returned in eax
|
||||
mov RegEDX, 0 // features returned in edx
|
||||
mov RegEAX, 4<<8 // family, etc returned in eax
|
||||
mov RegEDX, 0 // features returned in edx
|
||||
|
||||
done_checking_cpuid:
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
}
|
||||
}
|
||||
|
||||
// RegEAX . Bits 11:8 is family
|
||||
*cpu = (RegEAX >> 8) & 0xF;
|
||||
|
||||
if (*cpu < 5) {
|
||||
*cpu = 4; // processor does not support CPUID
|
||||
*mmx = 0;
|
||||
}
|
||||
|
||||
//RegEAX . Bits 11:8 is family
|
||||
*cpu = (RegEAX >>8) & 0xF;
|
||||
if (RegEDX & (1 << 4)) { // bit 4 is set for RTSC technology
|
||||
*time_stamp_counter = 1;
|
||||
}
|
||||
|
||||
if ( *cpu < 5 ) {
|
||||
*cpu = 4; // processor does not support CPUID
|
||||
*mmx = 0;
|
||||
}
|
||||
if (RegEDX & 0x800000) // bit 23 is set for MMX technology
|
||||
{
|
||||
|
||||
if (RegEDX & (1<<4) ) { // bit 4 is set for RTSC technology
|
||||
*time_stamp_counter = 1;
|
||||
}
|
||||
__try {
|
||||
|
||||
if (RegEDX & 0x800000) // bit 23 is set for MMX technology
|
||||
{
|
||||
|
||||
__try {
|
||||
|
||||
_asm {
|
||||
_asm {
|
||||
EMMS
|
||||
}
|
||||
}
|
||||
|
||||
} // try executing an MMX instruction "emms"
|
||||
} // try executing an MMX instruction "emms"
|
||||
|
||||
__except(EXCEPTION_EXECUTE_HANDLER) { retval = FALSE; }
|
||||
__except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
} else {
|
||||
*mmx = 0; // processor supports CPUID but does not support MMX technology
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
*mmx = 0; // processor supports CPUID but does not support MMX technology
|
||||
return;
|
||||
}
|
||||
|
||||
if (retval == 0) {
|
||||
// if retval == 0 here that means the processor has MMX technology but
|
||||
// floating-point emulation is on; so MMX technology is unavailable
|
||||
*mmx = 0; // processor supports CPUID but does not support MMX technology
|
||||
return;
|
||||
}
|
||||
|
||||
if ( retval == 0 ) {
|
||||
// if retval == 0 here that means the processor has MMX technology but
|
||||
// floating-point emulation is on; so MMX technology is unavailable
|
||||
*mmx = 0; // processor supports CPUID but does not support MMX technology
|
||||
return;
|
||||
}
|
||||
|
||||
*mmx = 1; // processor supports CPUID but does not support MMX technology
|
||||
*mmx = 1; // processor supports CPUID but does not support MMX technology
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
void CSpeedTab::OnBtnSpeedDetect()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
char tmp[1024];
|
||||
CString tmp_str;
|
||||
HWND hwnd;
|
||||
void CSpeedTab::OnBtnSpeedDetect() {
|
||||
// TODO: Add your control notification handler code here
|
||||
char tmp[1024];
|
||||
CString tmp_str;
|
||||
HWND hwnd;
|
||||
|
||||
// Set the wait cursor
|
||||
CWaitCursor wc;
|
||||
// Set the wait cursor
|
||||
CWaitCursor wc;
|
||||
|
||||
// Blank out property entries so user can watch them fill up again
|
||||
tmp_str.LoadString(IDS_SPEEDTAB_NOT_DETECTED);
|
||||
sprintf(tmp,"%s",tmp_str.GetBuffer(0));
|
||||
GetDlgItem( IDC_CPU_TYPE, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_CPU_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_TOTAL_RAM, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_RAM_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_VRAM_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
GetDlgItem( IDC_3D_GRAPHICS_ACCELERATOR, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
// Blank out property entries so user can watch them fill up again
|
||||
tmp_str.LoadString(IDS_SPEEDTAB_NOT_DETECTED);
|
||||
sprintf(tmp, "%s", tmp_str.GetBuffer(0));
|
||||
GetDlgItem(IDC_CPU_TYPE, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_CPU_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_TOTAL_RAM, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_RAM_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_VRAM_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
GetDlgItem(IDC_3D_GRAPHICS_ACCELERATOR, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
|
||||
int cpu, mmx, timestamp_available;
|
||||
detect_cpu(&cpu, &mmx, ×tamp_available);
|
||||
|
||||
int cpu, mmx, timestamp_available;
|
||||
detect_cpu( &cpu, &mmx, ×tamp_available );
|
||||
switch (cpu) {
|
||||
case 3:
|
||||
sprintf(tmp, "i386");
|
||||
break;
|
||||
case 4:
|
||||
sprintf(tmp, "i486");
|
||||
break;
|
||||
case 5:
|
||||
sprintf(tmp, "Pentium ");
|
||||
if (mmx) {
|
||||
strcat(tmp, " w/ MMX");
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (SupportsKatmai()) {
|
||||
sprintf(tmp, "Pentium III");
|
||||
} else if (mmx) {
|
||||
sprintf(tmp, "Pentium II w/ MMX");
|
||||
} else {
|
||||
sprintf(tmp, "Pentium Pro");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sprintf(tmp, "i%d86, MMX:%s", cpu, (mmx ? "Yes" : "No"));
|
||||
break;
|
||||
}
|
||||
|
||||
switch( cpu ) {
|
||||
case 3:
|
||||
sprintf( tmp, "i386" );
|
||||
break;
|
||||
case 4:
|
||||
sprintf( tmp, "i486" );
|
||||
break;
|
||||
case 5:
|
||||
sprintf( tmp, "Pentium " );
|
||||
if ( mmx ) {
|
||||
strcat( tmp, " w/ MMX" );
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (SupportsKatmai()) {
|
||||
sprintf( tmp, "Pentium III" );
|
||||
} else if ( mmx ) {
|
||||
sprintf( tmp, "Pentium II w/ MMX" );
|
||||
} else {
|
||||
sprintf( tmp, "Pentium Pro" );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sprintf( tmp, "i%d86, MMX:%s", cpu, (mmx?"Yes":"No") );
|
||||
break;
|
||||
}
|
||||
GetDlgItem(IDC_CPU_TYPE, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
|
||||
GetDlgItem( IDC_CPU_TYPE, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
int NiceMhz = 0;
|
||||
|
||||
int NiceMhz = 0;
|
||||
if (timestamp_available) {
|
||||
DWORD t1;
|
||||
DWORD c1, c2;
|
||||
|
||||
do {
|
||||
|
||||
if ( timestamp_available ) {
|
||||
DWORD t1;
|
||||
DWORD c1, c2;
|
||||
t1 = timeGetTime() + 1000;
|
||||
|
||||
do {
|
||||
c1 = ReadClocks();
|
||||
|
||||
t1 = timeGetTime() + 1000;
|
||||
while (timeGetTime() < t1) {
|
||||
}
|
||||
|
||||
c1 = ReadClocks();
|
||||
c2 = ReadClocks();
|
||||
} while (c2 < c1); // Retry if it rolled
|
||||
|
||||
while( timeGetTime() < t1 ) {
|
||||
}
|
||||
int Mhz = c2 - c1;
|
||||
|
||||
c2 = ReadClocks();
|
||||
} while ( c2 < c1 ); // Retry if it rolled
|
||||
// Round to the nearest multiple of 16.66666666666667
|
||||
int factor = (Mhz + (16666667 / 2)) / 16666667;
|
||||
|
||||
int Mhz = c2-c1;
|
||||
NiceMhz = (factor * 16666667);
|
||||
|
||||
// Round to the nearest multiple of 16.66666666666667
|
||||
int factor = (Mhz+(16666667/2)) / 16666667;
|
||||
NiceMhz /= 1000000;
|
||||
}
|
||||
|
||||
NiceMhz = (factor*16666667);
|
||||
if (NiceMhz < 1) {
|
||||
sprintf(tmp, "Unknown\n");
|
||||
} else {
|
||||
sprintf(tmp, "%d MHz\n", NiceMhz);
|
||||
}
|
||||
|
||||
NiceMhz /= 1000000;
|
||||
GetDlgItem(IDC_CPU_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
|
||||
MEMORYSTATUS ms;
|
||||
ms.dwLength = sizeof(MEMORYSTATUS);
|
||||
GlobalMemoryStatus(&ms);
|
||||
DWORD descent3_total_ram = (ms.dwTotalPhys + (4194304 / 2)) / (4194304);
|
||||
descent3_total_ram *= 4;
|
||||
sprintf(tmp, "%d MB", descent3_total_ram);
|
||||
GetDlgItem(IDC_TOTAL_RAM, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
|
||||
}
|
||||
// Test memory READ speed.
|
||||
int *array1, *array2;
|
||||
|
||||
if ( NiceMhz < 1 ) {
|
||||
sprintf( tmp, "Unknown\n" );
|
||||
} else {
|
||||
sprintf( tmp, "%d MHz\n", NiceMhz );
|
||||
}
|
||||
array1 = new int[1024 * 1024];
|
||||
array2 = new int[1024 * 1024];
|
||||
|
||||
GetDlgItem( IDC_CPU_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
int64_t ct1, ct2, freq;
|
||||
|
||||
QueryPerformanceCounter((LARGE_INTEGER *)&ct1);
|
||||
|
||||
MEMORYSTATUS ms;
|
||||
ms.dwLength = sizeof(MEMORYSTATUS);
|
||||
GlobalMemoryStatus(&ms);
|
||||
DWORD descent3_total_ram = (ms.dwTotalPhys+(4194304/2))/(4194304);
|
||||
descent3_total_ram *= 4;
|
||||
sprintf( tmp, "%d MB", descent3_total_ram );
|
||||
GetDlgItem( IDC_TOTAL_RAM, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
int count = 0;
|
||||
|
||||
DWORD t1 = timeGetTime() + 1000;
|
||||
|
||||
// Test memory READ speed.
|
||||
int *array1, *array2;
|
||||
|
||||
array1 = new int[1024*1024];
|
||||
array2 = new int[1024*1024];
|
||||
|
||||
int64_t ct1, ct2, freq;
|
||||
|
||||
QueryPerformanceCounter( (LARGE_INTEGER *)&ct1 );
|
||||
|
||||
int count=0;
|
||||
|
||||
DWORD t1 = timeGetTime() + 1000;
|
||||
|
||||
while( timeGetTime() < t1 ) {
|
||||
_asm {
|
||||
while (timeGetTime() < t1) {
|
||||
_asm {
|
||||
push esi
|
||||
push edi
|
||||
push ecx
|
||||
@@ -489,168 +469,161 @@ void CSpeedTab::OnBtnSpeedDetect()
|
||||
pop ecx
|
||||
pop edi
|
||||
pop esi
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
QueryPerformanceCounter( (LARGE_INTEGER *)&ct2 );
|
||||
QueryPerformanceFrequency( (LARGE_INTEGER *)&freq );
|
||||
QueryPerformanceCounter((LARGE_INTEGER *)&ct2);
|
||||
QueryPerformanceFrequency((LARGE_INTEGER *)&freq);
|
||||
|
||||
delete(array1);
|
||||
delete(array2);
|
||||
delete (array1);
|
||||
delete (array2);
|
||||
|
||||
int64_t deltat = (ct2-ct1)/count;
|
||||
int64_t deltat = (ct2 - ct1) / count;
|
||||
|
||||
int speed = int(freq/deltat);
|
||||
int speed = int(freq / deltat);
|
||||
|
||||
// Round to nearest 10 MB/s
|
||||
// speed = (speed+5)/10;
|
||||
// speed = speed*10;
|
||||
// Round to nearest 10 MB/s
|
||||
// speed = (speed+5)/10;
|
||||
// speed = speed*10;
|
||||
|
||||
sprintf( tmp, "%d MB/s", speed );
|
||||
GetDlgItem( IDC_RAM_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
sprintf(tmp, "%d MB/s", speed);
|
||||
GetDlgItem(IDC_RAM_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
|
||||
HDC hScreenDC = ::GetDC(NULL);
|
||||
HDC hMemDC = CreateCompatibleDC(hScreenDC);
|
||||
|
||||
HDC hScreenDC = ::GetDC(NULL);
|
||||
HDC hMemDC = CreateCompatibleDC(hScreenDC);
|
||||
int w, h;
|
||||
w = GetDeviceCaps(hScreenDC, HORZRES);
|
||||
h = GetDeviceCaps(hScreenDC, VERTRES);
|
||||
|
||||
int w, h;
|
||||
w = GetDeviceCaps(hScreenDC,HORZRES);
|
||||
h = GetDeviceCaps(hScreenDC,VERTRES);
|
||||
HBITMAP hBmp = CreateCompatibleBitmap(hScreenDC, w, h * 4);
|
||||
if (hBmp && hScreenDC && hMemDC) {
|
||||
SelectObject(hMemDC, hBmp);
|
||||
|
||||
HBITMAP hBmp = CreateCompatibleBitmap( hScreenDC, w, h*4 );
|
||||
if (hBmp && hScreenDC && hMemDC ) {
|
||||
SelectObject( hMemDC, hBmp );
|
||||
BitBlt(hMemDC, 0, 0, w, h, hScreenDC, 0, 0, SRCCOPY);
|
||||
|
||||
BitBlt( hMemDC, 0, 0, w, h, hScreenDC, 0, 0, SRCCOPY );
|
||||
QueryPerformanceCounter((LARGE_INTEGER *)&ct1);
|
||||
BitBlt(hScreenDC, 0, 0, w, h, hMemDC, 0, 0, SRCCOPY);
|
||||
GdiFlush();
|
||||
QueryPerformanceCounter((LARGE_INTEGER *)&ct2);
|
||||
|
||||
QueryPerformanceCounter( (LARGE_INTEGER *)&ct1 );
|
||||
BitBlt( hScreenDC, 0, 0, w, h, hMemDC, 0, 0, SRCCOPY );
|
||||
GdiFlush();
|
||||
QueryPerformanceCounter( (LARGE_INTEGER *)&ct2 );
|
||||
QueryPerformanceFrequency((LARGE_INTEGER *)&freq);
|
||||
|
||||
QueryPerformanceFrequency( (LARGE_INTEGER *)&freq );
|
||||
deltat = ct2 - ct1;
|
||||
|
||||
deltat = ct2-ct1;
|
||||
// int64_t speed = (int64_t(300)*freq)/(deltat*int64_t(1024));
|
||||
|
||||
//int64_t speed = (int64_t(300)*freq)/(deltat*int64_t(1024));
|
||||
int bpp = GetDeviceCaps(hScreenDC, BITSPIXEL);
|
||||
int bpp1 = (bpp + 7) / 8;
|
||||
|
||||
int bpp = GetDeviceCaps(hScreenDC,BITSPIXEL);
|
||||
int bpp1 = (bpp+7)/8;
|
||||
int64_t vram_speed = freq;
|
||||
vram_speed /= (int64_t)deltat;
|
||||
vram_speed *= (int64_t)(w * h * bpp1);
|
||||
vram_speed /= (int64_t)(1024 * 1024);
|
||||
|
||||
int64_t vram_speed = freq;
|
||||
vram_speed /= (int64_t)deltat;
|
||||
vram_speed *= (int64_t)(w*h*bpp1);
|
||||
vram_speed /= (int64_t)(1024*1024);
|
||||
speed = int(vram_speed);
|
||||
|
||||
speed = int(vram_speed);
|
||||
sprintf(tmp, "%d MB/s\n", speed);
|
||||
GetDlgItem(IDC_VRAM_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, tmp);
|
||||
|
||||
sprintf( tmp, "%d MB/s\n", speed );
|
||||
GetDlgItem( IDC_VRAM_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, tmp );
|
||||
DeleteObject(hBmp);
|
||||
} else {
|
||||
speed = 0;
|
||||
sprintf(tmp, "%d MB/s\n", speed);
|
||||
GetDlgItem(IDC_VRAM_SPEED, &hwnd);
|
||||
::SetWindowText(hwnd, "unknown");
|
||||
}
|
||||
|
||||
DeleteObject(hBmp);
|
||||
} else {
|
||||
speed = 0;
|
||||
sprintf( tmp, "%d MB/s\n", speed );
|
||||
GetDlgItem( IDC_VRAM_SPEED, &hwnd );
|
||||
::SetWindowText( hwnd, "unknown" );
|
||||
}
|
||||
::DeleteDC(hMemDC);
|
||||
::DeleteDC(hScreenDC);
|
||||
|
||||
::DeleteDC( hMemDC );
|
||||
::DeleteDC( hScreenDC );
|
||||
int current_card = 0;
|
||||
int graphics_accelerator = RENDERER_NONE;
|
||||
GetDlgItem(IDC_3D_GRAPHICS_ACCELERATOR, &hwnd);
|
||||
|
||||
// If the video tab has been initialized, get card from there
|
||||
if (CurrentVideoTab && Num_cards != 0) {
|
||||
current_card = CurrentVideoTab->GetCurrentCard();
|
||||
::SetWindowText(hwnd, GetFullName(&Cards[current_card]));
|
||||
graphics_accelerator = Cards[current_card].renderer_type;
|
||||
} else { // otherwise, get it from the registry
|
||||
RendererType renderer_id = (RendererType)os_config_read_uint(NULL, "PreferredRenderer", RENDERER_NONE);
|
||||
char *card_name = os_config_read_string(szSectionName, "RenderingDeviceName", "");
|
||||
card3d temp_card;
|
||||
temp_card.renderer_type = renderer_id;
|
||||
strcpy(temp_card.name, card_name);
|
||||
::SetWindowText(hwnd, GetFullName(&temp_card));
|
||||
graphics_accelerator = temp_card.renderer_type;
|
||||
}
|
||||
|
||||
int current_card = 0;
|
||||
int graphics_accelerator = RENDERER_NONE;
|
||||
GetDlgItem( IDC_3D_GRAPHICS_ACCELERATOR, &hwnd );
|
||||
// Calculate default detail level based on CPU speed, and then weight it on
|
||||
// System RAM and whether or not they are using Glide
|
||||
int recommended_detail_level;
|
||||
|
||||
// If the video tab has been initialized, get card from there
|
||||
if ( CurrentVideoTab && Num_cards !=0 ) {
|
||||
current_card = CurrentVideoTab->GetCurrentCard();
|
||||
::SetWindowText( hwnd, GetFullName(&Cards[current_card]) );
|
||||
graphics_accelerator=Cards[current_card].renderer_type;
|
||||
}
|
||||
else { // otherwise, get it from the registry
|
||||
RendererType renderer_id = (RendererType)os_config_read_uint(NULL, "PreferredRenderer", RENDERER_NONE);
|
||||
char *card_name = os_config_read_string(szSectionName, "RenderingDeviceName", "" );
|
||||
card3d temp_card;
|
||||
temp_card.renderer_type=renderer_id;
|
||||
strcpy(temp_card.name,card_name);
|
||||
::SetWindowText( hwnd, GetFullName(&temp_card) );
|
||||
graphics_accelerator=temp_card.renderer_type;
|
||||
}
|
||||
// calculate setting based roughly on CPU speed
|
||||
if (NiceMhz <= 300) {
|
||||
recommended_detail_level = LOW_DETAIL;
|
||||
} else if (NiceMhz <= 400) {
|
||||
recommended_detail_level = MEDIUM_DETAIL;
|
||||
} else if (NiceMhz <= 500) {
|
||||
recommended_detail_level = HIGH_DETAIL;
|
||||
} else {
|
||||
recommended_detail_level = VERY_HIGH_DETAIL;
|
||||
}
|
||||
|
||||
// Calculate default detail level based on CPU speed, and then weight it on
|
||||
// System RAM and whether or not they are using Glide
|
||||
int recommended_detail_level;
|
||||
// weight the setting if user has ample supply of RAM
|
||||
if (descent3_total_ram >= 64)
|
||||
recommended_detail_level++;
|
||||
|
||||
// calculate setting based roughly on CPU speed
|
||||
if ( NiceMhz <= 300 ) {
|
||||
recommended_detail_level = LOW_DETAIL;
|
||||
} else if ( NiceMhz <= 400 ) {
|
||||
recommended_detail_level = MEDIUM_DETAIL;
|
||||
} else if ( NiceMhz <= 500 ) {
|
||||
recommended_detail_level = HIGH_DETAIL;
|
||||
} else {
|
||||
recommended_detail_level = VERY_HIGH_DETAIL;
|
||||
}
|
||||
// weight the setting if user has Glide selected as API
|
||||
if (graphics_accelerator == RENDERER_GLIDE)
|
||||
recommended_detail_level++;
|
||||
|
||||
// weight the setting if user has ample supply of RAM
|
||||
if ( descent3_total_ram >= 64 )
|
||||
recommended_detail_level++;
|
||||
// Make sure detail level is capped at the highest setting
|
||||
if (recommended_detail_level > VERY_HIGH_DETAIL)
|
||||
recommended_detail_level = VERY_HIGH_DETAIL;
|
||||
|
||||
// weight the setting if user has Glide selected as API
|
||||
if ( graphics_accelerator == RENDERER_GLIDE )
|
||||
recommended_detail_level++;
|
||||
// Ask the user if he/she wants detail level changed
|
||||
if (m_speed_list.GetCurSel() != recommended_detail_level) {
|
||||
CString speed_prompt, speed_title;
|
||||
speed_prompt.LoadString(IDS_SPEEDTAB_SPEED_PROMPT);
|
||||
speed_title.LoadString(IDS_SPEEDTAB_SPEED_TITLE);
|
||||
if (MessageBox(speed_prompt, speed_title, MB_YESNO | MB_ICONQUESTION) == IDNO)
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure detail level is capped at the highest setting
|
||||
if ( recommended_detail_level > VERY_HIGH_DETAIL )
|
||||
recommended_detail_level = VERY_HIGH_DETAIL;
|
||||
|
||||
// Ask the user if he/she wants detail level changed
|
||||
if(m_speed_list.GetCurSel()!=recommended_detail_level) {
|
||||
CString speed_prompt, speed_title;
|
||||
speed_prompt.LoadString(IDS_SPEEDTAB_SPEED_PROMPT);
|
||||
speed_title.LoadString(IDS_SPEEDTAB_SPEED_TITLE);
|
||||
if(MessageBox(speed_prompt,speed_title,MB_YESNO|MB_ICONQUESTION)==IDNO)
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the new detail level
|
||||
m_speed_list.SetCurSel(recommended_detail_level);
|
||||
DetailLevelConfigured=TRUE;
|
||||
m_WriteDetailValues=TRUE;
|
||||
// Set the new detail level
|
||||
m_speed_list.SetCurSel(recommended_detail_level);
|
||||
DetailLevelConfigured = TRUE;
|
||||
m_WriteDetailValues = TRUE;
|
||||
}
|
||||
|
||||
BOOL CSpeedTab::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
BOOL CSpeedTab::OnHelpInfo(HELPINFO *pHelpInfo) {
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
CWaitCursor wc;
|
||||
help_launch(SPEEDTAB_HELP);
|
||||
return 1;
|
||||
CWaitCursor wc;
|
||||
help_launch(SPEEDTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Display the html help file
|
||||
afx_msg LRESULT CSpeedTab::OnCommandHelp(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
afx_msg LRESULT CSpeedTab::OnCommandHelp(WPARAM wParam, LPARAM lParam) {
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
help_launch(SPEEDTAB_HELP);
|
||||
return 1;
|
||||
help_launch(SPEEDTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnCommandHelp(wParam,lParam);
|
||||
return CPropertyPage::OnCommandHelp(wParam, lParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CSpeedTab::OnSelchangeSpeedList()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
m_WriteDetailValues=TRUE;
|
||||
void CSpeedTab::OnSelchangeSpeedList() {
|
||||
// TODO: Add your control notification handler code here
|
||||
m_WriteDetailValues = TRUE;
|
||||
}
|
||||
|
||||
@@ -58,51 +58,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSpeedTab dialog
|
||||
|
||||
#define LOW_DETAIL 0
|
||||
#define MEDIUM_DETAIL 1
|
||||
#define HIGH_DETAIL 2
|
||||
#define VERY_HIGH_DETAIL 3
|
||||
#define CUSTOM_DETAIL 4
|
||||
#define LOW_DETAIL 0
|
||||
#define MEDIUM_DETAIL 1
|
||||
#define HIGH_DETAIL 2
|
||||
#define VERY_HIGH_DETAIL 3
|
||||
#define CUSTOM_DETAIL 4
|
||||
|
||||
class CSpeedTab : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CSpeedTab)
|
||||
class CSpeedTab : public CPropertyPage {
|
||||
DECLARE_DYNCREATE(CSpeedTab)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CSpeedTab();
|
||||
~CSpeedTab();
|
||||
CSpeedTab();
|
||||
~CSpeedTab();
|
||||
|
||||
bool m_WriteDetailValues;
|
||||
bool m_WriteDetailValues;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CSpeedTab)
|
||||
enum { IDD = IDD_PROPPAGE_SPEED };
|
||||
CComboBox m_speed_list;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CSpeedTab)
|
||||
enum { IDD = IDD_PROPPAGE_SPEED };
|
||||
CComboBox m_speed_list;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSpeedTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CSpeedTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CSpeedTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnBtnSpeedDetect();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
afx_msg void OnSelchangeSpeedList();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CSpeedTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnBtnSpeedDetect();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
afx_msg void OnSelchangeSpeedList();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// D3Launch.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
@@ -28,15 +28,14 @@
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
//#include <afxdisp.h> // MFC OLE automation classes
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
// #include <afxdisp.h> // MFC OLE automation classes
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// TitleTip.cpp : implementation file
|
||||
@@ -32,255 +32,219 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTitleTip
|
||||
|
||||
CTitleTip::CTitleTip()
|
||||
{
|
||||
m_iHorzSpace = 2;
|
||||
m_brshBackground = (HBRUSH)0;
|
||||
CTitleTip::CTitleTip() {
|
||||
m_iHorzSpace = 2;
|
||||
m_brshBackground = (HBRUSH)0;
|
||||
|
||||
m_clrBackground = ::GetSysColor(COLOR_HIGHLIGHT);
|
||||
m_clrText = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
|
||||
m_clrBackground = ::GetSysColor(COLOR_HIGHLIGHT);
|
||||
m_clrText = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
|
||||
|
||||
RegisterWindowClass(); // Register window class if not already registered.
|
||||
RegisterWindowClass(); // Register window class if not already registered.
|
||||
}
|
||||
|
||||
CTitleTip::~CTitleTip()
|
||||
{
|
||||
}
|
||||
CTitleTip::~CTitleTip() {}
|
||||
|
||||
// static
|
||||
void
|
||||
CTitleTip::RegisterWindowClass()
|
||||
{
|
||||
WNDCLASS wndcls;
|
||||
HINSTANCE hInst = AfxGetInstanceHandle();
|
||||
if(!(::GetClassInfo(hInst, TITLETIP_CLASSNAME, &wndcls)))
|
||||
{
|
||||
// otherwise we need to register a new class
|
||||
wndcls.style = CS_SAVEBITS | CS_DBLCLKS;
|
||||
wndcls.lpfnWndProc = ::DefWindowProc;
|
||||
wndcls.cbClsExtra = wndcls.cbWndExtra = 0;
|
||||
wndcls.hInstance = hInst;
|
||||
wndcls.hIcon = NULL;
|
||||
wndcls.hCursor = LoadCursor( hInst, IDC_ARROW );
|
||||
wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK + 1);
|
||||
wndcls.lpszMenuName = NULL;
|
||||
wndcls.lpszClassName = TITLETIP_CLASSNAME;
|
||||
if (!AfxRegisterClass(&wndcls))
|
||||
AfxThrowResourceException();
|
||||
}
|
||||
void CTitleTip::RegisterWindowClass() {
|
||||
WNDCLASS wndcls;
|
||||
HINSTANCE hInst = AfxGetInstanceHandle();
|
||||
if (!(::GetClassInfo(hInst, TITLETIP_CLASSNAME, &wndcls))) {
|
||||
// otherwise we need to register a new class
|
||||
wndcls.style = CS_SAVEBITS | CS_DBLCLKS;
|
||||
wndcls.lpfnWndProc = ::DefWindowProc;
|
||||
wndcls.cbClsExtra = wndcls.cbWndExtra = 0;
|
||||
wndcls.hInstance = hInst;
|
||||
wndcls.hIcon = NULL;
|
||||
wndcls.hCursor = LoadCursor(hInst, IDC_ARROW);
|
||||
wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK + 1);
|
||||
wndcls.lpszMenuName = NULL;
|
||||
wndcls.lpszClassName = TITLETIP_CLASSNAME;
|
||||
if (!AfxRegisterClass(&wndcls))
|
||||
AfxThrowResourceException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTitleTip, CWnd)
|
||||
//{{AFX_MSG_MAP(CTitleTip)
|
||||
ON_WM_MOUSEMOVE()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CTitleTip)
|
||||
ON_WM_MOUSEMOVE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void CTitleTip::SetBackground(HBRUSH brshBackground)
|
||||
{
|
||||
m_brshBackground = brshBackground;
|
||||
}
|
||||
void CTitleTip::SetBackground(HBRUSH brshBackground) { m_brshBackground = brshBackground; }
|
||||
|
||||
void CTitleTip::SetBkColor(COLORREF crColor)
|
||||
{
|
||||
m_clrBackground = crColor;
|
||||
}
|
||||
void CTitleTip::SetBkColor(COLORREF crColor) { m_clrBackground = crColor; }
|
||||
|
||||
void CTitleTip::SetTextColor(COLORREF crColor)
|
||||
{
|
||||
m_clrText = crColor;
|
||||
}
|
||||
void CTitleTip::SetTextColor(COLORREF crColor) { m_clrText = crColor; }
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTitleTip message handlers
|
||||
|
||||
/*
|
||||
* styles:
|
||||
* <UL>
|
||||
* <LI>WS_BORDER: draws a border around the titletip window
|
||||
* <LI>WS_POPUP: needed so that the TitleTip window is able to extend
|
||||
* beyond the boundary of the control
|
||||
* <LI>WS_EX_TOOLWINDOW: stops the window from appearing in the task bar
|
||||
* <LI>WS_EX_TOPMOST: ensures the titletip is visible
|
||||
* <LI>COLOR_INFOBK: the same color used by ToolTip
|
||||
* </UL>
|
||||
*/
|
||||
* styles:
|
||||
* <UL>
|
||||
* <LI>WS_BORDER: draws a border around the titletip window
|
||||
* <LI>WS_POPUP: needed so that the TitleTip window is able to extend
|
||||
* beyond the boundary of the control
|
||||
* <LI>WS_EX_TOOLWINDOW: stops the window from appearing in the task bar
|
||||
* <LI>WS_EX_TOPMOST: ensures the titletip is visible
|
||||
* <LI>COLOR_INFOBK: the same color used by ToolTip
|
||||
* </UL>
|
||||
*/
|
||||
|
||||
BOOL CTitleTip::Create(CWnd * pParentWnd)
|
||||
{
|
||||
ASSERT_VALID(pParentWnd);
|
||||
BOOL CTitleTip::Create(CWnd *pParentWnd) {
|
||||
ASSERT_VALID(pParentWnd);
|
||||
|
||||
DWORD dwStyle = WS_BORDER | WS_POPUP;
|
||||
DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
|
||||
m_pParentWnd = pParentWnd;
|
||||
return CreateEx( dwExStyle, TITLETIP_CLASSNAME, NULL, dwStyle, 0, 0, 0, 0,
|
||||
NULL, NULL, NULL );
|
||||
DWORD dwStyle = WS_BORDER | WS_POPUP;
|
||||
DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
|
||||
m_pParentWnd = pParentWnd;
|
||||
return CreateEx(dwExStyle, TITLETIP_CLASSNAME, NULL, dwStyle, 0, 0, 0, 0, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets called repeatedly by its parent control.
|
||||
* Determines whether the text extent of pszTitleText is too big for the
|
||||
* original rectangle (rectTitle) and displays a TitleTip if required.
|
||||
*
|
||||
* @memo Displays the titletip if required.
|
||||
*
|
||||
* @param rectTitle rectangle for the original title - in client coordinates
|
||||
* @param sTitleText text to be displayed
|
||||
* @param xoffset number of pixel the text is offset from left border of the cell
|
||||
*/
|
||||
* This gets called repeatedly by its parent control.
|
||||
* Determines whether the text extent of pszTitleText is too big for the
|
||||
* original rectangle (rectTitle) and displays a TitleTip if required.
|
||||
*
|
||||
* @memo Displays the titletip if required.
|
||||
*
|
||||
* @param rectTitle rectangle for the original title - in client coordinates
|
||||
* @param sTitleText text to be displayed
|
||||
* @param xoffset number of pixel the text is offset from left border of the cell
|
||||
*/
|
||||
|
||||
void CTitleTip::Show(CRect rectTitle, CString sTitleText, int xoffset /*=0*/)
|
||||
{
|
||||
ASSERT(::IsWindow(m_hWnd));
|
||||
ASSERT(!rectTitle.IsRectEmpty());
|
||||
void CTitleTip::Show(CRect rectTitle, CString sTitleText, int xoffset /*=0*/) {
|
||||
ASSERT(::IsWindow(m_hWnd));
|
||||
ASSERT(!rectTitle.IsRectEmpty());
|
||||
|
||||
if(GetFocus() == NULL) // only display titletip if app has focus
|
||||
return;
|
||||
if (GetFocus() == NULL) // only display titletip if app has focus
|
||||
return;
|
||||
|
||||
// Define the rectangle outside which the titletip will be hidden.
|
||||
m_rectTitle.top = 0;
|
||||
m_rectTitle.left = -xoffset;
|
||||
m_rectTitle.right = rectTitle.Width() - xoffset;
|
||||
m_rectTitle.bottom = rectTitle.Height();
|
||||
// Define the rectangle outside which the titletip will be hidden.
|
||||
m_rectTitle.top = 0;
|
||||
m_rectTitle.left = -xoffset;
|
||||
m_rectTitle.right = rectTitle.Width() - xoffset;
|
||||
m_rectTitle.bottom = rectTitle.Height();
|
||||
|
||||
m_pParentWnd->ClientToScreen(rectTitle); // Determine the width of the text
|
||||
m_pParentWnd->ClientToScreen(rectTitle); // Determine the width of the text
|
||||
|
||||
CClientDC dc(this);
|
||||
int iSavedDC = dc.SaveDC(); // Save DC state
|
||||
CClientDC dc(this);
|
||||
int iSavedDC = dc.SaveDC(); // Save DC state
|
||||
|
||||
dc.SelectObject(m_pParentWnd->GetFont()); // use same font as ctrl
|
||||
dc.SelectObject(m_pParentWnd->GetFont()); // use same font as ctrl
|
||||
|
||||
CSize size = dc.GetTextExtent(sTitleText);
|
||||
CRect rectDisplay = rectTitle;
|
||||
rectDisplay.left += xoffset - GetHorzSpace();
|
||||
rectDisplay.right = rectDisplay.left + size.cx + 2 + 2*GetHorzSpace();
|
||||
CSize size = dc.GetTextExtent(sTitleText);
|
||||
CRect rectDisplay = rectTitle;
|
||||
rectDisplay.left += xoffset - GetHorzSpace();
|
||||
rectDisplay.right = rectDisplay.left + size.cx + 2 + 2 * GetHorzSpace();
|
||||
|
||||
// Do not display if the text fits within available space
|
||||
if(size.cx <= rectTitle.Width()-2*xoffset-2)
|
||||
return;
|
||||
// Do not display if the text fits within available space
|
||||
if (size.cx <= rectTitle.Width() - 2 * xoffset - 2)
|
||||
return;
|
||||
|
||||
// Show the titletip
|
||||
SetWindowPos(&wndTop, rectDisplay.left, rectDisplay.top,
|
||||
rectDisplay.Width(), rectDisplay.Height(),
|
||||
SWP_SHOWWINDOW|SWP_NOACTIVATE);
|
||||
// Show the titletip
|
||||
SetWindowPos(&wndTop, rectDisplay.left, rectDisplay.top, rectDisplay.Width(), rectDisplay.Height(),
|
||||
SWP_SHOWWINDOW | SWP_NOACTIVATE);
|
||||
|
||||
if (m_brshBackground) {
|
||||
dc.SetTextColor(m_clrText);
|
||||
dc.SetBkColor(m_clrBackground);
|
||||
dc.SetBkMode(OPAQUE);
|
||||
dc.SelectObject(CBrush::FromHandle(m_brshBackground));
|
||||
dc.FillSolidRect(0, 0, rectDisplay.Width(), rectDisplay.Height(), m_clrBackground);
|
||||
} else {
|
||||
dc.SetBkMode(TRANSPARENT);
|
||||
}
|
||||
|
||||
if(m_brshBackground)
|
||||
{
|
||||
dc.SetTextColor(m_clrText);
|
||||
dc.SetBkColor(m_clrBackground);
|
||||
dc.SetBkMode(OPAQUE);
|
||||
dc.SelectObject(CBrush::FromHandle(m_brshBackground));
|
||||
dc.FillSolidRect(0, 0, rectDisplay.Width(), rectDisplay.Height(), m_clrBackground);
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.SetBkMode(TRANSPARENT);
|
||||
}
|
||||
dc.TextOut(GetHorzSpace(), 0, sTitleText);
|
||||
|
||||
dc.TextOut(GetHorzSpace(), 0, sTitleText);
|
||||
dc.RestoreDC(iSavedDC); // Restore DC.
|
||||
|
||||
dc.RestoreDC(iSavedDC); // Restore DC.
|
||||
|
||||
SetCapture();
|
||||
SetCapture();
|
||||
}
|
||||
|
||||
/*
|
||||
* Hide if the mouse is outside the original rectangle. Note that this is
|
||||
* smaller than the actual window rectangle.
|
||||
*/
|
||||
void CTitleTip::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
if(!m_rectTitle.PtInRect(point))
|
||||
{
|
||||
ReleaseCapture();
|
||||
ShowWindow(SW_HIDE);
|
||||
* Hide if the mouse is outside the original rectangle. Note that this is
|
||||
* smaller than the actual window rectangle.
|
||||
*/
|
||||
void CTitleTip::OnMouseMove(UINT nFlags, CPoint point) {
|
||||
if (!m_rectTitle.PtInRect(point)) {
|
||||
ReleaseCapture();
|
||||
ShowWindow(SW_HIDE);
|
||||
|
||||
// Forward the message
|
||||
ClientToScreen(&point);
|
||||
CWnd *pWnd = WindowFromPoint(point);
|
||||
if(pWnd == this)
|
||||
pWnd = m_pParentWnd;
|
||||
int hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y));
|
||||
if(hittest == HTCLIENT)
|
||||
{
|
||||
pWnd->ScreenToClient(&point);
|
||||
pWnd->PostMessage(WM_MOUSEMOVE, nFlags, MAKELONG(point.x,point.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
pWnd->PostMessage( WM_NCMOUSEMOVE, hittest, MAKELONG(point.x,point.y));
|
||||
}
|
||||
}
|
||||
// Forward the message
|
||||
ClientToScreen(&point);
|
||||
CWnd *pWnd = WindowFromPoint(point);
|
||||
if (pWnd == this)
|
||||
pWnd = m_pParentWnd;
|
||||
int hittest = (int)pWnd->SendMessage(WM_NCHITTEST, 0, MAKELONG(point.x, point.y));
|
||||
if (hittest == HTCLIENT) {
|
||||
pWnd->ScreenToClient(&point);
|
||||
pWnd->PostMessage(WM_MOUSEMOVE, nFlags, MAKELONG(point.x, point.y));
|
||||
} else {
|
||||
pWnd->PostMessage(WM_NCMOUSEMOVE, hittest, MAKELONG(point.x, point.y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CTitleTip::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
CWnd *pWnd;
|
||||
int hittest ;
|
||||
switch(pMsg->message)
|
||||
{
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONDBLCLK:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_MBUTTONDOWN:
|
||||
POINTS pts = MAKEPOINTS(pMsg->lParam);
|
||||
POINT point;
|
||||
point.x = pts.x;
|
||||
point.y = pts.y;
|
||||
ClientToScreen(&point);
|
||||
pWnd = WindowFromPoint(point);
|
||||
if(pWnd == this)
|
||||
pWnd = m_pParentWnd;
|
||||
BOOL CTitleTip::PreTranslateMessage(MSG *pMsg) {
|
||||
CWnd *pWnd;
|
||||
int hittest;
|
||||
switch (pMsg->message) {
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONDBLCLK:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_MBUTTONDOWN:
|
||||
POINTS pts = MAKEPOINTS(pMsg->lParam);
|
||||
POINT point;
|
||||
point.x = pts.x;
|
||||
point.y = pts.y;
|
||||
ClientToScreen(&point);
|
||||
pWnd = WindowFromPoint(point);
|
||||
if (pWnd == this)
|
||||
pWnd = m_pParentWnd;
|
||||
|
||||
hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y));
|
||||
if(hittest == HTCLIENT)
|
||||
{
|
||||
pWnd->ScreenToClient(&point);
|
||||
pMsg->lParam = MAKELONG(point.x,point.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(pMsg->message)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
pMsg->message = WM_NCLBUTTONDOWN;
|
||||
break;
|
||||
case WM_RBUTTONDOWN:
|
||||
pMsg->message = WM_NCRBUTTONDOWN;
|
||||
break;
|
||||
case WM_MBUTTONDOWN:
|
||||
pMsg->message = WM_NCMBUTTONDOWN;
|
||||
break;
|
||||
}
|
||||
pMsg->wParam = hittest;
|
||||
pMsg->lParam = MAKELONG(point.x,point.y);
|
||||
ShowWindow(SW_HIDE);
|
||||
}
|
||||
pWnd->SendMessage(pMsg->message,pMsg->wParam,pMsg->lParam);
|
||||
if(GetCapture() == NULL)
|
||||
SetCapture();
|
||||
return TRUE;
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
ReleaseCapture();
|
||||
ShowWindow(SW_HIDE);
|
||||
m_pParentWnd->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||
return TRUE;
|
||||
}
|
||||
hittest = (int)pWnd->SendMessage(WM_NCHITTEST, 0, MAKELONG(point.x, point.y));
|
||||
if (hittest == HTCLIENT) {
|
||||
pWnd->ScreenToClient(&point);
|
||||
pMsg->lParam = MAKELONG(point.x, point.y);
|
||||
} else {
|
||||
switch (pMsg->message) {
|
||||
case WM_LBUTTONDOWN:
|
||||
pMsg->message = WM_NCLBUTTONDOWN;
|
||||
break;
|
||||
case WM_RBUTTONDOWN:
|
||||
pMsg->message = WM_NCRBUTTONDOWN;
|
||||
break;
|
||||
case WM_MBUTTONDOWN:
|
||||
pMsg->message = WM_NCMBUTTONDOWN;
|
||||
break;
|
||||
}
|
||||
pMsg->wParam = hittest;
|
||||
pMsg->lParam = MAKELONG(point.x, point.y);
|
||||
ShowWindow(SW_HIDE);
|
||||
}
|
||||
pWnd->SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||
if (GetCapture() == NULL)
|
||||
SetCapture();
|
||||
return TRUE;
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
ReleaseCapture();
|
||||
ShowWindow(SW_HIDE);
|
||||
m_pParentWnd->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if(GetFocus() == NULL)
|
||||
{
|
||||
ReleaseCapture();
|
||||
ShowWindow(SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
if (GetFocus() == NULL) {
|
||||
ReleaseCapture();
|
||||
ShowWindow(SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return CWnd::PreTranslateMessage(pMsg);
|
||||
return CWnd::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_TITLETIP_H__FB05F243_E98F_11D0_82A3_20933B000000__INCLUDED_)
|
||||
#define AFX_TITLETIP_H__FB05F243_E98F_11D0_82A3_20933B000000__INCLUDED_
|
||||
@@ -31,56 +31,53 @@
|
||||
#define TITLETIP_CLASSNAME _T("ZTitleTip")
|
||||
|
||||
/**
|
||||
* Titletips similar to tooltips. For ListView controls, TitleTips are used to
|
||||
* display text of those cells which are not wide enough to display the text
|
||||
* completely. TitleTips show up as soon as the mouse moves over the cell.
|
||||
*/
|
||||
* Titletips similar to tooltips. For ListView controls, TitleTips are used to
|
||||
* display text of those cells which are not wide enough to display the text
|
||||
* completely. TitleTips show up as soon as the mouse moves over the cell.
|
||||
*/
|
||||
|
||||
class CTitleTip : public CWnd
|
||||
{
|
||||
// Construction
|
||||
class CTitleTip : public CWnd {
|
||||
// Construction
|
||||
public:
|
||||
CTitleTip();
|
||||
virtual ~CTitleTip();
|
||||
CTitleTip();
|
||||
virtual ~CTitleTip();
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CTitleTip)
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CTitleTip)
|
||||
public:
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
virtual BOOL Create(CWnd* pParentWnd);
|
||||
//}}AFX_VIRTUAL
|
||||
virtual BOOL PreTranslateMessage(MSG *pMsg);
|
||||
virtual BOOL Create(CWnd *pParentWnd);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Implementation
|
||||
public:
|
||||
int GetHorzSpace() {return m_iHorzSpace;}
|
||||
void SetBackground(HBRUSH brshBackground);
|
||||
void SetBkColor(COLORREF crColor);
|
||||
void SetTextColor(COLORREF crColor);
|
||||
void Show(CRect rectTitle, CString sTitleText, int xoffset = 0);
|
||||
int GetHorzSpace() { return m_iHorzSpace; }
|
||||
void SetBackground(HBRUSH brshBackground);
|
||||
void SetBkColor(COLORREF crColor);
|
||||
void SetTextColor(COLORREF crColor);
|
||||
void Show(CRect rectTitle, CString sTitleText, int xoffset = 0);
|
||||
|
||||
static void RegisterWindowClass();
|
||||
static void RegisterWindowClass();
|
||||
|
||||
protected:
|
||||
CWnd* m_pParentWnd;
|
||||
CRect m_rectTitle;
|
||||
HBRUSH m_brshBackground;
|
||||
COLORREF m_clrBackground;
|
||||
COLORREF m_clrText;
|
||||
int m_iHorzSpace;
|
||||
CWnd *m_pParentWnd;
|
||||
CRect m_rectTitle;
|
||||
HBRUSH m_brshBackground;
|
||||
COLORREF m_clrBackground;
|
||||
COLORREF m_clrText;
|
||||
int m_iHorzSpace;
|
||||
|
||||
// Generated message map functions
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CTitleTip)
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CTitleTip)
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -73,95 +73,93 @@
|
||||
// CUpdateDlg dialog
|
||||
|
||||
// Return values for UpdateTheLauncher()
|
||||
#define LAUNCHER_REPLACE_NONE 0
|
||||
#define LAUNCHER_REPLACE_ERROR 1
|
||||
#define LAUNCHER_REPLACE_NEEDED 2
|
||||
#define LAUNCHER_REPLACE_ACCESS_ERROR 3
|
||||
#define LAUNCHER_REPLACE_CREATEPROC_ERROR 4
|
||||
#define LAUNCHER_REPLACE_NONE 0
|
||||
#define LAUNCHER_REPLACE_ERROR 1
|
||||
#define LAUNCHER_REPLACE_NEEDED 2
|
||||
#define LAUNCHER_REPLACE_ACCESS_ERROR 3
|
||||
#define LAUNCHER_REPLACE_CREATEPROC_ERROR 4
|
||||
|
||||
// Return values for GetHTTPFile
|
||||
#define GETHTTPFILE_OK 0
|
||||
#define GETHTTPFILE_UNKNOWN_ERROR 1
|
||||
#define GETHTTPFILE_CANCELLED 2
|
||||
#define GETHTTPFILE_BADPARMS 3
|
||||
#define GETHTTPFILE_CANT_WRITE_FILE 4
|
||||
#define GETHTTPFILE_CANT_PARSE_URL 5
|
||||
#define GETHTTPFILE_BAD_FILE_OR_DIR 6
|
||||
#define GETHTTPFILE_HOST_NOT_FOUND 7
|
||||
#define GETHTTPFILE_NO_MEMORY 8
|
||||
#define GETHTTPFILE_OK 0
|
||||
#define GETHTTPFILE_UNKNOWN_ERROR 1
|
||||
#define GETHTTPFILE_CANCELLED 2
|
||||
#define GETHTTPFILE_BADPARMS 3
|
||||
#define GETHTTPFILE_CANT_WRITE_FILE 4
|
||||
#define GETHTTPFILE_CANT_PARSE_URL 5
|
||||
#define GETHTTPFILE_BAD_FILE_OR_DIR 6
|
||||
#define GETHTTPFILE_HOST_NOT_FOUND 7
|
||||
#define GETHTTPFILE_NO_MEMORY 8
|
||||
|
||||
class CUpdateDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CUpdateDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
int m_should_verify; // should actually go through the verification process
|
||||
int m_should_verify; // should actually go through the verification process
|
||||
|
||||
void StatusBar(UINT strID);
|
||||
void StatusBar(char *status);
|
||||
void LocalizedMessageBox(UINT msgID, UINT titleID, UINT type=MB_OK);
|
||||
void AddToList(UINT strID);
|
||||
void CloseHTTP();
|
||||
BOOL InitHTTP();
|
||||
void DebugSpew(char *);
|
||||
void DebugSpew(CString &msg);
|
||||
int GetHTTPFile(char *remote, char *local);
|
||||
BOOL ApplyPatch();
|
||||
int UpdateTheLauncher();
|
||||
void GetHTTPFileErrorBox(int error_id, char *remote, char *local);
|
||||
BOOL ParseMOTDFile(void);
|
||||
void DisplayVersions(int maj1, int min1, int bld1, int maj2=-1, int min2=-1, int bld2=-1);
|
||||
void Cleanup(void);
|
||||
void StatusBar(UINT strID);
|
||||
void StatusBar(char *status);
|
||||
void LocalizedMessageBox(UINT msgID, UINT titleID, UINT type = MB_OK);
|
||||
void AddToList(UINT strID);
|
||||
void CloseHTTP();
|
||||
BOOL InitHTTP();
|
||||
void DebugSpew(char *);
|
||||
void DebugSpew(CString &msg);
|
||||
int GetHTTPFile(char *remote, char *local);
|
||||
BOOL ApplyPatch();
|
||||
int UpdateTheLauncher();
|
||||
void GetHTTPFileErrorBox(int error_id, char *remote, char *local);
|
||||
BOOL ParseMOTDFile(void);
|
||||
void DisplayVersions(int maj1, int min1, int bld1, int maj2 = -1, int min2 = -1, int bld2 = -1);
|
||||
void Cleanup(void);
|
||||
|
||||
CUpdateDlg(CWnd* pParent = NULL, int should_verify = 1); // standard constructor
|
||||
CUpdateDlg(CWnd *pParent = NULL, int should_verify = 1); // standard constructor
|
||||
|
||||
CFont m_listfont; // font for the update feedback list
|
||||
CMessageWindowDlg msg_dlg;
|
||||
CFont m_listfont; // font for the update feedback list
|
||||
CMessageWindowDlg msg_dlg;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CUpdateDlg)
|
||||
enum { IDD = IDD_UPDATE_DIALOG };
|
||||
CLabel m_UserMsgStatic;
|
||||
CEdit m_LatestVersionEdit;
|
||||
CEdit m_YourVersionEdit;
|
||||
CEdit m_MOTDBox;
|
||||
CProgressCtrl m_progress;
|
||||
CListBox m_list;
|
||||
CString m_statusbar;
|
||||
CString m_usermsg;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CUpdateDlg)
|
||||
enum { IDD = IDD_UPDATE_DIALOG };
|
||||
CLabel m_UserMsgStatic;
|
||||
CEdit m_LatestVersionEdit;
|
||||
CEdit m_YourVersionEdit;
|
||||
CEdit m_MOTDBox;
|
||||
CProgressCtrl m_progress;
|
||||
CListBox m_list;
|
||||
CString m_statusbar;
|
||||
CString m_usermsg;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CUpdateDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CUpdateDlg)
|
||||
protected:
|
||||
BOOL GetVersionNfo();
|
||||
BOOL GetMOTD();
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// User's current version
|
||||
uint32_t UsrMajor, UsrMinor, UsrBuild;
|
||||
// Implementation
|
||||
protected:
|
||||
BOOL GetVersionNfo();
|
||||
BOOL GetMOTD();
|
||||
|
||||
// Newest version available
|
||||
uint32_t NewMajor, NewMinor, NewBuild;
|
||||
// User's current version
|
||||
uint32_t UsrMajor, UsrMinor, UsrBuild;
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CUpdateDlg)
|
||||
afx_msg void OnYes();
|
||||
virtual void OnCancel();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnClose();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Newest version available
|
||||
uint32_t NewMajor, NewMinor, NewBuild;
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CUpdateDlg)
|
||||
afx_msg void OnYes();
|
||||
virtual void OnCancel();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnClose();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern bool CancelPressed; // indicates that the user has pressed cancel button
|
||||
extern bool CancelPressed; // indicates that the user has pressed cancel button
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// VideoDetectDlg.cpp : implementation file
|
||||
//
|
||||
@@ -30,84 +30,78 @@
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define DETECT_DIRECT3D 0x01
|
||||
#define DETECT_OPENGL 0x02
|
||||
#define DETECT_GLIDE 0x04
|
||||
|
||||
#define DETECT_DIRECT3D 0x01
|
||||
#define DETECT_OPENGL 0x02
|
||||
#define DETECT_GLIDE 0x04
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CVideoDetectDlg dialog
|
||||
|
||||
CVideoDetectDlg::CVideoDetectDlg(CWnd *pParent /*=NULL*/) : CDialog(CVideoDetectDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CVideoDetectDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
CVideoDetectDlg::CVideoDetectDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CVideoDetectDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CVideoDetectDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
DetectDirect3D=TRUE;
|
||||
DetectOpenGL=TRUE;
|
||||
DetectGlide=TRUE;
|
||||
DetectDirect3D = TRUE;
|
||||
DetectOpenGL = TRUE;
|
||||
DetectGlide = TRUE;
|
||||
}
|
||||
|
||||
|
||||
void CVideoDetectDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CVideoDetectDlg)
|
||||
DDX_Control(pDX, IDC_OPENGL_CHECK, m_OpenGLCheck);
|
||||
DDX_Control(pDX, IDC_GLIDE_CHECK, m_GlideCheck);
|
||||
DDX_Control(pDX, IDC_DIRECT3D_CHECK, m_Direct3DCheck);
|
||||
//}}AFX_DATA_MAP
|
||||
void CVideoDetectDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CVideoDetectDlg)
|
||||
DDX_Control(pDX, IDC_OPENGL_CHECK, m_OpenGLCheck);
|
||||
DDX_Control(pDX, IDC_GLIDE_CHECK, m_GlideCheck);
|
||||
DDX_Control(pDX, IDC_DIRECT3D_CHECK, m_Direct3DCheck);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CVideoDetectDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CVideoDetectDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CVideoDetectDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CVideoDetectDlg message handlers
|
||||
|
||||
void CVideoDetectDlg::OnOK()
|
||||
{
|
||||
// TODO: Add extra validation here
|
||||
DetectDirect3D=m_Direct3DCheck.GetCheck();
|
||||
DetectOpenGL=m_OpenGLCheck.GetCheck();
|
||||
DetectGlide=m_GlideCheck.GetCheck();
|
||||
void CVideoDetectDlg::OnOK() {
|
||||
// TODO: Add extra validation here
|
||||
DetectDirect3D = m_Direct3DCheck.GetCheck();
|
||||
DetectOpenGL = m_OpenGLCheck.GetCheck();
|
||||
DetectGlide = m_GlideCheck.GetCheck();
|
||||
|
||||
// Store these settings for next time
|
||||
int settings=0;
|
||||
if(DetectDirect3D) settings |= DETECT_DIRECT3D;
|
||||
if(DetectOpenGL) settings |= DETECT_OPENGL;
|
||||
if(DetectGlide) settings |= DETECT_GLIDE;
|
||||
os_config_write_uint(szSectionName, "VideoDetectSettings", settings);
|
||||
// Store these settings for next time
|
||||
int settings = 0;
|
||||
if (DetectDirect3D)
|
||||
settings |= DETECT_DIRECT3D;
|
||||
if (DetectOpenGL)
|
||||
settings |= DETECT_OPENGL;
|
||||
if (DetectGlide)
|
||||
settings |= DETECT_GLIDE;
|
||||
os_config_write_uint(szSectionName, "VideoDetectSettings", settings);
|
||||
|
||||
RenderersDetected=TRUE;
|
||||
RenderersDetected = TRUE;
|
||||
|
||||
CDialog::OnOK();
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
BOOL CVideoDetectDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
BOOL CVideoDetectDlg::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
int settings;
|
||||
// TODO: Add extra initialization here
|
||||
int settings;
|
||||
|
||||
// Get the settings from last time user chose
|
||||
settings=os_config_read_uint(szSectionName, "VideoDetectSettings", DETECT_DIRECT3D|DETECT_GLIDE);
|
||||
DetectDirect3D=settings & DETECT_DIRECT3D;
|
||||
DetectOpenGL=settings & DETECT_OPENGL;
|
||||
DetectGlide=settings & DETECT_GLIDE;
|
||||
// Get the settings from last time user chose
|
||||
settings = os_config_read_uint(szSectionName, "VideoDetectSettings", DETECT_DIRECT3D | DETECT_GLIDE);
|
||||
DetectDirect3D = settings & DETECT_DIRECT3D;
|
||||
DetectOpenGL = settings & DETECT_OPENGL;
|
||||
DetectGlide = settings & DETECT_GLIDE;
|
||||
|
||||
// Set the check marks appropriately
|
||||
m_Direct3DCheck.SetCheck(DetectDirect3D);
|
||||
m_OpenGLCheck.SetCheck(DetectOpenGL);
|
||||
m_GlideCheck.SetCheck(DetectGlide);
|
||||
// Set the check marks appropriately
|
||||
m_Direct3DCheck.SetCheck(DetectDirect3D);
|
||||
m_OpenGLCheck.SetCheck(DetectOpenGL);
|
||||
m_GlideCheck.SetCheck(DetectGlide);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_VIDEODETECTDLG_H__11362FC3_61E3_11D2_A4E0_00A0C96ED60D__INCLUDED_)
|
||||
#define AFX_VIDEODETECTDLG_H__11362FC3_61E3_11D2_A4E0_00A0C96ED60D__INCLUDED_
|
||||
@@ -28,41 +28,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CVideoDetectDlg dialog
|
||||
|
||||
class CVideoDetectDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CVideoDetectDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CVideoDetectDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CVideoDetectDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
int DetectOpenGL;
|
||||
int DetectDirect3D;
|
||||
int DetectGlide;
|
||||
int DetectOpenGL;
|
||||
int DetectDirect3D;
|
||||
int DetectGlide;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CVideoDetectDlg)
|
||||
enum { IDD = IDD_VIDEODETECT_DLG };
|
||||
CButton m_OpenGLCheck;
|
||||
CButton m_GlideCheck;
|
||||
CButton m_Direct3DCheck;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CVideoDetectDlg)
|
||||
enum { IDD = IDD_VIDEODETECT_DLG };
|
||||
CButton m_OpenGLCheck;
|
||||
CButton m_GlideCheck;
|
||||
CButton m_Direct3DCheck;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CVideoDetectDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CVideoDetectDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CVideoDetectDlg)
|
||||
virtual void OnOK();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CVideoDetectDlg)
|
||||
virtual void OnOK();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
CVideoTab * CurrentVideoTab = NULL;
|
||||
CVideoTab *CurrentVideoTab = NULL;
|
||||
BOOL VideoTabInitialized = FALSE;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -111,46 +111,39 @@ BOOL VideoTabInitialized = FALSE;
|
||||
|
||||
IMPLEMENT_DYNCREATE(CVideoTab, CPropertyPage)
|
||||
|
||||
CVideoTab::CVideoTab() : CPropertyPage(CVideoTab::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CVideoTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CVideoTab::CVideoTab() : CPropertyPage(CVideoTab::IDD) {
|
||||
//{{AFX_DATA_INIT(CVideoTab)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
CurrentVideoTab = NULL;
|
||||
CurrentVideoTab = NULL;
|
||||
}
|
||||
|
||||
CVideoTab::~CVideoTab()
|
||||
{
|
||||
CurrentVideoTab = NULL;
|
||||
CVideoTab::~CVideoTab() { CurrentVideoTab = NULL; }
|
||||
|
||||
int CVideoTab::GetCurrentCard() {
|
||||
int current = m_videocard_list.GetCurSel();
|
||||
|
||||
if ((current < 0) || (current >= Num_cards)) {
|
||||
current = 0;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
int CVideoTab::GetCurrentCard()
|
||||
{
|
||||
int current = m_videocard_list.GetCurSel();
|
||||
|
||||
if ( (current < 0) || (current>=Num_cards)) {
|
||||
current = 0;
|
||||
}
|
||||
return current;
|
||||
void CVideoTab::DoDataExchange(CDataExchange *pDX) {
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CVideoTab)
|
||||
DDX_Control(pDX, IDC_VIDEOCARD_LIST, m_videocard_list);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
void CVideoTab::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CVideoTab)
|
||||
DDX_Control(pDX, IDC_VIDEOCARD_LIST, m_videocard_list);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CVideoTab, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CVideoTab)
|
||||
ON_BN_CLICKED(IDC_VIDEOCARD_DETECT, OnVideocardDetect)
|
||||
ON_MESSAGE(WM_COMMANDHELP,OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
ON_CBN_SELCHANGE(IDC_VIDEOCARD_LIST, OnSelchangeVideocardList)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CVideoTab)
|
||||
ON_BN_CLICKED(IDC_VIDEOCARD_DETECT, OnVideocardDetect)
|
||||
ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
|
||||
ON_WM_HELPINFO()
|
||||
ON_CBN_SELCHANGE(IDC_VIDEOCARD_LIST, OnSelchangeVideocardList)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -158,284 +151,278 @@ END_MESSAGE_MAP()
|
||||
|
||||
extern HINSTANCE Dd_dll_handle;
|
||||
|
||||
void CVideoTab::OnVideocardDetect()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
if(VideoCardsDetected) return;
|
||||
void CVideoTab::OnVideocardDetect() {
|
||||
// TODO: Add your control notification handler code here
|
||||
if (VideoCardsDetected)
|
||||
return;
|
||||
|
||||
#if (!defined(OEM_VOODOO3) || defined(USE_ALL_VIDEO_OPTIONS))
|
||||
// Display the scan selection options to user
|
||||
CVideoDetectDlg dlg;
|
||||
dlg.DoModal();
|
||||
// Display the scan selection options to user
|
||||
CVideoDetectDlg dlg;
|
||||
dlg.DoModal();
|
||||
#endif
|
||||
|
||||
// Set the wait cursor
|
||||
CWaitCursor wc;
|
||||
// Set the wait cursor
|
||||
CWaitCursor wc;
|
||||
|
||||
// Clear the box
|
||||
m_videocard_list.ResetContent();
|
||||
// Clear the box
|
||||
m_videocard_list.ResetContent();
|
||||
|
||||
// Display the scanning window
|
||||
m_MsgDlg.m_ScanningMsg.LoadString(IDS_VIDEOTAB_SCANNING);
|
||||
m_MsgDlg.m_WaitMsg.LoadString(IDS_PLEASE_WAIT_MSG);
|
||||
m_MsgDlg.Create(IDD_MSG_DLG,this);
|
||||
m_MsgDlg.ShowWindow(SW_SHOW);
|
||||
m_MsgDlg.UpdateData(FALSE);
|
||||
// Display the scanning window
|
||||
m_MsgDlg.m_ScanningMsg.LoadString(IDS_VIDEOTAB_SCANNING);
|
||||
m_MsgDlg.m_WaitMsg.LoadString(IDS_PLEASE_WAIT_MSG);
|
||||
m_MsgDlg.Create(IDD_MSG_DLG, this);
|
||||
m_MsgDlg.ShowWindow(SW_SHOW);
|
||||
m_MsgDlg.UpdateData(FALSE);
|
||||
|
||||
#if (defined(OEM_VOODOO3) && !defined(USE_ALL_VIDEO_OPTIONS))
|
||||
// Detect only 3dfx cards
|
||||
detect_3dcards(0,1,0);
|
||||
// Detect only 3dfx cards
|
||||
detect_3dcards(0, 1, 0);
|
||||
#else
|
||||
// Detect the cards
|
||||
detect_3dcards(dlg.DetectDirect3D,dlg.DetectGlide,dlg.DetectOpenGL);
|
||||
// Detect the cards
|
||||
detect_3dcards(dlg.DetectDirect3D, dlg.DetectGlide, dlg.DetectOpenGL);
|
||||
#endif
|
||||
|
||||
// Remove the scanning window
|
||||
m_MsgDlg.DestroyWindow();
|
||||
// Remove the scanning window
|
||||
m_MsgDlg.DestroyWindow();
|
||||
|
||||
// Now that the window is gone, release the opengl dll (fixes crash)
|
||||
if(opengl_dll_handle!=NULL) {
|
||||
FreeLibrary(opengl_dll_handle);
|
||||
opengl_dll_handle=NULL;
|
||||
}
|
||||
// Now that the window is gone, release the opengl dll (fixes crash)
|
||||
if (opengl_dll_handle != NULL) {
|
||||
FreeLibrary(opengl_dll_handle);
|
||||
opengl_dll_handle = NULL;
|
||||
}
|
||||
|
||||
int i;
|
||||
int current=0;
|
||||
int i;
|
||||
int current = 0;
|
||||
|
||||
// Add cards to listbox
|
||||
for (i=0; i<Num_cards; i++ ) {
|
||||
// Construct the listbox name
|
||||
m_videocard_list.InsertString( i, GetFullName(&Cards[i]) );
|
||||
}
|
||||
// Add cards to listbox
|
||||
for (i = 0; i < Num_cards; i++) {
|
||||
// Construct the listbox name
|
||||
m_videocard_list.InsertString(i, GetFullName(&Cards[i]));
|
||||
}
|
||||
|
||||
// If only one card (in addition to NONE option) has been detected, select it
|
||||
if(Num_cards==2) current=1;
|
||||
// If only one card (in addition to NONE option) has been detected, select it
|
||||
if (Num_cards == 2)
|
||||
current = 1;
|
||||
|
||||
// If more than one card, then display the "you must select one" message
|
||||
if(Num_cards>2) {
|
||||
current=0; // set it to "none", make user pick
|
||||
// If more than one card, then display the "you must select one" message
|
||||
if (Num_cards > 2) {
|
||||
current = 0; // set it to "none", make user pick
|
||||
|
||||
CString mtod_msg, mtod_title;
|
||||
mtod_msg.LoadString(IDS_VIDEOTAB_MTOD_MSG);
|
||||
mtod_title.LoadString(IDS_VIDEOTAB_MTOD_TITLE);
|
||||
MessageBox(mtod_msg,mtod_title,MB_OK|MB_ICONINFORMATION);
|
||||
}
|
||||
CString mtod_msg, mtod_title;
|
||||
mtod_msg.LoadString(IDS_VIDEOTAB_MTOD_MSG);
|
||||
mtod_title.LoadString(IDS_VIDEOTAB_MTOD_TITLE);
|
||||
MessageBox(mtod_msg, mtod_title, MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
// Set the determined selection
|
||||
m_videocard_list.SetCurSel(current);
|
||||
// Set the determined selection
|
||||
m_videocard_list.SetCurSel(current);
|
||||
|
||||
// Desensitize detection button since cards have been detected
|
||||
//HWND hwnd;
|
||||
//GetDlgItem(IDC_VIDEOCARD_DETECT,&hwnd);
|
||||
//::EnableWindow(hwnd,FALSE);
|
||||
// Desensitize detection button since cards have been detected
|
||||
// HWND hwnd;
|
||||
// GetDlgItem(IDC_VIDEOCARD_DETECT,&hwnd);
|
||||
//::EnableWindow(hwnd,FALSE);
|
||||
}
|
||||
|
||||
BOOL CVideoTab::OnInitDialog() {
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
BOOL CVideoTab::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
// TODO: Add extra initialization here
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
CDialog::OnInitDialog();
|
||||
CurrentVideoTab = this;
|
||||
|
||||
CurrentVideoTab = this;
|
||||
// Get the PreferredRenderer
|
||||
RendererType renderer_id = (RendererType)os_config_read_uint(NULL, "PreferredRenderer", RENDERER_NONE);
|
||||
|
||||
// Get the PreferredRenderer
|
||||
RendererType renderer_id = (RendererType)os_config_read_uint(NULL, "PreferredRenderer", RENDERER_NONE);
|
||||
// Get the name of the selected rendering device
|
||||
char *current_card = os_config_read_string(szSectionName, "RenderingDeviceName", "");
|
||||
|
||||
// Get the name of the selected rendering device
|
||||
char *current_card = os_config_read_string(szSectionName, "RenderingDeviceName", "" );
|
||||
// Clear the box
|
||||
m_videocard_list.ResetContent();
|
||||
|
||||
// Clear the box
|
||||
m_videocard_list.ResetContent();
|
||||
|
||||
// if renderer none is selected, automatically display the detection dialog
|
||||
int current=-1;
|
||||
if(renderer_id==RENDERER_NONE) {
|
||||
// if renderer none is selected, automatically display the detection dialog
|
||||
int current = -1;
|
||||
if (renderer_id == RENDERER_NONE) {
|
||||
|
||||
#if (!defined(OEM_VOODOO3) || defined(USE_ALL_VIDEO_OPTIONS))
|
||||
// Display the scan selection options to user
|
||||
CVideoDetectDlg dlg;
|
||||
dlg.DoModal();
|
||||
// Display the scan selection options to user
|
||||
CVideoDetectDlg dlg;
|
||||
dlg.DoModal();
|
||||
#endif
|
||||
|
||||
// Set the wait cursor
|
||||
CWaitCursor wc;
|
||||
// Set the wait cursor
|
||||
CWaitCursor wc;
|
||||
|
||||
// Display the scanning window
|
||||
m_MsgDlg.m_ScanningMsg.LoadString(IDS_VIDEOTAB_SCANNING);
|
||||
m_MsgDlg.m_WaitMsg.LoadString(IDS_PLEASE_WAIT_MSG);
|
||||
m_MsgDlg.Create(IDD_MSG_DLG,this);
|
||||
m_MsgDlg.ShowWindow(SW_SHOW);
|
||||
m_MsgDlg.UpdateData(FALSE);
|
||||
// Display the scanning window
|
||||
m_MsgDlg.m_ScanningMsg.LoadString(IDS_VIDEOTAB_SCANNING);
|
||||
m_MsgDlg.m_WaitMsg.LoadString(IDS_PLEASE_WAIT_MSG);
|
||||
m_MsgDlg.Create(IDD_MSG_DLG, this);
|
||||
m_MsgDlg.ShowWindow(SW_SHOW);
|
||||
m_MsgDlg.UpdateData(FALSE);
|
||||
|
||||
#if (defined(OEM_VOODOO3) && !defined(USE_ALL_VIDEO_OPTIONS))
|
||||
// Detect only 3dfx cards
|
||||
detect_3dcards(0,1,0);
|
||||
// Detect only 3dfx cards
|
||||
detect_3dcards(0, 1, 0);
|
||||
#else
|
||||
// Detect the cards
|
||||
detect_3dcards(dlg.DetectDirect3D,dlg.DetectGlide,dlg.DetectOpenGL);
|
||||
// Detect the cards
|
||||
detect_3dcards(dlg.DetectDirect3D, dlg.DetectGlide, dlg.DetectOpenGL);
|
||||
#endif
|
||||
|
||||
// Remove the scanning window
|
||||
m_MsgDlg.DestroyWindow();
|
||||
// Remove the scanning window
|
||||
m_MsgDlg.DestroyWindow();
|
||||
|
||||
// Now that the window is gone, release the opengl dll (fixes crash)
|
||||
if(opengl_dll_handle!=NULL) {
|
||||
FreeLibrary(opengl_dll_handle);
|
||||
opengl_dll_handle=NULL;
|
||||
}
|
||||
// Now that the window is gone, release the opengl dll (fixes crash)
|
||||
if (opengl_dll_handle != NULL) {
|
||||
FreeLibrary(opengl_dll_handle);
|
||||
opengl_dll_handle = NULL;
|
||||
}
|
||||
|
||||
// Put the detected cards into the list, and see if the selected card is one of them
|
||||
for(int j=0; j<Num_cards; j++) {
|
||||
m_videocard_list.InsertString( j, GetFullName(&Cards[j]) );
|
||||
if ( Cards[j].renderer_type==renderer_id && !stricmp(Cards[j].name, current_card) )
|
||||
current=j;
|
||||
}
|
||||
}
|
||||
else { // just put the selected card in the list (and none selected)
|
||||
detect_3dcards(0,0,0);
|
||||
m_videocard_list.InsertString( 0, GetFullName(&Cards[0]) );
|
||||
Cards[Num_cards].renderer_type=renderer_id;
|
||||
strcpy( Cards[Num_cards].name, current_card );
|
||||
m_videocard_list.InsertString( Num_cards, GetFullName(&Cards[Num_cards]) );
|
||||
current = Num_cards;
|
||||
Num_cards++;
|
||||
}
|
||||
// Put the detected cards into the list, and see if the selected card is one of them
|
||||
for (int j = 0; j < Num_cards; j++) {
|
||||
m_videocard_list.InsertString(j, GetFullName(&Cards[j]));
|
||||
if (Cards[j].renderer_type == renderer_id && !stricmp(Cards[j].name, current_card))
|
||||
current = j;
|
||||
}
|
||||
} else { // just put the selected card in the list (and none selected)
|
||||
detect_3dcards(0, 0, 0);
|
||||
m_videocard_list.InsertString(0, GetFullName(&Cards[0]));
|
||||
Cards[Num_cards].renderer_type = renderer_id;
|
||||
strcpy(Cards[Num_cards].name, current_card);
|
||||
m_videocard_list.InsertString(Num_cards, GetFullName(&Cards[Num_cards]));
|
||||
current = Num_cards;
|
||||
Num_cards++;
|
||||
}
|
||||
|
||||
// Only do "auto-selection" when renderer_id is set to RENDERER_NONE
|
||||
if(renderer_id==RENDERER_NONE || current==-1) {
|
||||
// Only do "auto-selection" when renderer_id is set to RENDERER_NONE
|
||||
if (renderer_id == RENDERER_NONE || current == -1) {
|
||||
|
||||
if(Num_cards<=2) current=Num_cards-1;
|
||||
if (Num_cards <= 2)
|
||||
current = Num_cards - 1;
|
||||
|
||||
// If more than one card, then display the "you must select one" message
|
||||
if(Num_cards>2) {
|
||||
current=0; // set it to "none", make user pick
|
||||
// If more than one card, then display the "you must select one" message
|
||||
if (Num_cards > 2) {
|
||||
current = 0; // set it to "none", make user pick
|
||||
|
||||
CString mtod_msg, mtod_title;
|
||||
mtod_msg.LoadString(IDS_VIDEOTAB_MTOD_MSG);
|
||||
mtod_title.LoadString(IDS_VIDEOTAB_MTOD_TITLE);
|
||||
MessageBox(mtod_msg,mtod_title,MB_OK|MB_ICONINFORMATION);
|
||||
}
|
||||
}
|
||||
CString mtod_msg, mtod_title;
|
||||
mtod_msg.LoadString(IDS_VIDEOTAB_MTOD_MSG);
|
||||
mtod_title.LoadString(IDS_VIDEOTAB_MTOD_TITLE);
|
||||
MessageBox(mtod_msg, mtod_title, MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// If the selected card isn't in the current list, put it in the list
|
||||
if(current==-1) {
|
||||
Cards[Num_cards].renderer_type=renderer_id;
|
||||
strcpy( Cards[Num_cards].name, current_card );
|
||||
m_videocard_list.InsertString( Num_cards, GetFullName(&Cards[Num_cards]) );
|
||||
current = Num_cards;
|
||||
Num_cards++;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// If the selected card isn't in the current list, put it in the list
|
||||
if(current==-1) {
|
||||
Cards[Num_cards].renderer_type=renderer_id;
|
||||
strcpy( Cards[Num_cards].name, current_card );
|
||||
m_videocard_list.InsertString( Num_cards, GetFullName(&Cards[Num_cards]) );
|
||||
current = Num_cards;
|
||||
Num_cards++;
|
||||
}
|
||||
*/
|
||||
|
||||
// Desensitize detection button since cards have been detected
|
||||
//HWND hwnd;
|
||||
//GetDlgItem(IDC_VIDEOCARD_DETECT,&hwnd);
|
||||
//::EnableWindow(hwnd,FALSE);
|
||||
// Desensitize detection button since cards have been detected
|
||||
// HWND hwnd;
|
||||
// GetDlgItem(IDC_VIDEOCARD_DETECT,&hwnd);
|
||||
//::EnableWindow(hwnd,FALSE);
|
||||
|
||||
/*
|
||||
detect_3dcards(0);
|
||||
m_videocard_list.InsertString( 0, GetFullName(&Cards[0]) );
|
||||
/*
|
||||
detect_3dcards(0);
|
||||
m_videocard_list.InsertString( 0, GetFullName(&Cards[0]) );
|
||||
|
||||
if ( renderer_id != RENDERER_NONE ) {
|
||||
Cards[Num_cards].renderer_type=renderer_id;
|
||||
strcpy( Cards[Num_cards].name, current_card );
|
||||
m_videocard_list.InsertString( Num_cards, GetFullName(&Cards[Num_cards]) );
|
||||
current = Num_cards;
|
||||
Num_cards++;
|
||||
}
|
||||
*/
|
||||
if ( renderer_id != RENDERER_NONE ) {
|
||||
Cards[Num_cards].renderer_type=renderer_id;
|
||||
strcpy( Cards[Num_cards].name, current_card );
|
||||
m_videocard_list.InsertString( Num_cards, GetFullName(&Cards[Num_cards]) );
|
||||
current = Num_cards;
|
||||
Num_cards++;
|
||||
}
|
||||
*/
|
||||
|
||||
m_videocard_list.SetCurSel(current);
|
||||
m_videocard_list.SetCurSel(current);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CVideoTab::OnOK()
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
int current = m_videocard_list.GetCurSel();
|
||||
void CVideoTab::OnOK() {
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
int current = m_videocard_list.GetCurSel();
|
||||
|
||||
if ( (current < 0) || (current>=Num_cards)) {
|
||||
current = 0;
|
||||
}
|
||||
if ((current < 0) || (current >= Num_cards)) {
|
||||
current = 0;
|
||||
}
|
||||
|
||||
OutputDebugString("Setting the videocard!\n");
|
||||
OutputDebugString("Setting the videocard!\n");
|
||||
|
||||
// Get the PreferredRenderer
|
||||
os_config_write_uint(NULL, "PreferredRenderer", Cards[current].renderer_type);
|
||||
// Get the PreferredRenderer
|
||||
os_config_write_uint(NULL, "PreferredRenderer", Cards[current].renderer_type);
|
||||
|
||||
// Write out the name of the rendering device
|
||||
os_config_write_string(szSectionName, "RenderingDeviceName", Cards[current].name);
|
||||
// Write out the name of the rendering device
|
||||
os_config_write_string(szSectionName, "RenderingDeviceName", Cards[current].name);
|
||||
|
||||
CPropertyPage::OnOK();
|
||||
CPropertyPage::OnOK();
|
||||
}
|
||||
|
||||
|
||||
BOOL CVideoTab::OnHelpInfo(HELPINFO* pHelpInfo)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
BOOL CVideoTab::OnHelpInfo(HELPINFO *pHelpInfo) {
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
CWaitCursor wc;
|
||||
help_launch(VIDEOTAB_HELP);
|
||||
return 1;
|
||||
CWaitCursor wc;
|
||||
help_launch(VIDEOTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
return CPropertyPage::OnHelpInfo(pHelpInfo);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Display the html help file
|
||||
afx_msg LRESULT CVideoTab::OnCommandHelp(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
afx_msg LRESULT CVideoTab::OnCommandHelp(WPARAM wParam, LPARAM lParam) {
|
||||
#ifdef USE_HTML_HELP_SYSTEM
|
||||
help_launch(VIDEOTAB_HELP);
|
||||
return 1;
|
||||
help_launch(VIDEOTAB_HELP);
|
||||
return 1;
|
||||
#else
|
||||
return CPropertyPage::OnCommandHelp(wParam,lParam);
|
||||
return CPropertyPage::OnCommandHelp(wParam, lParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CVideoTab::OnSelchangeVideocardList()
|
||||
{
|
||||
int current = m_videocard_list.GetCurSel();
|
||||
void CVideoTab::OnSelchangeVideocardList() {
|
||||
int current = m_videocard_list.GetCurSel();
|
||||
|
||||
if ( (current < 0) || (current>=Num_cards)) {
|
||||
current = 0;
|
||||
}
|
||||
if ((current < 0) || (current >= Num_cards)) {
|
||||
current = 0;
|
||||
}
|
||||
|
||||
// If user's DirectX version is less than 6.0,
|
||||
// then don't let them select Direct 3D
|
||||
if(Dx_version<6) {
|
||||
if(Cards[current].renderer_type==RENDERER_DIRECT3D) {
|
||||
CString title, msg;
|
||||
title.LoadString(IDS_VIDEOTAB_DXVERSION_TITLE);
|
||||
msg.LoadString(IDS_VIDEOTAB_DXVERSION_MSG);
|
||||
MessageBox(msg,title,MB_OK|MB_ICONEXCLAMATION);
|
||||
m_videocard_list.SetCurSel(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// If user's DirectX version is less than 6.0,
|
||||
// then don't let them select Direct 3D
|
||||
if (Dx_version < 6) {
|
||||
if (Cards[current].renderer_type == RENDERER_DIRECT3D) {
|
||||
CString title, msg;
|
||||
title.LoadString(IDS_VIDEOTAB_DXVERSION_TITLE);
|
||||
msg.LoadString(IDS_VIDEOTAB_DXVERSION_MSG);
|
||||
MessageBox(msg, title, MB_OK | MB_ICONEXCLAMATION);
|
||||
m_videocard_list.SetCurSel(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// See if user has the option of selecting 3Dfx glide
|
||||
int glide = -1;
|
||||
for(int j=0;j<Num_cards;j++) {
|
||||
if(Cards[j].renderer_type==RENDERER_GLIDE) {
|
||||
glide=j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// See if user has the option of selecting 3Dfx glide
|
||||
int glide = -1;
|
||||
for (int j = 0; j < Num_cards; j++) {
|
||||
if (Cards[j].renderer_type == RENDERER_GLIDE) {
|
||||
glide = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Display warning if user has glide and is choosing opengl or direct3d
|
||||
if(glide>=0 && glide<Num_cards) {
|
||||
if(Cards[current].renderer_type==RENDERER_DIRECT3D || Cards[current].renderer_type==RENDERER_OPENGL) {
|
||||
CString title, msg;
|
||||
title.LoadString(IDS_NOTGLIDE_TITLE);
|
||||
msg.LoadString(IDS_NOTGLIDE_MSG);
|
||||
MessageBox(msg,title,MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
// Display warning if user has glide and is choosing opengl or direct3d
|
||||
if (glide >= 0 && glide < Num_cards) {
|
||||
if (Cards[current].renderer_type == RENDERER_DIRECT3D || Cards[current].renderer_type == RENDERER_OPENGL) {
|
||||
CString title, msg;
|
||||
title.LoadString(IDS_NOTGLIDE_TITLE);
|
||||
msg.LoadString(IDS_NOTGLIDE_MSG);
|
||||
MessageBox(msg, title, MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,49 +71,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CVideoTab dialog
|
||||
|
||||
class CVideoTab : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CVideoTab)
|
||||
class CVideoTab : public CPropertyPage {
|
||||
DECLARE_DYNCREATE(CVideoTab)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CVideoTab();
|
||||
~CVideoTab();
|
||||
CVideoTab();
|
||||
~CVideoTab();
|
||||
|
||||
int GetCurrentCard();
|
||||
CMsgDlg m_MsgDlg;
|
||||
int GetCurrentCard();
|
||||
CMsgDlg m_MsgDlg;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CVideoTab)
|
||||
enum { IDD = IDD_PROPPAGE_VIDEO };
|
||||
CComboBox m_videocard_list;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CVideoTab)
|
||||
enum { IDD = IDD_PROPPAGE_VIDEO };
|
||||
CComboBox m_videocard_list;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CVideoTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CVideoTab)
|
||||
public:
|
||||
virtual void OnOK();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CVideoTab)
|
||||
afx_msg void OnVideocardDetect();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
afx_msg void OnSelchangeVideocardList();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CVideoTab)
|
||||
afx_msg void OnVideocardDetect();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO *pHelpInfo);
|
||||
afx_msg void OnSelchangeVideocardList();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CVideoTab * CurrentVideoTab;
|
||||
extern CVideoTab *CurrentVideoTab;
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// EAX.H -- DirectSound Environmental Audio Extensions
|
||||
|
||||
@@ -26,89 +25,77 @@
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
// EAX (listener) reverb property set {4a4e6fc1-c341-11d1-b73a-444553540000}
|
||||
DEFINE_GUID(DSPROPSETID_EAX_ReverbProperties,
|
||||
0x4a4e6fc1,
|
||||
0xc341,
|
||||
0x11d1,
|
||||
0xb7, 0x3a, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
|
||||
DEFINE_GUID(DSPROPSETID_EAX_ReverbProperties, 0x4a4e6fc1, 0xc341, 0x11d1, 0xb7, 0x3a, 0x44, 0x45, 0x53, 0x54, 0x00,
|
||||
0x00);
|
||||
|
||||
enum DSPROPERTY_EAX_REVERBPROPERTY
|
||||
{
|
||||
DSPROPERTY_EAX_ALL, // all reverb properties
|
||||
DSPROPERTY_EAX_ENVIRONMENT, // standard environment no.
|
||||
DSPROPERTY_EAX_VOLUME, // loudness of the reverb
|
||||
DSPROPERTY_EAX_DECAYTIME, // how long the reverb lasts
|
||||
DSPROPERTY_EAX_DAMPING // the high frequencies decay faster
|
||||
enum DSPROPERTY_EAX_REVERBPROPERTY {
|
||||
DSPROPERTY_EAX_ALL, // all reverb properties
|
||||
DSPROPERTY_EAX_ENVIRONMENT, // standard environment no.
|
||||
DSPROPERTY_EAX_VOLUME, // loudness of the reverb
|
||||
DSPROPERTY_EAX_DECAYTIME, // how long the reverb lasts
|
||||
DSPROPERTY_EAX_DAMPING // the high frequencies decay faster
|
||||
};
|
||||
|
||||
#define EAX_NUM_STANDARD_PROPERTIES (DSPROPERTY_EAX_DAMPING + 1)
|
||||
|
||||
// use this structure for get/set all properties...
|
||||
struct EAX_REVERBPROPERTIES
|
||||
{
|
||||
uint32_t environment; // 0 to EAX_ENVIRONMENT_COUNT-1
|
||||
float fVolume; // 0 to 1
|
||||
float fDecayTime_sec; // seconds, 0.1 to 100
|
||||
float fDamping; // 0 to 1
|
||||
struct EAX_REVERBPROPERTIES {
|
||||
uint32_t environment; // 0 to EAX_ENVIRONMENT_COUNT-1
|
||||
float fVolume; // 0 to 1
|
||||
float fDecayTime_sec; // seconds, 0.1 to 100
|
||||
float fDamping; // 0 to 1
|
||||
};
|
||||
|
||||
|
||||
//#define EAX_MAX_ENVIRONMENT (EAX_ENVIRONMENT_COUNT - 1)
|
||||
// #define EAX_MAX_ENVIRONMENT (EAX_ENVIRONMENT_COUNT - 1)
|
||||
|
||||
// presets
|
||||
#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F
|
||||
#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F
|
||||
#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F
|
||||
#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F
|
||||
#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F
|
||||
#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F
|
||||
#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F
|
||||
#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F
|
||||
#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F
|
||||
#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F
|
||||
#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F
|
||||
#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F
|
||||
#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F
|
||||
#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F
|
||||
#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F
|
||||
#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F
|
||||
#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F
|
||||
#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F
|
||||
#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F
|
||||
#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F
|
||||
#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F
|
||||
#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F
|
||||
#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F
|
||||
#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F
|
||||
#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F
|
||||
#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F
|
||||
|
||||
#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC, 0.5F, 1.493F, 0.5F
|
||||
#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL, 0.25F, 0.1F, 0.0F
|
||||
#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM, 0.417F, 0.4F, 0.666F
|
||||
#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM, 0.653F, 1.499F, 0.166F
|
||||
#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM, 0.208F, 0.478F, 0.0F
|
||||
#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM, 0.5F, 2.309F, 0.888F
|
||||
#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM, 0.403F, 4.279F, 0.5F
|
||||
#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL, 0.5F, 3.961F, 0.5F
|
||||
#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE, 0.5F, 2.886F, 1.304F
|
||||
#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA, 0.361F, 7.284F, 0.332F
|
||||
#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR, 0.5F, 10.0F, 0.3F
|
||||
#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153F, 0.259F, 2.0F
|
||||
#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY, 0.361F, 1.493F, 0.0F
|
||||
#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR, 0.444F, 2.697F, 0.638F
|
||||
#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY, 0.25F, 1.752F, 0.776F
|
||||
#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST, 0.111F, 3.145F, 0.472F
|
||||
#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY, 0.111F, 2.767F, 0.224F
|
||||
#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS, 0.194F, 7.841F, 0.472F
|
||||
#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY, 1.0F, 1.499F, 0.5F
|
||||
#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN, 0.097F, 2.767F, 0.224F
|
||||
#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT, 0.208F, 1.652F, 1.5F
|
||||
#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE, 0.652F, 2.886F, 0.25F
|
||||
#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER, 1.0F, 1.499F, 0.0F
|
||||
#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED, 0.875F, 8.392F, 1.388F
|
||||
#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY, 0.139F, 17.234F, 0.666F
|
||||
#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC, 0.486F, 7.563F, 0.806F
|
||||
|
||||
// EAX buffer reverb property set {4a4e6fc0-c341-11d1-b73a-444553540000}
|
||||
DEFINE_GUID(DSPROPSETID_EAXBUFFER_ReverbProperties,
|
||||
0x4a4e6fc0,
|
||||
0xc341,
|
||||
0x11d1,
|
||||
0xb7, 0x3a, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
|
||||
DEFINE_GUID(DSPROPSETID_EAXBUFFER_ReverbProperties, 0x4a4e6fc0, 0xc341, 0x11d1, 0xb7, 0x3a, 0x44, 0x45, 0x53, 0x54,
|
||||
0x00, 0x00);
|
||||
|
||||
enum DSPROPERTY_EAXBUFFER_REVERBPROPERTY
|
||||
{
|
||||
DSPROPERTY_EAXBUFFER_ALL, // all reverb buffer properties
|
||||
DSPROPERTY_EAXBUFFER_REVERBMIX // the wet source amount
|
||||
enum DSPROPERTY_EAXBUFFER_REVERBPROPERTY {
|
||||
DSPROPERTY_EAXBUFFER_ALL, // all reverb buffer properties
|
||||
DSPROPERTY_EAXBUFFER_REVERBMIX // the wet source amount
|
||||
};
|
||||
|
||||
// use this structure for get/set all properties...
|
||||
struct EAXBUFFER_REVERBPROPERTIES
|
||||
{
|
||||
float fMix; // linear factor, 0.0F to 1.0F
|
||||
struct EAXBUFFER_REVERBPROPERTIES {
|
||||
float fMix; // linear factor, 0.0F to 1.0F
|
||||
};
|
||||
|
||||
#define EAX_REVERBMIX_USEDISTANCE -1.0F // out of normal range
|
||||
// signifies the reverb engine should
|
||||
// calculate it's own reverb mix value
|
||||
// based on distance
|
||||
#define EAX_REVERBMIX_USEDISTANCE \
|
||||
-1.0F // out of normal range
|
||||
// signifies the reverb engine should
|
||||
// calculate it's own reverb mix value
|
||||
// based on distance
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,332 +1,332 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by D3Launch.rc
|
||||
//
|
||||
#define IDS_UPDATEDLG_USERMSG1 1
|
||||
#define IDS_UPDATEDLG_USERMSG2 2
|
||||
#define IDS_D3LAUNCH_DLGTITLE 3
|
||||
#define IDS_D3LAUNCH_URL_ERR1 4
|
||||
#define IDS_D3LAUNCH_URL_ERR2 5
|
||||
#define IDS_D3LAUNCH_URL_ERR3 6
|
||||
#define IDS_D3LAUNCH_URL_ERR4 7
|
||||
#define IDS_D3LAUNCH_URL_ERR5 8
|
||||
#define IDS_D3LAUNCH_URL_ERR6 9
|
||||
#define IDS_D3LAUNCH_URL_ERR7 10
|
||||
#define IDS_D3LAUNCH_URL_ERR8 11
|
||||
#define IDS_D3LAUNCH_URL_ERR9 12
|
||||
#define IDS_D3LAUNCH_URL_ERR10 13
|
||||
#define IDS_D3LAUNCH_URL_ERR11 14
|
||||
#define IDS_D3LAUNCH_URL_ERR12 15
|
||||
#define IDS_D3LAUNCHDLG_NODD 16
|
||||
#define IDS_D3LAUNCHDLG_NODDT 17
|
||||
#define IDS_D3LAUNCHDLG_SETUP 18
|
||||
#define IDS_D3LAUNCHDLG_RM_ERR 19
|
||||
#define IDS_D3LAUNCHDLG_LNCH_ERR 20
|
||||
#define IDS_3D_DETECT_NO3D 21
|
||||
#define IDS_AUDIOTAB_A3D1 22
|
||||
#define IDS_AUDIOTAB_A3D2 23
|
||||
#define IDS_AUDIOTAB_NO_SOUND 24
|
||||
#define IDS_JOYSTICKTAB_ERR1 25
|
||||
#define IDS_JOYSTICKTAB_NONE 26
|
||||
#define IDS_UPDATEDLG_GVN_MSG1 27
|
||||
#define IDS_UPDATEDLG_NO_CON 28
|
||||
#define IDS_UPDATEDLG_ERROR 29
|
||||
#define IDS_UPDATEDLG_GVN_MSG2 30
|
||||
#define IDS_UPDATEDLG_NO_DL 31
|
||||
#define IDS_UPDATEDLG_NO_FIND 32
|
||||
#define IDS_UPDATEDLG_WAIT 33
|
||||
#define IDS_UPDATEDLG_SRV 34
|
||||
#define IDS_UPDATEDLG_UTD 35
|
||||
#define IDS_UPDATEDLG_UTDT 36
|
||||
#define IDS_UPDATEDLG_YES_ERR1 37
|
||||
#define IDS_UPDATEDLG_PF_ERR1 38
|
||||
#define IDS_UPDATEDLG_PATCHING 39
|
||||
#define IDS_UPDATEDLG_GET_FILE 40
|
||||
#define IDS_UPDATEDLG_CANT_PATCH 41
|
||||
#define IDS_UPDATEDLG_SKIPPING 42
|
||||
#define IDS_UPDATEDLG_PATCH_OK 43
|
||||
#define IDS_UPDATEDLG_SUCCESS 44
|
||||
#define IDS_UPDATEDLG_NO_PATCH_LIB 45
|
||||
#define IDS_UPDATEDLG_DL_FILE 46
|
||||
#define IDS_UPDATEDLG_INIT_CON 47
|
||||
#define IDS_UPDATEDLG_WS_ERR 48
|
||||
#define IDS_UPDATEDLG_CON_OK 49
|
||||
#define IDS_UPDATEDLG_CON_SHUTDOWN 50
|
||||
#define IDS_UPDATEDLG_WAITING 51
|
||||
#define IDS_SPEEDTAB_LOW 52
|
||||
#define IDS_SPEEDTAB_MEDIUM 53
|
||||
#define IDS_SPEEDTAB_HIGH 54
|
||||
#define IDS_SPEEDTAB_VERY_HIGH 55
|
||||
#define IDS_UPDATEDLG_LNCH_UPD1 56
|
||||
#define IDS_UPDATEDLG_LNCH_UPD2 57
|
||||
#define IDS_UPDATEDLG_LNCH_UPD3 58
|
||||
#define IDS_UPDATEDLG_LNCH_UPD_TITLE 59
|
||||
#define IDS_UPDATEDLG_BEG_PATCH 60
|
||||
#define IDS_UPDATEDLG_PATCH_COMPLETE 61
|
||||
#define IDS_UPDATEDLG_PATCH_FAILED 62
|
||||
#define IDS_UPDATEDLG_PATCH_ERROR 63
|
||||
#define IDS_UPDATEDLG_PROCESSING 64
|
||||
#define IDS_UPDATEDLG_FILE_COMPLETE 65
|
||||
#define IDS_UPDATEDLG_SEARCHING 66
|
||||
#define IDS_UPDATEDLG_WNDMSG_MAIN 67
|
||||
#define IDS_UPDATEDLG_WNDMSG_STATUS 68
|
||||
#define IDS_UPDATEDLG_USERMSG3 69
|
||||
#define IDS_SITESELECTDLG_SITE_NAME 70
|
||||
#define IDS_SITESELECTDLG_SITE_ADDRESS 71
|
||||
#define IDS_UPDATEDLG_USERMSG1 1
|
||||
#define IDS_UPDATEDLG_USERMSG2 2
|
||||
#define IDS_D3LAUNCH_DLGTITLE 3
|
||||
#define IDS_D3LAUNCH_URL_ERR1 4
|
||||
#define IDS_D3LAUNCH_URL_ERR2 5
|
||||
#define IDS_D3LAUNCH_URL_ERR3 6
|
||||
#define IDS_D3LAUNCH_URL_ERR4 7
|
||||
#define IDS_D3LAUNCH_URL_ERR5 8
|
||||
#define IDS_D3LAUNCH_URL_ERR6 9
|
||||
#define IDS_D3LAUNCH_URL_ERR7 10
|
||||
#define IDS_D3LAUNCH_URL_ERR8 11
|
||||
#define IDS_D3LAUNCH_URL_ERR9 12
|
||||
#define IDS_D3LAUNCH_URL_ERR10 13
|
||||
#define IDS_D3LAUNCH_URL_ERR11 14
|
||||
#define IDS_D3LAUNCH_URL_ERR12 15
|
||||
#define IDS_D3LAUNCHDLG_NODD 16
|
||||
#define IDS_D3LAUNCHDLG_NODDT 17
|
||||
#define IDS_D3LAUNCHDLG_SETUP 18
|
||||
#define IDS_D3LAUNCHDLG_RM_ERR 19
|
||||
#define IDS_D3LAUNCHDLG_LNCH_ERR 20
|
||||
#define IDS_3D_DETECT_NO3D 21
|
||||
#define IDS_AUDIOTAB_A3D1 22
|
||||
#define IDS_AUDIOTAB_A3D2 23
|
||||
#define IDS_AUDIOTAB_NO_SOUND 24
|
||||
#define IDS_JOYSTICKTAB_ERR1 25
|
||||
#define IDS_JOYSTICKTAB_NONE 26
|
||||
#define IDS_UPDATEDLG_GVN_MSG1 27
|
||||
#define IDS_UPDATEDLG_NO_CON 28
|
||||
#define IDS_UPDATEDLG_ERROR 29
|
||||
#define IDS_UPDATEDLG_GVN_MSG2 30
|
||||
#define IDS_UPDATEDLG_NO_DL 31
|
||||
#define IDS_UPDATEDLG_NO_FIND 32
|
||||
#define IDS_UPDATEDLG_WAIT 33
|
||||
#define IDS_UPDATEDLG_SRV 34
|
||||
#define IDS_UPDATEDLG_UTD 35
|
||||
#define IDS_UPDATEDLG_UTDT 36
|
||||
#define IDS_UPDATEDLG_YES_ERR1 37
|
||||
#define IDS_UPDATEDLG_PF_ERR1 38
|
||||
#define IDS_UPDATEDLG_PATCHING 39
|
||||
#define IDS_UPDATEDLG_GET_FILE 40
|
||||
#define IDS_UPDATEDLG_CANT_PATCH 41
|
||||
#define IDS_UPDATEDLG_SKIPPING 42
|
||||
#define IDS_UPDATEDLG_PATCH_OK 43
|
||||
#define IDS_UPDATEDLG_SUCCESS 44
|
||||
#define IDS_UPDATEDLG_NO_PATCH_LIB 45
|
||||
#define IDS_UPDATEDLG_DL_FILE 46
|
||||
#define IDS_UPDATEDLG_INIT_CON 47
|
||||
#define IDS_UPDATEDLG_WS_ERR 48
|
||||
#define IDS_UPDATEDLG_CON_OK 49
|
||||
#define IDS_UPDATEDLG_CON_SHUTDOWN 50
|
||||
#define IDS_UPDATEDLG_WAITING 51
|
||||
#define IDS_SPEEDTAB_LOW 52
|
||||
#define IDS_SPEEDTAB_MEDIUM 53
|
||||
#define IDS_SPEEDTAB_HIGH 54
|
||||
#define IDS_SPEEDTAB_VERY_HIGH 55
|
||||
#define IDS_UPDATEDLG_LNCH_UPD1 56
|
||||
#define IDS_UPDATEDLG_LNCH_UPD2 57
|
||||
#define IDS_UPDATEDLG_LNCH_UPD3 58
|
||||
#define IDS_UPDATEDLG_LNCH_UPD_TITLE 59
|
||||
#define IDS_UPDATEDLG_BEG_PATCH 60
|
||||
#define IDS_UPDATEDLG_PATCH_COMPLETE 61
|
||||
#define IDS_UPDATEDLG_PATCH_FAILED 62
|
||||
#define IDS_UPDATEDLG_PATCH_ERROR 63
|
||||
#define IDS_UPDATEDLG_PROCESSING 64
|
||||
#define IDS_UPDATEDLG_FILE_COMPLETE 65
|
||||
#define IDS_UPDATEDLG_SEARCHING 66
|
||||
#define IDS_UPDATEDLG_WNDMSG_MAIN 67
|
||||
#define IDS_UPDATEDLG_WNDMSG_STATUS 68
|
||||
#define IDS_UPDATEDLG_USERMSG3 69
|
||||
#define IDS_SITESELECTDLG_SITE_NAME 70
|
||||
#define IDS_SITESELECTDLG_SITE_ADDRESS 71
|
||||
#define IDS_SITESELECTDLG_SITE_LOCATION 72
|
||||
#define IDS_SITESELECTDLG_MUST_SELECT 73
|
||||
#define IDS_SITESELECTDLG_SELECT_TITLE 74
|
||||
#define IDS_UPDATEDLG_BADPARMS 75
|
||||
#define IDS_UPDATEDLG_CANT_WRITE_FILE 76
|
||||
#define IDS_UPDATEDLG_CANT_PARSE_URL 77
|
||||
#define IDS_UPDATEDLG_BAD_FILE_OR_DIR 78
|
||||
#define IDS_UPDATEDLG_HOST_NOT_FOUND 79
|
||||
#define IDS_UPDATEDLG_NO_MEMORY 80
|
||||
#define IDS_UPDATEDLG_CANCELLED 81
|
||||
#define IDS_UPDATEDLG_UNKNOWN_ERROR 82
|
||||
#define IDS_UPDATEDLG_DOWNLOAD_ERROR 83
|
||||
#define IDS_SITESELECTDLG_PARSE_ERROR 84
|
||||
#define IDS_UPDATEDLG_DONE_UPDATING 85
|
||||
#define IDS_UPDATEDLG_CONTINUE_MSG 86
|
||||
#define IDS_UPDATEDLG_NO_MOTD 87
|
||||
#define IDS_UPDATEDLG_DL_MOTD 88
|
||||
#define IDS_UPDATEDLG_GOT_MOTD 89
|
||||
#define IDS_UPDATEDLG_NODL_MOTD 90
|
||||
#define IDS_AUDIOTAB_CARD_MISSING 91
|
||||
#define IDS_AUDIOTAB_WARNING 92
|
||||
#define IDS_DIRECTXTAB_OK 93
|
||||
#define IDS_D3LAUNCH_NO_CD 94
|
||||
#define IDS_D3LAUNCH_CD_ERROR 95
|
||||
#define IDS_DIRECTXTAB_NTMSG 96
|
||||
#define IDS_DIRECTXTAB_NTNOTICE 97
|
||||
#define IDS_DIRECTXTAB_LOAD_ERROR 98
|
||||
#define IDS_D3LAUNCHDLG_NO_UNINSTALL 99
|
||||
#define IDS_SITESELECTDLG_MUST_SELECT 73
|
||||
#define IDS_SITESELECTDLG_SELECT_TITLE 74
|
||||
#define IDS_UPDATEDLG_BADPARMS 75
|
||||
#define IDS_UPDATEDLG_CANT_WRITE_FILE 76
|
||||
#define IDS_UPDATEDLG_CANT_PARSE_URL 77
|
||||
#define IDS_UPDATEDLG_BAD_FILE_OR_DIR 78
|
||||
#define IDS_UPDATEDLG_HOST_NOT_FOUND 79
|
||||
#define IDS_UPDATEDLG_NO_MEMORY 80
|
||||
#define IDS_UPDATEDLG_CANCELLED 81
|
||||
#define IDS_UPDATEDLG_UNKNOWN_ERROR 82
|
||||
#define IDS_UPDATEDLG_DOWNLOAD_ERROR 83
|
||||
#define IDS_SITESELECTDLG_PARSE_ERROR 84
|
||||
#define IDS_UPDATEDLG_DONE_UPDATING 85
|
||||
#define IDS_UPDATEDLG_CONTINUE_MSG 86
|
||||
#define IDS_UPDATEDLG_NO_MOTD 87
|
||||
#define IDS_UPDATEDLG_DL_MOTD 88
|
||||
#define IDS_UPDATEDLG_GOT_MOTD 89
|
||||
#define IDS_UPDATEDLG_NODL_MOTD 90
|
||||
#define IDS_AUDIOTAB_CARD_MISSING 91
|
||||
#define IDS_AUDIOTAB_WARNING 92
|
||||
#define IDS_DIRECTXTAB_OK 93
|
||||
#define IDS_D3LAUNCH_NO_CD 94
|
||||
#define IDS_D3LAUNCH_CD_ERROR 95
|
||||
#define IDS_DIRECTXTAB_NTMSG 96
|
||||
#define IDS_DIRECTXTAB_NTNOTICE 97
|
||||
#define IDS_DIRECTXTAB_LOAD_ERROR 98
|
||||
#define IDS_D3LAUNCHDLG_NO_UNINSTALL 99
|
||||
#define IDS_D3LAUNCHDLG_COULDNT_UNINSTALL 100
|
||||
#define IDS_D3LAUNCHDLG_WARNING_PROMPT 101
|
||||
#define IDD_D3LAUNCH_DIALOG 102
|
||||
#define IDS_D3LAUNCHDLG_WARNING_TITLE 102
|
||||
#define IDS_D3LAUNCHDLG_WARNING_PROMPT 101
|
||||
#define IDD_D3LAUNCH_DIALOG 102
|
||||
#define IDS_D3LAUNCHDLG_WARNING_TITLE 102
|
||||
#define IDS_D3LAUNCHDLG_UNINSTALL_ERROR 103
|
||||
#define IDS_D3LAUNCHDLG_PLAY 104
|
||||
#define IDS_D3LAUNCHDLG_PLAY_BTN 104
|
||||
#define IDS_D3LAUNCHDLG_SETUP_BTN 105
|
||||
#define IDS_D3LAUNCHDLG_UPDATE_BTN 106
|
||||
#define IDS_D3LAUNCHDLG_README_BTN 107
|
||||
#define IDS_D3LAUNCHDLG_DIRECTX_BTN 108
|
||||
#define IDS_D3LAUNCHDLG_UNINSTALL_BTN 109
|
||||
#define IDS_D3LAUNCHDLG_INSTALL_BTN 110
|
||||
#define IDS_D3LAUNCHDLG_PLAY 104
|
||||
#define IDS_D3LAUNCHDLG_PLAY_BTN 104
|
||||
#define IDS_D3LAUNCHDLG_SETUP_BTN 105
|
||||
#define IDS_D3LAUNCHDLG_UPDATE_BTN 106
|
||||
#define IDS_D3LAUNCHDLG_README_BTN 107
|
||||
#define IDS_D3LAUNCHDLG_DIRECTX_BTN 108
|
||||
#define IDS_D3LAUNCHDLG_UNINSTALL_BTN 109
|
||||
#define IDS_D3LAUNCHDLG_INSTALL_BTN 110
|
||||
#define IDS_D3LAUNCHDLG_STRAIGHTTOSETUP_MSG 111
|
||||
#define IDS_D3LAUNCHDLG_STRAIGHTTOSETUP_TITLE 112
|
||||
#define IDS_D3LAUNCHDLG_PLAY_WARNING_MSG 113
|
||||
#define IDS_D3LAUNCHDLG_FILE_NOT_FOUND 114
|
||||
#define IDS_D3LAUNCH_NO_HELP 115
|
||||
#define IDS_SPEEDTAB_SPEED_PROMPT 116
|
||||
#define IDS_SPEEDTAB_SPEED_TITLE 117
|
||||
#define IDS_D3LAUNCHDLG_WEBPAGE_BTN 118
|
||||
#define IDS_D3LAUNCHDLG_PXO_BTN 119
|
||||
#define IDS_D3LAUNCHDLG_FILE_NOT_FOUND 114
|
||||
#define IDS_D3LAUNCH_NO_HELP 115
|
||||
#define IDS_SPEEDTAB_SPEED_PROMPT 116
|
||||
#define IDS_SPEEDTAB_SPEED_TITLE 117
|
||||
#define IDS_D3LAUNCHDLG_WEBPAGE_BTN 118
|
||||
#define IDS_D3LAUNCHDLG_PXO_BTN 119
|
||||
#define IDS_D3LAUNCHDLG_NO_RENDERER_MSG 120
|
||||
#define IDS_D3LAUNCHDLG_NO_RENDERER_TITLE 121
|
||||
#define IDS_D3LAUNCHDLG_DEMO_ONLY_MSG 122
|
||||
#define IDS_D3LAUNCHDLG_DEMO_ONLY_MSG 122
|
||||
#define IDS_D3LAUNCHDLG_DEMO_ONLY_TITLE 123
|
||||
#define IDS_D3LAUNCH_DEMO_DLGTITLE 124
|
||||
#define IDS_VIDEOTAB_DXVERSION_TITLE 125
|
||||
#define IDS_VIDEOTAB_DXVERSION_MSG 126
|
||||
#define IDS_D3LAUNCH_DEMO_DLGTITLE 124
|
||||
#define IDS_VIDEOTAB_DXVERSION_TITLE 125
|
||||
#define IDS_VIDEOTAB_DXVERSION_MSG 126
|
||||
#define IDS_D3LAUNCHDLG_DXVERSION_TITLE 127
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDS_D3LAUNCHDLG_DXVERSION_MSG 128
|
||||
#define IDD_UPDATE_DIALOG 129
|
||||
#define IDS_D3LAUNCHDLG_NOMEM_TITLE 129
|
||||
#define IDS_D3LAUNCHDLG_NOMEM_MSG 130
|
||||
#define IDS_PLEASE_WAIT_MSG 131
|
||||
#define IDS_VIDEOTAB_SCANNING 132
|
||||
#define IDS_AUDIOTAB_SCANNING 133
|
||||
#define IDB_D3LAUNCH_BG 134
|
||||
#define IDS_JOYSTICKTAB_SCANNING 134
|
||||
#define IDD_PROPPAGE_JOYSTICK 135
|
||||
#define IDS_VIDEOTAB_MTOD_MSG 135
|
||||
#define IDD_PROPPAGE_VIDEO 136
|
||||
#define IDS_VIDEOTAB_MTOD_TITLE 136
|
||||
#define IDD_PROPPAGE_AUDIO 137
|
||||
#define IDS_SPEEDTAB_NOT_DETECTED 137
|
||||
#define IDD_PROPPAGE_SPEED 138
|
||||
#define IDS_UPDATEDLG_NOREGVER_MSG 138
|
||||
#define IDD_PROPPAGE_NETWORK 139
|
||||
#define IDS_UPDATEDLG_NOREGVER_TITLE 139
|
||||
#define IDD_WAIT_DIALOG 140
|
||||
#define IDS_DIRECTXTAB_UPD_REC 140
|
||||
#define IDS_SPEEDTAB_CUSTOM 141
|
||||
#define IDS_D3LAUNCHDLG_SPD_MSG 142
|
||||
#define IDS_D3LAUNCHDLG_SPD_TITLE 143
|
||||
#define IDS_D3LAUNCHDLG_LAUNCH_ERRMSG 144
|
||||
#define IDS_D3LAUNCHDLG_CONTEST_MSG 145
|
||||
#define IDS_D3LAUNCHDLG_CONTEST_TITLE 146
|
||||
#define IDS_D3LAUNCHDLG_DXERR_SUCCESS 147
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDS_D3LAUNCHDLG_DXVERSION_MSG 128
|
||||
#define IDD_UPDATE_DIALOG 129
|
||||
#define IDS_D3LAUNCHDLG_NOMEM_TITLE 129
|
||||
#define IDS_D3LAUNCHDLG_NOMEM_MSG 130
|
||||
#define IDS_PLEASE_WAIT_MSG 131
|
||||
#define IDS_VIDEOTAB_SCANNING 132
|
||||
#define IDS_AUDIOTAB_SCANNING 133
|
||||
#define IDB_D3LAUNCH_BG 134
|
||||
#define IDS_JOYSTICKTAB_SCANNING 134
|
||||
#define IDD_PROPPAGE_JOYSTICK 135
|
||||
#define IDS_VIDEOTAB_MTOD_MSG 135
|
||||
#define IDD_PROPPAGE_VIDEO 136
|
||||
#define IDS_VIDEOTAB_MTOD_TITLE 136
|
||||
#define IDD_PROPPAGE_AUDIO 137
|
||||
#define IDS_SPEEDTAB_NOT_DETECTED 137
|
||||
#define IDD_PROPPAGE_SPEED 138
|
||||
#define IDS_UPDATEDLG_NOREGVER_MSG 138
|
||||
#define IDD_PROPPAGE_NETWORK 139
|
||||
#define IDS_UPDATEDLG_NOREGVER_TITLE 139
|
||||
#define IDD_WAIT_DIALOG 140
|
||||
#define IDS_DIRECTXTAB_UPD_REC 140
|
||||
#define IDS_SPEEDTAB_CUSTOM 141
|
||||
#define IDS_D3LAUNCHDLG_SPD_MSG 142
|
||||
#define IDS_D3LAUNCHDLG_SPD_TITLE 143
|
||||
#define IDS_D3LAUNCHDLG_LAUNCH_ERRMSG 144
|
||||
#define IDS_D3LAUNCHDLG_CONTEST_MSG 145
|
||||
#define IDS_D3LAUNCHDLG_CONTEST_TITLE 146
|
||||
#define IDS_D3LAUNCHDLG_DXERR_SUCCESS 147
|
||||
#define IDS_D3LAUNCHDLG_DXERR_SUCCESS_RESTART 148
|
||||
#define IDS_D3LAUNCHDLG_DXERR_BADSOURCESIZE 149
|
||||
#define IDS_D3LAUNCHDLG_DXERR_BADSOURCETIME 150
|
||||
#define IDS_D3LAUNCHDLG_DXERR_BADWINDOWSVERSION 151
|
||||
#define IDS_D3LAUNCHDLG_DXERR_CANTFINDDIR 152
|
||||
#define IDS_D3LAUNCHDLG_DXERR_CANTFINDINF 153
|
||||
#define IDS_D3LAUNCHDLG_DXERR_INTERNAL 154
|
||||
#define IDS_D3LAUNCHDLG_DXERR_NOCOPY 155
|
||||
#define IDS_D3LAUNCHDLG_DXERR_INTERNAL 154
|
||||
#define IDS_D3LAUNCHDLG_DXERR_NOCOPY 155
|
||||
#define IDS_D3LAUNCHDLG_DXERR_NOTPREINSTALLEDONNT 156
|
||||
#define IDS_D3LAUNCHDLG_DXERR_OUTOFDISKSPACE 157
|
||||
#define IDS_D3LAUNCHDLG_DXERR_SOURCEFILENOTFOUND 158
|
||||
#define IDS_D3LAUNCHDLG_DXERR_UNKNOWNOS 159
|
||||
#define IDS_D3LAUNCHDLG_DXERR_USERHITCANCEL 160
|
||||
#define IDS_D3LAUNCHDLG_DXERR_TITLE 161
|
||||
#define IDD_PROPPAGE_KEYBOARD 162
|
||||
#define IDS_D3LAUNCHDLG_DXERR_TITLE 161
|
||||
#define IDD_PROPPAGE_KEYBOARD 162
|
||||
#define IDS_D3LAUNCHDLG_DSETUP_ERR_MSG1 162
|
||||
#define IDD_MESSAGE_WINDOW 163
|
||||
#define IDD_MESSAGE_WINDOW 163
|
||||
#define IDS_D3LAUNCHDLG_DSETUP_ERR_MSG2 163
|
||||
#define IDD_SITE_SELECTION_DIALOG 164
|
||||
#define IDD_SITE_SELECTION_DIALOG 164
|
||||
#define IDS_D3LAUNCHDLG_DSETUP_ERR_TITLE 164
|
||||
#define IDD_MOTD_DIALOG 165
|
||||
#define IDS_GLSETUP_ERROR 165
|
||||
#define IDD_PROPPAGE_DIRECTX 166
|
||||
#define IDS_LANG_ENGLISH 166
|
||||
#define IDB_PALETTE_BITMAP 167
|
||||
#define IDS_LANG_FRENCH 167
|
||||
#define IDS_LANG_GERMAN 168
|
||||
#define IDS_LANG_ITALIAN 169
|
||||
#define IDS_LANG_SPANISH 170
|
||||
#define IDS_D3LAUNCH_OEMV3_DLGTITLE 171
|
||||
#define IDS_D3LAUNCH_OEMA2_DLGTITLE 172
|
||||
#define IDS_D3LAUNCH_OEMKM_DLGTITLE 173
|
||||
#define IDS_D3LAUNCHDLG_UPDPRMT_MSG 174
|
||||
#define IDS_D3LAUNCHDLG_UPDPRMT_TITLE 175
|
||||
#define IDS_D3LAUNCH_OEM_DLGTITLE 176
|
||||
#define IDS_D3LAUNCH_DEMO2_DLGTITLE 177
|
||||
#define IDS_OPENGL_WARNING_MSG 178
|
||||
#define IDS_OPENGL_WARNING_TITLE 179
|
||||
#define IDS_NOTGLIDE_TITLE 180
|
||||
#define IDS_NOTGLIDE_MSG 181
|
||||
#define IDS_PROFANITY_MSG 182
|
||||
#define IDS_PROFANITY_TITLE 183
|
||||
#define IDS_GLSETUP_EXPIRED_MSG 184
|
||||
#define IDS_FINDFAST_MSG 185
|
||||
#define IDS_FINDFAST_TITLE 186
|
||||
#define IDS_OK 187
|
||||
#define IDS_CANCEL 188
|
||||
#define IDS_HELP 189
|
||||
#define IDD_MSG_DLG 205
|
||||
#define IDD_VIDEODETECT_DLG 206
|
||||
#define IDD_DRIVERS_DIALOG 215
|
||||
#define IDD_GLSETUP_DIALOG 216
|
||||
#define IDD_FINDFASTDLG 218
|
||||
#define IDC_BTN_QUIT 1001
|
||||
#define IDC_PROGRESS1 1001
|
||||
#define IDC_BTN_SETUP 1002
|
||||
#define IDC_LIST1 1002
|
||||
#define IDC_BTN_README 1003
|
||||
#define IDC_BTN_WEBPAGE 1004
|
||||
#define IDC_BTN_DETECT 1005
|
||||
#define IDC_BTN_CALIBRATE 1006
|
||||
#define IDC_JOYSTICK_LIST 1008
|
||||
#define IDC_FF_ENABLED 1009
|
||||
#define IDC_FF_HIT_EFFECT 1010
|
||||
#define IDC_VIDEOCARD_LIST 1011
|
||||
#define IDC_VIDEOCARD_DETECT 1012
|
||||
#define IDC_BTN_PLAY 1013
|
||||
#define IDC_AUDIO_LIST 1014
|
||||
#define IDC_BTN_AUDIO_DETECT 1015
|
||||
#define IDC_SPEED_LIST 1016
|
||||
#define IDC_BTN_UPDATE 1017
|
||||
#define IDC_BTN_SPEED_DETECT 1018
|
||||
#define IDC_USERMSG 1018
|
||||
#define IDC_CONNECT_TYPE_GROUP 1019
|
||||
#define IDC_CONNECT_SPEED_GROUP 1020
|
||||
#define IDC_BTN_LIGHT 1021
|
||||
#define IDC_CPU_TYPE 1024
|
||||
#define IDC_US_KEYBOARD 1024
|
||||
#define IDC_VRAM_SPEED 1025
|
||||
#define IDC_FRENCH_KEYBOARD 1025
|
||||
#define IDC_TOTAL_RAM 1026
|
||||
#define IDC_DX_VERSION 1026
|
||||
#define IDC_GERMAN_KEYBOARD 1026
|
||||
#define IDC_RAM_SPEED 1027
|
||||
#define IDC_GET_DX 1027
|
||||
#define IDC_WND_MSG_MAIN 1027
|
||||
#define IDC_CPU_SPEED 1028
|
||||
#define IDC_MSG1 1028
|
||||
#define IDC_WND_MSG_STATUS 1028
|
||||
#define IDC_DX_STATUS 1028
|
||||
#define IDC_3D_GRAPHICS_ACCELERATOR 1029
|
||||
#define IDC_MSG2 1029
|
||||
#define IDC_SITE_LIST 1029
|
||||
#define IDC_MSG3 1030
|
||||
#define IDC_MOTD_EDIT 1030
|
||||
#define IDC_YOUR_VERSION_EDIT 1032
|
||||
#define IDC_LATEST_VERSION_EDIT 1033
|
||||
#define IDC_MIXER_SOFTWARE 1034
|
||||
#define IDC_NONE 1035
|
||||
#define IDC_MIXER_DS8BIT 1035
|
||||
#define IDC_DIALUP 1036
|
||||
#define IDC_STATUSBAR 1036
|
||||
#define IDC_MIXER_DS16BIT 1036
|
||||
#define IDC_LAN 1037
|
||||
#define IDC_MIXER_DS3D 1037
|
||||
#define IDC_SLOW_CONNECTION 1038
|
||||
#define IDC_33K_CONNECTION 1038
|
||||
#define IDC_MIXER_AUREAL 1038 // Unused
|
||||
#define IDC_56K_CONNECTION 1039
|
||||
#define IDC_BTN_PXO 1039
|
||||
#define IDC_CABLE_CONNECTION 1040
|
||||
#define IDC_BTN_UNINSTALL 1040
|
||||
#define IDC_BTN_DIRECTX 1041
|
||||
#define IDC_NO_CONNECTION 1043
|
||||
#define IDC_28K_CONNECTION 1043
|
||||
#define IDC_ANIM_BUTTON 1043
|
||||
#define IDC_FAST_CONNECTION 1044
|
||||
#define IDC_BTN_CANCEL 1044
|
||||
#define IDC_SINGLE_ISDN_CONNECTION 1045
|
||||
#define IDC_PRIMARY_JOYSTICK_TEXT 1045
|
||||
#define IDC_SCANNING_TEXT 1046
|
||||
#define IDC_WAIT_TEXT 1047
|
||||
#define IDC_DIRECT3D_CHECK 1049
|
||||
#define IDC_GLIDE_CHECK 1050
|
||||
#define IDC_OPENGL_CHECK 1051
|
||||
#define IDC_COMMANDLINE_EDIT 1052
|
||||
#define IDC_LAUNCHER_SND_CHECK 1053
|
||||
#define IDC_CUSTOM1 1057
|
||||
#define IDC_LANGUAGE_COMBO 1058
|
||||
#define IDC_DIRECTX_BUTTON 1059
|
||||
#define IDC_GLSETUP_BUTTON 1060
|
||||
#define IDC_INSTALL_BUTTON 1063
|
||||
#define IDC_VISIT_BUTTON 1064
|
||||
#define IDC_INFO_STATIC 1065
|
||||
#define IDC_INFO2_STATIC 1066
|
||||
#define IDC_INFO3_STATIC 1067
|
||||
#define IDC_MIXER_EAX 1068
|
||||
#define IDC_CHFLIGHT_CHECK 1069
|
||||
#define IDC_MOUSEMAN_CHECK 1070
|
||||
#define IDC_FINDFASTCHKBOX 1071
|
||||
#define IDC_FINDFAST_CHECK 1072
|
||||
#define IDD_MOTD_DIALOG 165
|
||||
#define IDS_GLSETUP_ERROR 165
|
||||
#define IDD_PROPPAGE_DIRECTX 166
|
||||
#define IDS_LANG_ENGLISH 166
|
||||
#define IDB_PALETTE_BITMAP 167
|
||||
#define IDS_LANG_FRENCH 167
|
||||
#define IDS_LANG_GERMAN 168
|
||||
#define IDS_LANG_ITALIAN 169
|
||||
#define IDS_LANG_SPANISH 170
|
||||
#define IDS_D3LAUNCH_OEMV3_DLGTITLE 171
|
||||
#define IDS_D3LAUNCH_OEMA2_DLGTITLE 172
|
||||
#define IDS_D3LAUNCH_OEMKM_DLGTITLE 173
|
||||
#define IDS_D3LAUNCHDLG_UPDPRMT_MSG 174
|
||||
#define IDS_D3LAUNCHDLG_UPDPRMT_TITLE 175
|
||||
#define IDS_D3LAUNCH_OEM_DLGTITLE 176
|
||||
#define IDS_D3LAUNCH_DEMO2_DLGTITLE 177
|
||||
#define IDS_OPENGL_WARNING_MSG 178
|
||||
#define IDS_OPENGL_WARNING_TITLE 179
|
||||
#define IDS_NOTGLIDE_TITLE 180
|
||||
#define IDS_NOTGLIDE_MSG 181
|
||||
#define IDS_PROFANITY_MSG 182
|
||||
#define IDS_PROFANITY_TITLE 183
|
||||
#define IDS_GLSETUP_EXPIRED_MSG 184
|
||||
#define IDS_FINDFAST_MSG 185
|
||||
#define IDS_FINDFAST_TITLE 186
|
||||
#define IDS_OK 187
|
||||
#define IDS_CANCEL 188
|
||||
#define IDS_HELP 189
|
||||
#define IDD_MSG_DLG 205
|
||||
#define IDD_VIDEODETECT_DLG 206
|
||||
#define IDD_DRIVERS_DIALOG 215
|
||||
#define IDD_GLSETUP_DIALOG 216
|
||||
#define IDD_FINDFASTDLG 218
|
||||
#define IDC_BTN_QUIT 1001
|
||||
#define IDC_PROGRESS1 1001
|
||||
#define IDC_BTN_SETUP 1002
|
||||
#define IDC_LIST1 1002
|
||||
#define IDC_BTN_README 1003
|
||||
#define IDC_BTN_WEBPAGE 1004
|
||||
#define IDC_BTN_DETECT 1005
|
||||
#define IDC_BTN_CALIBRATE 1006
|
||||
#define IDC_JOYSTICK_LIST 1008
|
||||
#define IDC_FF_ENABLED 1009
|
||||
#define IDC_FF_HIT_EFFECT 1010
|
||||
#define IDC_VIDEOCARD_LIST 1011
|
||||
#define IDC_VIDEOCARD_DETECT 1012
|
||||
#define IDC_BTN_PLAY 1013
|
||||
#define IDC_AUDIO_LIST 1014
|
||||
#define IDC_BTN_AUDIO_DETECT 1015
|
||||
#define IDC_SPEED_LIST 1016
|
||||
#define IDC_BTN_UPDATE 1017
|
||||
#define IDC_BTN_SPEED_DETECT 1018
|
||||
#define IDC_USERMSG 1018
|
||||
#define IDC_CONNECT_TYPE_GROUP 1019
|
||||
#define IDC_CONNECT_SPEED_GROUP 1020
|
||||
#define IDC_BTN_LIGHT 1021
|
||||
#define IDC_CPU_TYPE 1024
|
||||
#define IDC_US_KEYBOARD 1024
|
||||
#define IDC_VRAM_SPEED 1025
|
||||
#define IDC_FRENCH_KEYBOARD 1025
|
||||
#define IDC_TOTAL_RAM 1026
|
||||
#define IDC_DX_VERSION 1026
|
||||
#define IDC_GERMAN_KEYBOARD 1026
|
||||
#define IDC_RAM_SPEED 1027
|
||||
#define IDC_GET_DX 1027
|
||||
#define IDC_WND_MSG_MAIN 1027
|
||||
#define IDC_CPU_SPEED 1028
|
||||
#define IDC_MSG1 1028
|
||||
#define IDC_WND_MSG_STATUS 1028
|
||||
#define IDC_DX_STATUS 1028
|
||||
#define IDC_3D_GRAPHICS_ACCELERATOR 1029
|
||||
#define IDC_MSG2 1029
|
||||
#define IDC_SITE_LIST 1029
|
||||
#define IDC_MSG3 1030
|
||||
#define IDC_MOTD_EDIT 1030
|
||||
#define IDC_YOUR_VERSION_EDIT 1032
|
||||
#define IDC_LATEST_VERSION_EDIT 1033
|
||||
#define IDC_MIXER_SOFTWARE 1034
|
||||
#define IDC_NONE 1035
|
||||
#define IDC_MIXER_DS8BIT 1035
|
||||
#define IDC_DIALUP 1036
|
||||
#define IDC_STATUSBAR 1036
|
||||
#define IDC_MIXER_DS16BIT 1036
|
||||
#define IDC_LAN 1037
|
||||
#define IDC_MIXER_DS3D 1037
|
||||
#define IDC_SLOW_CONNECTION 1038
|
||||
#define IDC_33K_CONNECTION 1038
|
||||
#define IDC_MIXER_AUREAL 1038 // Unused
|
||||
#define IDC_56K_CONNECTION 1039
|
||||
#define IDC_BTN_PXO 1039
|
||||
#define IDC_CABLE_CONNECTION 1040
|
||||
#define IDC_BTN_UNINSTALL 1040
|
||||
#define IDC_BTN_DIRECTX 1041
|
||||
#define IDC_NO_CONNECTION 1043
|
||||
#define IDC_28K_CONNECTION 1043
|
||||
#define IDC_ANIM_BUTTON 1043
|
||||
#define IDC_FAST_CONNECTION 1044
|
||||
#define IDC_BTN_CANCEL 1044
|
||||
#define IDC_SINGLE_ISDN_CONNECTION 1045
|
||||
#define IDC_PRIMARY_JOYSTICK_TEXT 1045
|
||||
#define IDC_SCANNING_TEXT 1046
|
||||
#define IDC_WAIT_TEXT 1047
|
||||
#define IDC_DIRECT3D_CHECK 1049
|
||||
#define IDC_GLIDE_CHECK 1050
|
||||
#define IDC_OPENGL_CHECK 1051
|
||||
#define IDC_COMMANDLINE_EDIT 1052
|
||||
#define IDC_LAUNCHER_SND_CHECK 1053
|
||||
#define IDC_CUSTOM1 1057
|
||||
#define IDC_LANGUAGE_COMBO 1058
|
||||
#define IDC_DIRECTX_BUTTON 1059
|
||||
#define IDC_GLSETUP_BUTTON 1060
|
||||
#define IDC_INSTALL_BUTTON 1063
|
||||
#define IDC_VISIT_BUTTON 1064
|
||||
#define IDC_INFO_STATIC 1065
|
||||
#define IDC_INFO2_STATIC 1066
|
||||
#define IDC_INFO3_STATIC 1067
|
||||
#define IDC_MIXER_EAX 1068
|
||||
#define IDC_CHFLIGHT_CHECK 1069
|
||||
#define IDC_MOUSEMAN_CHECK 1070
|
||||
#define IDC_FINDFASTCHKBOX 1071
|
||||
#define IDC_FINDFAST_CHECK 1072
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 219
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1073
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#define _APS_NEXT_RESOURCE_VALUE 219
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1073
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
#ifndef ARGS_H
|
||||
#define ARGS_H
|
||||
|
||||
#define MAX_ARGS 15
|
||||
#define MAX_CHARS_PER_ARG 100
|
||||
#define MAX_ARGS 15
|
||||
#define MAX_CHARS_PER_ARG 100
|
||||
|
||||
extern char GameArgs[MAX_ARGS][MAX_CHARS_PER_ARG];
|
||||
|
||||
// Gathers all arguments
|
||||
void GatherArgs (const char *str);
|
||||
void GatherArgs(const char *str);
|
||||
|
||||
// Returns index of argument sought, or 0 if not found
|
||||
int FindArg (const char *which);
|
||||
int FindArg(const char *which);
|
||||
#endif
|
||||
|
||||
@@ -53,102 +53,88 @@
|
||||
|
||||
// Font File stuff
|
||||
|
||||
typedef FILE* FONTFILE;
|
||||
typedef FILE *FONTFILE;
|
||||
|
||||
#define BITS_TO_BYTES(x) (((x)+7)>>3)
|
||||
#define BITS_TO_BYTES(x) (((x) + 7) >> 3)
|
||||
|
||||
inline int WRITE_FONT_INT(FONTFILE ffile, int i) {
|
||||
return fwrite(&i, sizeof(i), 1, (FILE *)ffile);
|
||||
}
|
||||
inline int WRITE_FONT_INT(FONTFILE ffile, int i) { return fwrite(&i, sizeof(i), 1, (FILE *)ffile); }
|
||||
|
||||
inline int WRITE_FONT_SHORT(FONTFILE ffile, int16_t s) {
|
||||
return fwrite(&s, sizeof(s), 1, (FILE *)ffile);
|
||||
}
|
||||
inline int WRITE_FONT_SHORT(FONTFILE ffile, int16_t s) { return fwrite(&s, sizeof(s), 1, (FILE *)ffile); }
|
||||
|
||||
inline int WRITE_FONT_BYTE(FONTFILE ffile, uint8_t c) {
|
||||
return fwrite(&c, sizeof(c), 1, (FILE *)ffile);
|
||||
}
|
||||
inline int WRITE_FONT_BYTE(FONTFILE ffile, uint8_t c) { return fwrite(&c, sizeof(c), 1, (FILE *)ffile); }
|
||||
|
||||
inline int WRITE_FONT_DATA(FONTFILE ffile, void *buf, int size, int nelem)
|
||||
{
|
||||
int i;
|
||||
i = (int)fwrite(buf, size, nelem, (FILE *)ffile);
|
||||
inline int WRITE_FONT_DATA(FONTFILE ffile, void *buf, int size, int nelem) {
|
||||
int i;
|
||||
i = (int)fwrite(buf, size, nelem, (FILE *)ffile);
|
||||
|
||||
ASSERT(i == nelem);
|
||||
ASSERT(i == nelem);
|
||||
|
||||
return i;
|
||||
return i;
|
||||
}
|
||||
|
||||
inline FONTFILE OPEN_FONT(char *filename) {
|
||||
FONTFILE fp;
|
||||
FONTFILE fp;
|
||||
|
||||
fp = (FONTFILE)fopen(filename, "wb");
|
||||
if (!fp) return NULL;
|
||||
fp = (FONTFILE)fopen(filename, "wb");
|
||||
if (!fp)
|
||||
return NULL;
|
||||
|
||||
return fp;
|
||||
return fp;
|
||||
}
|
||||
|
||||
inline void CLOSE_FONT(FONTFILE ffile) {
|
||||
fclose((FILE *)ffile);
|
||||
}
|
||||
inline void CLOSE_FONT(FONTFILE ffile) { fclose((FILE *)ffile); }
|
||||
|
||||
|
||||
void message_box(const char *fmt, ...)
|
||||
{
|
||||
#define FIXED_MSGBOX_WIDTH (512)
|
||||
void message_box(const char *fmt, ...) {
|
||||
#define FIXED_MSGBOX_WIDTH (512)
|
||||
#define FIXED_MSGBOX_HEIGHT (128)
|
||||
|
||||
std::va_list arglist;
|
||||
char buf[512];
|
||||
int len;
|
||||
std::va_list arglist;
|
||||
char buf[512];
|
||||
int len;
|
||||
|
||||
va_start(arglist,fmt);
|
||||
len = std::vsnprintf(buf,512,fmt,arglist);
|
||||
va_end(arglist);
|
||||
if (len < 0) return;
|
||||
va_start(arglist, fmt);
|
||||
len = std::vsnprintf(buf, 512, fmt, arglist);
|
||||
va_end(arglist);
|
||||
if (len < 0)
|
||||
return;
|
||||
|
||||
while(1)
|
||||
{
|
||||
int key;
|
||||
int l = (FIXED_SCREEN_WIDTH-FIXED_MSGBOX_WIDTH)/2;
|
||||
int t = (FIXED_SCREEN_HEIGHT-FIXED_MSGBOX_HEIGHT)/2;
|
||||
int r = l+FIXED_MSGBOX_WIDTH;
|
||||
int b = t+FIXED_MSGBOX_HEIGHT;
|
||||
while (1) {
|
||||
int key;
|
||||
int l = (FIXED_SCREEN_WIDTH - FIXED_MSGBOX_WIDTH) / 2;
|
||||
int t = (FIXED_SCREEN_HEIGHT - FIXED_MSGBOX_HEIGHT) / 2;
|
||||
int r = l + FIXED_MSGBOX_WIDTH;
|
||||
int b = t + FIXED_MSGBOX_HEIGHT;
|
||||
|
||||
FontDoIO();
|
||||
key = ddio_KeyInKey();
|
||||
if (key == KEY_ENTER || key == KEY_ESC) {
|
||||
break;
|
||||
}
|
||||
FontDoIO();
|
||||
key = ddio_KeyInKey();
|
||||
if (key == KEY_ENTER || key == KEY_ESC) {
|
||||
break;
|
||||
}
|
||||
|
||||
rend_StartFrame(0,0,FIXED_SCREEN_WIDTH,FIXED_SCREEN_HEIGHT,0);
|
||||
grtext_SetParameters(0,0,FIXED_SCREEN_WIDTH,FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetFont(System_font_handle);
|
||||
grtext_SetColor(GR_WHITE);
|
||||
rend_StartFrame(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT, 0);
|
||||
grtext_SetParameters(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetFont(System_font_handle);
|
||||
grtext_SetColor(GR_WHITE);
|
||||
|
||||
rend_ClearScreen(GR_BLACK);
|
||||
rend_SetFlatColor(GR_WHITE);
|
||||
rend_DrawLine(l,t,r,t);
|
||||
rend_DrawLine(r,t,r,b);
|
||||
rend_DrawLine(l,b,r,b);
|
||||
rend_DrawLine(l,t,l,b);
|
||||
rend_ClearScreen(GR_BLACK);
|
||||
rend_SetFlatColor(GR_WHITE);
|
||||
rend_DrawLine(l, t, r, t);
|
||||
rend_DrawLine(r, t, r, b);
|
||||
rend_DrawLine(l, b, r, b);
|
||||
rend_DrawLine(l, t, l, b);
|
||||
|
||||
grtext_CenteredPrintf(0,t+30, buf);
|
||||
grtext_CenteredPrintf(0,b-30, "Press ENTER or ESC");
|
||||
grtext_Flush();
|
||||
rend_EndFrame();
|
||||
rend_Flip();
|
||||
}
|
||||
grtext_CenteredPrintf(0, t + 30, buf);
|
||||
grtext_CenteredPrintf(0, b - 30, "Press ENTER or ESC");
|
||||
grtext_Flush();
|
||||
rend_EndFrame();
|
||||
rend_Flip();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
#define COLOR_FONT 1
|
||||
#define MONOCHROME_FONT 2
|
||||
#define MAX_FONT_CHARS 256
|
||||
|
||||
|
||||
#define COLOR_FONT 1
|
||||
#define MONOCHROME_FONT 2
|
||||
#define MAX_FONT_CHARS 256
|
||||
|
||||
static bool m_FontProp;
|
||||
static uint8_t m_CharWidths[MAX_FONT_CHARS];
|
||||
@@ -160,207 +146,194 @@ static int m_FontType;
|
||||
static int m_FontBmW, m_FontBmH;
|
||||
static uint16_t m_FgColor, m_BgColor, m_BoxColor;
|
||||
|
||||
#define PIX(_x,_y) m_FontBmData[(_x) + (_y) * m_FontBmW]
|
||||
#define PIX(_x, _y) m_FontBmData[(_x) + (_y) * m_FontBmW]
|
||||
|
||||
int read_font_char(int cur_char, int &bmx, int &bmy) {
|
||||
int w, h, x, y;
|
||||
bool box_edge = false;
|
||||
|
||||
int read_font_char(int cur_char, int& bmx, int& bmy)
|
||||
{
|
||||
int w,h,x,y;
|
||||
bool box_edge = false;
|
||||
mprintf(0, " %d-(%d,%d)", cur_char, bmx, bmy);
|
||||
|
||||
mprintf(0," %d-(%d,%d)",cur_char,bmx,bmy);
|
||||
while (PIX(bmx + 1, bmy + 1) == m_BoxColor)
|
||||
bmx++; // deal with double-thick vertical lines
|
||||
|
||||
while (PIX(bmx+1,bmy+1) == m_BoxColor)
|
||||
bmx++; //deal with double-thick vertical lines
|
||||
for (w = 0; PIX(bmx + 1 + w, bmy + 1) != m_BoxColor; w++) {
|
||||
if (PIX(bmx + 1 + w, bmy) != m_BoxColor) {
|
||||
if (box_edge) {
|
||||
message_box("Read probable premature eol at (%d,%d).\n", bmx + 1 + w, bmy);
|
||||
w--;
|
||||
return 2;
|
||||
} else {
|
||||
message_box("Suspected error at pixel coordindates %d,%d (char %d)", bmx + 1 + w, bmy, cur_char);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
box_edge = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (w=0;PIX(bmx+1+w,bmy+1)!=m_BoxColor;w++)
|
||||
{
|
||||
if (PIX(bmx+1+w,bmy)!=m_BoxColor) {
|
||||
if (box_edge) {
|
||||
message_box("Read probable premature eol at (%d,%d).\n", bmx+1+w, bmy);
|
||||
w--;
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
message_box("Suspected error at pixel coordindates %d,%d (char %d)",bmx+1+w,bmy, cur_char);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
box_edge = true;
|
||||
}
|
||||
}
|
||||
box_edge = false;
|
||||
|
||||
box_edge = false;
|
||||
for (h = 0; PIX(bmx + 1, bmy + 1 + h) != m_BoxColor; h++) {
|
||||
if (PIX(bmx, bmy + 1 + h) != m_BoxColor) {
|
||||
if (box_edge) {
|
||||
message_box("Read probable premature end of row at (%d,%d) (pix=%04x,box=%04x).\n", bmx, bmy + 1 + h,
|
||||
PIX(bmx, bmy + 1 + h), m_BoxColor);
|
||||
h--;
|
||||
return 2;
|
||||
} else {
|
||||
message_box("Suspected error at pixel coordindates %d,%d (char %d)", bmx, bmy + 1 + h, cur_char);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
box_edge = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (h=0;PIX(bmx+1,bmy+1+h)!=m_BoxColor;h++)
|
||||
{
|
||||
if (PIX(bmx,bmy+1+h)!=m_BoxColor) {
|
||||
if (box_edge) {
|
||||
message_box("Read probable premature end of row at (%d,%d) (pix=%04x,box=%04x).\n", bmx, bmy+1+h, PIX(bmx,bmy+1+h), m_BoxColor);
|
||||
h--;
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
message_box("Suspected error at pixel coordindates %d,%d (char %d)",bmx,bmy+1+h, cur_char);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
box_edge = true;
|
||||
}
|
||||
}
|
||||
if (w == 0 || h == 0) {
|
||||
message_box("Character %d has width of %d and height of %d", cur_char, w, h);
|
||||
return 0;
|
||||
}
|
||||
if (w > 255 || w < 0) {
|
||||
message_box("Character %d has bad width %d (maximum=255)", cur_char, w);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (w==0 || h==0) {
|
||||
message_box("Character %d has width of %d and height of %d",cur_char,w,h);
|
||||
return 0;
|
||||
}
|
||||
if (w > 255 || w< 0) {
|
||||
message_box("Character %d has bad width %d (maximum=255)", cur_char, w);
|
||||
return 0;
|
||||
}
|
||||
m_CharWidths[cur_char] = w;
|
||||
|
||||
m_CharWidths[cur_char] = w;
|
||||
if (m_CharMaxWidth != 0 && w != m_CharMaxWidth)
|
||||
m_FontProp = true;
|
||||
|
||||
if (m_CharMaxWidth !=0 && w != m_CharMaxWidth)
|
||||
m_FontProp = true;
|
||||
if (w > m_CharMaxWidth)
|
||||
m_CharMaxWidth = w;
|
||||
|
||||
if (w > m_CharMaxWidth) m_CharMaxWidth = w;
|
||||
if (m_CharHeight == 0)
|
||||
m_CharHeight = h;
|
||||
else if (m_CharHeight != h) {
|
||||
message_box("Char %d is wrong height (height = %d, correct height = %d)", cur_char, h, m_CharHeight);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_CharHeight == 0)
|
||||
m_CharHeight = h;
|
||||
else if (m_CharHeight != h) {
|
||||
message_box("Char %d is wrong height (height = %d, correct height = %d)",cur_char,h,m_CharHeight);
|
||||
return 0;
|
||||
}
|
||||
for (y = 0; y < h; y++)
|
||||
for (x = 0; x < w; x++) {
|
||||
uint16_t c;
|
||||
|
||||
for (y=0;y<h;y++)
|
||||
for (x=0;x<w;x++)
|
||||
{
|
||||
uint16_t c;
|
||||
if ((c = PIX(bmx + 1 + x, bmy + 1 + y)) == m_BgColor)
|
||||
c = 0; // OLD COMMENT-must go back 565 pure green (old transparent)
|
||||
else if (!(m_FgColor & 0xf000)) // 4444 check for alpha
|
||||
m_FgColor = c;
|
||||
else if (m_FgColor != c) { // OLD_COMMENT-c here is 1555 !! remember this.
|
||||
m_FontType = COLOR_FONT; // mprintf(0, "%d,%d\n", bmx+1+x, bmy+1+y);
|
||||
}
|
||||
|
||||
if ((c=PIX(bmx+1+x,bmy+1+y)) == m_BgColor)
|
||||
c = 0; // OLD COMMENT-must go back 565 pure green (old transparent)
|
||||
else if (! (m_FgColor & 0xf000)) // 4444 check for alpha
|
||||
m_FgColor = c;
|
||||
else if (m_FgColor != c) { // OLD_COMMENT-c here is 1555 !! remember this.
|
||||
m_FontType = COLOR_FONT; // mprintf(0, "%d,%d\n", bmx+1+x, bmy+1+y);
|
||||
}
|
||||
// if (c != 0)
|
||||
// *m_DataPtr++ = c; // OLD
|
||||
//COMMENT-here 555 pure green will turn into 565 pure green transparent. else
|
||||
*m_DataPtr++ = c;
|
||||
|
||||
// if (c != 0)
|
||||
// *m_DataPtr++ = c; // OLD COMMENT-here 555 pure green will turn into 565 pure green transparent.
|
||||
// else
|
||||
*m_DataPtr++ = c;
|
||||
ASSERT(m_DataPtr < m_DataBuffer + (1024 * 256));
|
||||
}
|
||||
|
||||
ASSERT(m_DataPtr < m_DataBuffer+(1024*256));
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read_font_line(int cur_char, int &bmx, int &bmy) {
|
||||
while (bmx < m_FontBmW && PIX(bmx + 1, bmy) == m_BoxColor) {
|
||||
int res;
|
||||
res = read_font_char(cur_char, bmx, bmy);
|
||||
if (res == 0)
|
||||
return -1;
|
||||
else if (res == 1) {
|
||||
bmx += m_CharWidths[cur_char] + 1;
|
||||
cur_char++;
|
||||
} else if (res == 2) {
|
||||
cur_char = -1;
|
||||
break;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
int read_font_line(int cur_char, int& bmx, int& bmy)
|
||||
{
|
||||
while (bmx < m_FontBmW && PIX(bmx+1,bmy) == m_BoxColor)
|
||||
{
|
||||
int res;
|
||||
res = read_font_char(cur_char, bmx, bmy);
|
||||
if (res == 0) return -1;
|
||||
else if (res == 1) {
|
||||
bmx += m_CharWidths[cur_char]+1;
|
||||
cur_char++;
|
||||
}
|
||||
else if (res == 2) {
|
||||
cur_char = -1;
|
||||
break;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
return cur_char;
|
||||
return cur_char;
|
||||
}
|
||||
|
||||
bool extract_font(int bm_handle, tFontFileInfo *ft) {
|
||||
int bmx, bmy;
|
||||
int cur_char;
|
||||
|
||||
bool extract_font(int bm_handle, tFontFileInfo *ft)
|
||||
{
|
||||
int bmx, bmy;
|
||||
int cur_char;
|
||||
// grab font template bitmap data from the bitmap library and retrieve characters
|
||||
// store relevent information in file record.
|
||||
m_FontBmData = bm_data(bm_handle, 0);
|
||||
m_FontBmW = bm_w(bm_handle, 0);
|
||||
m_FontBmH = bm_h(bm_handle, 0);
|
||||
m_CharMaxWidth = m_CharHeight = 0;
|
||||
m_FontProp = false;
|
||||
m_FontType = MONOCHROME_FONT;
|
||||
m_FgColor = NEW_TRANSPARENT_COLOR;
|
||||
|
||||
// grab font template bitmap data from the bitmap library and retrieve characters
|
||||
// store relevent information in file record.
|
||||
m_FontBmData = bm_data(bm_handle, 0);
|
||||
m_FontBmW = bm_w(bm_handle,0);
|
||||
m_FontBmH = bm_h(bm_handle, 0);
|
||||
m_CharMaxWidth = m_CharHeight = 0;
|
||||
m_FontProp = false;
|
||||
m_FontType = MONOCHROME_FONT;
|
||||
m_FgColor = NEW_TRANSPARENT_COLOR;
|
||||
m_DataBuffer = new uint16_t[1024 * MAX_FONT_CHARS];
|
||||
m_DataPtr = m_DataBuffer;
|
||||
|
||||
m_DataBuffer = new uint16_t[1024*MAX_FONT_CHARS];
|
||||
m_DataPtr = m_DataBuffer;
|
||||
// assume upper left pixel is background color, and first-found other
|
||||
// color is box color
|
||||
m_BgColor = PIX(0, 0);
|
||||
mprintf(0, "m_BgColor=%04x\n", m_BgColor);
|
||||
|
||||
// assume upper left pixel is background color, and first-found other
|
||||
// color is box color
|
||||
m_BgColor = PIX(0,0);
|
||||
mprintf(0, "m_BgColor=%04x\n", m_BgColor);
|
||||
for (bmy = 0; bmy < m_FontBmH; bmy++) {
|
||||
for (bmx = 0; bmx < m_FontBmW && PIX(bmx, bmy) == m_BgColor; bmx++)
|
||||
;
|
||||
if (PIX(bmx, bmy) != m_BgColor)
|
||||
break;
|
||||
}
|
||||
|
||||
for (bmy = 0;bmy < m_FontBmH; bmy++)
|
||||
{
|
||||
for (bmx = 0;bmx < m_FontBmW && PIX(bmx,bmy)==m_BgColor; bmx++) ;
|
||||
if (PIX(bmx,bmy)!= m_BgColor) break;
|
||||
}
|
||||
m_BoxColor = PIX(bmx, bmy);
|
||||
mprintf(0, "m_BoxColor=%04x\n", m_BoxColor);
|
||||
|
||||
m_BoxColor = PIX(bmx,bmy);
|
||||
mprintf(0, "m_BoxColor=%04x\n", m_BoxColor);
|
||||
// Get all data from current line.
|
||||
mprintf(0, "Parsing font...");
|
||||
mprintf(0, " read_characters: ");
|
||||
|
||||
// Get all data from current line.
|
||||
mprintf(0, "Parsing font...");
|
||||
mprintf(0," read_characters: ");
|
||||
for (cur_char = 0; bmy < m_FontBmH && cur_char < MAX_FONT_CHARS;) {
|
||||
cur_char = read_font_line(cur_char, bmx, bmy);
|
||||
if (cur_char == -1) {
|
||||
delete[] m_DataBuffer;
|
||||
m_DataBuffer = NULL;
|
||||
return false;
|
||||
}
|
||||
bmy += m_CharHeight + 1;
|
||||
|
||||
for (cur_char=0;bmy < m_FontBmH && cur_char<MAX_FONT_CHARS;)
|
||||
{
|
||||
cur_char = read_font_line(cur_char, bmx, bmy);
|
||||
if (cur_char == -1) {
|
||||
delete[] m_DataBuffer;
|
||||
m_DataBuffer = NULL;
|
||||
return false;
|
||||
}
|
||||
bmy += m_CharHeight+1;
|
||||
// search for start of next box
|
||||
for (; bmy < m_FontBmH; bmy++) {
|
||||
for (bmx = 0; bmx < m_FontBmW && PIX(bmx, bmy) != m_BoxColor; bmx++)
|
||||
;
|
||||
if ((PIX(bmx, bmy) == m_BoxColor) && (PIX(bmx, bmy + 1) == m_BoxColor))
|
||||
break;
|
||||
}
|
||||
|
||||
//search for start of next box
|
||||
for (;bmy < m_FontBmH;bmy++) {
|
||||
for (bmx = 0;bmx<m_FontBmW && PIX(bmx,bmy)!=m_BoxColor;bmx++) ;
|
||||
if ((PIX(bmx,bmy)==m_BoxColor) && (PIX(bmx,bmy+1) == m_BoxColor))
|
||||
break;
|
||||
}
|
||||
if (bmy == m_FontBmH)
|
||||
break;
|
||||
// if (PIX(bmx,bmy+1) != m_BoxColor)
|
||||
// break;
|
||||
}
|
||||
mprintf(0, "\nDone!\n");
|
||||
|
||||
if (bmy == m_FontBmH)
|
||||
break;
|
||||
// if (PIX(bmx,bmy+1) != m_BoxColor)
|
||||
// break;
|
||||
}
|
||||
mprintf(0, "\nDone!\n");
|
||||
// now fill in font information & store it into our file record. this information
|
||||
// can be used to save the font
|
||||
ft->width = m_CharMaxWidth;
|
||||
ft->height = m_CharHeight;
|
||||
ft->flags = (m_FontProp ? FT_PROPORTIONAL : 0) + ((m_FontType == COLOR_FONT) ? FT_COLOR : 0);
|
||||
ft->baseline = m_CharHeight;
|
||||
ft->min_ascii = 0;
|
||||
ft->max_ascii = cur_char - 1;
|
||||
ft->raw_data = (uint8_t *)m_DataBuffer;
|
||||
ft->char_data = NULL;
|
||||
ft->char_widths = m_CharWidths;
|
||||
ft->kern_data = NULL;
|
||||
|
||||
// now fill in font information & store it into our file record. this information
|
||||
// can be used to save the font
|
||||
ft->width = m_CharMaxWidth;
|
||||
ft->height = m_CharHeight;
|
||||
ft->flags = (m_FontProp?FT_PROPORTIONAL:0) + ((m_FontType==COLOR_FONT)?FT_COLOR:0);
|
||||
ft->baseline = m_CharHeight;
|
||||
ft->min_ascii = 0;
|
||||
ft->max_ascii = cur_char-1;
|
||||
ft->raw_data = (uint8_t *)m_DataBuffer;
|
||||
ft->char_data = NULL;
|
||||
ft->char_widths = m_CharWidths;
|
||||
ft->kern_data= NULL;
|
||||
ft->flags |= FT_FMT4444;
|
||||
|
||||
ft->flags |= FT_FMT4444;
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Font file format.
|
||||
//
|
||||
@@ -375,250 +348,240 @@ bool extract_font(int bm_handle, tFontFileInfo *ft)
|
||||
// no kerning.
|
||||
// store font data.
|
||||
|
||||
void FontCreate(const char *fnt_file_source, const char *fnt_file_dest, int min_ascii) {
|
||||
// import font
|
||||
FONTFILE ffile;
|
||||
tFontFileInfo ft;
|
||||
int bm_handle;
|
||||
char fontname[32];
|
||||
|
||||
void FontCreate(const char *fnt_file_source, const char *fnt_file_dest, int min_ascii)
|
||||
{
|
||||
// import font
|
||||
FONTFILE ffile;
|
||||
tFontFileInfo ft;
|
||||
int bm_handle;
|
||||
char fontname[32];
|
||||
strcpy(fontname, "d3font");
|
||||
|
||||
strcpy(fontname, "d3font");
|
||||
bm_handle = bm_AllocLoadFileBitmap(fnt_file_source, 0, BITMAP_FORMAT_4444);
|
||||
if (bm_handle < 0) {
|
||||
Error("Couldn't open %s for extraction.", fnt_file_source);
|
||||
}
|
||||
|
||||
bm_handle = bm_AllocLoadFileBitmap(fnt_file_source, 0, BITMAP_FORMAT_4444);
|
||||
if (bm_handle < 0) {
|
||||
Error("Couldn't open %s for extraction.", fnt_file_source);
|
||||
}
|
||||
// Get MinAscii and other needed info before extracting font.
|
||||
if (!extract_font(bm_handle, &ft)) {
|
||||
Error("Unable to generate font from %s.", fnt_file_source);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get MinAscii and other needed info before extracting font.
|
||||
if (!extract_font(bm_handle, &ft)) {
|
||||
Error("Unable to generate font from %s.", fnt_file_source);
|
||||
return;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Adjust font record for file write.
|
||||
int num_char;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Adjust font record for file write.
|
||||
int num_char;
|
||||
ft.kern_data = NULL;
|
||||
ft.min_ascii = min_ascii;
|
||||
ft.max_ascii = ft.min_ascii + ft.max_ascii;
|
||||
|
||||
ft.kern_data= NULL;
|
||||
ft.min_ascii = min_ascii;
|
||||
ft.max_ascii = ft.min_ascii + ft.max_ascii;
|
||||
// add newstyle variables here.
|
||||
ft.flags |= FT_FFI2;
|
||||
ft.ffi2.tracking = 0;
|
||||
|
||||
// add newstyle variables here.
|
||||
ft.flags |= FT_FFI2;
|
||||
ft.ffi2.tracking = 0;
|
||||
// write to file
|
||||
mprintf(0, "Saving font data...");
|
||||
ffile = OPEN_FONT((char *)fnt_file_dest);
|
||||
if (!ffile) {
|
||||
Error("Unable to save font %s.", fnt_file_dest);
|
||||
}
|
||||
|
||||
// write to file
|
||||
mprintf(0, "Saving font data...");
|
||||
ffile = OPEN_FONT((char *)fnt_file_dest);
|
||||
if (!ffile) {
|
||||
Error("Unable to save font %s.", fnt_file_dest);
|
||||
}
|
||||
// Write file id.
|
||||
WRITE_FONT_INT(ffile, 0xfeedbaba);
|
||||
|
||||
// Write file id.
|
||||
WRITE_FONT_INT(ffile, 0xfeedbaba);
|
||||
// Write Header
|
||||
ft.baseline = 0;
|
||||
|
||||
// Write Header
|
||||
ft.baseline = 0;
|
||||
WRITE_FONT_SHORT(ffile, ft.width);
|
||||
WRITE_FONT_SHORT(ffile, ft.height);
|
||||
WRITE_FONT_SHORT(ffile, ft.flags);
|
||||
WRITE_FONT_SHORT(ffile, ft.baseline);
|
||||
WRITE_FONT_BYTE(ffile, ft.min_ascii);
|
||||
WRITE_FONT_BYTE(ffile, ft.max_ascii);
|
||||
WRITE_FONT_DATA(ffile, fontname, 32, 1);
|
||||
|
||||
WRITE_FONT_SHORT(ffile, ft.width);
|
||||
WRITE_FONT_SHORT(ffile, ft.height);
|
||||
WRITE_FONT_SHORT(ffile, ft.flags);
|
||||
WRITE_FONT_SHORT(ffile, ft.baseline);
|
||||
WRITE_FONT_BYTE(ffile, ft.min_ascii);
|
||||
WRITE_FONT_BYTE(ffile, ft.max_ascii);
|
||||
WRITE_FONT_DATA(ffile, fontname, 32, 1);
|
||||
WRITE_FONT_SHORT(ffile, (int16_t)ft.ffi2.tracking);
|
||||
WRITE_FONT_DATA(ffile, ft.ffi2.reserved, sizeof(ft.ffi2.reserved), 1);
|
||||
|
||||
WRITE_FONT_SHORT(ffile, (int16_t)ft.ffi2.tracking);
|
||||
WRITE_FONT_DATA(ffile, ft.ffi2.reserved, sizeof(ft.ffi2.reserved),1);
|
||||
num_char = (int)(ft.max_ascii - ft.min_ascii + 1);
|
||||
|
||||
num_char = (int)(ft.max_ascii - ft.min_ascii + 1);
|
||||
// Write widths now if necessary.(FT_PROPORTIONAL)
|
||||
if (ft.flags & FT_PROPORTIONAL) {
|
||||
for (int i = 0; i < num_char; i++)
|
||||
WRITE_FONT_SHORT(ffile, ft.char_widths[i]);
|
||||
}
|
||||
|
||||
// Write widths now if necessary.(FT_PROPORTIONAL)
|
||||
if (ft.flags & FT_PROPORTIONAL) {
|
||||
for (int i = 0; i < num_char; i++)
|
||||
WRITE_FONT_SHORT(ffile, ft.char_widths[i]);
|
||||
}
|
||||
if (ft.flags & FT_COLOR) {
|
||||
WRITE_FONT_INT(ffile, (int)(m_DataPtr - m_DataBuffer) * sizeof(uint16_t));
|
||||
WRITE_FONT_DATA(ffile, (uint8_t *)m_DataBuffer, (m_DataPtr - m_DataBuffer) * sizeof(uint16_t), 1);
|
||||
} else {
|
||||
// bitpack for mono font storage:: 16bpp -> 8 bits/1 byte
|
||||
int i, x, y, w, cnt = 0;
|
||||
uint16_t *p = m_DataBuffer;
|
||||
uint8_t *bits;
|
||||
|
||||
if (ft.flags & FT_COLOR) {
|
||||
WRITE_FONT_INT(ffile, (int)(m_DataPtr-m_DataBuffer)*sizeof(uint16_t));
|
||||
WRITE_FONT_DATA(ffile, (uint8_t *)m_DataBuffer, (m_DataPtr-m_DataBuffer)*sizeof(uint16_t), 1);
|
||||
}
|
||||
else {
|
||||
// bitpack for mono font storage:: 16bpp -> 8 bits/1 byte
|
||||
int i,x,y,w,cnt=0;
|
||||
uint16_t *p = m_DataBuffer;
|
||||
uint8_t *bits;
|
||||
bits = (uint8_t *)mem_malloc(256 * MAX_FONT_CHARS);
|
||||
|
||||
bits = (uint8_t *)mem_malloc(256 * MAX_FONT_CHARS);
|
||||
for (i = 0; i < num_char; i++) {
|
||||
for (y = 0; y < ft.height; y++) {
|
||||
uint8_t mask, datum;
|
||||
|
||||
for (i = 0; i < num_char; i++)
|
||||
{
|
||||
for (y = 0; y < ft.height; y++)
|
||||
{
|
||||
uint8_t mask, datum;
|
||||
w = (ft.flags & FT_PROPORTIONAL) ? ft.char_widths[i] : ft.width;
|
||||
|
||||
w = (ft.flags & FT_PROPORTIONAL) ? ft.char_widths[i] : ft.width;
|
||||
ASSERT(w <= 48); // Max width size shall be 32 pixels
|
||||
|
||||
ASSERT(w <= 48); // Max width size shall be 32 pixels
|
||||
mask = 0x80;
|
||||
datum = 0;
|
||||
|
||||
mask = 0x80; datum = 0;
|
||||
for (x = 0; x < w; x++) {
|
||||
if (mask == 0) {
|
||||
bits[cnt++] = datum;
|
||||
datum = 0;
|
||||
mask = 0x80;
|
||||
}
|
||||
if (*p++ != 0x07e0)
|
||||
datum |= mask;
|
||||
mask >>= 1;
|
||||
}
|
||||
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
if (mask == 0) {
|
||||
bits[cnt++] = datum;
|
||||
datum = 0;
|
||||
mask = 0x80;
|
||||
}
|
||||
if (*p++ != 0x07e0) datum |= mask;
|
||||
mask >>= 1;
|
||||
}
|
||||
bits[cnt++] = datum;
|
||||
}
|
||||
}
|
||||
|
||||
bits[cnt++] = datum;
|
||||
}
|
||||
}
|
||||
WRITE_FONT_INT(ffile, cnt);
|
||||
WRITE_FONT_DATA(ffile, bits, cnt, 1);
|
||||
mem_free(bits);
|
||||
}
|
||||
|
||||
WRITE_FONT_INT(ffile, cnt);
|
||||
WRITE_FONT_DATA(ffile, bits, cnt, 1);
|
||||
mem_free(bits);
|
||||
}
|
||||
// We should add kerning support here.
|
||||
|
||||
// We should add kerning support here.
|
||||
// Close font.
|
||||
CLOSE_FONT(ffile);
|
||||
|
||||
// Close font.
|
||||
CLOSE_FONT(ffile);
|
||||
delete[] m_DataBuffer; // allocated in extract_font!
|
||||
bm_FreeBitmap(bm_handle);
|
||||
|
||||
delete[] m_DataBuffer; // allocated in extract_font!
|
||||
bm_FreeBitmap(bm_handle);
|
||||
int new_font_handle = grfont_Load((char *)fnt_file_dest);
|
||||
if (new_font_handle < 0) {
|
||||
message_box("New font failed to load!");
|
||||
}
|
||||
|
||||
int new_font_handle = grfont_Load((char*)fnt_file_dest);
|
||||
if (new_font_handle < 0) {
|
||||
message_box("New font failed to load!");
|
||||
}
|
||||
// print out stats.
|
||||
while (1) {
|
||||
int x, y, i;
|
||||
FontDoIO();
|
||||
|
||||
if (ddio_KeyInKey() == KEY_ENTER) {
|
||||
break;
|
||||
}
|
||||
|
||||
// print out stats.
|
||||
while (1)
|
||||
{
|
||||
int x,y,i;
|
||||
FontDoIO();
|
||||
rend_StartFrame(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetParameters(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetFont(System_font_handle);
|
||||
grtext_SetColor(GR_WHITE);
|
||||
rend_ClearScreen(GR_BLACK);
|
||||
|
||||
if (ddio_KeyInKey() == KEY_ENTER) {
|
||||
break;
|
||||
}
|
||||
grtext_Printf(0, 12, "Created font:\2\65 %s", fnt_file_dest);
|
||||
grtext_Printf(0, 28, "Type:\2\65 %s, %s", (ft.flags & FT_COLOR) ? "COLOR" : "MONO",
|
||||
(ft.flags & FT_PROPORTIONAL) ? "PROPORTIONAL" : "FIXED WIDTH");
|
||||
grtext_Printf(0, 40, "Ascii:\2\65 %d to %d", ft.min_ascii, ft.max_ascii);
|
||||
grtext_Printf(0, 52, "Maxwidth:\2\65 %d", ft.width);
|
||||
grtext_Printf(0, 64, "Maxheight:\2\65 %d", ft.height);
|
||||
|
||||
rend_StartFrame(0,0,FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetParameters(0,0,FIXED_SCREEN_WIDTH,FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetFont(System_font_handle);
|
||||
grtext_SetColor(GR_WHITE);
|
||||
rend_ClearScreen(GR_BLACK);
|
||||
grtext_Printf(0, FIXED_SCREEN_HEIGHT - 20, "Press ENTER to quit.");
|
||||
|
||||
grtext_Printf(0,12, "Created font:\2\65 %s", fnt_file_dest);
|
||||
grtext_Printf(0,28, "Type:\2\65 %s, %s", (ft.flags & FT_COLOR) ? "COLOR" : "MONO", (ft.flags & FT_PROPORTIONAL) ? "PROPORTIONAL" : "FIXED WIDTH");
|
||||
grtext_Printf(0,40, "Ascii:\2\65 %d to %d", ft.min_ascii,ft.max_ascii);
|
||||
grtext_Printf(0,52, "Maxwidth:\2\65 %d", ft.width);
|
||||
grtext_Printf(0,64, "Maxheight:\2\65 %d", ft.height);
|
||||
// spew new font.
|
||||
x = 10;
|
||||
y = 120;
|
||||
grtext_SetFont(new_font_handle);
|
||||
|
||||
grtext_Printf(0,FIXED_SCREEN_HEIGHT-20, "Press ENTER to quit.");
|
||||
for (i = ft.min_ascii; i <= ft.max_ascii; i++) {
|
||||
char str[2];
|
||||
str[0] = i;
|
||||
str[1] = 0;
|
||||
|
||||
// spew new font.
|
||||
x=10; y = 120;
|
||||
grtext_SetFont(new_font_handle);
|
||||
if ((x + grfont_GetCharWidth(new_font_handle, i)) > FIXED_SCREEN_WIDTH) {
|
||||
x = 10;
|
||||
y += grfont_GetHeight(new_font_handle) + 1;
|
||||
}
|
||||
|
||||
for (i = ft.min_ascii; i <= ft.max_ascii; i++)
|
||||
{
|
||||
char str[2];
|
||||
str[0] = i;
|
||||
str[1] = 0;
|
||||
grtext_Puts(x, y, str);
|
||||
x += grfont_GetCharWidth(new_font_handle, i) + 1;
|
||||
}
|
||||
|
||||
if ((x+grfont_GetCharWidth(new_font_handle, i)) > FIXED_SCREEN_WIDTH) {
|
||||
x = 10;
|
||||
y += grfont_GetHeight(new_font_handle)+1;
|
||||
}
|
||||
grtext_Flush();
|
||||
rend_EndFrame();
|
||||
rend_Flip();
|
||||
}
|
||||
|
||||
grtext_Puts(x,y,str);
|
||||
x+= grfont_GetCharWidth(new_font_handle, i)+1;
|
||||
}
|
||||
|
||||
grtext_Flush();
|
||||
rend_EndFrame();
|
||||
rend_Flip();
|
||||
}
|
||||
|
||||
grfont_Free(new_font_handle);
|
||||
grfont_Free(new_font_handle);
|
||||
}
|
||||
|
||||
void FontView(const char *fnt_file_name) {
|
||||
tFontTemplate ft;
|
||||
int new_font_handle;
|
||||
|
||||
void FontView(const char *fnt_file_name)
|
||||
{
|
||||
tFontTemplate ft;
|
||||
int new_font_handle;
|
||||
new_font_handle = grfont_Load((char *)fnt_file_name);
|
||||
if (new_font_handle < 0) {
|
||||
Error("Couldn't load font %s.", fnt_file_name);
|
||||
}
|
||||
grfont_LoadTemplate((char *)fnt_file_name, &ft);
|
||||
|
||||
new_font_handle = grfont_Load((char *)fnt_file_name);
|
||||
if (new_font_handle < 0) {
|
||||
Error("Couldn't load font %s.", fnt_file_name);
|
||||
}
|
||||
grfont_LoadTemplate((char *)fnt_file_name, &ft);
|
||||
ddio_KeyFlush();
|
||||
// print out stats.
|
||||
while (1) {
|
||||
int x, y, i;
|
||||
|
||||
ddio_KeyFlush();
|
||||
// print out stats.
|
||||
while (1)
|
||||
{
|
||||
int x,y,i;
|
||||
FontDoIO();
|
||||
|
||||
FontDoIO();
|
||||
if (ddio_KeyInKey() == KEY_ENTER) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ddio_KeyInKey() == KEY_ENTER) {
|
||||
break;
|
||||
}
|
||||
rend_StartFrame(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetParameters(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetFont(System_font_handle);
|
||||
grtext_SetColor(GR_WHITE);
|
||||
rend_ClearScreen(GR_BLACK);
|
||||
|
||||
rend_StartFrame(0,0,FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetParameters(0,0,FIXED_SCREEN_WIDTH,FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetFont(System_font_handle);
|
||||
grtext_SetColor(GR_WHITE);
|
||||
rend_ClearScreen(GR_BLACK);
|
||||
grtext_Printf(0, 12, "Font:\2\65 %s", fnt_file_name);
|
||||
grtext_Printf(0, 28, "Type:\2\65 %s, %s, %s", (ft.monochromatic ? "MONO" : "COLOR"),
|
||||
(ft.proportional ? "PROPORTIONAL" : "FIXED WIDTH"), (ft.newstyle ? "4444" : "1555"));
|
||||
grtext_Printf(0, 40, "Ascii:\2\65 %d to %d", ft.min_ascii, ft.max_ascii);
|
||||
grtext_Printf(0, 52, "Maxwidth:\2\65 %d", ft.ch_maxwidth);
|
||||
grtext_Printf(0, 64, "Maxheight:\2\65 %d", ft.ch_height);
|
||||
|
||||
grtext_Printf(0,12, "Font:\2\65 %s", fnt_file_name);
|
||||
grtext_Printf(0,28, "Type:\2\65 %s, %s, %s", (ft.monochromatic ? "MONO" : "COLOR"), (ft.proportional ? "PROPORTIONAL" : "FIXED WIDTH"),
|
||||
(ft.newstyle ? "4444" : "1555"));
|
||||
grtext_Printf(0,40, "Ascii:\2\65 %d to %d", ft.min_ascii,ft.max_ascii);
|
||||
grtext_Printf(0,52, "Maxwidth:\2\65 %d", ft.ch_maxwidth);
|
||||
grtext_Printf(0,64, "Maxheight:\2\65 %d", ft.ch_height);
|
||||
if (ft.ffi2) {
|
||||
grtext_Printf(0, 76, "Tracking:\2\65 %d", (int)ft.ch_tracking);
|
||||
}
|
||||
|
||||
if (ft.ffi2) {
|
||||
grtext_Printf(0,76, "Tracking:\2\65 %d", (int)ft.ch_tracking);
|
||||
}
|
||||
grtext_Printf(0, FIXED_SCREEN_HEIGHT - 20, "Press ENTER to quit.");
|
||||
|
||||
// spew new font.
|
||||
x = 10;
|
||||
y = 120;
|
||||
grtext_SetFont(new_font_handle);
|
||||
|
||||
grtext_Printf(0,FIXED_SCREEN_HEIGHT-20, "Press ENTER to quit.");
|
||||
for (i = ft.min_ascii; i <= ft.max_ascii; i++) {
|
||||
char str[2];
|
||||
str[0] = i;
|
||||
str[1] = 0;
|
||||
|
||||
// spew new font.
|
||||
x=10; y = 120;
|
||||
grtext_SetFont(new_font_handle);
|
||||
if ((x + grfont_GetCharWidth(new_font_handle, i)) > FIXED_SCREEN_WIDTH) {
|
||||
x = 10;
|
||||
y += grfont_GetHeight(new_font_handle) + 1;
|
||||
}
|
||||
|
||||
for (i = ft.min_ascii; i <= ft.max_ascii; i++)
|
||||
{
|
||||
char str[2];
|
||||
str[0] = i;
|
||||
str[1] = 0;
|
||||
grtext_Puts(x, y, str);
|
||||
x += grfont_GetCharWidth(new_font_handle, i) + 1;
|
||||
}
|
||||
|
||||
if ((x+grfont_GetCharWidth(new_font_handle, i)) > FIXED_SCREEN_WIDTH) {
|
||||
x = 10;
|
||||
y += grfont_GetHeight(new_font_handle)+1;
|
||||
}
|
||||
grtext_Flush();
|
||||
|
||||
grtext_Puts(x,y,str);
|
||||
x+= grfont_GetCharWidth(new_font_handle, i)+1;
|
||||
}
|
||||
rend_EndFrame();
|
||||
rend_Flip();
|
||||
}
|
||||
|
||||
grtext_Flush();
|
||||
|
||||
rend_EndFrame();
|
||||
rend_Flip();
|
||||
|
||||
}
|
||||
|
||||
grfont_Free(new_font_handle);
|
||||
grfont_Free(new_font_handle);
|
||||
}
|
||||
|
||||
@@ -71,159 +71,141 @@ extern void FontCreate(const char *fnt_file_source, const char *fnt_file_dest, i
|
||||
class oeApplication *FontEditor = NULL;
|
||||
int System_font_handle = -1;
|
||||
|
||||
class appFontKerner: public oeWin32Application
|
||||
{
|
||||
bool shutdown;
|
||||
class appFontKerner : public oeWin32Application {
|
||||
bool shutdown;
|
||||
|
||||
public:
|
||||
appFontKerner(HINSTANCE hinst): oeWin32Application(APPNAME, OEAPP_FULLSCREEN, hinst) { shutdown = false; };
|
||||
appFontKerner(HINSTANCE hinst) : oeWin32Application(APPNAME, OEAPP_FULLSCREEN, hinst) { shutdown = false; };
|
||||
|
||||
// returns 0 if we pass to default window handler.
|
||||
virtual int WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_ACTIVATEAPP:
|
||||
if (wParam == (unsigned)(FALSE) && !shutdown && FontEditor) {
|
||||
shutdown = true;
|
||||
rend_Close();
|
||||
ddio_Close();
|
||||
ShowWindow((HWND)hwnd, SW_MINIMIZE);
|
||||
this->deactivate();
|
||||
}
|
||||
else if (wParam == (unsigned)(TRUE) && shutdown && FontEditor) {
|
||||
this->activate();
|
||||
ShowWindow((HWND)hwnd, SW_MAXIMIZE);
|
||||
InitIO(this);
|
||||
InitRenderer(this, Preferred_renderer);
|
||||
shutdown = false;
|
||||
}
|
||||
break;
|
||||
// returns 0 if we pass to default window handler.
|
||||
virtual int WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
switch (msg) {
|
||||
case WM_ACTIVATEAPP:
|
||||
if (wParam == (unsigned)(FALSE) && !shutdown && FontEditor) {
|
||||
shutdown = true;
|
||||
rend_Close();
|
||||
ddio_Close();
|
||||
ShowWindow((HWND)hwnd, SW_MINIMIZE);
|
||||
this->deactivate();
|
||||
} else if (wParam == (unsigned)(TRUE) && shutdown && FontEditor) {
|
||||
this->activate();
|
||||
ShowWindow((HWND)hwnd, SW_MAXIMIZE);
|
||||
InitIO(this);
|
||||
InitRenderer(this, Preferred_renderer);
|
||||
shutdown = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return oeWin32Application::WndProc(hwnd, msg, wParam, lParam);
|
||||
};
|
||||
return oeWin32Application::WndProc(hwnd, msg, wParam, lParam);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
|
||||
appFontKerner fontkern(hInstance);
|
||||
int i;
|
||||
int i;
|
||||
|
||||
fontkern.init();
|
||||
fontkern.init();
|
||||
|
||||
GatherArgs(lpCmdLine);
|
||||
GatherArgs(lpCmdLine);
|
||||
|
||||
i = FindArg("-glide");
|
||||
if (i) Preferred_renderer = RENDERER_GLIDE;
|
||||
i = FindArg("-glide");
|
||||
if (i)
|
||||
Preferred_renderer = RENDERER_GLIDE;
|
||||
|
||||
i = FindArg("-create");
|
||||
if (i) {
|
||||
int min_ascii = atoi(GameArgs[i+3]);
|
||||
InitSystems(&fontkern, false, false, Preferred_renderer);
|
||||
FontCreate(GameArgs[i+1], GameArgs[i+2], min_ascii);
|
||||
return 0;
|
||||
}
|
||||
i = FindArg("-create");
|
||||
if (i) {
|
||||
int min_ascii = atoi(GameArgs[i + 3]);
|
||||
InitSystems(&fontkern, false, false, Preferred_renderer);
|
||||
FontCreate(GameArgs[i + 1], GameArgs[i + 2], min_ascii);
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = FindArg("-kern");
|
||||
if (i) {
|
||||
InitSystems(&fontkern, false, false, Preferred_renderer);
|
||||
FontKern(GameArgs[i+1]);
|
||||
return 0;
|
||||
}
|
||||
i = FindArg("-kern");
|
||||
if (i) {
|
||||
InitSystems(&fontkern, false, false, Preferred_renderer);
|
||||
FontKern(GameArgs[i + 1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = FindArg("-view");
|
||||
if (i) {
|
||||
InitSystems(&fontkern, false, false, Preferred_renderer);
|
||||
FontView(GameArgs[i+1]);
|
||||
return 0;
|
||||
}
|
||||
i = FindArg("-view");
|
||||
if (i) {
|
||||
InitSystems(&fontkern, false, false, Preferred_renderer);
|
||||
FontView(GameArgs[i + 1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = FindArg("-kerndump");
|
||||
if (i) {
|
||||
error_Init(false, false, APPNAME);
|
||||
SetMessageBoxTitle(APPNAME " Message");
|
||||
mem_Init();
|
||||
FontEditor = &fontkern;
|
||||
InitIO(&fontkern);
|
||||
grfont_Reset();
|
||||
grtext_Init();
|
||||
FontKernDump(GameArgs[i+1]);
|
||||
return 0;
|
||||
}
|
||||
i = FindArg("-kerndump");
|
||||
if (i) {
|
||||
error_Init(false, false, APPNAME);
|
||||
SetMessageBoxTitle(APPNAME " Message");
|
||||
mem_Init();
|
||||
FontEditor = &fontkern;
|
||||
InitIO(&fontkern);
|
||||
grfont_Reset();
|
||||
grtext_Init();
|
||||
FontKernDump(GameArgs[i + 1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MessageBox(NULL, "Need to specify a font to edit.", "Error",MB_OK);
|
||||
MessageBox(NULL, "Need to specify a font to edit.", "Error", MB_OK);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InitSystems(oeApplication *app, bool debug, bool mono, renderer_type renderer) {
|
||||
error_Init(debug, mono, APPNAME);
|
||||
SetMessageBoxTitle(APPNAME " Message");
|
||||
|
||||
void InitSystems(oeApplication *app, bool debug, bool mono, renderer_type renderer)
|
||||
{
|
||||
error_Init(debug, mono, APPNAME);
|
||||
SetMessageBoxTitle(APPNAME " Message");
|
||||
mem_Init();
|
||||
InitIO(app);
|
||||
|
||||
mem_Init(); InitIO(app);
|
||||
cf_OpenLibrary("fonteditor.hog");
|
||||
bm_InitBitmaps();
|
||||
grfont_Reset();
|
||||
grtext_Init();
|
||||
InitRenderer(app, renderer);
|
||||
|
||||
cf_OpenLibrary("fonteditor.hog");
|
||||
bm_InitBitmaps();
|
||||
grfont_Reset();
|
||||
grtext_Init();
|
||||
InitRenderer(app, renderer);
|
||||
System_font_handle = grfont_Load("system.fnt");
|
||||
if (System_font_handle < 0) {
|
||||
Error("Failed to load system font.");
|
||||
}
|
||||
|
||||
System_font_handle = grfont_Load("system.fnt");
|
||||
if (System_font_handle < 0) {
|
||||
Error("Failed to load system font.");
|
||||
}
|
||||
|
||||
FontEditor = app;
|
||||
FontEditor = app;
|
||||
}
|
||||
|
||||
void InitIO(oeApplication *app) {
|
||||
char path[1024];
|
||||
|
||||
void InitIO(oeApplication *app)
|
||||
{
|
||||
char path[1024];
|
||||
ddio_init_info ddio_init_data;
|
||||
|
||||
ddio_init_info ddio_init_data;
|
||||
ddio_init_data.obj = app;
|
||||
ddio_init_data.use_lo_res_time = true;
|
||||
ddio_init_data.key_emulation = true;
|
||||
ddio_init_data.joy_emulation = true;
|
||||
ddio_Init(&ddio_init_data);
|
||||
|
||||
ddio_init_data.obj = app;
|
||||
ddio_init_data.use_lo_res_time = true;
|
||||
ddio_init_data.key_emulation = true;
|
||||
ddio_init_data.joy_emulation = true;
|
||||
ddio_Init(&ddio_init_data);
|
||||
|
||||
GetCurrentDirectory(sizeof(path), path);
|
||||
cf_SetSearchPath(path,NULL);
|
||||
GetCurrentDirectory(sizeof(path), path);
|
||||
cf_SetSearchPath(path, NULL);
|
||||
}
|
||||
|
||||
void InitRenderer(oeApplication *app, renderer_type renderer) {
|
||||
renderer_preferred_state req_renderer_state;
|
||||
|
||||
void InitRenderer(oeApplication *app, renderer_type renderer)
|
||||
{
|
||||
renderer_preferred_state req_renderer_state;
|
||||
req_renderer_state.width = FIXED_SCREEN_WIDTH;
|
||||
req_renderer_state.height = FIXED_SCREEN_HEIGHT;
|
||||
req_renderer_state.bit_depth = 16;
|
||||
req_renderer_state.gamma = 1.6f;
|
||||
req_renderer_state.vsync_on = true;
|
||||
req_renderer_state.filtering = true;
|
||||
req_renderer_state.mipping = false;
|
||||
|
||||
req_renderer_state.width = FIXED_SCREEN_WIDTH;
|
||||
req_renderer_state.height = FIXED_SCREEN_HEIGHT;
|
||||
req_renderer_state.bit_depth = 16;
|
||||
req_renderer_state.gamma = 1.6f;
|
||||
req_renderer_state.vsync_on = true;
|
||||
req_renderer_state.filtering = true;
|
||||
req_renderer_state.mipping = false;
|
||||
|
||||
if (!rend_Init(renderer, app, &req_renderer_state)) {
|
||||
Error("Failed to initialize renderer.");
|
||||
}
|
||||
if (!rend_Init(renderer, app, &req_renderer_state)) {
|
||||
Error("Failed to initialize renderer.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FontDoIO()
|
||||
{
|
||||
FontEditor->defer();
|
||||
ddio_Frame();
|
||||
void FontDoIO() {
|
||||
FontEditor->defer();
|
||||
ddio_Frame();
|
||||
}
|
||||
|
||||
@@ -41,4 +41,3 @@ extern void FontView(const char *fnt_file_name);
|
||||
extern void FontCreate(const char *fnt_file_source, const char *fnt_file_dest, int min_ascii);
|
||||
|
||||
extern int System_font_handle;
|
||||
|
||||
|
||||
@@ -48,474 +48,476 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
chunked_bitmap Editor_bkg;
|
||||
tFontTemplate Font_template;
|
||||
|
||||
char *SampleText = "This is some sample text that is here to\n" \
|
||||
"Show you how the antialiasing will\n" \
|
||||
"look over different color backgrounds\n" \
|
||||
"KERN PAIRS: VaWaVeWeVAV-LyT.T,TyTvTcYe\n";
|
||||
|
||||
char *SampleText = "This is some sample text that is here to\n"
|
||||
"Show you how the antialiasing will\n"
|
||||
"look over different color backgrounds\n"
|
||||
"KERN PAIRS: VaWaVeWeVAV-LyT.T,TyTvTcYe\n";
|
||||
|
||||
// this function determines if a kerning pair exists in the current font template
|
||||
// if there is no kerning structure, add it. if no kerning in font, add it to the template
|
||||
#define KERNINFO_PAIR_SIZE 3
|
||||
#define KERNINFO_PAIR_SIZE 3
|
||||
|
||||
int fonttool_get_kerning( int c1, int c2, int *pairnum=NULL);
|
||||
int fonttool_get_kerning(int c1, int c2, int *pairnum = NULL);
|
||||
|
||||
int fonttool_get_kerning( int c1, int c2, int *pairnum)
|
||||
{
|
||||
int i;
|
||||
uint8_t *kern_data;
|
||||
int fonttool_get_kerning(int c1, int c2, int *pairnum) {
|
||||
int i;
|
||||
uint8_t *kern_data;
|
||||
|
||||
kern_data = Font_template.kern_data;
|
||||
if (kern_data) {
|
||||
i = 0;
|
||||
while (kern_data[i] != 255) {
|
||||
if (kern_data[i] == (uint8_t)c1 && kern_data[i + 1] == (uint8_t)c2) {
|
||||
if (pairnum)
|
||||
*pairnum = i / 3;
|
||||
return (int)((int8_t)kern_data[i + 2]);
|
||||
}
|
||||
i += KERNINFO_PAIR_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
kern_data= Font_template.kern_data;
|
||||
if (kern_data) {
|
||||
i=0;
|
||||
while (kern_data[i] != 255)
|
||||
{
|
||||
if (kern_data[i] == (uint8_t)c1 && kern_data[i+1] == (uint8_t)c2) {
|
||||
if (pairnum) *pairnum = i/3;
|
||||
return (int)((int8_t)kern_data[i+2]);
|
||||
}
|
||||
i+=KERNINFO_PAIR_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fonttool_set_kerning(int c1, int c2, int dist) {
|
||||
int i, j;
|
||||
uint8_t *kern_data;
|
||||
|
||||
void fonttool_set_kerning( int c1, int c2, int dist )
|
||||
{
|
||||
int i,j;
|
||||
uint8_t *kern_data;
|
||||
if (c1 == 255 || c2 == 255) {
|
||||
mprintf(0, "seting illegal kerning of 255!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (c1 == 255 || c2 == 255) {
|
||||
mprintf(0, "seting illegal kerning of 255!\n");
|
||||
return;
|
||||
}
|
||||
kern_data = Font_template.kern_data;
|
||||
|
||||
kern_data= Font_template.kern_data;
|
||||
if (!kern_data) {
|
||||
// create a one entry kern table.
|
||||
kern_data = (uint8_t *)mem_malloc(KERNINFO_PAIR_SIZE * 2);
|
||||
kern_data[0] = (uint8_t)c1;
|
||||
kern_data[1] = (uint8_t)c2;
|
||||
kern_data[2] = (int8_t)dist;
|
||||
kern_data[3] = 255;
|
||||
kern_data[4] = 255;
|
||||
kern_data[5] = 0;
|
||||
Font_template.kern_data = kern_data;
|
||||
mprintf(0, "adding first kerning pair %d,%d\n", c1, c2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!kern_data) {
|
||||
// create a one entry kern table.
|
||||
kern_data = (uint8_t *)mem_malloc(KERNINFO_PAIR_SIZE*2);
|
||||
kern_data[0] = (uint8_t)c1;
|
||||
kern_data[1] = (uint8_t)c2;
|
||||
kern_data[2] = (int8_t)dist;
|
||||
kern_data[3] = 255;
|
||||
kern_data[4] = 255;
|
||||
kern_data[5] = 0;
|
||||
Font_template.kern_data = kern_data;
|
||||
mprintf(0, "adding first kerning pair %d,%d\n", c1,c2);
|
||||
return;
|
||||
}
|
||||
// check for match in current list.
|
||||
i = 0;
|
||||
while (kern_data[i] != 255) {
|
||||
if (kern_data[i] == (uint8_t)c1 && kern_data[i + 1] == (uint8_t)c2) {
|
||||
kern_data[i + 2] = (int8_t)dist;
|
||||
if (dist == 0) {
|
||||
// remove this kerning pair.
|
||||
j = i;
|
||||
do {
|
||||
kern_data[j] = kern_data[j + 3];
|
||||
kern_data[j + 1] = kern_data[j + 4];
|
||||
kern_data[j + 2] = kern_data[j + 5];
|
||||
j += KERNINFO_PAIR_SIZE;
|
||||
} while (kern_data[j] != 255);
|
||||
if (i == 0) {
|
||||
// last pair, deallocate kern_data and end.
|
||||
mprintf(0, "removing last kerning pair\n");
|
||||
mem_free(kern_data);
|
||||
kern_data = NULL;
|
||||
} else {
|
||||
mprintf(0, "removing kerning pair %d,%d\n", c1, c2);
|
||||
}
|
||||
}
|
||||
Font_template.kern_data = kern_data;
|
||||
return;
|
||||
}
|
||||
i += KERNINFO_PAIR_SIZE;
|
||||
}
|
||||
|
||||
// check for match in current list.
|
||||
i=0;
|
||||
while (kern_data[i] != 255)
|
||||
{
|
||||
if (kern_data[i] == (uint8_t)c1 && kern_data[i+1] == (uint8_t)c2) {
|
||||
kern_data[i+2] = (int8_t)dist;
|
||||
if (dist == 0) {
|
||||
// remove this kerning pair.
|
||||
j = i;
|
||||
do
|
||||
{
|
||||
kern_data[j] = kern_data[j+3];
|
||||
kern_data[j+1] = kern_data[j+4];
|
||||
kern_data[j+2] = kern_data[j+5];
|
||||
j+= KERNINFO_PAIR_SIZE;
|
||||
}
|
||||
while (kern_data[j] != 255);
|
||||
if (i == 0) {
|
||||
// last pair, deallocate kern_data and end.
|
||||
mprintf(0, "removing last kerning pair\n");
|
||||
mem_free(kern_data);
|
||||
kern_data = NULL;
|
||||
}
|
||||
else {
|
||||
mprintf(0, "removing kerning pair %d,%d\n", c1,c2);
|
||||
}
|
||||
}
|
||||
Font_template.kern_data = kern_data;
|
||||
return;
|
||||
}
|
||||
i+=KERNINFO_PAIR_SIZE;
|
||||
}
|
||||
// new entry.
|
||||
uint8_t *new_kern_data;
|
||||
int n_pairs = i / KERNINFO_PAIR_SIZE;
|
||||
|
||||
// new entry.
|
||||
uint8_t *new_kern_data;
|
||||
int n_pairs = i/KERNINFO_PAIR_SIZE;
|
||||
new_kern_data = (uint8_t *)mem_malloc((n_pairs + 2) * sizeof(uint8_t) * KERNINFO_PAIR_SIZE);
|
||||
for (i = 0; i < n_pairs; i++) {
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE] = kern_data[i * 3];
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE + 1] = kern_data[i * 3 + 1];
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE + 2] = kern_data[i * 3 + 2];
|
||||
}
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE] = (uint8_t)c1;
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE + 1] = (uint8_t)c2;
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE + 2] = (int8_t)dist;
|
||||
i++;
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE] = 255;
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE + 1] = 255;
|
||||
new_kern_data[i * KERNINFO_PAIR_SIZE + 2] = 0;
|
||||
|
||||
new_kern_data = (uint8_t *)mem_malloc((n_pairs+2)*sizeof(uint8_t)*KERNINFO_PAIR_SIZE);
|
||||
for (i = 0; i < n_pairs; i++)
|
||||
{
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE] = kern_data[i*3];
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE+1] = kern_data[i*3+1];
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE+2] = kern_data[i*3+2];
|
||||
}
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE] = (uint8_t)c1;
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE+1] = (uint8_t)c2;
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE+2] = (int8_t)dist;
|
||||
i++;
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE] = 255;
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE+1] = 255;
|
||||
new_kern_data[i*KERNINFO_PAIR_SIZE+2] = 0;
|
||||
mem_free(kern_data);
|
||||
|
||||
mem_free(kern_data);
|
||||
Font_template.kern_data = new_kern_data;
|
||||
|
||||
Font_template.kern_data = new_kern_data;
|
||||
|
||||
mprintf(0, "adding first kerning pair %d,%d (total=%d)\n", c1,c2, n_pairs+1);
|
||||
mprintf(0, "adding first kerning pair %d,%d (total=%d)\n", c1, c2, n_pairs + 1);
|
||||
}
|
||||
|
||||
|
||||
void fonttool_remove_kerning()
|
||||
{
|
||||
if (Font_template.kern_data) {
|
||||
mem_free(Font_template.kern_data);
|
||||
Font_template.kern_data = NULL;
|
||||
}
|
||||
void fonttool_remove_kerning() {
|
||||
if (Font_template.kern_data) {
|
||||
mem_free(Font_template.kern_data);
|
||||
Font_template.kern_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void FontKern(const char *fnt_file_name)
|
||||
{
|
||||
int bm_handle;
|
||||
int font_handle;
|
||||
int c1 = 'b', c2 = 'u', d;
|
||||
int last_good_pair, current_pair;
|
||||
int first_item = 0;
|
||||
int current_item = 0;
|
||||
int num_items_displayed = 1;
|
||||
bool done = false;
|
||||
int16_t text_alpha=255;
|
||||
int red_comp , green_comp, blue_comp;
|
||||
ddgr_color text_color;
|
||||
void FontKern(const char *fnt_file_name) {
|
||||
int bm_handle;
|
||||
int font_handle;
|
||||
int c1 = 'b', c2 = 'u', d;
|
||||
int last_good_pair, current_pair;
|
||||
int first_item = 0;
|
||||
int current_item = 0;
|
||||
int num_items_displayed = 1;
|
||||
bool done = false;
|
||||
int16_t text_alpha = 255;
|
||||
int red_comp, green_comp, blue_comp;
|
||||
ddgr_color text_color;
|
||||
|
||||
red_comp = green_comp = blue_comp = 255;
|
||||
red_comp = green_comp = blue_comp = 255;
|
||||
|
||||
bm_handle = bm_AllocLoadFileBitmap("FontTool.ogf",0);
|
||||
if (bm_handle <= BAD_BITMAP_HANDLE) {
|
||||
Error("Error loading FontEditor art.");
|
||||
}
|
||||
if (!bm_CreateChunkedBitmap(bm_handle, &Editor_bkg)) {
|
||||
Error("Error chunking FontEditor art.");
|
||||
}
|
||||
bm_FreeBitmap(bm_handle);
|
||||
bm_handle = bm_AllocLoadFileBitmap("FontTool.ogf", 0);
|
||||
if (bm_handle <= BAD_BITMAP_HANDLE) {
|
||||
Error("Error loading FontEditor art.");
|
||||
}
|
||||
if (!bm_CreateChunkedBitmap(bm_handle, &Editor_bkg)) {
|
||||
Error("Error chunking FontEditor art.");
|
||||
}
|
||||
bm_FreeBitmap(bm_handle);
|
||||
|
||||
// load font into memory.
|
||||
font_handle = grfont_Load((char *)fnt_file_name);
|
||||
if (font_handle < 0) {
|
||||
Error("Error loading font %s", fnt_file_name);
|
||||
}
|
||||
if (!grfont_LoadTemplate((char *)fnt_file_name, &Font_template)) {
|
||||
Error("Error loading font template %s", fnt_file_name);
|
||||
}
|
||||
// load font into memory.
|
||||
font_handle = grfont_Load((char *)fnt_file_name);
|
||||
if (font_handle < 0) {
|
||||
Error("Error loading font %s", fnt_file_name);
|
||||
}
|
||||
if (!grfont_LoadTemplate((char *)fnt_file_name, &Font_template)) {
|
||||
Error("Error loading font template %s", fnt_file_name);
|
||||
}
|
||||
|
||||
if (Font_template.ffi2 == false) {
|
||||
Font_template.ffi2 = true;
|
||||
Font_template.ch_tracking = 0;
|
||||
}
|
||||
if (Font_template.ffi2 == false) {
|
||||
Font_template.ffi2 = true;
|
||||
Font_template.ch_tracking = 0;
|
||||
}
|
||||
|
||||
if (Font_template.kern_data) {
|
||||
current_pair = 0;
|
||||
}
|
||||
else {
|
||||
current_pair = -1;
|
||||
}
|
||||
if (Font_template.kern_data) {
|
||||
current_pair = 0;
|
||||
} else {
|
||||
current_pair = -1;
|
||||
}
|
||||
|
||||
last_good_pair = current_pair;
|
||||
last_good_pair = current_pair;
|
||||
|
||||
while(!done)
|
||||
{
|
||||
int key;
|
||||
while (!done) {
|
||||
int key;
|
||||
|
||||
FontDoIO();
|
||||
FontDoIO();
|
||||
|
||||
key = ddio_KeyInKey();
|
||||
switch (key)
|
||||
{
|
||||
case KEY_ESC:
|
||||
done = true;
|
||||
break;
|
||||
key = ddio_KeyInKey();
|
||||
switch (key) {
|
||||
case KEY_ESC:
|
||||
done = true;
|
||||
break;
|
||||
|
||||
case KEY_F5:
|
||||
grfont_Free(font_handle);
|
||||
grfont_FreeTemplate(&Font_template);
|
||||
font_handle = grfont_Load((char *)fnt_file_name);
|
||||
if (font_handle == -1) {
|
||||
Error("Font failed reload test!");
|
||||
}
|
||||
grfont_LoadTemplate((char *)fnt_file_name, &Font_template);
|
||||
break;
|
||||
case KEY_F5:
|
||||
grfont_Free(font_handle);
|
||||
grfont_FreeTemplate(&Font_template);
|
||||
font_handle = grfont_Load((char *)fnt_file_name);
|
||||
if (font_handle == -1) {
|
||||
Error("Font failed reload test!");
|
||||
}
|
||||
grfont_LoadTemplate((char *)fnt_file_name, &Font_template);
|
||||
break;
|
||||
|
||||
case KEY_MINUS:
|
||||
if (Font_template.ch_tracking > -80) {
|
||||
Font_template.ch_tracking--;
|
||||
grfont_SetTracking(font_handle, Font_template.ch_tracking);
|
||||
}
|
||||
break;
|
||||
case KEY_MINUS:
|
||||
if (Font_template.ch_tracking > -80) {
|
||||
Font_template.ch_tracking--;
|
||||
grfont_SetTracking(font_handle, Font_template.ch_tracking);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_EQUAL:
|
||||
if (Font_template.ch_tracking < 80) {
|
||||
Font_template.ch_tracking++;
|
||||
grfont_SetTracking(font_handle, Font_template.ch_tracking);
|
||||
}
|
||||
break;
|
||||
case KEY_EQUAL:
|
||||
if (Font_template.ch_tracking < 80) {
|
||||
Font_template.ch_tracking++;
|
||||
grfont_SetTracking(font_handle, Font_template.ch_tracking);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_F10:
|
||||
grfont_Free(font_handle);
|
||||
if (!grfont_SetTemplate(fnt_file_name, &Font_template)) {
|
||||
Error("Failed to save font correctly!");
|
||||
}
|
||||
grfont_FreeTemplate(&Font_template);
|
||||
font_handle = grfont_Load((char *)fnt_file_name);
|
||||
if (font_handle == -1) {
|
||||
Error("Font failed reload test on save!");
|
||||
}
|
||||
grfont_LoadTemplate((char *)fnt_file_name, &Font_template);
|
||||
mprintf(0, "font saved and reloaded correctly?\n");
|
||||
done = true;
|
||||
break;
|
||||
case KEY_F10:
|
||||
grfont_Free(font_handle);
|
||||
if (!grfont_SetTemplate(fnt_file_name, &Font_template)) {
|
||||
Error("Failed to save font correctly!");
|
||||
}
|
||||
grfont_FreeTemplate(&Font_template);
|
||||
font_handle = grfont_Load((char *)fnt_file_name);
|
||||
if (font_handle == -1) {
|
||||
Error("Font failed reload test on save!");
|
||||
}
|
||||
grfont_LoadTemplate((char *)fnt_file_name, &Font_template);
|
||||
mprintf(0, "font saved and reloaded correctly?\n");
|
||||
done = true;
|
||||
break;
|
||||
|
||||
case KEY_F6:
|
||||
fonttool_remove_kerning();
|
||||
break;
|
||||
case KEY_F6:
|
||||
fonttool_remove_kerning();
|
||||
break;
|
||||
|
||||
case KEY_COMMA:
|
||||
text_alpha -= 16;
|
||||
if (text_alpha < 0) text_alpha = 0;
|
||||
break;
|
||||
case KEY_COMMA:
|
||||
text_alpha -= 16;
|
||||
if (text_alpha < 0)
|
||||
text_alpha = 0;
|
||||
break;
|
||||
|
||||
case KEY_PERIOD:
|
||||
text_alpha += 16;
|
||||
if (text_alpha > 255) text_alpha = 255;
|
||||
break;
|
||||
case KEY_PERIOD:
|
||||
text_alpha += 16;
|
||||
if (text_alpha > 255)
|
||||
text_alpha = 255;
|
||||
break;
|
||||
|
||||
case KEY_PAD7:
|
||||
c1++;
|
||||
if (c1 > Font_template.max_ascii) c1 = Font_template.min_ascii;
|
||||
break;
|
||||
case KEY_PAD7:
|
||||
c1++;
|
||||
if (c1 > Font_template.max_ascii)
|
||||
c1 = Font_template.min_ascii;
|
||||
break;
|
||||
|
||||
case KEY_PAD9:
|
||||
c2++;
|
||||
if (c2 > Font_template.max_ascii) c2 = Font_template.min_ascii;
|
||||
break;
|
||||
case KEY_PAD9:
|
||||
c2++;
|
||||
if (c2 > Font_template.max_ascii)
|
||||
c2 = Font_template.min_ascii;
|
||||
break;
|
||||
|
||||
case KEY_PAD1:
|
||||
c1--;
|
||||
if (c1 < Font_template.min_ascii) c1 = Font_template.max_ascii;
|
||||
break;
|
||||
case KEY_PAD1:
|
||||
c1--;
|
||||
if (c1 < Font_template.min_ascii)
|
||||
c1 = Font_template.max_ascii;
|
||||
break;
|
||||
|
||||
case KEY_PAD3:
|
||||
c2--;
|
||||
if (c2 < Font_template.min_ascii) c2 = Font_template.max_ascii;
|
||||
break;
|
||||
case KEY_PAD3:
|
||||
c2--;
|
||||
if (c2 < Font_template.min_ascii)
|
||||
c2 = Font_template.max_ascii;
|
||||
break;
|
||||
|
||||
case KEY_PAD4:
|
||||
d = fonttool_get_kerning(c1,c2);
|
||||
fonttool_set_kerning(c1, c2, d-1);
|
||||
grfont_SetKerning(font_handle, Font_template.kern_data);
|
||||
break;
|
||||
case KEY_PAD4:
|
||||
d = fonttool_get_kerning(c1, c2);
|
||||
fonttool_set_kerning(c1, c2, d - 1);
|
||||
grfont_SetKerning(font_handle, Font_template.kern_data);
|
||||
break;
|
||||
|
||||
case KEY_PAD5:
|
||||
fonttool_set_kerning(c1,c2,0);
|
||||
break;
|
||||
case KEY_PAD5:
|
||||
fonttool_set_kerning(c1, c2, 0);
|
||||
break;
|
||||
|
||||
case KEY_PAD6:
|
||||
d = fonttool_get_kerning(c1,c2);
|
||||
fonttool_set_kerning(c1,c2,d+1);
|
||||
grfont_SetKerning(font_handle, Font_template.kern_data);
|
||||
break;
|
||||
case KEY_PAD6:
|
||||
d = fonttool_get_kerning(c1, c2);
|
||||
fonttool_set_kerning(c1, c2, d + 1);
|
||||
grfont_SetKerning(font_handle, Font_template.kern_data);
|
||||
break;
|
||||
|
||||
case KEY_PAD2:
|
||||
if ( current_pair < 0 ) {
|
||||
current_pair = last_good_pair;
|
||||
}
|
||||
case KEY_PAD2:
|
||||
if (current_pair < 0) {
|
||||
current_pair = last_good_pair;
|
||||
}
|
||||
|
||||
if (current_pair >= 0) {
|
||||
uint8_t *kern_data = &Font_template.kern_data[current_pair*3];
|
||||
if (kern_data[3] != 255) {
|
||||
current_pair++;
|
||||
kern_data = &Font_template.kern_data[current_pair*3];
|
||||
}
|
||||
c1 = kern_data[0];
|
||||
c2 = kern_data[1];
|
||||
}
|
||||
break;
|
||||
if (current_pair >= 0) {
|
||||
uint8_t *kern_data = &Font_template.kern_data[current_pair * 3];
|
||||
if (kern_data[3] != 255) {
|
||||
current_pair++;
|
||||
kern_data = &Font_template.kern_data[current_pair * 3];
|
||||
}
|
||||
c1 = kern_data[0];
|
||||
c2 = kern_data[1];
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_PAD8:
|
||||
if ( current_pair < 0 ) {
|
||||
current_pair = last_good_pair;
|
||||
}
|
||||
case KEY_PAD8:
|
||||
if (current_pair < 0) {
|
||||
current_pair = last_good_pair;
|
||||
}
|
||||
|
||||
if (current_pair >= 0) {
|
||||
uint8_t *kern_data = &Font_template.kern_data[current_pair*3];
|
||||
if (kern_data != Font_template.kern_data) {
|
||||
// gosh, comparing pointers like this may not be the best method...this is shitty code...
|
||||
current_pair--;
|
||||
kern_data = &Font_template.kern_data[current_pair*3];
|
||||
}
|
||||
c1 = kern_data[0];
|
||||
c2 = kern_data[1];
|
||||
}
|
||||
break;
|
||||
if (current_pair >= 0) {
|
||||
uint8_t *kern_data = &Font_template.kern_data[current_pair * 3];
|
||||
if (kern_data != Font_template.kern_data) {
|
||||
// gosh, comparing pointers like this may not be the best method...this is shitty code...
|
||||
current_pair--;
|
||||
kern_data = &Font_template.kern_data[current_pair * 3];
|
||||
}
|
||||
c1 = kern_data[0];
|
||||
c2 = kern_data[1];
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_R:
|
||||
red_comp = red_comp ? 0 : 255;
|
||||
break;
|
||||
case KEY_G:
|
||||
green_comp = green_comp ? 0 : 255;
|
||||
break;
|
||||
case KEY_B:
|
||||
blue_comp = blue_comp ? 0 : 255;
|
||||
break;
|
||||
}
|
||||
case KEY_R:
|
||||
red_comp = red_comp ? 0 : 255;
|
||||
break;
|
||||
case KEY_G:
|
||||
green_comp = green_comp ? 0 : 255;
|
||||
break;
|
||||
case KEY_B:
|
||||
blue_comp = blue_comp ? 0 : 255;
|
||||
break;
|
||||
}
|
||||
|
||||
// draw.
|
||||
text_color = GR_RGB(red_comp, green_comp, blue_comp);
|
||||
// draw.
|
||||
text_color = GR_RGB(red_comp, green_comp, blue_comp);
|
||||
|
||||
rend_StartFrame(0,0,FIXED_SCREEN_WIDTH,FIXED_SCREEN_HEIGHT,0);
|
||||
grtext_SetParameters(0,0,FIXED_SCREEN_WIDTH,FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetFont(font_handle);
|
||||
grtext_SetColor(text_color);
|
||||
grtext_SetAlpha((uint8_t)text_alpha);
|
||||
rend_StartFrame(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT, 0);
|
||||
grtext_SetParameters(0, 0, FIXED_SCREEN_WIDTH, FIXED_SCREEN_HEIGHT);
|
||||
grtext_SetFont(font_handle);
|
||||
grtext_SetColor(text_color);
|
||||
grtext_SetAlpha((uint8_t)text_alpha);
|
||||
|
||||
rend_ClearScreen(GR_BLACK);
|
||||
rend_DrawChunkedBitmap(&Editor_bkg, 0, 0, 255);
|
||||
rend_ClearScreen(GR_BLACK);
|
||||
rend_DrawChunkedBitmap(&Editor_bkg, 0, 0, 255);
|
||||
|
||||
grtext_Printf(240,210,"%c (%d)", c1, c1);
|
||||
grtext_Printf(340,210,"%c (%d)", c2, c2);
|
||||
grtext_Printf(240, 210, "%c (%d)", c1, c1);
|
||||
grtext_Printf(340, 210, "%c (%d)", c2, c2);
|
||||
|
||||
grtext_CenteredPrintf(0, 240, "Ham%c%crger", c1, c2);
|
||||
grtext_CenteredPrintf(0, 240, "Ham%c%crger", c1, c2);
|
||||
|
||||
grtext_CenteredPrintf(0, 270, "HAM%c%cRGER", c1, c2);
|
||||
grtext_CenteredPrintf(0, 270, "HAM%c%cRGER", c1, c2);
|
||||
|
||||
grtext_CenteredPrintf(0, 300, "Offset: %d pixels", fonttool_get_kerning(c1, c2));
|
||||
grtext_CenteredPrintf(0, 320, "Tracking: %d pixels", (int)Font_template.ch_tracking);
|
||||
{
|
||||
int th;
|
||||
th = grtext_GetTextHeight(SampleText);
|
||||
grtext_CenteredPrintf(0, 300, "Offset: %d pixels", fonttool_get_kerning(c1, c2));
|
||||
grtext_CenteredPrintf(0, 320, "Tracking: %d pixels", (int)Font_template.ch_tracking);
|
||||
{
|
||||
int th;
|
||||
th = grtext_GetTextHeight(SampleText);
|
||||
|
||||
grtext_Printf(10,350,SampleText);
|
||||
grtext_Printf(10,350+th+10, SampleText);
|
||||
}
|
||||
grtext_Printf(10, 350, SampleText);
|
||||
grtext_Printf(10, 350 + th + 10, SampleText);
|
||||
}
|
||||
|
||||
// display kerned pairs.
|
||||
int x = 5, y = 200, i, n, widest=0;
|
||||
int n_pairs=0, stop;
|
||||
int tmpp=-1;
|
||||
char kerntext[16];
|
||||
// display kerned pairs.
|
||||
int x = 5, y = 200, i, n, widest = 0;
|
||||
int n_pairs = 0, stop;
|
||||
int tmpp = -1;
|
||||
char kerntext[16];
|
||||
|
||||
if (Font_template.kern_data) {
|
||||
i=0;
|
||||
while (Font_template.kern_data[i] != 255)
|
||||
{
|
||||
n_pairs++;
|
||||
i+=KERNINFO_PAIR_SIZE;
|
||||
}
|
||||
}
|
||||
if (Font_template.kern_data) {
|
||||
i = 0;
|
||||
while (Font_template.kern_data[i] != 255) {
|
||||
n_pairs++;
|
||||
i += KERNINFO_PAIR_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
// update current pair values
|
||||
if ( current_pair >= n_pairs ) {
|
||||
current_pair = -1;
|
||||
}
|
||||
// update current pair values
|
||||
if (current_pair >= n_pairs) {
|
||||
current_pair = -1;
|
||||
}
|
||||
|
||||
fonttool_get_kerning(c1, c2, &tmpp );
|
||||
fonttool_get_kerning(c1, c2, &tmpp);
|
||||
|
||||
if ( tmpp != -1 ) {
|
||||
current_pair = tmpp;
|
||||
} else {
|
||||
if ( current_pair > -1 )
|
||||
last_good_pair = current_pair;
|
||||
current_pair = -1;
|
||||
}
|
||||
if (current_pair > -1) { current_item = current_pair; }
|
||||
if (current_item < 0) { current_item = 0; }
|
||||
if (current_item >= n_pairs) { current_item = n_pairs-1; }
|
||||
if (current_item < first_item) { first_item = current_item; }
|
||||
if (current_item >= (first_item+num_items_displayed)) { first_item = current_item-num_items_displayed+1; }
|
||||
if (n_pairs <= num_items_displayed) { first_item = 0; }
|
||||
stop = first_item+num_items_displayed;
|
||||
if (stop>n_pairs) stop = n_pairs;
|
||||
if (tmpp != -1) {
|
||||
current_pair = tmpp;
|
||||
} else {
|
||||
if (current_pair > -1)
|
||||
last_good_pair = current_pair;
|
||||
current_pair = -1;
|
||||
}
|
||||
if (current_pair > -1) {
|
||||
current_item = current_pair;
|
||||
}
|
||||
if (current_item < 0) {
|
||||
current_item = 0;
|
||||
}
|
||||
if (current_item >= n_pairs) {
|
||||
current_item = n_pairs - 1;
|
||||
}
|
||||
if (current_item < first_item) {
|
||||
first_item = current_item;
|
||||
}
|
||||
if (current_item >= (first_item + num_items_displayed)) {
|
||||
first_item = current_item - num_items_displayed + 1;
|
||||
}
|
||||
if (n_pairs <= num_items_displayed) {
|
||||
first_item = 0;
|
||||
}
|
||||
stop = first_item + num_items_displayed;
|
||||
if (stop > n_pairs)
|
||||
stop = n_pairs;
|
||||
|
||||
for (i=first_item,n=0; i<stop; i++)
|
||||
{
|
||||
int tw,th;
|
||||
ASSERT(Font_template.kern_data);
|
||||
uint8_t *kern_data = &Font_template.kern_data[i*3];
|
||||
if (i==current_pair) {
|
||||
rend_SetFlatColor(GR_RGB(255,0,0));
|
||||
rend_DrawLine(x,y,x+6,y+5);
|
||||
rend_DrawLine(x+6,y+5,x,y+8);
|
||||
rend_DrawLine(x,y+8,x,y);
|
||||
}
|
||||
sprintf(kerntext, "%c%c", kern_data[0], kern_data[1]);
|
||||
grtext_Puts(x+8,y,kerntext);
|
||||
n++;
|
||||
tw = grtext_GetTextLineWidth(kerntext) + 8;
|
||||
th = grtext_GetTextHeight(kerntext);
|
||||
if (tw > widest) {widest = tw; }
|
||||
y += th;
|
||||
if (y > 330) {
|
||||
y = 200;
|
||||
x += widest+5;
|
||||
if (x > 150) {
|
||||
num_items_displayed = n;
|
||||
break;
|
||||
}
|
||||
widest = 0;
|
||||
}
|
||||
}
|
||||
if (i == stop) { num_items_displayed++; }
|
||||
if (num_items_displayed < 1) {num_items_displayed = 1;}
|
||||
if (num_items_displayed > n_pairs) { num_items_displayed = n_pairs; }
|
||||
for (i = first_item, n = 0; i < stop; i++) {
|
||||
int tw, th;
|
||||
ASSERT(Font_template.kern_data);
|
||||
uint8_t *kern_data = &Font_template.kern_data[i * 3];
|
||||
if (i == current_pair) {
|
||||
rend_SetFlatColor(GR_RGB(255, 0, 0));
|
||||
rend_DrawLine(x, y, x + 6, y + 5);
|
||||
rend_DrawLine(x + 6, y + 5, x, y + 8);
|
||||
rend_DrawLine(x, y + 8, x, y);
|
||||
}
|
||||
sprintf(kerntext, "%c%c", kern_data[0], kern_data[1]);
|
||||
grtext_Puts(x + 8, y, kerntext);
|
||||
n++;
|
||||
tw = grtext_GetTextLineWidth(kerntext) + 8;
|
||||
th = grtext_GetTextHeight(kerntext);
|
||||
if (tw > widest) {
|
||||
widest = tw;
|
||||
}
|
||||
y += th;
|
||||
if (y > 330) {
|
||||
y = 200;
|
||||
x += widest + 5;
|
||||
if (x > 150) {
|
||||
num_items_displayed = n;
|
||||
break;
|
||||
}
|
||||
widest = 0;
|
||||
}
|
||||
}
|
||||
if (i == stop) {
|
||||
num_items_displayed++;
|
||||
}
|
||||
if (num_items_displayed < 1) {
|
||||
num_items_displayed = 1;
|
||||
}
|
||||
if (num_items_displayed > n_pairs) {
|
||||
num_items_displayed = n_pairs;
|
||||
}
|
||||
|
||||
grtext_Flush();
|
||||
rend_EndFrame();
|
||||
rend_Flip();
|
||||
}
|
||||
|
||||
grtext_Flush();
|
||||
rend_EndFrame();
|
||||
rend_Flip();
|
||||
}
|
||||
|
||||
grfont_FreeTemplate(&Font_template);
|
||||
grfont_Free(font_handle);
|
||||
bm_DestroyChunkedBitmap(&Editor_bkg);
|
||||
grfont_FreeTemplate(&Font_template);
|
||||
grfont_Free(font_handle);
|
||||
bm_DestroyChunkedBitmap(&Editor_bkg);
|
||||
}
|
||||
|
||||
void FontKernDump(const char *fnt_file_name) {
|
||||
if (!grfont_LoadTemplate((char *)fnt_file_name, &Font_template)) {
|
||||
Error("Error loading font template %s", fnt_file_name);
|
||||
}
|
||||
|
||||
if (Font_template.kern_data) {
|
||||
FILE *fp;
|
||||
char filename[_MAX_PATH];
|
||||
|
||||
void FontKernDump(const char *fnt_file_name)
|
||||
{
|
||||
if (!grfont_LoadTemplate((char *)fnt_file_name, &Font_template)) {
|
||||
Error("Error loading font template %s", fnt_file_name);
|
||||
}
|
||||
sprintf(filename, "%s.kern", fnt_file_name);
|
||||
fp = fopen(filename, "wt");
|
||||
if (fp) {
|
||||
uint8_t *kern_data = Font_template.kern_data;
|
||||
while (kern_data[0] != 255) {
|
||||
uint8_t c1 = kern_data[0];
|
||||
uint8_t c2 = kern_data[1];
|
||||
int8_t delta = (int8_t)kern_data[2];
|
||||
|
||||
if (Font_template.kern_data) {
|
||||
FILE *fp;
|
||||
char filename[_MAX_PATH];
|
||||
fprintf(fp, "%c %c => %d spacing\n", c1, c2, (int)delta);
|
||||
kern_data += 3;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(filename, "%s.kern", fnt_file_name);
|
||||
fp = fopen(filename, "wt");
|
||||
if (fp) {
|
||||
uint8_t *kern_data = Font_template.kern_data;
|
||||
while (kern_data[0] != 255)
|
||||
{
|
||||
uint8_t c1 = kern_data[0];
|
||||
uint8_t c2 = kern_data[1];
|
||||
int8_t delta = (int8_t)kern_data[2];
|
||||
|
||||
fprintf(fp, "%c %c => %d spacing\n", c1,c2,(int)delta);
|
||||
kern_data += 3;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
grfont_FreeTemplate(&Font_template);
|
||||
grfont_FreeTemplate(&Font_template);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// FontEditor.pch will be the pre-compiled header
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -35,70 +35,60 @@
|
||||
#include "mono.h"
|
||||
#include <string.h>
|
||||
|
||||
static int TotalArgs=0;
|
||||
static int TotalArgs = 0;
|
||||
char GameArgs[MAX_ARGS][MAX_CHARS_PER_ARG];
|
||||
|
||||
// Gathers all arguments
|
||||
void GatherArgs (const char *str)
|
||||
{
|
||||
int i,t,curarg=1;
|
||||
int len=strlen(str);
|
||||
bool gotquote = false;
|
||||
void GatherArgs(const char *str) {
|
||||
int i, t, curarg = 1;
|
||||
int len = strlen(str);
|
||||
bool gotquote = false;
|
||||
|
||||
for (t=0,i=0;i<len;i++)
|
||||
{
|
||||
if(t==0)
|
||||
{
|
||||
if(str[i]=='\"')
|
||||
{
|
||||
gotquote = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(gotquote)
|
||||
{
|
||||
if (str[i]!='\"' && str[i]!=0)
|
||||
GameArgs[curarg][t++]=str[i];
|
||||
else
|
||||
{
|
||||
GameArgs[curarg][t]=0;
|
||||
t=0;
|
||||
mprintf(0,"Arg %d is %s\n",curarg,GameArgs[curarg]);
|
||||
gotquote = false;
|
||||
curarg++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (str[i]!=' ' && str[i]!=0)
|
||||
GameArgs[curarg][t++]=str[i];
|
||||
else
|
||||
{
|
||||
GameArgs[curarg][t]=0;
|
||||
t=0;
|
||||
mprintf(0,"Arg %d is %s\n",curarg,GameArgs[curarg]);
|
||||
curarg++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (t = 0, i = 0; i < len; i++) {
|
||||
if (t == 0) {
|
||||
if (str[i] == '\"') {
|
||||
gotquote = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (gotquote) {
|
||||
if (str[i] != '\"' && str[i] != 0)
|
||||
GameArgs[curarg][t++] = str[i];
|
||||
else {
|
||||
GameArgs[curarg][t] = 0;
|
||||
t = 0;
|
||||
mprintf(0, "Arg %d is %s\n", curarg, GameArgs[curarg]);
|
||||
gotquote = false;
|
||||
curarg++;
|
||||
}
|
||||
} else {
|
||||
if (str[i] != ' ' && str[i] != 0)
|
||||
GameArgs[curarg][t++] = str[i];
|
||||
else {
|
||||
GameArgs[curarg][t] = 0;
|
||||
t = 0;
|
||||
mprintf(0, "Arg %d is %s\n", curarg, GameArgs[curarg]);
|
||||
curarg++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GameArgs[curarg][t]=0;
|
||||
curarg++;
|
||||
TotalArgs=curarg;
|
||||
GameArgs[curarg][t] = 0;
|
||||
curarg++;
|
||||
TotalArgs = curarg;
|
||||
|
||||
// clear out argument list.
|
||||
for(;curarg < MAX_ARGS; curarg++)
|
||||
GameArgs[curarg][0] = 0;
|
||||
// clear out argument list.
|
||||
for (; curarg < MAX_ARGS; curarg++)
|
||||
GameArgs[curarg][0] = 0;
|
||||
}
|
||||
|
||||
// Returns index of argument sought, or 0 if not found
|
||||
int FindArg (const char *which)
|
||||
{
|
||||
int FindArg(const char *which) {
|
||||
int i;
|
||||
|
||||
for (i=1;i<=TotalArgs;i++)
|
||||
if (stricmp (which,GameArgs[i])==0)
|
||||
return (i);
|
||||
for (i = 1; i <= TotalArgs; i++)
|
||||
if (stricmp(which, GameArgs[i]) == 0)
|
||||
return (i);
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "appdatabase.h"
|
||||
|
||||
int paged_in_num=0;
|
||||
int paged_in_count=0;
|
||||
class oeAppDatabase *Database=NULL;
|
||||
int paged_in_num = 0;
|
||||
int paged_in_count = 0;
|
||||
class oeAppDatabase *Database = NULL;
|
||||
bool Force_one_texture = false;
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// briefinglocalizer.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
@@ -28,15 +28,14 @@
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// briefinglocalizer.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
@@ -33,17 +33,15 @@ static char THIS_FILE[] = __FILE__;
|
||||
// CBriefinglocalizerApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CBriefinglocalizerApp, CWinApp)
|
||||
//{{AFX_MSG_MAP(CBriefinglocalizerApp)
|
||||
//}}AFX_MSG
|
||||
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
||||
//{{AFX_MSG_MAP(CBriefinglocalizerApp)
|
||||
//}}AFX_MSG
|
||||
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBriefinglocalizerApp construction
|
||||
|
||||
CBriefinglocalizerApp::CBriefinglocalizerApp()
|
||||
{
|
||||
}
|
||||
CBriefinglocalizerApp::CBriefinglocalizerApp() {}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// The one and only CBriefinglocalizerApp object
|
||||
@@ -53,31 +51,26 @@ CBriefinglocalizerApp theApp;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBriefinglocalizerApp initialization
|
||||
|
||||
BOOL CBriefinglocalizerApp::InitInstance()
|
||||
{
|
||||
// Standard initialization
|
||||
|
||||
SetRegistryKey(_T("Descent 3 Briefing Localizer"));
|
||||
AfxInitRichEdit( );
|
||||
BOOL CBriefinglocalizerApp::InitInstance() {
|
||||
// Standard initialization
|
||||
|
||||
SetRegistryKey(_T("Descent 3 Briefing Localizer"));
|
||||
AfxInitRichEdit();
|
||||
|
||||
#ifdef _AFXDLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
#else
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
#endif
|
||||
|
||||
CBriefinglocalizerDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
int nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
}
|
||||
CBriefinglocalizerDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
int nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK) {
|
||||
} else if (nResponse == IDCANCEL) {
|
||||
}
|
||||
|
||||
// Since the dialog has been closed, return FALSE so that we exit the
|
||||
// application, rather than start the application's message pump.
|
||||
return FALSE;
|
||||
// Since the dialog has been closed, return FALSE so that we exit the
|
||||
// application, rather than start the application's message pump.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// briefinglocalizer.h : main header file for the BRIEFINGLOCALIZER application
|
||||
//
|
||||
@@ -27,36 +27,34 @@
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBriefinglocalizerApp:
|
||||
// See briefinglocalizer.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CBriefinglocalizerApp : public CWinApp
|
||||
{
|
||||
class CBriefinglocalizerApp : public CWinApp {
|
||||
public:
|
||||
CBriefinglocalizerApp();
|
||||
CBriefinglocalizerApp();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CBriefinglocalizerApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CBriefinglocalizerApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Implementation
|
||||
|
||||
//{{AFX_MSG(CBriefinglocalizerApp)
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CBriefinglocalizerApp)
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// briefinglocalizerDlg.cpp : implementation file
|
||||
//
|
||||
@@ -32,440 +32,382 @@
|
||||
#include <stdio.h>
|
||||
#include <direct.h>
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define TITLE_TAG "$title \""
|
||||
#define TITLE_TAG_LENGTH strlen(TITLE_TAG)
|
||||
#define TITLE_TAG "$title \""
|
||||
#define TITLE_TAG_LENGTH strlen(TITLE_TAG)
|
||||
|
||||
#define TEXT_START_TAG "$text"
|
||||
#define TEXT_START_TAG_LEN strlen(TEXT_START_TAG)
|
||||
#define TEXT_START_TAG "$text"
|
||||
#define TEXT_START_TAG_LEN strlen(TEXT_START_TAG)
|
||||
|
||||
#define TEXT_SHOW_TAG "show"
|
||||
#define TEXT_SHOW_TAG_LEN strlen(TEXT_SHOW_TAG)
|
||||
#define TEXT_SHOW_TAG "show"
|
||||
#define TEXT_SHOW_TAG_LEN strlen(TEXT_SHOW_TAG)
|
||||
|
||||
#define TEXT_END_TAG "$endtext"
|
||||
#define TEXT_END_TAG_TAG_LEN strlen(TEXT_END_TAG)
|
||||
|
||||
#define TEXT_END_TAG "$endtext"
|
||||
#define TEXT_END_TAG_TAG_LEN strlen(TEXT_END_TAG)
|
||||
|
||||
#define FIND_NEXT_LINE(a,b) do{ while( ((b[a]==0x0a) || (b[a]==0x0d)) && (a<(b).GetLength()) ) a++; }while(0)
|
||||
//a = (b).FindOneOf("\x0a\x0d"); if(a!=-1)
|
||||
#define FIND_NEXT_LINE(a, b) \
|
||||
do { \
|
||||
while (((b[a] == 0x0a) || (b[a] == 0x0d)) && (a < (b).GetLength())) \
|
||||
a++; \
|
||||
} while (0)
|
||||
// a = (b).FindOneOf("\x0a\x0d"); if(a!=-1)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBriefinglocalizerDlg dialog
|
||||
|
||||
CBriefinglocalizerDlg::CBriefinglocalizerDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CBriefinglocalizerDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CBriefinglocalizerDlg)
|
||||
m_Title = _T("");
|
||||
m_Text = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||
m_FileChanged = false;
|
||||
m_CurTextLeft = 0;
|
||||
m_CurTextRight = 0;
|
||||
m_BigStringTextLower.Empty();
|
||||
m_BigTextString.Empty();
|
||||
CBriefinglocalizerDlg::CBriefinglocalizerDlg(CWnd *pParent /*=NULL*/) : CDialog(CBriefinglocalizerDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CBriefinglocalizerDlg)
|
||||
m_Title = _T("");
|
||||
m_Text = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||
m_FileChanged = false;
|
||||
m_CurTextLeft = 0;
|
||||
m_CurTextRight = 0;
|
||||
m_BigStringTextLower.Empty();
|
||||
m_BigTextString.Empty();
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CBriefinglocalizerDlg)
|
||||
DDX_Control(pDX, IDC_TEXT, m_RichText);
|
||||
DDX_Text(pDX, IDC_TITLE, m_Title);
|
||||
DDX_Text(pDX, IDC_TEXT, m_Text);
|
||||
//}}AFX_DATA_MAP
|
||||
void CBriefinglocalizerDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CBriefinglocalizerDlg)
|
||||
DDX_Control(pDX, IDC_TEXT, m_RichText);
|
||||
DDX_Text(pDX, IDC_TITLE, m_Title);
|
||||
DDX_Text(pDX, IDC_TEXT, m_Text);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CBriefinglocalizerDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CBriefinglocalizerDlg)
|
||||
ON_WM_PAINT()
|
||||
ON_WM_QUERYDRAGICON()
|
||||
ON_BN_CLICKED(IDC_NEXT, OnNext)
|
||||
ON_BN_CLICKED(IDC_PREV, OnPrev)
|
||||
ON_BN_CLICKED(IDC_QUIT, OnQuit)
|
||||
ON_BN_CLICKED(IDC_SAVE, OnSave)
|
||||
ON_EN_KILLFOCUS(IDC_TITLE, OnKillfocusTitle)
|
||||
ON_EN_CHANGE(IDC_TEXT, OnChangeText)
|
||||
ON_EN_CHANGE(IDC_TITLE, OnChangeTitle)
|
||||
ON_NOTIFY(NM_KILLFOCUS, IDC_TEXT, OnKillfocusText)
|
||||
ON_NOTIFY(EN_KILLFOCUS, IDC_TEXT, OnKillfocusText)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CBriefinglocalizerDlg)
|
||||
ON_WM_PAINT()
|
||||
ON_WM_QUERYDRAGICON()
|
||||
ON_BN_CLICKED(IDC_NEXT, OnNext)
|
||||
ON_BN_CLICKED(IDC_PREV, OnPrev)
|
||||
ON_BN_CLICKED(IDC_QUIT, OnQuit)
|
||||
ON_BN_CLICKED(IDC_SAVE, OnSave)
|
||||
ON_EN_KILLFOCUS(IDC_TITLE, OnKillfocusTitle)
|
||||
ON_EN_CHANGE(IDC_TEXT, OnChangeText)
|
||||
ON_EN_CHANGE(IDC_TITLE, OnChangeTitle)
|
||||
ON_NOTIFY(NM_KILLFOCUS, IDC_TEXT, OnKillfocusText)
|
||||
ON_NOTIFY(EN_KILLFOCUS, IDC_TEXT, OnKillfocusText)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBriefinglocalizerDlg message handlers
|
||||
|
||||
BOOL CBriefinglocalizerDlg::OnInitDialog()
|
||||
{
|
||||
static char sztemppath[_MAX_PATH*2] = ".";
|
||||
static char sztempfile[_MAX_PATH*2] = "tempfile.tmp";
|
||||
char path[_MAX_PATH*2];
|
||||
char drive[10];
|
||||
CString savepath;
|
||||
CString DefaultPath;
|
||||
BOOL CBriefinglocalizerDlg::OnInitDialog() {
|
||||
static char sztemppath[_MAX_PATH * 2] = ".";
|
||||
static char sztempfile[_MAX_PATH * 2] = "tempfile.tmp";
|
||||
char path[_MAX_PATH * 2];
|
||||
char drive[10];
|
||||
CString savepath;
|
||||
CString DefaultPath;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
m_RichText.SetEventMask(ENM_CHANGE);
|
||||
|
||||
m_RichText.SetEventMask(ENM_CHANGE);
|
||||
SetIcon(m_hIcon, TRUE); // Set big icon
|
||||
SetIcon(m_hIcon, FALSE); // Set small icon
|
||||
|
||||
SetIcon(m_hIcon, TRUE); // Set big icon
|
||||
SetIcon(m_hIcon, FALSE); // Set small icon
|
||||
CFileDialog *fd;
|
||||
|
||||
CFileDialog *fd;
|
||||
DefaultPath = AfxGetApp()->GetProfileString("Defaults", "LastDir", "");
|
||||
|
||||
static char szFilter[] = "Descent 3 Briefing (*.br?)|*.br?|All Files (*.*)|*.*||";
|
||||
|
||||
DefaultPath = AfxGetApp()->GetProfileString("Defaults","LastDir","");
|
||||
_chdir(DefaultPath);
|
||||
fd = new CFileDialog(true, ".brf", NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szFilter);
|
||||
if (fd->DoModal() == IDCANCEL) {
|
||||
delete fd;
|
||||
CDialog::OnCancel();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static char szFilter[] = "Descent 3 Briefing (*.br?)|*.br?|All Files (*.*)|*.*||";
|
||||
GetTempPath(_MAX_PATH * 2, sztemppath);
|
||||
|
||||
_chdir(DefaultPath);
|
||||
fd = new CFileDialog(true,".brf",NULL,OFN_FILEMUSTEXIST|OFN_HIDEREADONLY,szFilter);
|
||||
if (fd->DoModal() == IDCANCEL)
|
||||
{
|
||||
delete fd;
|
||||
CDialog::OnCancel();
|
||||
return FALSE;
|
||||
}
|
||||
m_RealFileName = fd->GetPathName();
|
||||
|
||||
GetTempPath(_MAX_PATH*2,sztemppath);
|
||||
_splitpath(m_RealFileName, drive, path, NULL, NULL);
|
||||
|
||||
m_RealFileName = fd->GetPathName();
|
||||
savepath = drive;
|
||||
savepath += path;
|
||||
|
||||
_splitpath(m_RealFileName,drive,path,NULL,NULL);
|
||||
AfxGetApp()->WriteProfileString("Defaults", "LastDir", savepath);
|
||||
|
||||
GetTempFileName(sztemppath, "d3brf", 0x42, sztempfile);
|
||||
|
||||
savepath = drive;
|
||||
savepath += path;
|
||||
m_TempFileName = sztempfile;
|
||||
|
||||
AfxGetApp()->WriteProfileString("Defaults","LastDir",savepath);
|
||||
delete fd;
|
||||
fd = NULL;
|
||||
FILE *infile;
|
||||
struct _stat buf;
|
||||
int result = _stat(m_RealFileName, &buf);
|
||||
if (result != 0) {
|
||||
AfxMessageBox("Error: Cannot determine file size!", MB_OK | MB_ICONSTOP);
|
||||
goto do_error;
|
||||
}
|
||||
infile = fopen(m_RealFileName, "rt");
|
||||
if (infile) {
|
||||
CString newtitle;
|
||||
|
||||
GetTempFileName(sztemppath,"d3brf",0x42,sztempfile);
|
||||
newtitle.Format("Outrage Briefing file localizer -- %s", m_RealFileName);
|
||||
SetWindowText(newtitle);
|
||||
|
||||
m_TempFileName = sztempfile;
|
||||
char *szbuf;
|
||||
szbuf = (char *)malloc(buf.st_size);
|
||||
fread(szbuf, buf.st_size, 1, infile);
|
||||
fclose(infile);
|
||||
m_BigTextString = szbuf;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
|
||||
delete fd;
|
||||
fd = NULL;
|
||||
FILE *infile;
|
||||
struct _stat buf;
|
||||
int result = _stat( m_RealFileName, &buf );
|
||||
if(result!=0)
|
||||
{
|
||||
AfxMessageBox("Error: Cannot determine file size!",MB_OK|MB_ICONSTOP);
|
||||
goto do_error;
|
||||
}
|
||||
infile = fopen(m_RealFileName,"rt");
|
||||
if(infile)
|
||||
{
|
||||
CString newtitle;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
|
||||
newtitle.Format("Outrage Briefing file localizer -- %s",m_RealFileName);
|
||||
SetWindowText(newtitle);
|
||||
delete szbuf;
|
||||
|
||||
char *szbuf;
|
||||
szbuf = (char *)malloc(buf.st_size);
|
||||
fread(szbuf,buf.st_size,1,infile);
|
||||
fclose(infile);
|
||||
m_BigTextString = szbuf;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_TitleLeft = m_BigStringTextLower.Find(TITLE_TAG);
|
||||
if (m_TitleLeft != -1) {
|
||||
m_TitleRight = m_BigStringTextLower.Find("\"", m_TitleLeft + TITLE_TAG_LENGTH);
|
||||
m_Title = m_BigTextString.Mid(TITLE_TAG_LENGTH + m_TitleLeft, (m_TitleRight - (m_TitleLeft + TITLE_TAG_LENGTH)));
|
||||
} else {
|
||||
AfxMessageBox("Warning: There is no title in this briefing file!", MB_OK);
|
||||
GetDlgItem(IDC_TITLE)->EnableWindow(false);
|
||||
}
|
||||
|
||||
m_BigStringTextLower.MakeLower();
|
||||
// Now I need to find the first text item!
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_START_TAG);
|
||||
if (m_CurTextLeft != -1) {
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_SHOW_TAG, m_CurTextLeft);
|
||||
if (m_CurTextLeft != -1) {
|
||||
m_CurTextRight = m_BigStringTextLower.Find(TEXT_END_TAG, m_CurTextLeft + TEXT_SHOW_TAG_LEN);
|
||||
m_CurTextLeft += TEXT_SHOW_TAG_LEN;
|
||||
FIND_NEXT_LINE(m_CurTextLeft, m_BigTextString);
|
||||
m_Text = m_BigTextString.Mid(m_CurTextLeft, (m_CurTextRight - (m_CurTextLeft)-1));
|
||||
}
|
||||
} else {
|
||||
AfxMessageBox("Warning: There is no text in this briefing file!", MB_OK);
|
||||
GetDlgItem(IDC_NEXT)->EnableWindow(false);
|
||||
GetDlgItem(IDC_PREV)->EnableWindow(false);
|
||||
GetDlgItem(IDC_TEXT)->EnableWindow(false);
|
||||
}
|
||||
|
||||
delete szbuf;
|
||||
m_CurrentText = 1;
|
||||
|
||||
m_TitleLeft = m_BigStringTextLower.Find(TITLE_TAG);
|
||||
if(m_TitleLeft!=-1)
|
||||
{
|
||||
m_TitleRight = m_BigStringTextLower.Find("\"",m_TitleLeft+TITLE_TAG_LENGTH);
|
||||
m_Title = m_BigTextString.Mid(TITLE_TAG_LENGTH+m_TitleLeft,(m_TitleRight-(m_TitleLeft+TITLE_TAG_LENGTH)));
|
||||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox("Warning: There is no title in this briefing file!",MB_OK);
|
||||
GetDlgItem(IDC_TITLE)->EnableWindow(false);
|
||||
}
|
||||
// Disable the previous button
|
||||
GetDlgItem(IDC_PREV)->EnableWindow(false);
|
||||
|
||||
UpdateData(false);
|
||||
|
||||
//Now I need to find the first text item!
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_START_TAG);
|
||||
if(m_CurTextLeft!=-1)
|
||||
{
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_SHOW_TAG,m_CurTextLeft);
|
||||
if(m_CurTextLeft!=-1)
|
||||
{
|
||||
m_CurTextRight = m_BigStringTextLower.Find(TEXT_END_TAG,m_CurTextLeft+TEXT_SHOW_TAG_LEN);
|
||||
m_CurTextLeft += TEXT_SHOW_TAG_LEN;
|
||||
FIND_NEXT_LINE(m_CurTextLeft,m_BigTextString);
|
||||
m_Text = m_BigTextString.Mid(m_CurTextLeft,(m_CurTextRight-(m_CurTextLeft)-1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox("Warning: There is no text in this briefing file!",MB_OK);
|
||||
GetDlgItem(IDC_NEXT)->EnableWindow(false);
|
||||
GetDlgItem(IDC_PREV)->EnableWindow(false);
|
||||
GetDlgItem(IDC_TEXT)->EnableWindow(false);
|
||||
}
|
||||
|
||||
m_CurrentText = 1;
|
||||
|
||||
//Disable the previous button
|
||||
GetDlgItem(IDC_PREV)->EnableWindow(false);
|
||||
|
||||
UpdateData(false);
|
||||
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
do_error:
|
||||
|
||||
AfxMessageBox("Error: Cannot open specified file!",MB_OK|MB_ICONSTOP);
|
||||
CDialog::OnCancel();
|
||||
return TRUE;
|
||||
|
||||
AfxMessageBox("Error: Cannot open specified file!", MB_OK | MB_ICONSTOP);
|
||||
CDialog::OnCancel();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// If you add a minimize button to your dialog, you will need the code below
|
||||
// to draw the icon. For MFC applications using the document/view model,
|
||||
// this is automatically done for you by the framework.
|
||||
|
||||
void CBriefinglocalizerDlg::OnPaint()
|
||||
{
|
||||
if (IsIconic())
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
void CBriefinglocalizerDlg::OnPaint() {
|
||||
if (IsIconic()) {
|
||||
CPaintDC dc(this); // device context for painting
|
||||
|
||||
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
|
||||
SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0);
|
||||
|
||||
// Center icon in client rectangle
|
||||
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||||
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
int x = (rect.Width() - cxIcon + 1) / 2;
|
||||
int y = (rect.Height() - cyIcon + 1) / 2;
|
||||
// Center icon in client rectangle
|
||||
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||||
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
int x = (rect.Width() - cxIcon + 1) / 2;
|
||||
int y = (rect.Height() - cyIcon + 1) / 2;
|
||||
|
||||
// Draw the icon
|
||||
dc.DrawIcon(x, y, m_hIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
CDialog::OnPaint();
|
||||
}
|
||||
// Draw the icon
|
||||
dc.DrawIcon(x, y, m_hIcon);
|
||||
} else {
|
||||
CDialog::OnPaint();
|
||||
}
|
||||
}
|
||||
|
||||
HCURSOR CBriefinglocalizerDlg::OnQueryDragIcon()
|
||||
{
|
||||
return (HCURSOR) m_hIcon;
|
||||
HCURSOR CBriefinglocalizerDlg::OnQueryDragIcon() { return (HCURSOR)m_hIcon; }
|
||||
|
||||
void CBriefinglocalizerDlg::OnNext() {
|
||||
// Get the text out of the dialog...
|
||||
UpdateData(true);
|
||||
|
||||
CString left, right;
|
||||
|
||||
left = m_BigTextString.Left(m_CurTextLeft);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength() - m_CurTextRight);
|
||||
|
||||
m_BigTextString = left + m_Text + "\n" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
|
||||
m_CurTextRight = m_CurTextLeft + m_Text.GetLength();
|
||||
|
||||
int saveleft = m_CurTextLeft;
|
||||
// Now I need to find the next text item!
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_START_TAG, m_CurTextRight);
|
||||
if (m_CurTextLeft != -1) {
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_SHOW_TAG, m_CurTextLeft);
|
||||
if (m_CurTextLeft != -1) {
|
||||
m_CurTextRight = m_BigStringTextLower.Find(TEXT_END_TAG, m_CurTextLeft + TEXT_SHOW_TAG_LEN);
|
||||
m_CurTextLeft += TEXT_SHOW_TAG_LEN;
|
||||
FIND_NEXT_LINE(m_CurTextLeft, m_BigTextString);
|
||||
m_Text = m_BigTextString.Mid(m_CurTextLeft, (m_CurTextRight - (m_CurTextLeft)-1));
|
||||
GetDlgItem(IDC_PREV)->EnableWindow(true);
|
||||
m_CurrentText++;
|
||||
}
|
||||
} else {
|
||||
m_CurTextLeft = saveleft;
|
||||
GetDlgItem(IDC_NEXT)->EnableWindow(false);
|
||||
}
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnNext()
|
||||
{
|
||||
//Get the text out of the dialog...
|
||||
UpdateData(true);
|
||||
void CBriefinglocalizerDlg::OnPrev() {
|
||||
UpdateData(true);
|
||||
|
||||
CString left,right;
|
||||
CString left, right;
|
||||
|
||||
left = m_BigTextString.Left(m_CurTextLeft);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength()-m_CurTextRight);
|
||||
left = m_BigTextString.Left(m_CurTextLeft);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength() - m_CurTextRight);
|
||||
|
||||
m_BigTextString = left + m_Text + "\n" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
m_BigTextString = left + m_Text + "\n" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
|
||||
m_CurTextRight = 0;
|
||||
m_CurTextLeft = 0;
|
||||
|
||||
m_CurTextRight = m_CurTextLeft + m_Text.GetLength();
|
||||
m_CurrentText--;
|
||||
|
||||
int saveleft = m_CurTextLeft;
|
||||
//Now I need to find the next text item!
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_START_TAG,m_CurTextRight);
|
||||
if(m_CurTextLeft!=-1)
|
||||
{
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_SHOW_TAG,m_CurTextLeft);
|
||||
if(m_CurTextLeft!=-1)
|
||||
{
|
||||
m_CurTextRight = m_BigStringTextLower.Find(TEXT_END_TAG,m_CurTextLeft+TEXT_SHOW_TAG_LEN);
|
||||
m_CurTextLeft += TEXT_SHOW_TAG_LEN;
|
||||
FIND_NEXT_LINE(m_CurTextLeft,m_BigTextString);
|
||||
m_Text = m_BigTextString.Mid(m_CurTextLeft,(m_CurTextRight-(m_CurTextLeft)-1));
|
||||
GetDlgItem(IDC_PREV)->EnableWindow(true);
|
||||
m_CurrentText++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurTextLeft = saveleft;
|
||||
GetDlgItem(IDC_NEXT)->EnableWindow(false);
|
||||
}
|
||||
UpdateData(false);
|
||||
int count = 0;
|
||||
// Rewind to the previous item
|
||||
while (count != m_CurrentText) {
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_START_TAG, m_CurTextRight);
|
||||
if (m_CurTextLeft != -1) {
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_SHOW_TAG, m_CurTextLeft);
|
||||
if (m_CurTextLeft != -1) {
|
||||
m_CurTextRight = m_BigStringTextLower.Find(TEXT_END_TAG, m_CurTextLeft + TEXT_SHOW_TAG_LEN);
|
||||
m_CurTextLeft += TEXT_SHOW_TAG_LEN;
|
||||
FIND_NEXT_LINE(m_CurTextLeft, m_BigTextString);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
m_Text = m_BigTextString.Mid(m_CurTextLeft, (m_CurTextRight - (m_CurTextLeft)));
|
||||
|
||||
GetDlgItem(IDC_NEXT)->EnableWindow(true);
|
||||
if (m_CurrentText <= 1) {
|
||||
// Disable the previous button
|
||||
GetDlgItem(IDC_PREV)->EnableWindow(false);
|
||||
}
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnPrev()
|
||||
{
|
||||
UpdateData(true);
|
||||
|
||||
CString left,right;
|
||||
|
||||
left = m_BigTextString.Left(m_CurTextLeft);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength()-m_CurTextRight);
|
||||
|
||||
m_BigTextString = left + m_Text + "\n" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
|
||||
|
||||
m_CurTextRight = 0;
|
||||
m_CurTextLeft = 0;
|
||||
|
||||
m_CurrentText--;
|
||||
|
||||
int count = 0;
|
||||
//Rewind to the previous item
|
||||
while(count!=m_CurrentText)
|
||||
{
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_START_TAG,m_CurTextRight);
|
||||
if(m_CurTextLeft!=-1)
|
||||
{
|
||||
m_CurTextLeft = m_BigStringTextLower.Find(TEXT_SHOW_TAG,m_CurTextLeft);
|
||||
if(m_CurTextLeft!=-1)
|
||||
{
|
||||
m_CurTextRight = m_BigStringTextLower.Find(TEXT_END_TAG,m_CurTextLeft+TEXT_SHOW_TAG_LEN);
|
||||
m_CurTextLeft += TEXT_SHOW_TAG_LEN;
|
||||
FIND_NEXT_LINE(m_CurTextLeft,m_BigTextString);
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
m_Text = m_BigTextString.Mid(m_CurTextLeft,(m_CurTextRight-(m_CurTextLeft)));
|
||||
|
||||
GetDlgItem(IDC_NEXT)->EnableWindow(true);
|
||||
if(m_CurrentText<=1)
|
||||
{
|
||||
//Disable the previous button
|
||||
GetDlgItem(IDC_PREV)->EnableWindow(false);
|
||||
}
|
||||
UpdateData(false);
|
||||
void CBriefinglocalizerDlg::OnQuit() {
|
||||
// See if the file has changed since it was last saved
|
||||
if (m_FileChanged) {
|
||||
int res = AfxMessageBox("Briefing has changed, would you like to save your changes?", MB_YESNOCANCEL);
|
||||
switch (res) {
|
||||
case IDYES:
|
||||
// Prompt to save if it has
|
||||
OnSave();
|
||||
break;
|
||||
case IDNO:
|
||||
break;
|
||||
case IDCANCEL:
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnQuit()
|
||||
{
|
||||
//See if the file has changed since it was last saved
|
||||
if(m_FileChanged)
|
||||
{
|
||||
int res = AfxMessageBox("Briefing has changed, would you like to save your changes?",MB_YESNOCANCEL);
|
||||
switch(res)
|
||||
{
|
||||
case IDYES:
|
||||
//Prompt to save if it has
|
||||
OnSave();
|
||||
break;
|
||||
case IDNO:
|
||||
break;
|
||||
case IDCANCEL:
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
CDialog::OnCancel();
|
||||
|
||||
void CBriefinglocalizerDlg::OnSave() {
|
||||
// Update the big string
|
||||
CString testfile;
|
||||
FILE *outfile;
|
||||
testfile = m_RealFileName; // + ".test";
|
||||
outfile = fopen(testfile, "wt");
|
||||
if (outfile) {
|
||||
fwrite(LPCSTR(m_BigTextString), m_BigTextString.GetLength(), 1, outfile);
|
||||
m_FileChanged = false;
|
||||
fclose(outfile);
|
||||
} else {
|
||||
AfxMessageBox("Error: Unable to write to file!", MB_OK);
|
||||
}
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnSave()
|
||||
{
|
||||
//Update the big string
|
||||
CString testfile;
|
||||
FILE *outfile;
|
||||
testfile = m_RealFileName;// + ".test";
|
||||
outfile = fopen(testfile,"wt");
|
||||
if(outfile)
|
||||
{
|
||||
fwrite(LPCSTR(m_BigTextString),m_BigTextString.GetLength(),1,outfile);
|
||||
m_FileChanged = false;
|
||||
fclose(outfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox("Error: Unable to write to file!",MB_OK);
|
||||
}
|
||||
void CBriefinglocalizerDlg::OnKillfocusTitle() {
|
||||
CString oldtitle = m_Title;
|
||||
UpdateData(true);
|
||||
|
||||
int titlelendelta = m_Title.GetLength() - oldtitle.GetLength();
|
||||
int titleleft = 0;
|
||||
int titleright = 0;
|
||||
CString left, right;
|
||||
|
||||
titleleft = m_BigStringTextLower.Find(TITLE_TAG);
|
||||
if (titleleft != -1) {
|
||||
titleright = m_BigStringTextLower.Find("\"", titleleft + TITLE_TAG_LENGTH);
|
||||
left = m_BigTextString.Left(titleleft + TITLE_TAG_LENGTH);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength() - (titleright + 1));
|
||||
m_BigTextString = left + m_Title + "\"" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
m_CurTextLeft += titlelendelta;
|
||||
m_CurTextRight += titlelendelta;
|
||||
}
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnKillfocusTitle()
|
||||
{
|
||||
CString oldtitle = m_Title;
|
||||
UpdateData(true);
|
||||
|
||||
int titlelendelta = m_Title.GetLength()-oldtitle.GetLength();
|
||||
int titleleft=0;
|
||||
int titleright=0;
|
||||
CString left,right;
|
||||
|
||||
titleleft = m_BigStringTextLower.Find(TITLE_TAG);
|
||||
if(titleleft!=-1)
|
||||
{
|
||||
titleright = m_BigStringTextLower.Find("\"",titleleft+TITLE_TAG_LENGTH);
|
||||
left = m_BigTextString.Left(titleleft+TITLE_TAG_LENGTH);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength()-(titleright+1));
|
||||
m_BigTextString = left + m_Title + "\"" + right ;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
m_CurTextLeft += titlelendelta;
|
||||
m_CurTextRight += titlelendelta;
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnCancel() {
|
||||
// do nothing... we want to use OnQuit()
|
||||
// CDialog::OnCancel();
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnCancel()
|
||||
{
|
||||
//do nothing... we want to use OnQuit()
|
||||
//CDialog::OnCancel();
|
||||
void CBriefinglocalizerDlg::OnChangeText() {
|
||||
m_FileChanged = true;
|
||||
UpdateData(true);
|
||||
|
||||
CString left, right;
|
||||
|
||||
left = m_BigTextString.Left(m_CurTextLeft);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength() - m_CurTextRight);
|
||||
|
||||
m_BigTextString = left + m_Text + "\n" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
m_CurTextRight = m_CurTextLeft + m_Text.GetLength();
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnChangeText()
|
||||
{
|
||||
m_FileChanged = true;
|
||||
UpdateData(true);
|
||||
void CBriefinglocalizerDlg::OnChangeTitle() { m_FileChanged = true; }
|
||||
|
||||
CString left,right;
|
||||
void CBriefinglocalizerDlg::OnKillfocusText(NMHDR *pNMHDR, LRESULT *pResult) {
|
||||
UpdateData(true);
|
||||
|
||||
left = m_BigTextString.Left(m_CurTextLeft);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength()-m_CurTextRight);
|
||||
CString left, right;
|
||||
|
||||
m_BigTextString = left + m_Text + "\n" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
m_CurTextRight = m_CurTextLeft + m_Text.GetLength();
|
||||
left = m_BigTextString.Left(m_CurTextLeft);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength() - m_CurTextRight);
|
||||
|
||||
}
|
||||
|
||||
void CBriefinglocalizerDlg::OnChangeTitle()
|
||||
{
|
||||
m_FileChanged = true;
|
||||
}
|
||||
|
||||
|
||||
void CBriefinglocalizerDlg::OnKillfocusText(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
UpdateData(true);
|
||||
|
||||
CString left,right;
|
||||
|
||||
left = m_BigTextString.Left(m_CurTextLeft);
|
||||
right = m_BigTextString.Right(m_BigTextString.GetLength()-m_CurTextRight);
|
||||
|
||||
m_BigTextString = left + m_Text + "\n" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
m_CurTextRight = m_CurTextLeft + m_Text.GetLength();
|
||||
|
||||
*pResult = 0;
|
||||
m_BigTextString = left + m_Text + "\n" + right;
|
||||
m_BigStringTextLower = m_BigTextString;
|
||||
m_BigStringTextLower.MakeLower();
|
||||
m_CurTextRight = m_CurTextLeft + m_Text.GetLength();
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// briefinglocalizerDlg.h : header file
|
||||
//
|
||||
@@ -29,56 +29,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBriefinglocalizerDlg dialog
|
||||
|
||||
class CBriefinglocalizerDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CBriefinglocalizerDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
int m_TitleRight;
|
||||
int m_TitleLeft;
|
||||
int m_CurrentText;
|
||||
CString m_BigStringTextLower;
|
||||
int m_CurTextRight;
|
||||
int m_CurTextLeft;
|
||||
CString m_BigTextString;
|
||||
CString m_TempFileName;
|
||||
CString m_RealFileName;
|
||||
bool m_FileChanged;
|
||||
CBriefinglocalizerDlg(CWnd* pParent = NULL); // standard constructor
|
||||
int m_TitleRight;
|
||||
int m_TitleLeft;
|
||||
int m_CurrentText;
|
||||
CString m_BigStringTextLower;
|
||||
int m_CurTextRight;
|
||||
int m_CurTextLeft;
|
||||
CString m_BigTextString;
|
||||
CString m_TempFileName;
|
||||
CString m_RealFileName;
|
||||
bool m_FileChanged;
|
||||
CBriefinglocalizerDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CBriefinglocalizerDlg)
|
||||
enum { IDD = IDD_BRIEFINGLOCALIZER_DIALOG };
|
||||
CRichEditCtrl m_RichText;
|
||||
CString m_Title;
|
||||
CString m_Text;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CBriefinglocalizerDlg)
|
||||
enum { IDD = IDD_BRIEFINGLOCALIZER_DIALOG };
|
||||
CRichEditCtrl m_RichText;
|
||||
CString m_Title;
|
||||
CString m_Text;
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CBriefinglocalizerDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CBriefinglocalizerDlg)
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CBriefinglocalizerDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnPaint();
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
afx_msg void OnNext();
|
||||
afx_msg void OnPrev();
|
||||
afx_msg void OnQuit();
|
||||
afx_msg void OnSave();
|
||||
afx_msg void OnKillfocusTitle();
|
||||
virtual void OnCancel();
|
||||
afx_msg void OnChangeText();
|
||||
afx_msg void OnChangeTitle();
|
||||
afx_msg void OnKillfocusText(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CBriefinglocalizerDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnPaint();
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
afx_msg void OnNext();
|
||||
afx_msg void OnPrev();
|
||||
afx_msg void OnQuit();
|
||||
afx_msg void OnSave();
|
||||
afx_msg void OnKillfocusTitle();
|
||||
virtual void OnCancel();
|
||||
afx_msg void OnChangeText();
|
||||
afx_msg void OnChangeTitle();
|
||||
afx_msg void OnKillfocusText(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by briefinglocalizer.rc
|
||||
//
|
||||
#define IDD_BRIEFINGLOCALIZER_DIALOG 102
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDC_PREV 1000
|
||||
#define IDC_NEXT 1001
|
||||
#define IDC_SAVE 1002
|
||||
#define IDC_QUIT 1003
|
||||
#define IDC_TEXT 1004
|
||||
#define IDC_TITLE 1005
|
||||
#define IDC_RICHEDIT2 1008
|
||||
#define IDD_BRIEFINGLOCALIZER_DIALOG 102
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDC_PREV 1000
|
||||
#define IDC_NEXT 1001
|
||||
#define IDC_SAVE 1002
|
||||
#define IDC_QUIT 1003
|
||||
#define IDC_TEXT 1004
|
||||
#define IDC_TITLE 1005
|
||||
#define IDC_RICHEDIT2 1008
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1009
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1009
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// DirDialog.cpp: implementation of the CDirDialog class.
|
||||
@@ -26,37 +26,33 @@
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
// Callback function called by SHBrowseForFolder's browse control
|
||||
// after initialization and when selection changes
|
||||
int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||
{
|
||||
CDirDialog* pDirDialogObj = (CDirDialog*)lpData;
|
||||
if (uMsg == BFFM_INITIALIZED )
|
||||
{
|
||||
if( ! pDirDialogObj->m_strSelDir.IsEmpty() )
|
||||
::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)(LPCTSTR)(pDirDialogObj->m_strSelDir));
|
||||
if( ! pDirDialogObj->m_strWindowTitle.IsEmpty() )
|
||||
::SetWindowText(hwnd, (LPCTSTR) pDirDialogObj->m_strWindowTitle);
|
||||
}
|
||||
else if( uMsg == BFFM_SELCHANGED )
|
||||
{
|
||||
LPITEMIDLIST pidl = (LPITEMIDLIST) lParam;
|
||||
char selection[_MAX_PATH];
|
||||
if( ! ::SHGetPathFromIDList(pidl, selection) )
|
||||
selection[0] = '\0';
|
||||
int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) {
|
||||
CDirDialog *pDirDialogObj = (CDirDialog *)lpData;
|
||||
if (uMsg == BFFM_INITIALIZED) {
|
||||
if (!pDirDialogObj->m_strSelDir.IsEmpty())
|
||||
::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)(LPCTSTR)(pDirDialogObj->m_strSelDir));
|
||||
if (!pDirDialogObj->m_strWindowTitle.IsEmpty())
|
||||
::SetWindowText(hwnd, (LPCTSTR)pDirDialogObj->m_strWindowTitle);
|
||||
} else if (uMsg == BFFM_SELCHANGED) {
|
||||
LPITEMIDLIST pidl = (LPITEMIDLIST)lParam;
|
||||
char selection[_MAX_PATH];
|
||||
if (!::SHGetPathFromIDList(pidl, selection))
|
||||
selection[0] = '\0';
|
||||
|
||||
CString csStatusText;
|
||||
BOOL bOk = pDirDialogObj->SelChanged(selection, csStatusText);
|
||||
CString csStatusText;
|
||||
BOOL bOk = pDirDialogObj->SelChanged(selection, csStatusText);
|
||||
|
||||
if( pDirDialogObj->m_bStatus )
|
||||
::SendMessage(hwnd, BFFM_SETSTATUSTEXT , 0, (LPARAM)(LPCSTR)csStatusText);
|
||||
if (pDirDialogObj->m_bStatus)
|
||||
::SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)(LPCSTR)csStatusText);
|
||||
|
||||
::SendMessage(hwnd, BFFM_ENABLEOK, 0, bOk);
|
||||
}
|
||||
::SendMessage(hwnd, BFFM_ENABLEOK, 0, bOk);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,99 +60,78 @@ int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CDirDialog::CDirDialog()
|
||||
{
|
||||
m_bStatus = FALSE;
|
||||
}
|
||||
CDirDialog::CDirDialog() { m_bStatus = FALSE; }
|
||||
|
||||
CDirDialog::~CDirDialog()
|
||||
{
|
||||
}
|
||||
CDirDialog::~CDirDialog() {}
|
||||
|
||||
BOOL CDirDialog::DoBrowse(CWnd *pwndParent)
|
||||
{
|
||||
BOOL CDirDialog::DoBrowse(CWnd *pwndParent) {
|
||||
|
||||
if( ! m_strSelDir.IsEmpty() )
|
||||
{
|
||||
m_strSelDir.TrimRight();
|
||||
if( m_strSelDir.Right(1) == "\\" || m_strSelDir.Right(1) == "//" )
|
||||
m_strSelDir = m_strSelDir.Left(m_strSelDir.GetLength() - 1);
|
||||
}
|
||||
if (!m_strSelDir.IsEmpty()) {
|
||||
m_strSelDir.TrimRight();
|
||||
if (m_strSelDir.Right(1) == "\\" || m_strSelDir.Right(1) == "//")
|
||||
m_strSelDir = m_strSelDir.Left(m_strSelDir.GetLength() - 1);
|
||||
}
|
||||
|
||||
LPMALLOC pMalloc;
|
||||
if (SHGetMalloc (&pMalloc)!= NOERROR)
|
||||
LPMALLOC pMalloc;
|
||||
if (SHGetMalloc(&pMalloc) != NOERROR)
|
||||
return FALSE;
|
||||
|
||||
BROWSEINFO bInfo;
|
||||
LPITEMIDLIST pidl;
|
||||
ZeroMemory((PVOID)&bInfo, sizeof(BROWSEINFO));
|
||||
|
||||
if (!m_strInitDir.IsEmpty()) {
|
||||
OLECHAR olePath[_MAX_PATH];
|
||||
ULONG chEaten;
|
||||
ULONG dwAttributes;
|
||||
HRESULT hr;
|
||||
LPSHELLFOLDER pDesktopFolder;
|
||||
//
|
||||
// Get a pointer to the Desktop's IShellFolder interface.
|
||||
//
|
||||
if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder))) {
|
||||
//
|
||||
// IShellFolder::ParseDisplayName requires the file name be in Unicode.
|
||||
//
|
||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, m_strInitDir.GetBuffer(_MAX_PATH), -1, olePath, _MAX_PATH);
|
||||
|
||||
m_strInitDir.ReleaseBuffer(-1);
|
||||
//
|
||||
// Convert the path to an ITEMIDLIST.
|
||||
//
|
||||
hr = pDesktopFolder->ParseDisplayName(NULL, NULL, olePath, &chEaten, &pidl, &dwAttributes);
|
||||
if (FAILED(hr)) {
|
||||
pMalloc->Free(pidl);
|
||||
pMalloc->Release();
|
||||
return FALSE;
|
||||
|
||||
BROWSEINFO bInfo;
|
||||
LPITEMIDLIST pidl;
|
||||
ZeroMemory ( (PVOID) &bInfo,sizeof (BROWSEINFO));
|
||||
|
||||
if (!m_strInitDir.IsEmpty ())
|
||||
{
|
||||
OLECHAR olePath[_MAX_PATH];
|
||||
ULONG chEaten;
|
||||
ULONG dwAttributes;
|
||||
HRESULT hr;
|
||||
LPSHELLFOLDER pDesktopFolder;
|
||||
//
|
||||
// Get a pointer to the Desktop's IShellFolder interface.
|
||||
//
|
||||
if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
|
||||
{
|
||||
//
|
||||
// IShellFolder::ParseDisplayName requires the file name be in Unicode.
|
||||
//
|
||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, m_strInitDir.GetBuffer(_MAX_PATH), -1,
|
||||
olePath, _MAX_PATH);
|
||||
|
||||
m_strInitDir.ReleaseBuffer (-1);
|
||||
//
|
||||
// Convert the path to an ITEMIDLIST.
|
||||
//
|
||||
hr = pDesktopFolder->ParseDisplayName(NULL,
|
||||
NULL,
|
||||
olePath,
|
||||
&chEaten,
|
||||
&pidl,
|
||||
&dwAttributes);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pMalloc ->Free (pidl);
|
||||
pMalloc ->Release ();
|
||||
return FALSE;
|
||||
}
|
||||
bInfo.pidlRoot = pidl;
|
||||
|
||||
}
|
||||
}
|
||||
bInfo.pidlRoot = pidl;
|
||||
}
|
||||
bInfo.hwndOwner = pwndParent == NULL ? NULL : pwndParent->GetSafeHwnd();
|
||||
bInfo.pszDisplayName = m_strPath.GetBuffer (_MAX_PATH);
|
||||
bInfo.lpszTitle = (m_strTitle.IsEmpty()) ? "Open" : m_strTitle;
|
||||
bInfo.ulFlags = BIF_RETURNFSANCESTORS
|
||||
| BIF_RETURNONLYFSDIRS
|
||||
| (m_bStatus ? BIF_STATUSTEXT : 0);
|
||||
}
|
||||
bInfo.hwndOwner = pwndParent == NULL ? NULL : pwndParent->GetSafeHwnd();
|
||||
bInfo.pszDisplayName = m_strPath.GetBuffer(_MAX_PATH);
|
||||
bInfo.lpszTitle = (m_strTitle.IsEmpty()) ? "Open" : m_strTitle;
|
||||
bInfo.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | (m_bStatus ? BIF_STATUSTEXT : 0);
|
||||
|
||||
bInfo.lpfn = BrowseCtrlCallback; // address of callback function
|
||||
bInfo.lParam = (LPARAM)this; // pass address of object to callback function
|
||||
bInfo.lpfn = BrowseCtrlCallback; // address of callback function
|
||||
bInfo.lParam = (LPARAM)this; // pass address of object to callback function
|
||||
|
||||
if ((pidl = ::SHBrowseForFolder(&bInfo)) == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
m_strPath.ReleaseBuffer();
|
||||
m_iImageIndex = bInfo.iImage;
|
||||
if ((pidl = ::SHBrowseForFolder(&bInfo)) == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
m_strPath.ReleaseBuffer();
|
||||
m_iImageIndex = bInfo.iImage;
|
||||
|
||||
if (::SHGetPathFromIDList(pidl, m_strPath.GetBuffer(_MAX_PATH)) == FALSE)
|
||||
{
|
||||
pMalloc ->Free(pidl);
|
||||
pMalloc ->Release();
|
||||
return FALSE;
|
||||
}
|
||||
if (::SHGetPathFromIDList(pidl, m_strPath.GetBuffer(_MAX_PATH)) == FALSE) {
|
||||
pMalloc->Free(pidl);
|
||||
pMalloc->Release();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_strPath.ReleaseBuffer();
|
||||
m_strPath.ReleaseBuffer();
|
||||
|
||||
pMalloc ->Free(pidl);
|
||||
pMalloc ->Release();
|
||||
pMalloc->Free(pidl);
|
||||
pMalloc->Release();
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// DirDialog.h: interface for the CDirDialog class.
|
||||
@@ -27,28 +27,24 @@
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
class CDirDialog
|
||||
{
|
||||
class CDirDialog {
|
||||
public:
|
||||
CDirDialog();
|
||||
virtual ~CDirDialog();
|
||||
|
||||
CDirDialog();
|
||||
virtual ~CDirDialog();
|
||||
BOOL DoBrowse(CWnd *pwndParent = NULL);
|
||||
|
||||
BOOL DoBrowse(CWnd *pwndParent = NULL);
|
||||
|
||||
CString m_strWindowTitle;
|
||||
CString m_strPath;
|
||||
CString m_strInitDir;
|
||||
CString m_strSelDir;
|
||||
CString m_strTitle;
|
||||
int m_iImageIndex;
|
||||
BOOL m_bStatus;
|
||||
CString m_strWindowTitle;
|
||||
CString m_strPath;
|
||||
CString m_strInitDir;
|
||||
CString m_strSelDir;
|
||||
CString m_strTitle;
|
||||
int m_iImageIndex;
|
||||
BOOL m_bStatus;
|
||||
|
||||
private:
|
||||
|
||||
virtual BOOL SelChanged(LPCSTR lpcsSelection, CString& csStatusText) { return TRUE; };
|
||||
static int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
|
||||
virtual BOOL SelChanged(LPCSTR lpcsSelection, CString &csStatusText) { return TRUE; };
|
||||
static int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_DIRDIALOG_H__62FFAC92_1DEE_11D1_B87A_0060979CDF6D__INCLUDED_)
|
||||
|
||||
|
||||
@@ -79,19 +79,19 @@
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
CStatusBar *MainStatusBar; // pointer to the main status bar of the app
|
||||
CStatusBar *MainStatusBar; // pointer to the main status bar of the app
|
||||
|
||||
// globals for automated hog processing
|
||||
CString AutoRibFilename;
|
||||
CString AutoHogFilename;
|
||||
bool DoAutoProcess;
|
||||
bool UseCurrentHogFilename;
|
||||
bool DoAutoProcess;
|
||||
bool UseCurrentHogFilename;
|
||||
|
||||
// globals for command line processing
|
||||
#define MAX_CMDLINE_ARGS 3
|
||||
#define MAX_CMDLINE_ARG_SIZE 512
|
||||
#define MAX_CMDLINE_ARGS 3
|
||||
#define MAX_CMDLINE_ARG_SIZE 512
|
||||
char *app_argv[MAX_CMDLINE_ARGS];
|
||||
int app_argc;
|
||||
int app_argc;
|
||||
|
||||
// Command line parsing function prototype
|
||||
int ParseAppCommandLine(char *cmdline, char **argv, int max_args);
|
||||
@@ -100,25 +100,24 @@ int ParseAppCommandLine(char *cmdline, char **argv, int max_args);
|
||||
// CHogEditApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CHogEditApp, CWinApp)
|
||||
//{{AFX_MSG_MAP(CHogEditApp)
|
||||
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
// Standard file based document commands
|
||||
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
|
||||
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
|
||||
//{{AFX_MSG_MAP(CHogEditApp)
|
||||
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
// Standard file based document commands
|
||||
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
|
||||
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHogEditApp construction
|
||||
|
||||
CHogEditApp::CHogEditApp()
|
||||
{
|
||||
// TODO: add construction code here,
|
||||
WaitCursor=NULL;
|
||||
DoAutoProcess=FALSE;
|
||||
// Place all significant initialization in InitInstance
|
||||
CHogEditApp::CHogEditApp() {
|
||||
// TODO: add construction code here,
|
||||
WaitCursor = NULL;
|
||||
DoAutoProcess = FALSE;
|
||||
// Place all significant initialization in InitInstance
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -129,255 +128,238 @@ CHogEditApp theApp;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHogEditApp initialization
|
||||
|
||||
BOOL CHogEditApp::InitInstance()
|
||||
{
|
||||
int k;
|
||||
BOOL CHogEditApp::InitInstance() {
|
||||
int k;
|
||||
|
||||
AfxEnableControlContainer();
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// Standard initialization
|
||||
// If you are not using these features and wish to reduce the size
|
||||
// of your final executable, you should remove from the following
|
||||
// the specific initialization routines you do not need.
|
||||
// Standard initialization
|
||||
// If you are not using these features and wish to reduce the size
|
||||
// of your final executable, you should remove from the following
|
||||
// the specific initialization routines you do not need.
|
||||
|
||||
#ifdef _AFXDLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
#else
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
#endif
|
||||
|
||||
// Change the registry key under which our settings are stored.
|
||||
// You should modify this string to be something appropriate
|
||||
// such as the name of your company or organization.
|
||||
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||
// Change the registry key under which our settings are stored.
|
||||
// You should modify this string to be something appropriate
|
||||
// such as the name of your company or organization.
|
||||
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||
|
||||
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
|
||||
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
|
||||
|
||||
// Allocate mem for cmd line args
|
||||
for (k = 0; k < MAX_CMDLINE_ARGS; k++)
|
||||
app_argv[k] = new char[MAX_CMDLINE_ARG_SIZE + 1];
|
||||
|
||||
// Allocate mem for cmd line args
|
||||
for(k=0;k<MAX_CMDLINE_ARGS;k++)
|
||||
app_argv[k]=new char[MAX_CMDLINE_ARG_SIZE+1];
|
||||
// Get the command line arguments
|
||||
app_argc = ParseAppCommandLine(m_lpCmdLine, app_argv, MAX_CMDLINE_ARGS);
|
||||
|
||||
// Get the command line arguments
|
||||
app_argc=ParseAppCommandLine(m_lpCmdLine,app_argv,MAX_CMDLINE_ARGS);
|
||||
// See if user wants to do auto-processing of hog
|
||||
DoAutoProcess = FALSE;
|
||||
if (app_argc == 2) {
|
||||
AutoRibFilename = app_argv[0];
|
||||
AutoHogFilename = app_argv[1];
|
||||
DoAutoProcess = TRUE;
|
||||
/*
|
||||
AfxMessageBox(AutoRibFilename);
|
||||
AfxMessageBox(AutoHogFilename);
|
||||
*/
|
||||
}
|
||||
UseCurrentHogFilename = FALSE;
|
||||
OutputDebugString("Parsing command line...\n");
|
||||
|
||||
// See if user wants to do auto-processing of hog
|
||||
DoAutoProcess=FALSE;
|
||||
if(app_argc==2) {
|
||||
AutoRibFilename=app_argv[0];
|
||||
AutoHogFilename=app_argv[1];
|
||||
DoAutoProcess=TRUE;
|
||||
/*
|
||||
AfxMessageBox(AutoRibFilename);
|
||||
AfxMessageBox(AutoHogFilename);
|
||||
*/
|
||||
}
|
||||
UseCurrentHogFilename=FALSE;
|
||||
OutputDebugString("Parsing command line...\n");
|
||||
// Delete mem for cmd line args
|
||||
for (k = 0; k < MAX_CMDLINE_ARGS; k++)
|
||||
delete[] app_argv[k];
|
||||
app_argc = 0;
|
||||
|
||||
// Delete mem for cmd line args
|
||||
for(k=0;k<MAX_CMDLINE_ARGS;k++)
|
||||
delete[] app_argv[k];
|
||||
app_argc=0;
|
||||
// Register the application's document templates. Document templates
|
||||
// serve as the connection between documents, frame windows and views.
|
||||
|
||||
CSingleDocTemplate *pDocTemplate;
|
||||
pDocTemplate = new CSingleDocTemplate(IDR_MAINFRAME, RUNTIME_CLASS(CHogEditDoc),
|
||||
RUNTIME_CLASS(CMainFrame), // main SDI frame window
|
||||
RUNTIME_CLASS(CHogEditView));
|
||||
AddDocTemplate(pDocTemplate);
|
||||
|
||||
// Register the application's document templates. Document templates
|
||||
// serve as the connection between documents, frame windows and views.
|
||||
// Parse command line for standard shell commands, DDE, file open
|
||||
CCommandLineInfo cmdInfo;
|
||||
// ParseCommandLine(cmdInfo);
|
||||
|
||||
CSingleDocTemplate* pDocTemplate;
|
||||
pDocTemplate = new CSingleDocTemplate(
|
||||
IDR_MAINFRAME,
|
||||
RUNTIME_CLASS(CHogEditDoc),
|
||||
RUNTIME_CLASS(CMainFrame), // main SDI frame window
|
||||
RUNTIME_CLASS(CHogEditView));
|
||||
AddDocTemplate(pDocTemplate);
|
||||
// Dispatch commands specified on the command line
|
||||
if (!ProcessShellCommand(cmdInfo))
|
||||
return FALSE;
|
||||
|
||||
// Parse command line for standard shell commands, DDE, file open
|
||||
CCommandLineInfo cmdInfo;
|
||||
//ParseCommandLine(cmdInfo);
|
||||
// The one and only window has been initialized, so show and update it.
|
||||
m_pMainWnd->ShowWindow(SW_SHOW);
|
||||
m_pMainWnd->UpdateWindow();
|
||||
|
||||
// Dispatch commands specified on the command line
|
||||
if (!ProcessShellCommand(cmdInfo))
|
||||
return FALSE;
|
||||
// Initialize the memory library
|
||||
mem_Init();
|
||||
|
||||
|
||||
// The one and only window has been initialized, so show and update it.
|
||||
m_pMainWnd->ShowWindow(SW_SHOW);
|
||||
m_pMainWnd->UpdateWindow();
|
||||
|
||||
// Initialize the memory library
|
||||
mem_Init();
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAboutDlg dialog used for App About
|
||||
|
||||
class CAboutDlg : public CDialog
|
||||
{
|
||||
class CAboutDlg : public CDialog {
|
||||
public:
|
||||
CAboutDlg();
|
||||
CAboutDlg();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAboutDlg)
|
||||
enum { IDD = IDD_ABOUTBOX };
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAboutDlg)
|
||||
enum { IDD = IDD_ABOUTBOX };
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAboutDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAboutDlg)
|
||||
protected:
|
||||
//{{AFX_MSG(CAboutDlg)
|
||||
// No message handlers
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
//{{AFX_MSG(CAboutDlg)
|
||||
// No message handlers
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CAboutDlg)
|
||||
//}}AFX_DATA_INIT
|
||||
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {
|
||||
//{{AFX_DATA_INIT(CAboutDlg)
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CAboutDlg)
|
||||
//}}AFX_DATA_MAP
|
||||
void CAboutDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CAboutDlg)
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CAboutDlg)
|
||||
// No message handlers
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CAboutDlg)
|
||||
// No message handlers
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
// App command to run the dialog
|
||||
void CHogEditApp::OnAppAbout()
|
||||
{
|
||||
CAboutDlg aboutDlg;
|
||||
aboutDlg.DoModal();
|
||||
void CHogEditApp::OnAppAbout() {
|
||||
CAboutDlg aboutDlg;
|
||||
aboutDlg.DoModal();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHogEditApp commands
|
||||
|
||||
|
||||
// Displays the "are you sure?" dialog
|
||||
int ModifiedPrompt(CWnd *caller)
|
||||
{
|
||||
// If current file has been modified, check with user first...
|
||||
if(!DocModified) return(IDYES);
|
||||
if(caller->MessageBox("Your current file will be lost. Proceed?",
|
||||
"File Has Been Modified",
|
||||
MB_YESNO)==IDYES) return(IDYES);
|
||||
return(IDNO);
|
||||
int ModifiedPrompt(CWnd *caller) {
|
||||
// If current file has been modified, check with user first...
|
||||
if (!DocModified)
|
||||
return (IDYES);
|
||||
if (caller->MessageBox("Your current file will be lost. Proceed?", "File Has Been Modified", MB_YESNO) == IDYES)
|
||||
return (IDYES);
|
||||
return (IDNO);
|
||||
}
|
||||
|
||||
// Checks if there are any messages and translates and dispatches them
|
||||
#define MAX_MESSAGES 25
|
||||
void ProcessMessages(void)
|
||||
{
|
||||
MSG msg;
|
||||
int MsgCount;
|
||||
void ProcessMessages(void) {
|
||||
MSG msg;
|
||||
int MsgCount;
|
||||
|
||||
for ( MsgCount = MAX_MESSAGES;
|
||||
MsgCount && PeekMessage( &msg, NULL, 0, 0, PM_REMOVE );
|
||||
MsgCount--) {
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessage( &msg );
|
||||
}
|
||||
for (MsgCount = MAX_MESSAGES; MsgCount && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); MsgCount--) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Updates the total files indicator
|
||||
void UpdateTotalFiles(int num_files)
|
||||
{
|
||||
char msg[256];
|
||||
void UpdateTotalFiles(int num_files) {
|
||||
char msg[256];
|
||||
|
||||
sprintf(msg,"Total Files: %d", num_files);
|
||||
MainStatusBar->SetPaneText(1,msg,TRUE);
|
||||
ProcessMessages();
|
||||
sprintf(msg, "Total Files: %d", num_files);
|
||||
MainStatusBar->SetPaneText(1, msg, TRUE);
|
||||
ProcessMessages();
|
||||
}
|
||||
|
||||
// Updates the status bar with the given message
|
||||
CWaitCursor *WaitCursor;
|
||||
void UpdateStatusBar(char *msg)
|
||||
{
|
||||
if(msg==NULL) return;
|
||||
void UpdateStatusBar(char *msg) {
|
||||
if (msg == NULL)
|
||||
return;
|
||||
|
||||
MainStatusBar->SetPaneText(0,msg,TRUE);
|
||||
ProcessMessages();
|
||||
MainStatusBar->SetPaneText(0, msg, TRUE);
|
||||
ProcessMessages();
|
||||
|
||||
// If the WaitCursor is not null, restore it
|
||||
if(WaitCursor!=NULL)
|
||||
WaitCursor->Restore();
|
||||
// If the WaitCursor is not null, restore it
|
||||
if (WaitCursor != NULL)
|
||||
WaitCursor->Restore();
|
||||
}
|
||||
|
||||
// Parses the given command line into a list of arguments
|
||||
#define MAX_CMDLINE_SIZE 1024
|
||||
int ParseAppCommandLine(char *cmdline, char **argv, int max_args)
|
||||
{
|
||||
int i, argc, done;
|
||||
char *s, *q;
|
||||
char line[MAX_CMDLINE_SIZE+1];
|
||||
#define MAX_CMDLINE_SIZE 1024
|
||||
int ParseAppCommandLine(char *cmdline, char **argv, int max_args) {
|
||||
int i, argc, done;
|
||||
char *s, *q;
|
||||
char line[MAX_CMDLINE_SIZE + 1];
|
||||
|
||||
// make working copy of command line
|
||||
strncpy(line,cmdline,MAX_CMDLINE_SIZE);
|
||||
line[MAX_CMDLINE_SIZE]='\0';
|
||||
// make working copy of command line
|
||||
strncpy(line, cmdline, MAX_CMDLINE_SIZE);
|
||||
line[MAX_CMDLINE_SIZE] = '\0';
|
||||
|
||||
// Init arglist to empty
|
||||
for(i=0;i<max_args;i++)
|
||||
argv[i][0]='\0';
|
||||
// Init arglist to empty
|
||||
for (i = 0; i < max_args; i++)
|
||||
argv[i][0] = '\0';
|
||||
|
||||
argc=0;
|
||||
s=line;
|
||||
done=FALSE;
|
||||
argc = 0;
|
||||
s = line;
|
||||
done = FALSE;
|
||||
|
||||
// Get the arguments
|
||||
while(!done && argc<max_args) {
|
||||
// Get the arguments
|
||||
while (!done && argc < max_args) {
|
||||
|
||||
// strip off leading whitespace
|
||||
while(isspace(*s)) s++;
|
||||
// strip off leading whitespace
|
||||
while (isspace(*s))
|
||||
s++;
|
||||
|
||||
// if it's the end of the line, we're done
|
||||
if(strlen(s)==0) {
|
||||
done=TRUE;
|
||||
continue;
|
||||
}
|
||||
// if it's the end of the line, we're done
|
||||
if (strlen(s) == 0) {
|
||||
done = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
// process the argument
|
||||
if((*s)=='\"') { // handle quoted arguments
|
||||
s++; // skip to char after quote
|
||||
// process the argument
|
||||
if ((*s) == '\"') { // handle quoted arguments
|
||||
s++; // skip to char after quote
|
||||
|
||||
q=strchr(s,'\"'); // find ending quote
|
||||
if(q==NULL) {
|
||||
strcpy(argv[argc],s);
|
||||
s+=strlen(argv[argc]);
|
||||
}
|
||||
else {
|
||||
(*q)='\0';
|
||||
strcpy(argv[argc],s);
|
||||
s=q+1;
|
||||
}
|
||||
}
|
||||
else { // handle whitespace delimited args
|
||||
q=s;
|
||||
while(!isspace(*q) && (*q)!='\0') q++;
|
||||
if((*q)!='\0') {
|
||||
(*q)='\0';
|
||||
q++;
|
||||
}
|
||||
strcpy(argv[argc],s);
|
||||
s=q;
|
||||
}
|
||||
q = strchr(s, '\"'); // find ending quote
|
||||
if (q == NULL) {
|
||||
strcpy(argv[argc], s);
|
||||
s += strlen(argv[argc]);
|
||||
} else {
|
||||
(*q) = '\0';
|
||||
strcpy(argv[argc], s);
|
||||
s = q + 1;
|
||||
}
|
||||
} else { // handle whitespace delimited args
|
||||
q = s;
|
||||
while (!isspace(*q) && (*q) != '\0')
|
||||
q++;
|
||||
if ((*q) != '\0') {
|
||||
(*q) = '\0';
|
||||
q++;
|
||||
}
|
||||
strcpy(argv[argc], s);
|
||||
s = q;
|
||||
}
|
||||
|
||||
argc++;
|
||||
}
|
||||
argc++;
|
||||
}
|
||||
|
||||
return(argc);
|
||||
return (argc);
|
||||
}
|
||||
|
||||
@@ -67,10 +67,10 @@
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#define HOG_EDIT_TITLE "The Hog Farmer v1.0"
|
||||
|
||||
@@ -79,44 +79,42 @@ void ProcessMessages(void);
|
||||
void UpdateTotalFiles(int num_files);
|
||||
void UpdateStatusBar(char *msg);
|
||||
|
||||
extern bool DocModified; // is document modified.
|
||||
extern CStatusBar *MainStatusBar; // pointer to the main status bar
|
||||
extern CWaitCursor *WaitCursor; // pointer to a remote wait cursor
|
||||
extern bool DocModified; // is document modified.
|
||||
extern CStatusBar *MainStatusBar; // pointer to the main status bar
|
||||
extern CWaitCursor *WaitCursor; // pointer to a remote wait cursor
|
||||
|
||||
// Globals for automated hog file creation (from a given rib file)
|
||||
extern CString AutoRibFilename;
|
||||
extern CString AutoHogFilename;
|
||||
extern bool DoAutoProcess;
|
||||
extern bool UseCurrentHogFilename;
|
||||
extern bool UseCurrentHogFilename;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHogEditApp:
|
||||
// See HogEdit.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CHogEditApp : public CWinApp
|
||||
{
|
||||
class CHogEditApp : public CWinApp {
|
||||
public:
|
||||
CHogEditApp();
|
||||
CHogEditApp();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHogEditApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHogEditApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Implementation
|
||||
|
||||
//{{AFX_MSG(CHogEditApp)
|
||||
afx_msg void OnAppAbout();
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CHogEditApp)
|
||||
afx_msg void OnAppAbout();
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,116 +66,111 @@
|
||||
|
||||
#include "pstypes.h"
|
||||
|
||||
#define FILE_IS_SAME 0
|
||||
#define FILE_HAS_CHANGED 1
|
||||
#define FILE_IS_GONE 2
|
||||
#define FILE_IS_SAME 0
|
||||
#define FILE_HAS_CHANGED 1
|
||||
#define FILE_IS_GONE 2
|
||||
|
||||
#define RIB_TAG_STR "RIB_ID"
|
||||
|
||||
#define DEFAULT_NEW_FILENAME "Untitled.rib"
|
||||
#define DEFAULT_NEW_FILENAME "Untitled.rib"
|
||||
|
||||
#define ADDFILE_OK 0
|
||||
#define ADDFILE_LONG_FNAME_ERROR 1
|
||||
#define ADDFILE_DUP_FILE_ERROR 2
|
||||
#define ADDFILE_STAT_ERROR 3
|
||||
#define ADDFILE_OK 0
|
||||
#define ADDFILE_LONG_FNAME_ERROR 1
|
||||
#define ADDFILE_DUP_FILE_ERROR 2
|
||||
#define ADDFILE_STAT_ERROR 3
|
||||
|
||||
// the following structures are slightly modified versions of the CFILE hog structs
|
||||
struct hog_library_entry
|
||||
{
|
||||
char path[_MAX_PATH]; // location of data file (filename not included)
|
||||
char name[PSFILENAME_LEN+1]; // just the filename
|
||||
unsigned length; // length of this file
|
||||
int32_t timestamp; // time and date of file
|
||||
int flags; // misc flags
|
||||
int offset; // file offset in hog (or -1 if in .rib file)
|
||||
struct hog_library_entry {
|
||||
char path[_MAX_PATH]; // location of data file (filename not included)
|
||||
char name[PSFILENAME_LEN + 1]; // just the filename
|
||||
unsigned length; // length of this file
|
||||
int32_t timestamp; // time and date of file
|
||||
int flags; // misc flags
|
||||
int offset; // file offset in hog (or -1 if in .rib file)
|
||||
};
|
||||
|
||||
// the hog library structure
|
||||
struct hog_library
|
||||
{
|
||||
char filename[_MAX_PATH]; // full hog file path (including filename)
|
||||
int flags; // misc flags for the hog file
|
||||
int num_entries; // number of entries in the hog file
|
||||
CList <hog_library_entry, hog_library_entry&> filelist;
|
||||
struct hog_library {
|
||||
char filename[_MAX_PATH]; // full hog file path (including filename)
|
||||
int flags; // misc flags for the hog file
|
||||
int num_entries; // number of entries in the hog file
|
||||
CList<hog_library_entry, hog_library_entry &> filelist;
|
||||
};
|
||||
|
||||
// Comparison function for sorting filenames
|
||||
int compare( const void *arg1, const void *arg2 );
|
||||
int compare(const void *arg1, const void *arg2);
|
||||
|
||||
// HogEdit Doc class
|
||||
class CHogEditDoc : public CDocument
|
||||
{
|
||||
class CHogEditDoc : public CDocument {
|
||||
protected: // create from serialization only
|
||||
CHogEditDoc();
|
||||
DECLARE_DYNCREATE(CHogEditDoc)
|
||||
CHogEditDoc();
|
||||
DECLARE_DYNCREATE(CHogEditDoc)
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
public:
|
||||
CString m_DocumentName; // name of hog document
|
||||
bool m_StaticHog; // is library a loaded hogfile or a lite hogfile(only names)
|
||||
bool m_NoNameChosen; // Isn't set until user specifies name for a new file
|
||||
hog_library Library; // stores the list of entries
|
||||
CString m_DocumentName; // name of hog document
|
||||
bool m_StaticHog; // is library a loaded hogfile or a lite hogfile(only names)
|
||||
bool m_NoNameChosen; // Isn't set until user specifies name for a new file
|
||||
hog_library Library; // stores the list of entries
|
||||
|
||||
// Operations
|
||||
// Operations
|
||||
public:
|
||||
int LoadDocument(CString& name); // loads a hog or rib
|
||||
int SaveDocument(CString& name); // saves a hog or rib
|
||||
void NewDocument(); // creates a new document (entry list)
|
||||
int LoadDocument(CString &name); // loads a hog or rib
|
||||
int SaveDocument(CString &name); // saves a hog or rib
|
||||
void NewDocument(); // creates a new document (entry list)
|
||||
|
||||
int LoadHog(const char *pathname); // loads a Hog file
|
||||
int SaveHog(const char *pathname); // saves a Hog file
|
||||
int LoadRib(const char *pathname); // loads a Rib file.
|
||||
int SaveRib(const char *pathname); // saves a Rib file.
|
||||
int LoadHog(const char *pathname); // loads a Hog file
|
||||
int SaveHog(const char *pathname); // saves a Hog file
|
||||
int LoadRib(const char *pathname); // loads a Rib file.
|
||||
int SaveRib(const char *pathname); // saves a Rib file.
|
||||
|
||||
int AddFile(const char *pathname, hog_library_entry *entry); // adds a file to the file list.
|
||||
int AddFile(const char *pathname, hog_library_entry *entry); // adds a file to the file list.
|
||||
|
||||
bool ReadHogLibEntry(FILE *fp, hog_library_entry *entry);
|
||||
bool WriteHogLibEntry(FILE *fp, hog_library_entry *entry);
|
||||
bool ReadHogLibEntry(FILE *fp, hog_library_entry *entry);
|
||||
bool WriteHogLibEntry(FILE *fp, hog_library_entry *entry);
|
||||
|
||||
bool CreateFilenameList(char ***filenames);
|
||||
void SortFilenameList(char **filenames);
|
||||
bool DeleteFilenameList(char **filenames);
|
||||
bool CreateFilenameList(char ***filenames);
|
||||
void SortFilenameList(char **filenames);
|
||||
bool DeleteFilenameList(char **filenames);
|
||||
|
||||
int UpdatedFileCheck(hog_library_entry *entry);
|
||||
bool ExtractFile(int file_pos, unsigned file_len, char *out_fname);
|
||||
int UpdatedFileCheck(hog_library_entry *entry);
|
||||
bool ExtractFile(int file_pos, unsigned file_len, char *out_fname);
|
||||
|
||||
uint32_t CalcHogFileSize(void);
|
||||
uint32_t CalcHogFileSize(void);
|
||||
|
||||
FILE *FindFileInHog(char *hog_fname,tHogFileEntry *table_entry);
|
||||
FILE *FindFileInHog(char *hog_fname, tHogFileEntry *table_entry);
|
||||
|
||||
int CreateNewHogFromCurrentHog(char *src_hog_fname, char *target_hog_fname,
|
||||
int nfiles, const char **filenames,
|
||||
void(* UpdateFunction)(char *));
|
||||
int CreateNewHogFromCurrentHog(char *src_hog_fname, char *target_hog_fname, int nfiles, const char **filenames,
|
||||
void (*UpdateFunction)(char *));
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHogEditDoc)
|
||||
public:
|
||||
virtual BOOL OnNewDocument();
|
||||
virtual void Serialize(CArchive& ar);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHogEditDoc)
|
||||
public:
|
||||
virtual ~CHogEditDoc();
|
||||
virtual BOOL OnNewDocument();
|
||||
virtual void Serialize(CArchive &ar);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CHogEditDoc();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CHogEditDoc)
|
||||
afx_msg void OnUpdateActionInsert(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateActionCreate(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateFileSaveAs(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateActionUpdate(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateActionImport(CCmdUI* pCmdUI);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CHogEditDoc)
|
||||
afx_msg void OnUpdateActionInsert(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateActionCreate(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateFileSave(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateFileSaveAs(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateActionUpdate(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateActionImport(CCmdUI *pCmdUI);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -71,96 +71,93 @@
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
// HogEdit Window Constants
|
||||
#define FILE_NAME_COLUMN 0
|
||||
#define FILE_TYPE_COLUMN 1
|
||||
#define FILE_DIR_COLUMN 2
|
||||
#define FILE_SIZE_COLUMN 3
|
||||
#define FILE_TIME_COLUMN 4
|
||||
#define FILE_NAME_COLUMN 0
|
||||
#define FILE_TYPE_COLUMN 1
|
||||
#define FILE_DIR_COLUMN 2
|
||||
#define FILE_SIZE_COLUMN 3
|
||||
#define FILE_TIME_COLUMN 4
|
||||
|
||||
#define FILE_NAME_TITLE "Filename"
|
||||
#define FILE_TYPE_TITLE "Type"
|
||||
#define FILE_DIR_TITLE "Directory"
|
||||
#define FILE_SIZE_TITLE "Size"
|
||||
#define FILE_TIME_TITLE "Timestamp"
|
||||
#define FILE_NAME_TITLE "Filename"
|
||||
#define FILE_TYPE_TITLE "Type"
|
||||
#define FILE_DIR_TITLE "Directory"
|
||||
#define FILE_SIZE_TITLE "Size"
|
||||
#define FILE_TIME_TITLE "Timestamp"
|
||||
|
||||
#define FILE_NAME_COLUMN_WIDTH 0.20
|
||||
#define FILE_TYPE_COLUMN_WIDTH 0.18
|
||||
#define FILE_DIR_COLUMN_WIDTH 0.35
|
||||
#define FILE_SIZE_COLUMN_WIDTH 0.07
|
||||
#define FILE_TIME_COLUMN_WIDTH 0.20
|
||||
#define FILE_NAME_COLUMN_WIDTH 0.20
|
||||
#define FILE_TYPE_COLUMN_WIDTH 0.18
|
||||
#define FILE_DIR_COLUMN_WIDTH 0.35
|
||||
#define FILE_SIZE_COLUMN_WIDTH 0.07
|
||||
#define FILE_TIME_COLUMN_WIDTH 0.20
|
||||
|
||||
// The size of the buffer to hold the list of "to-be-added" filenames
|
||||
#define MAX_FILENAME_BUFFER 120000
|
||||
#define MAX_FILENAME_BUFFER 120000
|
||||
|
||||
class CHogEditView : public CListViewEx
|
||||
{
|
||||
class CHogEditView : public CListViewEx {
|
||||
protected: // create from serialization only
|
||||
CHogEditView();
|
||||
DECLARE_DYNCREATE(CHogEditView)
|
||||
CHogEditView();
|
||||
DECLARE_DYNCREATE(CHogEditView)
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
public:
|
||||
CHogEditDoc* GetDocument();
|
||||
CHogEditDoc *GetDocument();
|
||||
|
||||
// Operations
|
||||
// Operations
|
||||
public:
|
||||
void SetColumnWidths(void);
|
||||
void GetFileType(char *type, char *filename);
|
||||
bool InsertItem(int index, hog_library_entry *entry);
|
||||
void UpdateList(void);
|
||||
void UpdateTitle(CString &path, bool mod_flag);
|
||||
void SetColumnWidths(void);
|
||||
void GetFileType(char *type, char *filename);
|
||||
bool InsertItem(int index, hog_library_entry *entry);
|
||||
void UpdateList(void);
|
||||
void UpdateTitle(CString &path, bool mod_flag);
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHogEditView)
|
||||
public:
|
||||
virtual void OnDraw(CDC* pDC); // overridden to draw this view
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
protected:
|
||||
virtual void OnInitialUpdate(); // called first time after construct
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHogEditView)
|
||||
public:
|
||||
virtual ~CHogEditView();
|
||||
virtual void OnDraw(CDC *pDC); // overridden to draw this view
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
|
||||
protected:
|
||||
virtual void OnInitialUpdate(); // called first time after construct
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CHogEditView();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CHogEditView)
|
||||
afx_msg void OnFileNew();
|
||||
afx_msg void OnActionInsert();
|
||||
afx_msg void OnFileOpen();
|
||||
afx_msg void OnFileSave();
|
||||
afx_msg void OnFileSaveAs();
|
||||
afx_msg void OnActionDelete();
|
||||
afx_msg void OnActionCreate();
|
||||
afx_msg void OnViewFullRow();
|
||||
afx_msg void OnUpdateViewFullRow(CCmdUI* pCmdUI);
|
||||
afx_msg void OnActionUpdate();
|
||||
afx_msg void OnActionExtract();
|
||||
afx_msg void OnUpdateActionDelete(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateActionExtract(CCmdUI* pCmdUI);
|
||||
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnActionImport();
|
||||
afx_msg LONG OnStraightToFileOpen(UINT, LONG);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CHogEditView)
|
||||
afx_msg void OnFileNew();
|
||||
afx_msg void OnActionInsert();
|
||||
afx_msg void OnFileOpen();
|
||||
afx_msg void OnFileSave();
|
||||
afx_msg void OnFileSaveAs();
|
||||
afx_msg void OnActionDelete();
|
||||
afx_msg void OnActionCreate();
|
||||
afx_msg void OnViewFullRow();
|
||||
afx_msg void OnUpdateViewFullRow(CCmdUI *pCmdUI);
|
||||
afx_msg void OnActionUpdate();
|
||||
afx_msg void OnActionExtract();
|
||||
afx_msg void OnUpdateActionDelete(CCmdUI *pCmdUI);
|
||||
afx_msg void OnUpdateActionExtract(CCmdUI *pCmdUI);
|
||||
afx_msg void OnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnActionImport();
|
||||
afx_msg LONG OnStraightToFileOpen(UINT, LONG);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
// pass this message to myself when initializing if I should go straight to the
|
||||
// update dialog
|
||||
#define WM_STRAIGHT_TO_FILE_OPEN (WM_USER + 10)
|
||||
#define WM_STRAIGHT_TO_FILE_OPEN (WM_USER + 10)
|
||||
|
||||
|
||||
#ifndef _DEBUG // debug version in HogEditView.cpp
|
||||
inline CHogEditDoc* CHogEditView::GetDocument()
|
||||
{ return (CHogEditDoc*)m_pDocument; }
|
||||
#ifndef _DEBUG // debug version in HogEditView.cpp
|
||||
inline CHogEditDoc *CHogEditView::GetDocument() { return (CHogEditDoc *)m_pDocument; }
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -48,45 +48,38 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHogInfo dialog
|
||||
|
||||
|
||||
CHogInfo::CHogInfo(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CHogInfo::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CHogInfo)
|
||||
m_NumFiles = _T("");
|
||||
m_Location = _T("");
|
||||
m_SizeBytes = _T("");
|
||||
m_SizeMB = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
CHogInfo::CHogInfo(CWnd *pParent /*=NULL*/) : CDialog(CHogInfo::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CHogInfo)
|
||||
m_NumFiles = _T("");
|
||||
m_Location = _T("");
|
||||
m_SizeBytes = _T("");
|
||||
m_SizeMB = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CHogInfo::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CHogInfo)
|
||||
DDX_Text(pDX, IDC_HOGINFO_FILES, m_NumFiles);
|
||||
DDX_Text(pDX, IDC_HOGINFO_LOCATION, m_Location);
|
||||
DDX_Text(pDX, IDC_HOGINFO_SIZE_BYTES, m_SizeBytes);
|
||||
DDX_Text(pDX, IDC_HOGINFO_SIZE_MB, m_SizeMB);
|
||||
//}}AFX_DATA_MAP
|
||||
void CHogInfo::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CHogInfo)
|
||||
DDX_Text(pDX, IDC_HOGINFO_FILES, m_NumFiles);
|
||||
DDX_Text(pDX, IDC_HOGINFO_LOCATION, m_Location);
|
||||
DDX_Text(pDX, IDC_HOGINFO_SIZE_BYTES, m_SizeBytes);
|
||||
DDX_Text(pDX, IDC_HOGINFO_SIZE_MB, m_SizeMB);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CHogInfo, CDialog)
|
||||
//{{AFX_MSG_MAP(CHogInfo)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CHogInfo)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHogInfo message handlers
|
||||
|
||||
BOOL CHogInfo::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
BOOL CHogInfo::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
@@ -44,37 +44,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHogInfo dialog
|
||||
|
||||
class CHogInfo : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CHogInfo : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CHogInfo(CWnd* pParent = NULL); // standard constructor
|
||||
CHogInfo(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CHogInfo)
|
||||
enum { IDD = IDD_HOGINFO };
|
||||
CString m_NumFiles;
|
||||
CString m_Location;
|
||||
CString m_SizeBytes;
|
||||
CString m_SizeMB;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CHogInfo)
|
||||
enum { IDD = IDD_HOGINFO };
|
||||
CString m_NumFiles;
|
||||
CString m_Location;
|
||||
CString m_SizeBytes;
|
||||
CString m_SizeMB;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHogInfo)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CHogInfo)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CHogInfo)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CHogInfo)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -58,113 +58,91 @@
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame
|
||||
|
||||
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
|
||||
//{{AFX_MSG_MAP(CMainFrame)
|
||||
ON_WM_CREATE()
|
||||
ON_WM_CLOSE()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CMainFrame)
|
||||
ON_WM_CREATE()
|
||||
ON_WM_CLOSE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
static UINT indicators[] =
|
||||
{
|
||||
ID_SEPARATOR, // status line indicator
|
||||
//ID_INDICATOR_CAPS,
|
||||
//ID_INDICATOR_NUM,
|
||||
//ID_INDICATOR_SCRL,
|
||||
ID_INDICATOR_FILES
|
||||
};
|
||||
static UINT indicators[] = {ID_SEPARATOR, // status line indicator
|
||||
// ID_INDICATOR_CAPS,
|
||||
// ID_INDICATOR_NUM,
|
||||
// ID_INDICATOR_SCRL,
|
||||
ID_INDICATOR_FILES};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame construction/destruction
|
||||
|
||||
CMainFrame::CMainFrame()
|
||||
{
|
||||
// TODO: add member initialization code here
|
||||
|
||||
CMainFrame::CMainFrame() {
|
||||
// TODO: add member initialization code here
|
||||
}
|
||||
|
||||
CMainFrame::~CMainFrame()
|
||||
{
|
||||
CMainFrame::~CMainFrame() {}
|
||||
|
||||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) {
|
||||
TRACE0("Failed to create toolbar\n");
|
||||
return -1; // fail to create
|
||||
}
|
||||
|
||||
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT))) {
|
||||
TRACE0("Failed to create status bar\n");
|
||||
return -1; // fail to create
|
||||
}
|
||||
|
||||
// Get pointer to status bar so we can set it elsewhere
|
||||
MainStatusBar = &m_wndStatusBar;
|
||||
MainStatusBar->SetPaneText(1, "Total Files: 0", TRUE);
|
||||
|
||||
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
|
||||
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
|
||||
|
||||
// TODO: Delete these three lines if you don't want the toolbar to
|
||||
// be dockable
|
||||
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
||||
EnableDocking(CBRS_ALIGN_ANY);
|
||||
DockControlBar(&m_wndToolBar);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT &cs) {
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
cs.cx = MAIN_WINDOW_WIDTH;
|
||||
cs.cy = MAIN_WINDOW_HEIGHT;
|
||||
cs.lpszName = HOG_EDIT_TITLE;
|
||||
cs.style = WS_OVERLAPPEDWINDOW;
|
||||
|
||||
if (!m_wndToolBar.Create(this) ||
|
||||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
||||
{
|
||||
TRACE0("Failed to create toolbar\n");
|
||||
return -1; // fail to create
|
||||
}
|
||||
|
||||
if (!m_wndStatusBar.Create(this) ||
|
||||
!m_wndStatusBar.SetIndicators(indicators,
|
||||
sizeof(indicators)/sizeof(UINT)))
|
||||
{
|
||||
TRACE0("Failed to create status bar\n");
|
||||
return -1; // fail to create
|
||||
}
|
||||
|
||||
// Get pointer to status bar so we can set it elsewhere
|
||||
MainStatusBar=&m_wndStatusBar;
|
||||
MainStatusBar->SetPaneText(1,"Total Files: 0",TRUE);
|
||||
|
||||
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
|
||||
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
|
||||
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
|
||||
|
||||
// TODO: Delete these three lines if you don't want the toolbar to
|
||||
// be dockable
|
||||
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
||||
EnableDocking(CBRS_ALIGN_ANY);
|
||||
DockControlBar(&m_wndToolBar);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
cs.cx=MAIN_WINDOW_WIDTH;
|
||||
cs.cy=MAIN_WINDOW_HEIGHT;
|
||||
cs.lpszName=HOG_EDIT_TITLE;
|
||||
cs.style=WS_OVERLAPPEDWINDOW;
|
||||
|
||||
return CFrameWnd::PreCreateWindow(cs);
|
||||
return CFrameWnd::PreCreateWindow(cs);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMainFrame::AssertValid() const
|
||||
{
|
||||
CFrameWnd::AssertValid();
|
||||
}
|
||||
void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); }
|
||||
|
||||
void CMainFrame::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CFrameWnd::Dump(dc);
|
||||
}
|
||||
void CMainFrame::Dump(CDumpContext &dc) const { CFrameWnd::Dump(dc); }
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame message handlers
|
||||
|
||||
void CMainFrame::OnClose()
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
if(ModifiedPrompt(this)==IDNO) return;
|
||||
void CMainFrame::OnClose() {
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
if (ModifiedPrompt(this) == IDNO)
|
||||
return;
|
||||
|
||||
CFrameWnd::OnClose();
|
||||
CFrameWnd::OnClose();
|
||||
}
|
||||
|
||||
@@ -56,47 +56,43 @@
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
// Starting Window Dimensions
|
||||
#define MAIN_WINDOW_WIDTH 800
|
||||
#define MAIN_WINDOW_HEIGHT 600
|
||||
#define MAIN_WINDOW_WIDTH 800
|
||||
#define MAIN_WINDOW_HEIGHT 600
|
||||
|
||||
|
||||
class CMainFrame : public CFrameWnd
|
||||
{
|
||||
class CMainFrame : public CFrameWnd {
|
||||
protected: // create from serialization only
|
||||
CMainFrame();
|
||||
DECLARE_DYNCREATE(CMainFrame)
|
||||
CMainFrame();
|
||||
DECLARE_DYNCREATE(CMainFrame)
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
// Operations
|
||||
public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainFrame)
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainFrame)
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CMainFrame();
|
||||
virtual ~CMainFrame();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected: // control bar embedded members
|
||||
CStatusBar m_wndStatusBar;
|
||||
CToolBar m_wndToolBar;
|
||||
protected: // control bar embedded members
|
||||
CStatusBar m_wndStatusBar;
|
||||
CToolBar m_wndToolBar;
|
||||
|
||||
// Generated message map functions
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMainFrame)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnClose();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CMainFrame)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnClose();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by HogEdit.rc
|
||||
//
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDR_HOGEDITYPE 129
|
||||
#define IDD_HOGINFO 130
|
||||
#define IDC_HOGINFO_FILES 1000
|
||||
#define IDC_HOGINFO_SIZE_BYTES 1001
|
||||
#define IDC_HOGINFO_LOCATION 1002
|
||||
#define IDC_HOGINFO_SIZE_MB 1003
|
||||
#define ID_ACTION_INSERT 32771
|
||||
#define ID_ACTION_DELETE 32772
|
||||
#define ID_ACTION_UPDATE 32773
|
||||
#define ID_ACTION_BUILD 32776
|
||||
#define ID_ACTION_CREATE 32777
|
||||
#define ID_VIEW_FULL_ROW 32778
|
||||
#define ID_ACTION_EXTRACT 32779
|
||||
#define ID_ACTION_IMPORT 32782
|
||||
#define IDS_STRING61204 61204
|
||||
#define ID_INDICATOR_FILES 61205
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDR_HOGEDITYPE 129
|
||||
#define IDD_HOGINFO 130
|
||||
#define IDC_HOGINFO_FILES 1000
|
||||
#define IDC_HOGINFO_SIZE_BYTES 1001
|
||||
#define IDC_HOGINFO_LOCATION 1002
|
||||
#define IDC_HOGINFO_SIZE_MB 1003
|
||||
#define ID_ACTION_INSERT 32771
|
||||
#define ID_ACTION_DELETE 32772
|
||||
#define ID_ACTION_UPDATE 32773
|
||||
#define ID_ACTION_BUILD 32776
|
||||
#define ID_ACTION_CREATE 32777
|
||||
#define ID_VIEW_FULL_ROW 32778
|
||||
#define ID_ACTION_EXTRACT 32779
|
||||
#define ID_ACTION_IMPORT 32782
|
||||
#define IDS_STRING61204 61204
|
||||
#define ID_INDICATOR_FILES 61205
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
#define _APS_NEXT_COMMAND_VALUE 32784
|
||||
#define _APS_NEXT_CONTROL_VALUE 1004
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
#define _APS_NEXT_COMMAND_VALUE 32784
|
||||
#define _APS_NEXT_CONTROL_VALUE 1004
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// HogEdit.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
@@ -28,16 +28,15 @@
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxcview.h>
|
||||
#include <afxdisp.h> // MFC OLE automation classes
|
||||
#include <afxdisp.h> // MFC OLE automation classes
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// ListVwEx.cpp : implementation of the CListViewEx class
|
||||
//
|
||||
@@ -43,316 +43,278 @@ static char THIS_FILE[] = __FILE__;
|
||||
IMPLEMENT_DYNCREATE(CListViewEx, CListView)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CListViewEx, CListView)
|
||||
//{{AFX_MSG_MAP(CListViewEx)
|
||||
ON_WM_SIZE()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_SETFOCUS()
|
||||
ON_WM_KILLFOCUS()
|
||||
//}}AFX_MSG_MAP
|
||||
ON_MESSAGE(LVM_SETIMAGELIST, OnSetImageList)
|
||||
ON_MESSAGE(LVM_SETTEXTCOLOR, OnSetTextColor)
|
||||
ON_MESSAGE(LVM_SETTEXTBKCOLOR, OnSetTextBkColor)
|
||||
ON_MESSAGE(LVM_SETBKCOLOR, OnSetBkColor)
|
||||
//{{AFX_MSG_MAP(CListViewEx)
|
||||
ON_WM_SIZE()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_SETFOCUS()
|
||||
ON_WM_KILLFOCUS()
|
||||
//}}AFX_MSG_MAP
|
||||
ON_MESSAGE(LVM_SETIMAGELIST, OnSetImageList)
|
||||
ON_MESSAGE(LVM_SETTEXTCOLOR, OnSetTextColor)
|
||||
ON_MESSAGE(LVM_SETTEXTBKCOLOR, OnSetTextBkColor)
|
||||
ON_MESSAGE(LVM_SETBKCOLOR, OnSetBkColor)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CListViewEx construction/destruction
|
||||
|
||||
CListViewEx::CListViewEx()
|
||||
{
|
||||
m_bFullRowSel = TRUE;
|
||||
m_bClientWidthSel = TRUE;
|
||||
CListViewEx::CListViewEx() {
|
||||
m_bFullRowSel = TRUE;
|
||||
m_bClientWidthSel = TRUE;
|
||||
|
||||
m_cxClient = 0;
|
||||
m_cxStateImageOffset = 0;
|
||||
m_cxClient = 0;
|
||||
m_cxStateImageOffset = 0;
|
||||
|
||||
m_clrText = ::GetSysColor(COLOR_WINDOWTEXT);
|
||||
m_clrTextBk = ::GetSysColor(COLOR_WINDOW);
|
||||
m_clrBkgnd = ::GetSysColor(COLOR_WINDOW);
|
||||
m_clrText = ::GetSysColor(COLOR_WINDOWTEXT);
|
||||
m_clrTextBk = ::GetSysColor(COLOR_WINDOW);
|
||||
m_clrBkgnd = ::GetSysColor(COLOR_WINDOW);
|
||||
}
|
||||
|
||||
CListViewEx::~CListViewEx()
|
||||
{
|
||||
CListViewEx::~CListViewEx() {}
|
||||
|
||||
BOOL CListViewEx::PreCreateWindow(CREATESTRUCT &cs) {
|
||||
// default is report view and full row selection
|
||||
cs.style &= ~LVS_TYPEMASK;
|
||||
cs.style |= LVS_REPORT | LVS_OWNERDRAWFIXED;
|
||||
m_bFullRowSel = TRUE;
|
||||
|
||||
return (CListView::PreCreateWindow(cs));
|
||||
}
|
||||
|
||||
BOOL CListViewEx::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
// default is report view and full row selection
|
||||
cs.style &= ~LVS_TYPEMASK;
|
||||
cs.style |= LVS_REPORT | LVS_OWNERDRAWFIXED;
|
||||
m_bFullRowSel = TRUE;
|
||||
BOOL CListViewEx::SetFullRowSel(BOOL bFullRowSel) {
|
||||
// no painting during change
|
||||
LockWindowUpdate();
|
||||
|
||||
return(CListView::PreCreateWindow(cs));
|
||||
m_bFullRowSel = bFullRowSel;
|
||||
|
||||
BOOL bRet;
|
||||
|
||||
if (m_bFullRowSel)
|
||||
bRet = ModifyStyle(0L, LVS_OWNERDRAWFIXED);
|
||||
else
|
||||
bRet = ModifyStyle(LVS_OWNERDRAWFIXED, 0L);
|
||||
|
||||
// repaint window if we are not changing view type
|
||||
if (bRet && (GetStyle() & LVS_TYPEMASK) == LVS_REPORT)
|
||||
Invalidate();
|
||||
|
||||
// repaint changes
|
||||
UnlockWindowUpdate();
|
||||
|
||||
return (bRet);
|
||||
}
|
||||
|
||||
BOOL CListViewEx::SetFullRowSel(BOOL bFullRowSel)
|
||||
{
|
||||
// no painting during change
|
||||
LockWindowUpdate();
|
||||
|
||||
m_bFullRowSel = bFullRowSel;
|
||||
|
||||
BOOL bRet;
|
||||
|
||||
if (m_bFullRowSel)
|
||||
bRet = ModifyStyle(0L, LVS_OWNERDRAWFIXED);
|
||||
else
|
||||
bRet = ModifyStyle(LVS_OWNERDRAWFIXED, 0L);
|
||||
|
||||
// repaint window if we are not changing view type
|
||||
if (bRet && (GetStyle() & LVS_TYPEMASK) == LVS_REPORT)
|
||||
Invalidate();
|
||||
|
||||
// repaint changes
|
||||
UnlockWindowUpdate();
|
||||
|
||||
return(bRet);
|
||||
}
|
||||
|
||||
BOOL CListViewEx::GetFullRowSel()
|
||||
{
|
||||
return(m_bFullRowSel);
|
||||
}
|
||||
BOOL CListViewEx::GetFullRowSel() { return (m_bFullRowSel); }
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CListViewEx drawing
|
||||
|
||||
// offsets for first and other columns
|
||||
#define OFFSET_FIRST 2
|
||||
#define OFFSET_OTHER 6
|
||||
#define OFFSET_FIRST 2
|
||||
#define OFFSET_OTHER 6
|
||||
|
||||
void CListViewEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
{
|
||||
CListCtrl& ListCtrl=GetListCtrl();
|
||||
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||
CRect rcItem(lpDrawItemStruct->rcItem);
|
||||
UINT uiFlags = ILD_TRANSPARENT;
|
||||
CImageList* pImageList;
|
||||
int nItem = lpDrawItemStruct->itemID;
|
||||
BOOL bFocus = (GetFocus() == this);
|
||||
COLORREF clrTextSave, clrBkSave;
|
||||
COLORREF clrImage = m_clrBkgnd;
|
||||
static _TCHAR szBuff[_MAX_PATH];
|
||||
LPCTSTR pszText;
|
||||
void CListViewEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {
|
||||
CListCtrl &ListCtrl = GetListCtrl();
|
||||
CDC *pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||
CRect rcItem(lpDrawItemStruct->rcItem);
|
||||
UINT uiFlags = ILD_TRANSPARENT;
|
||||
CImageList *pImageList;
|
||||
int nItem = lpDrawItemStruct->itemID;
|
||||
BOOL bFocus = (GetFocus() == this);
|
||||
COLORREF clrTextSave, clrBkSave;
|
||||
COLORREF clrImage = m_clrBkgnd;
|
||||
static _TCHAR szBuff[_MAX_PATH];
|
||||
LPCTSTR pszText;
|
||||
|
||||
// get item data
|
||||
// get item data
|
||||
|
||||
LV_ITEM lvi;
|
||||
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
|
||||
lvi.iItem = nItem;
|
||||
lvi.iSubItem = 0;
|
||||
lvi.pszText = szBuff;
|
||||
lvi.cchTextMax = sizeof(szBuff);
|
||||
lvi.stateMask = 0xFFFF; // get all state flags
|
||||
ListCtrl.GetItem(&lvi);
|
||||
LV_ITEM lvi;
|
||||
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
|
||||
lvi.iItem = nItem;
|
||||
lvi.iSubItem = 0;
|
||||
lvi.pszText = szBuff;
|
||||
lvi.cchTextMax = sizeof(szBuff);
|
||||
lvi.stateMask = 0xFFFF; // get all state flags
|
||||
ListCtrl.GetItem(&lvi);
|
||||
|
||||
BOOL bSelected = (bFocus || (GetStyle() & LVS_SHOWSELALWAYS)) && lvi.state & LVIS_SELECTED;
|
||||
bSelected = bSelected || (lvi.state & LVIS_DROPHILITED);
|
||||
BOOL bSelected = (bFocus || (GetStyle() & LVS_SHOWSELALWAYS)) && lvi.state & LVIS_SELECTED;
|
||||
bSelected = bSelected || (lvi.state & LVIS_DROPHILITED);
|
||||
|
||||
// set colors if item is selected
|
||||
// set colors if item is selected
|
||||
|
||||
CRect rcAllLabels;
|
||||
ListCtrl.GetItemRect(nItem, rcAllLabels, LVIR_BOUNDS);
|
||||
CRect rcAllLabels;
|
||||
ListCtrl.GetItemRect(nItem, rcAllLabels, LVIR_BOUNDS);
|
||||
|
||||
CRect rcLabel;
|
||||
ListCtrl.GetItemRect(nItem, rcLabel, LVIR_LABEL);
|
||||
CRect rcLabel;
|
||||
ListCtrl.GetItemRect(nItem, rcLabel, LVIR_LABEL);
|
||||
|
||||
rcAllLabels.left = rcLabel.left;
|
||||
if (m_bClientWidthSel && rcAllLabels.right<m_cxClient)
|
||||
rcAllLabels.right = m_cxClient;
|
||||
rcAllLabels.left = rcLabel.left;
|
||||
if (m_bClientWidthSel && rcAllLabels.right < m_cxClient)
|
||||
rcAllLabels.right = m_cxClient;
|
||||
|
||||
if (bSelected)
|
||||
{
|
||||
clrTextSave = pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
clrBkSave = pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
|
||||
if (bSelected) {
|
||||
clrTextSave = pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
clrBkSave = pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
|
||||
|
||||
pDC->FillRect(rcAllLabels, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
|
||||
}
|
||||
else
|
||||
pDC->FillRect(rcAllLabels, &CBrush(m_clrTextBk));
|
||||
pDC->FillRect(rcAllLabels, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
|
||||
} else
|
||||
pDC->FillRect(rcAllLabels, &CBrush(m_clrTextBk));
|
||||
|
||||
// set color and mask for the icon
|
||||
// set color and mask for the icon
|
||||
|
||||
if (lvi.state & LVIS_CUT)
|
||||
{
|
||||
clrImage = m_clrBkgnd;
|
||||
uiFlags |= ILD_BLEND50;
|
||||
}
|
||||
else if (bSelected)
|
||||
{
|
||||
clrImage = ::GetSysColor(COLOR_HIGHLIGHT);
|
||||
uiFlags |= ILD_BLEND50;
|
||||
}
|
||||
if (lvi.state & LVIS_CUT) {
|
||||
clrImage = m_clrBkgnd;
|
||||
uiFlags |= ILD_BLEND50;
|
||||
} else if (bSelected) {
|
||||
clrImage = ::GetSysColor(COLOR_HIGHLIGHT);
|
||||
uiFlags |= ILD_BLEND50;
|
||||
}
|
||||
|
||||
// draw state icon
|
||||
// draw state icon
|
||||
|
||||
UINT nStateImageMask = lvi.state & LVIS_STATEIMAGEMASK;
|
||||
if (nStateImageMask)
|
||||
{
|
||||
int nImage = (nStateImageMask>>12) - 1;
|
||||
pImageList = ListCtrl.GetImageList(LVSIL_STATE);
|
||||
if (pImageList)
|
||||
{
|
||||
pImageList->Draw(pDC, nImage,
|
||||
CPoint(rcItem.left, rcItem.top), ILD_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
UINT nStateImageMask = lvi.state & LVIS_STATEIMAGEMASK;
|
||||
if (nStateImageMask) {
|
||||
int nImage = (nStateImageMask >> 12) - 1;
|
||||
pImageList = ListCtrl.GetImageList(LVSIL_STATE);
|
||||
if (pImageList) {
|
||||
pImageList->Draw(pDC, nImage, CPoint(rcItem.left, rcItem.top), ILD_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
// draw normal and overlay icon
|
||||
// draw normal and overlay icon
|
||||
|
||||
CRect rcIcon;
|
||||
ListCtrl.GetItemRect(nItem, rcIcon, LVIR_ICON);
|
||||
CRect rcIcon;
|
||||
ListCtrl.GetItemRect(nItem, rcIcon, LVIR_ICON);
|
||||
|
||||
pImageList = ListCtrl.GetImageList(LVSIL_SMALL);
|
||||
if (pImageList)
|
||||
{
|
||||
UINT nOvlImageMask=lvi.state & LVIS_OVERLAYMASK;
|
||||
if (rcItem.left<rcItem.right-1)
|
||||
{
|
||||
ImageList_DrawEx(pImageList->m_hImageList, lvi.iImage,
|
||||
pDC->m_hDC,rcIcon.left,rcIcon.top, 16, 16,
|
||||
m_clrBkgnd, clrImage, uiFlags | nOvlImageMask);
|
||||
}
|
||||
}
|
||||
pImageList = ListCtrl.GetImageList(LVSIL_SMALL);
|
||||
if (pImageList) {
|
||||
UINT nOvlImageMask = lvi.state & LVIS_OVERLAYMASK;
|
||||
if (rcItem.left < rcItem.right - 1) {
|
||||
ImageList_DrawEx(pImageList->m_hImageList, lvi.iImage, pDC->m_hDC, rcIcon.left, rcIcon.top, 16, 16, m_clrBkgnd,
|
||||
clrImage, uiFlags | nOvlImageMask);
|
||||
}
|
||||
}
|
||||
|
||||
// draw item label
|
||||
// draw item label
|
||||
|
||||
ListCtrl.GetItemRect(nItem, rcItem, LVIR_LABEL);
|
||||
rcItem.right -= m_cxStateImageOffset;
|
||||
ListCtrl.GetItemRect(nItem, rcItem, LVIR_LABEL);
|
||||
rcItem.right -= m_cxStateImageOffset;
|
||||
|
||||
pszText = MakeShortString(pDC, szBuff,
|
||||
rcItem.right-rcItem.left, 2*OFFSET_FIRST);
|
||||
pszText = MakeShortString(pDC, szBuff, rcItem.right - rcItem.left, 2 * OFFSET_FIRST);
|
||||
|
||||
rcLabel = rcItem;
|
||||
rcLabel.left += OFFSET_FIRST;
|
||||
rcLabel.right -= OFFSET_FIRST;
|
||||
rcLabel = rcItem;
|
||||
rcLabel.left += OFFSET_FIRST;
|
||||
rcLabel.right -= OFFSET_FIRST;
|
||||
|
||||
pDC->DrawText(pszText,-1,rcLabel,DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
|
||||
pDC->DrawText(pszText, -1, rcLabel, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
|
||||
|
||||
// draw labels for extra columns
|
||||
// draw labels for extra columns
|
||||
|
||||
LV_COLUMN lvc;
|
||||
lvc.mask = LVCF_FMT | LVCF_WIDTH;
|
||||
LV_COLUMN lvc;
|
||||
lvc.mask = LVCF_FMT | LVCF_WIDTH;
|
||||
|
||||
for(int nColumn = 1; ListCtrl.GetColumn(nColumn, &lvc); nColumn++)
|
||||
{
|
||||
rcItem.left = rcItem.right;
|
||||
rcItem.right += lvc.cx;
|
||||
for (int nColumn = 1; ListCtrl.GetColumn(nColumn, &lvc); nColumn++) {
|
||||
rcItem.left = rcItem.right;
|
||||
rcItem.right += lvc.cx;
|
||||
|
||||
int nRetLen = ListCtrl.GetItemText(nItem, nColumn,
|
||||
szBuff, sizeof(szBuff));
|
||||
if (nRetLen == 0)
|
||||
continue;
|
||||
int nRetLen = ListCtrl.GetItemText(nItem, nColumn, szBuff, sizeof(szBuff));
|
||||
if (nRetLen == 0)
|
||||
continue;
|
||||
|
||||
pszText = MakeShortString(pDC, szBuff,
|
||||
rcItem.right - rcItem.left, 2*OFFSET_OTHER);
|
||||
pszText = MakeShortString(pDC, szBuff, rcItem.right - rcItem.left, 2 * OFFSET_OTHER);
|
||||
|
||||
UINT nJustify = DT_LEFT;
|
||||
UINT nJustify = DT_LEFT;
|
||||
|
||||
if(pszText == szBuff)
|
||||
{
|
||||
switch(lvc.fmt & LVCFMT_JUSTIFYMASK)
|
||||
{
|
||||
case LVCFMT_RIGHT:
|
||||
nJustify = DT_RIGHT;
|
||||
break;
|
||||
case LVCFMT_CENTER:
|
||||
nJustify = DT_CENTER;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pszText == szBuff) {
|
||||
switch (lvc.fmt & LVCFMT_JUSTIFYMASK) {
|
||||
case LVCFMT_RIGHT:
|
||||
nJustify = DT_RIGHT;
|
||||
break;
|
||||
case LVCFMT_CENTER:
|
||||
nJustify = DT_CENTER;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rcLabel = rcItem;
|
||||
rcLabel.left += OFFSET_OTHER;
|
||||
rcLabel.right -= OFFSET_OTHER;
|
||||
rcLabel = rcItem;
|
||||
rcLabel.left += OFFSET_OTHER;
|
||||
rcLabel.right -= OFFSET_OTHER;
|
||||
|
||||
pDC->DrawText(pszText, -1, rcLabel,
|
||||
nJustify | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
|
||||
}
|
||||
pDC->DrawText(pszText, -1, rcLabel, nJustify | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
|
||||
}
|
||||
|
||||
// draw focus rectangle if item has focus
|
||||
// draw focus rectangle if item has focus
|
||||
|
||||
if (lvi.state & LVIS_FOCUSED && bFocus)
|
||||
pDC->DrawFocusRect(rcAllLabels);
|
||||
if (lvi.state & LVIS_FOCUSED && bFocus)
|
||||
pDC->DrawFocusRect(rcAllLabels);
|
||||
|
||||
// set original colors if item was selected
|
||||
// set original colors if item was selected
|
||||
|
||||
if (bSelected)
|
||||
{
|
||||
pDC->SetTextColor(clrTextSave);
|
||||
pDC->SetBkColor(clrBkSave);
|
||||
}
|
||||
if (bSelected) {
|
||||
pDC->SetTextColor(clrTextSave);
|
||||
pDC->SetBkColor(clrBkSave);
|
||||
}
|
||||
}
|
||||
|
||||
LPCTSTR CListViewEx::MakeShortString(CDC* pDC, LPCTSTR lpszLong, int nColumnLen, int nOffset)
|
||||
{
|
||||
static const _TCHAR szThreeDots[] = _T("...");
|
||||
LPCTSTR CListViewEx::MakeShortString(CDC *pDC, LPCTSTR lpszLong, int nColumnLen, int nOffset) {
|
||||
static const _TCHAR szThreeDots[] = _T("...");
|
||||
|
||||
int nStringLen = lstrlen(lpszLong);
|
||||
int nStringLen = lstrlen(lpszLong);
|
||||
|
||||
if(nStringLen == 0 ||
|
||||
(pDC->GetTextExtent(lpszLong, nStringLen).cx + nOffset) <= nColumnLen)
|
||||
{
|
||||
return(lpszLong);
|
||||
}
|
||||
if (nStringLen == 0 || (pDC->GetTextExtent(lpszLong, nStringLen).cx + nOffset) <= nColumnLen) {
|
||||
return (lpszLong);
|
||||
}
|
||||
|
||||
static _TCHAR szShort[_MAX_PATH];
|
||||
static _TCHAR szShort[_MAX_PATH];
|
||||
|
||||
lstrcpy(szShort,lpszLong);
|
||||
int nAddLen = pDC->GetTextExtent(szThreeDots,sizeof(szThreeDots)).cx;
|
||||
lstrcpy(szShort, lpszLong);
|
||||
int nAddLen = pDC->GetTextExtent(szThreeDots, sizeof(szThreeDots)).cx;
|
||||
|
||||
for(int i = nStringLen-1; i > 0; i--)
|
||||
{
|
||||
szShort[i] = 0;
|
||||
if((pDC->GetTextExtent(szShort, i).cx + nOffset + nAddLen)
|
||||
<= nColumnLen)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = nStringLen - 1; i > 0; i--) {
|
||||
szShort[i] = 0;
|
||||
if ((pDC->GetTextExtent(szShort, i).cx + nOffset + nAddLen) <= nColumnLen) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lstrcat(szShort, szThreeDots);
|
||||
return(szShort);
|
||||
lstrcat(szShort, szThreeDots);
|
||||
return (szShort);
|
||||
}
|
||||
|
||||
void CListViewEx::RepaintSelectedItems()
|
||||
{
|
||||
CListCtrl& ListCtrl = GetListCtrl();
|
||||
CRect rcItem, rcLabel;
|
||||
void CListViewEx::RepaintSelectedItems() {
|
||||
CListCtrl &ListCtrl = GetListCtrl();
|
||||
CRect rcItem, rcLabel;
|
||||
|
||||
// invalidate focused item so it can repaint properly
|
||||
// invalidate focused item so it can repaint properly
|
||||
|
||||
int nItem = ListCtrl.GetNextItem(-1, LVNI_FOCUSED);
|
||||
int nItem = ListCtrl.GetNextItem(-1, LVNI_FOCUSED);
|
||||
|
||||
if(nItem != -1)
|
||||
{
|
||||
ListCtrl.GetItemRect(nItem, rcItem, LVIR_BOUNDS);
|
||||
ListCtrl.GetItemRect(nItem, rcLabel, LVIR_LABEL);
|
||||
rcItem.left = rcLabel.left;
|
||||
if (nItem != -1) {
|
||||
ListCtrl.GetItemRect(nItem, rcItem, LVIR_BOUNDS);
|
||||
ListCtrl.GetItemRect(nItem, rcLabel, LVIR_LABEL);
|
||||
rcItem.left = rcLabel.left;
|
||||
|
||||
InvalidateRect(rcItem, FALSE);
|
||||
}
|
||||
InvalidateRect(rcItem, FALSE);
|
||||
}
|
||||
|
||||
// if selected items should not be preserved, invalidate them
|
||||
// if selected items should not be preserved, invalidate them
|
||||
|
||||
if(!(GetStyle() & LVS_SHOWSELALWAYS))
|
||||
{
|
||||
for(nItem = ListCtrl.GetNextItem(-1, LVNI_SELECTED);
|
||||
nItem != -1; nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED))
|
||||
{
|
||||
ListCtrl.GetItemRect(nItem, rcItem, LVIR_BOUNDS);
|
||||
ListCtrl.GetItemRect(nItem, rcLabel, LVIR_LABEL);
|
||||
rcItem.left = rcLabel.left;
|
||||
if (!(GetStyle() & LVS_SHOWSELALWAYS)) {
|
||||
for (nItem = ListCtrl.GetNextItem(-1, LVNI_SELECTED); nItem != -1;
|
||||
nItem = ListCtrl.GetNextItem(nItem, LVNI_SELECTED)) {
|
||||
ListCtrl.GetItemRect(nItem, rcItem, LVIR_BOUNDS);
|
||||
ListCtrl.GetItemRect(nItem, rcLabel, LVIR_LABEL);
|
||||
rcItem.left = rcLabel.left;
|
||||
|
||||
InvalidateRect(rcItem, FALSE);
|
||||
}
|
||||
}
|
||||
InvalidateRect(rcItem, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// update changes
|
||||
// update changes
|
||||
|
||||
UpdateWindow();
|
||||
UpdateWindow();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -360,14 +322,13 @@ void CListViewEx::RepaintSelectedItems()
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CListViewEx::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CListView::Dump(dc);
|
||||
void CListViewEx::Dump(CDumpContext &dc) const {
|
||||
CListView::Dump(dc);
|
||||
|
||||
dc << "m_bFullRowSel = " << (UINT)m_bFullRowSel;
|
||||
dc << "\n";
|
||||
dc << "m_cxStateImageOffset = " << m_cxStateImageOffset;
|
||||
dc << "\n";
|
||||
dc << "m_bFullRowSel = " << (UINT)m_bFullRowSel;
|
||||
dc << "\n";
|
||||
dc << "m_cxStateImageOffset = " << m_cxStateImageOffset;
|
||||
dc << "\n";
|
||||
}
|
||||
|
||||
#endif //_DEBUG
|
||||
@@ -375,98 +336,85 @@ void CListViewEx::Dump(CDumpContext& dc) const
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CListViewEx message handlers
|
||||
|
||||
LRESULT CListViewEx::OnSetImageList(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if( (int) wParam == LVSIL_STATE)
|
||||
{
|
||||
int cx, cy;
|
||||
LRESULT CListViewEx::OnSetImageList(WPARAM wParam, LPARAM lParam) {
|
||||
if ((int)wParam == LVSIL_STATE) {
|
||||
int cx, cy;
|
||||
|
||||
if(::ImageList_GetIconSize((HIMAGELIST)lParam, &cx, &cy))
|
||||
m_cxStateImageOffset = cx;
|
||||
else
|
||||
m_cxStateImageOffset = 0;
|
||||
}
|
||||
if (::ImageList_GetIconSize((HIMAGELIST)lParam, &cx, &cy))
|
||||
m_cxStateImageOffset = cx;
|
||||
else
|
||||
m_cxStateImageOffset = 0;
|
||||
}
|
||||
|
||||
return(Default());
|
||||
return (Default());
|
||||
}
|
||||
|
||||
LRESULT CListViewEx::OnSetTextColor(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_clrText = (COLORREF)lParam;
|
||||
return(Default());
|
||||
LRESULT CListViewEx::OnSetTextColor(WPARAM wParam, LPARAM lParam) {
|
||||
m_clrText = (COLORREF)lParam;
|
||||
return (Default());
|
||||
}
|
||||
|
||||
LRESULT CListViewEx::OnSetTextBkColor(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_clrTextBk = (COLORREF)lParam;
|
||||
return(Default());
|
||||
LRESULT CListViewEx::OnSetTextBkColor(WPARAM wParam, LPARAM lParam) {
|
||||
m_clrTextBk = (COLORREF)lParam;
|
||||
return (Default());
|
||||
}
|
||||
|
||||
LRESULT CListViewEx::OnSetBkColor(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_clrBkgnd = (COLORREF)lParam;
|
||||
return(Default());
|
||||
LRESULT CListViewEx::OnSetBkColor(WPARAM wParam, LPARAM lParam) {
|
||||
m_clrBkgnd = (COLORREF)lParam;
|
||||
return (Default());
|
||||
}
|
||||
|
||||
void CListViewEx::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
m_cxClient = cx;
|
||||
CListView::OnSize(nType, cx, cy);
|
||||
void CListViewEx::OnSize(UINT nType, int cx, int cy) {
|
||||
m_cxClient = cx;
|
||||
CListView::OnSize(nType, cx, cy);
|
||||
}
|
||||
|
||||
void CListViewEx::OnPaint()
|
||||
{
|
||||
// in full row select mode, we need to extend the clipping region
|
||||
// so we can paint a selection all the way to the right
|
||||
if (m_bClientWidthSel &&
|
||||
(GetStyle() & LVS_TYPEMASK) == LVS_REPORT &&
|
||||
GetFullRowSel())
|
||||
{
|
||||
CRect rcAllLabels;
|
||||
GetListCtrl().GetItemRect(0, rcAllLabels, LVIR_BOUNDS);
|
||||
void CListViewEx::OnPaint() {
|
||||
// in full row select mode, we need to extend the clipping region
|
||||
// so we can paint a selection all the way to the right
|
||||
if (m_bClientWidthSel && (GetStyle() & LVS_TYPEMASK) == LVS_REPORT && GetFullRowSel()) {
|
||||
CRect rcAllLabels;
|
||||
GetListCtrl().GetItemRect(0, rcAllLabels, LVIR_BOUNDS);
|
||||
|
||||
if(rcAllLabels.right < m_cxClient)
|
||||
{
|
||||
// need to call BeginPaint (in CPaintDC c-tor)
|
||||
// to get correct clipping rect
|
||||
CPaintDC dc(this);
|
||||
if (rcAllLabels.right < m_cxClient) {
|
||||
// need to call BeginPaint (in CPaintDC c-tor)
|
||||
// to get correct clipping rect
|
||||
CPaintDC dc(this);
|
||||
|
||||
CRect rcClip;
|
||||
dc.GetClipBox(rcClip);
|
||||
CRect rcClip;
|
||||
dc.GetClipBox(rcClip);
|
||||
|
||||
rcClip.left = min(rcAllLabels.right-1, rcClip.left);
|
||||
rcClip.right = m_cxClient;
|
||||
rcClip.left = min(rcAllLabels.right - 1, rcClip.left);
|
||||
rcClip.right = m_cxClient;
|
||||
|
||||
InvalidateRect(rcClip, FALSE);
|
||||
// EndPaint will be called in CPaintDC d-tor
|
||||
}
|
||||
}
|
||||
InvalidateRect(rcClip, FALSE);
|
||||
// EndPaint will be called in CPaintDC d-tor
|
||||
}
|
||||
}
|
||||
|
||||
CListView::OnPaint();
|
||||
CListView::OnPaint();
|
||||
}
|
||||
|
||||
void CListViewEx::OnSetFocus(CWnd* pOldWnd)
|
||||
{
|
||||
CListView::OnSetFocus(pOldWnd);
|
||||
void CListViewEx::OnSetFocus(CWnd *pOldWnd) {
|
||||
CListView::OnSetFocus(pOldWnd);
|
||||
|
||||
// check if we are getting focus from label edit box
|
||||
if(pOldWnd!=NULL && pOldWnd->GetParent()==this)
|
||||
return;
|
||||
// check if we are getting focus from label edit box
|
||||
if (pOldWnd != NULL && pOldWnd->GetParent() == this)
|
||||
return;
|
||||
|
||||
// repaint items that should change appearance
|
||||
if(m_bFullRowSel && (GetStyle() & LVS_TYPEMASK)==LVS_REPORT)
|
||||
RepaintSelectedItems();
|
||||
// repaint items that should change appearance
|
||||
if (m_bFullRowSel && (GetStyle() & LVS_TYPEMASK) == LVS_REPORT)
|
||||
RepaintSelectedItems();
|
||||
}
|
||||
|
||||
void CListViewEx::OnKillFocus(CWnd* pNewWnd)
|
||||
{
|
||||
CListView::OnKillFocus(pNewWnd);
|
||||
void CListViewEx::OnKillFocus(CWnd *pNewWnd) {
|
||||
CListView::OnKillFocus(pNewWnd);
|
||||
|
||||
// check if we are losing focus to label edit box
|
||||
if(pNewWnd != NULL && pNewWnd->GetParent() == this)
|
||||
return;
|
||||
// check if we are losing focus to label edit box
|
||||
if (pNewWnd != NULL && pNewWnd->GetParent() == this)
|
||||
return;
|
||||
|
||||
// repaint items that should change appearance
|
||||
if(m_bFullRowSel && (GetStyle() & LVS_TYPEMASK) == LVS_REPORT)
|
||||
RepaintSelectedItems();
|
||||
// repaint items that should change appearance
|
||||
if (m_bFullRowSel && (GetStyle() & LVS_TYPEMASK) == LVS_REPORT)
|
||||
RepaintSelectedItems();
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// ListVwEx.h : interface of the CListViewEx class
|
||||
//
|
||||
@@ -31,70 +31,70 @@
|
||||
// See these sources for detailed information regarding the
|
||||
// Microsoft Foundation Classes product.
|
||||
|
||||
class CListViewEx : public CListView
|
||||
{
|
||||
DECLARE_DYNCREATE(CListViewEx)
|
||||
class CListViewEx : public CListView {
|
||||
DECLARE_DYNCREATE(CListViewEx)
|
||||
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CListViewEx();
|
||||
CListViewEx();
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
protected:
|
||||
BOOL m_bFullRowSel;
|
||||
BOOL m_bFullRowSel;
|
||||
|
||||
public:
|
||||
BOOL SetFullRowSel(BOOL bFillRowSel);
|
||||
BOOL GetFullRowSel();
|
||||
BOOL SetFullRowSel(BOOL bFillRowSel);
|
||||
BOOL GetFullRowSel();
|
||||
|
||||
BOOL m_bClientWidthSel;
|
||||
BOOL m_bClientWidthSel;
|
||||
|
||||
// Overrides
|
||||
// Overrides
|
||||
protected:
|
||||
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CListViewEx)
|
||||
public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
protected:
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CListViewEx)
|
||||
public:
|
||||
virtual ~CListViewEx();
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
|
||||
protected:
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CListViewEx();
|
||||
#ifdef _DEBUG
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
static LPCTSTR MakeShortString(CDC* pDC, LPCTSTR lpszLong, int nColumnLen, int nOffset);
|
||||
void RepaintSelectedItems();
|
||||
static LPCTSTR MakeShortString(CDC *pDC, LPCTSTR lpszLong, int nColumnLen, int nOffset);
|
||||
void RepaintSelectedItems();
|
||||
|
||||
// Implementation - client area width
|
||||
int m_cxClient;
|
||||
// Implementation - client area width
|
||||
int m_cxClient;
|
||||
|
||||
// Implementation - state icon width
|
||||
int m_cxStateImageOffset;
|
||||
afx_msg LRESULT OnSetImageList(WPARAM wParam, LPARAM lParam);
|
||||
// Implementation - state icon width
|
||||
int m_cxStateImageOffset;
|
||||
afx_msg LRESULT OnSetImageList(WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// Implementation - list view colors
|
||||
COLORREF m_clrText;
|
||||
COLORREF m_clrTextBk;
|
||||
COLORREF m_clrBkgnd;
|
||||
afx_msg LRESULT OnSetTextColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetTextBkColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetBkColor(WPARAM wParam, LPARAM lParam);
|
||||
// Implementation - list view colors
|
||||
COLORREF m_clrText;
|
||||
COLORREF m_clrTextBk;
|
||||
COLORREF m_clrBkgnd;
|
||||
afx_msg LRESULT OnSetTextColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetTextBkColor(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnSetBkColor(WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// Generated message map functions
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CListViewEx)
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnSetFocus(CWnd* pOldWnd);
|
||||
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
//{{AFX_MSG(CListViewEx)
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnSetFocus(CWnd *pOldWnd);
|
||||
afx_msg void OnKillFocus(CWnd *pNewWnd);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -45,233 +45,213 @@
|
||||
#include "pstypes.h"
|
||||
#include "macros.h"
|
||||
|
||||
|
||||
/* HOG FILE FORMAT v2.0
|
||||
|
||||
HOG_TAG_STR [strlen()]
|
||||
NFILES [int32]
|
||||
HDRINFO [HOG_HDR_SIZE]
|
||||
FILE_TABLE [sizeof(FILE_ENTRY) * NFILES]
|
||||
FILE 0 [filelen(FILE 0)]
|
||||
FILE 1 [filelen(FILE 1)]
|
||||
.
|
||||
.
|
||||
.
|
||||
FILE NFILES-1 [filelen(NFILES -1)]
|
||||
HOG_TAG_STR [strlen()]
|
||||
NFILES [int32]
|
||||
HDRINFO [HOG_HDR_SIZE]
|
||||
FILE_TABLE [sizeof(FILE_ENTRY) * NFILES]
|
||||
FILE 0 [filelen(FILE 0)]
|
||||
FILE 1 [filelen(FILE 1)]
|
||||
.
|
||||
.
|
||||
.
|
||||
FILE NFILES-1 [filelen(NFILES -1)]
|
||||
*/
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool CopyFile(FILE *ofp,FILE *ifp,int length)
|
||||
{
|
||||
#define BUFFER_SIZE (1024*1024) // 1 meg
|
||||
bool CopyFile(FILE *ofp, FILE *ifp, int length) {
|
||||
#define BUFFER_SIZE (1024 * 1024) // 1 meg
|
||||
|
||||
char *buffer;
|
||||
char *buffer;
|
||||
|
||||
buffer = (char *)malloc(BUFFER_SIZE);
|
||||
if (!buffer)
|
||||
return false;
|
||||
buffer = (char *)malloc(BUFFER_SIZE);
|
||||
if (!buffer)
|
||||
return false;
|
||||
|
||||
while (length)
|
||||
{
|
||||
size_t n,read_len;
|
||||
while (length) {
|
||||
size_t n, read_len;
|
||||
|
||||
read_len = min(length,(int)BUFFER_SIZE);
|
||||
read_len = min(length, (int)BUFFER_SIZE);
|
||||
|
||||
n = fread( buffer, 1, read_len, ifp );
|
||||
if ( n != read_len ) {
|
||||
free(buffer);
|
||||
return false;
|
||||
}
|
||||
n = fread(buffer, 1, read_len, ifp);
|
||||
if (n != read_len) {
|
||||
free(buffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fwrite( buffer, 1, read_len, ofp) != read_len ) {
|
||||
free(buffer);
|
||||
return false;
|
||||
}
|
||||
if (fwrite(buffer, 1, read_len, ofp) != read_len) {
|
||||
free(buffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
length -= read_len;
|
||||
}
|
||||
length -= read_len;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
free(buffer);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadHogHeader(FILE *fp, tHogHeader *header) {
|
||||
int res = 0;
|
||||
res = fread(&header->nfiles, sizeof(header->nfiles), 1, fp);
|
||||
res = fwrite(&header->file_data_offset, sizeof(header->file_data_offset), 1, fp);
|
||||
|
||||
bool ReadHogHeader(FILE *fp, tHogHeader *header)
|
||||
{
|
||||
int res=0;
|
||||
res = fread(&header->nfiles, sizeof(header->nfiles), 1, fp);
|
||||
res = fwrite(&header->file_data_offset, sizeof(header->file_data_offset), 1, fp);
|
||||
|
||||
if (res)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
if (res)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReadHogEntry(FILE *fp, tHogFileEntry *entry) {
|
||||
int res = 0;
|
||||
res = fread(entry->name, strlen(entry->name), 1, fp);
|
||||
res = fread(&entry->flags, sizeof(entry->flags), 1, fp);
|
||||
res = fread(&entry->len, sizeof(entry->len), 1, fp);
|
||||
res = fread(&entry->timestamp, sizeof(entry->timestamp), 1, fp);
|
||||
|
||||
bool ReadHogEntry(FILE *fp, tHogFileEntry *entry)
|
||||
{
|
||||
int res=0;
|
||||
res = fread(entry->name, strlen(entry->name), 1, fp);
|
||||
res = fread(&entry->flags, sizeof(entry->flags), 1, fp);
|
||||
res = fread(&entry->len, sizeof(entry->len), 1, fp);
|
||||
res = fread(&entry->timestamp, sizeof(entry->timestamp), 1, fp);
|
||||
|
||||
if (res)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
if (res)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool WRITE_FILE_ENTRY(FILE *fp, tHogFileEntry *entry) {
|
||||
int res = 0;
|
||||
res = fwrite(entry->name, strlen(entry->name), 1, fp);
|
||||
res = fwrite(&entry->flags, sizeof(entry->flags), 1, fp);
|
||||
res = fwrite(&entry->len, sizeof(entry->len), 1, fp);
|
||||
res = fwrite(&entry->timestamp, sizeof(entry->timestamp), 1, fp);
|
||||
|
||||
inline bool WRITE_FILE_ENTRY(FILE *fp, tHogFileEntry *entry)
|
||||
{
|
||||
int res=0;
|
||||
res = fwrite(entry->name, strlen(entry->name), 1, fp);
|
||||
res = fwrite(&entry->flags, sizeof(entry->flags), 1, fp);
|
||||
res = fwrite(&entry->len, sizeof(entry->len), 1, fp);
|
||||
res = fwrite(&entry->timestamp, sizeof(entry->timestamp), 1, fp);
|
||||
|
||||
if (res)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
if (res)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create new hog file
|
||||
|
||||
#define HOGMAKER_ERROR 0
|
||||
#define HOGMAKER_OK 1
|
||||
#define HOGMAKER_MEMORY 2
|
||||
#define HOGMAKER_OUTFILE 3
|
||||
#define HOGMAKER_INFILE 4
|
||||
#define HOGMAKER_COPY 5
|
||||
#define HOGMAKER_ERROR 0
|
||||
#define HOGMAKER_OK 1
|
||||
#define HOGMAKER_MEMORY 2
|
||||
#define HOGMAKER_OUTFILE 3
|
||||
#define HOGMAKER_INFILE 4
|
||||
#define HOGMAKER_COPY 5
|
||||
|
||||
int NewHogFile(const char *hogname, int nfiles, const char **filenames)
|
||||
{
|
||||
unsigned i;
|
||||
int table_pos;
|
||||
FILE *hog_fp;
|
||||
tHogHeader header;
|
||||
tHogFileEntry *table;
|
||||
char ext[_MAX_EXT];
|
||||
int NewHogFile(const char *hogname, int nfiles, const char **filenames) {
|
||||
unsigned i;
|
||||
int table_pos;
|
||||
FILE *hog_fp;
|
||||
tHogHeader header;
|
||||
tHogFileEntry *table;
|
||||
char ext[_MAX_EXT];
|
||||
|
||||
// allocate file table
|
||||
if (nfiles <= 0)
|
||||
return HOGMAKER_ERROR;
|
||||
// allocate file table
|
||||
if (nfiles <= 0)
|
||||
return HOGMAKER_ERROR;
|
||||
|
||||
table = new tHogFileEntry[nfiles];
|
||||
if (!table)
|
||||
return HOGMAKER_MEMORY;
|
||||
table = new tHogFileEntry[nfiles];
|
||||
if (!table)
|
||||
return HOGMAKER_MEMORY;
|
||||
|
||||
// create new file
|
||||
hog_fp = fopen( hogname, "wb" );
|
||||
if ( hog_fp == NULL ) {
|
||||
delete[] table;
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
// create new file
|
||||
hog_fp = fopen(hogname, "wb");
|
||||
if (hog_fp == NULL) {
|
||||
delete[] table;
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
|
||||
//write the tag
|
||||
if (!fwrite(HOG_TAG_STR, strlen(HOG_TAG_STR), 1, hog_fp )) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
// write the tag
|
||||
if (!fwrite(HOG_TAG_STR, strlen(HOG_TAG_STR), 1, hog_fp)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
|
||||
//write number of files
|
||||
uint8_t filler = 0xff;
|
||||
header.nfiles = (unsigned)nfiles;
|
||||
header.file_data_offset = strlen(HOG_TAG_STR) + HOG_HDR_SIZE + (sizeof(tHogFileEntry) * header.nfiles);
|
||||
// write number of files
|
||||
uint8_t filler = 0xff;
|
||||
header.nfiles = (unsigned)nfiles;
|
||||
header.file_data_offset = strlen(HOG_TAG_STR) + HOG_HDR_SIZE + (sizeof(tHogFileEntry) * header.nfiles);
|
||||
|
||||
if (!fwrite(&header.nfiles,sizeof(header.nfiles),1,hog_fp)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
if (!fwrite(&header.file_data_offset,sizeof(header.file_data_offset),1,hog_fp)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
if (!fwrite(&filler,sizeof(uint8_t),HOG_HDR_SIZE-sizeof(tHogHeader),hog_fp)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
if (!fwrite(&header.nfiles, sizeof(header.nfiles), 1, hog_fp)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
if (!fwrite(&header.file_data_offset, sizeof(header.file_data_offset), 1, hog_fp)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
if (!fwrite(&filler, sizeof(uint8_t), HOG_HDR_SIZE - sizeof(tHogHeader), hog_fp)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
|
||||
//save file position of index table and write out dummy table
|
||||
table_pos = strlen(HOG_TAG_STR) + HOG_HDR_SIZE;
|
||||
// save file position of index table and write out dummy table
|
||||
table_pos = strlen(HOG_TAG_STR) + HOG_HDR_SIZE;
|
||||
|
||||
memset(&table[0], 0, sizeof(table[0]));
|
||||
memset(&table[0], 0, sizeof(table[0]));
|
||||
|
||||
for (i = 0; i < header.nfiles; i++)
|
||||
{
|
||||
if (!WRITE_FILE_ENTRY(hog_fp, &table[0])) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < header.nfiles; i++) {
|
||||
if (!WRITE_FILE_ENTRY(hog_fp, &table[0])) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
}
|
||||
|
||||
//write files (& build index)
|
||||
for (i=0;i<header.nfiles;i++)
|
||||
{
|
||||
FILE *ifp;
|
||||
struct _stat mystat;
|
||||
// write files (& build index)
|
||||
for (i = 0; i < header.nfiles; i++) {
|
||||
FILE *ifp;
|
||||
struct _stat mystat;
|
||||
|
||||
ifp = fopen(filenames[i],"rb");
|
||||
if ( ifp == NULL ) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_INFILE;
|
||||
}
|
||||
ifp = fopen(filenames[i], "rb");
|
||||
if (ifp == NULL) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_INFILE;
|
||||
}
|
||||
|
||||
_splitpath(filenames[i],NULL,NULL,table[i].name,ext);
|
||||
_fstat(fileno(ifp), &mystat);
|
||||
_splitpath(filenames[i], NULL, NULL, table[i].name, ext);
|
||||
_fstat(fileno(ifp), &mystat);
|
||||
|
||||
strcat(table[i].name,ext);
|
||||
table[i].flags = 0;
|
||||
table[i].len = _filelength(_fileno(ifp));
|
||||
table[i].timestamp = mystat.st_mtime;
|
||||
strcat(table[i].name, ext);
|
||||
table[i].flags = 0;
|
||||
table[i].len = _filelength(_fileno(ifp));
|
||||
table[i].timestamp = mystat.st_mtime;
|
||||
|
||||
if (!CopyFile(hog_fp,ifp,table[i].len)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_COPY;
|
||||
}
|
||||
if (!CopyFile(hog_fp, ifp, table[i].len)) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_COPY;
|
||||
}
|
||||
|
||||
fclose(ifp);
|
||||
}
|
||||
fclose(ifp);
|
||||
}
|
||||
|
||||
//now write the real index
|
||||
fseek(hog_fp,table_pos,SEEK_SET);
|
||||
// now write the real index
|
||||
fseek(hog_fp, table_pos, SEEK_SET);
|
||||
|
||||
for (i = 0; i < header.nfiles; i++)
|
||||
{
|
||||
if (!WRITE_FILE_ENTRY(hog_fp, &table[i])) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < header.nfiles; i++) {
|
||||
if (!WRITE_FILE_ENTRY(hog_fp, &table[i])) {
|
||||
delete[] table;
|
||||
fclose(hog_fp);
|
||||
return HOGMAKER_OUTFILE;
|
||||
}
|
||||
}
|
||||
|
||||
// cleanup
|
||||
fclose( hog_fp );
|
||||
delete[] table;
|
||||
// cleanup
|
||||
fclose(hog_fp);
|
||||
delete[] table;
|
||||
|
||||
return HOGMAKER_OK;
|
||||
return HOGMAKER_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* CopyFile
|
||||
used to copy one file to another.
|
||||
used to copy one file to another.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <dos.h>
|
||||
#include <stdio.h>
|
||||
@@ -23,215 +23,215 @@
|
||||
#include <io.h>
|
||||
#include <ctype.h>
|
||||
|
||||
//#include "mvlfile.h" //for old D2 movie libraries
|
||||
#include "hogfile.h" //new D3 hogs
|
||||
// #include "mvlfile.h" //for old D2 movie libraries
|
||||
#include "hogfile.h" //new D3 hogs
|
||||
|
||||
/*
|
||||
#define BUFFER_SIZE (1024*1024*5) //5 MB
|
||||
|
||||
struct library_entry {
|
||||
char name[LIB_FILENAME_LEN]; //just the filename part
|
||||
int offset; //offset into library file
|
||||
int length; //length of this file
|
||||
char name[LIB_FILENAME_LEN]; //just the filename part
|
||||
int offset; //offset into library file
|
||||
int length; //length of this file
|
||||
int32_t timestamp; //time and date of file
|
||||
int flags; //misc flags
|
||||
int flags; //misc flags
|
||||
};
|
||||
|
||||
struct library {
|
||||
int nfiles;
|
||||
library_entry *table;
|
||||
FILE *fp;
|
||||
int nfiles;
|
||||
library_entry *table;
|
||||
FILE *fp;
|
||||
};
|
||||
|
||||
library *open_hogfile(char *hogname)
|
||||
{
|
||||
FILE *fp;
|
||||
int id;
|
||||
int i,offset,t;
|
||||
library *hogfile;
|
||||
index_entry *index;
|
||||
FILE *fp;
|
||||
int id;
|
||||
int i,offset,t;
|
||||
library *hogfile;
|
||||
index_entry *index;
|
||||
|
||||
fp = fopen( hogname, "rb" );
|
||||
if ( fp == NULL )
|
||||
return NULL;
|
||||
fp = fopen( hogname, "rb" );
|
||||
if ( fp == NULL )
|
||||
return NULL;
|
||||
|
||||
fread( &id, 4, 1, fp );
|
||||
if ( strncmp( (char *) &id, LIBRARY_TAG, strlen(LIBRARY_TAG) ) ) {
|
||||
printf("Invalid library file <%s>\n",hogname);
|
||||
exit(11);
|
||||
}
|
||||
fread( &id, 4, 1, fp );
|
||||
if ( strncmp( (char *) &id, LIBRARY_TAG, strlen(LIBRARY_TAG) ) ) {
|
||||
printf("Invalid library file <%s>\n",hogname);
|
||||
exit(11);
|
||||
}
|
||||
|
||||
hogfile = malloc(sizeof(*hogfile));
|
||||
hogfile = malloc(sizeof(*hogfile));
|
||||
|
||||
hogfile->fp = fp;
|
||||
hogfile->fp = fp;
|
||||
|
||||
fread(&hogfile->nfiles,4,1,hogfile->fp); //get number of files
|
||||
fread(&hogfile->nfiles,4,1,hogfile->fp); //get number of files
|
||||
|
||||
hogfile->table = malloc(sizeof(library_entry)*hogfile->nfiles);
|
||||
hogfile->table = malloc(sizeof(library_entry)*hogfile->nfiles);
|
||||
|
||||
offset = 4+4+hogfile->nfiles*(13+4); //id + nfiles + nfiles * (filename + size)
|
||||
offset = 4+4+hogfile->nfiles*(13+4); //id + nfiles + nfiles * (filename + size)
|
||||
|
||||
//allocate index
|
||||
index = malloc(sizeof(index_entry) * hogfile->nfiles);
|
||||
//allocate index
|
||||
index = malloc(sizeof(index_entry) * hogfile->nfiles);
|
||||
|
||||
//read in index table
|
||||
t = fread( index, sizeof(*index), hogfile->nfiles, hogfile->fp );
|
||||
if ( t != hogfile->nfiles ) { //eof here is ok
|
||||
fclose(fp);
|
||||
return 0; //CF_BAD_LIB;
|
||||
}
|
||||
//read in index table
|
||||
t = fread( index, sizeof(*index), hogfile->nfiles, hogfile->fp );
|
||||
if ( t != hogfile->nfiles ) { //eof here is ok
|
||||
fclose(fp);
|
||||
return 0; //CF_BAD_LIB;
|
||||
}
|
||||
|
||||
//copy disk index to our internal structure
|
||||
for (i=0;i<hogfile->nfiles;i++) {
|
||||
//copy disk index to our internal structure
|
||||
for (i=0;i<hogfile->nfiles;i++) {
|
||||
|
||||
strcpy(hogfile->table[i].name, index[i].name);
|
||||
hogfile->table[i].length = index[i].len;
|
||||
hogfile->table[i].offset = offset;
|
||||
offset += hogfile->table[i].length;
|
||||
strcpy(hogfile->table[i].name, index[i].name);
|
||||
hogfile->table[i].length = index[i].len;
|
||||
hogfile->table[i].offset = offset;
|
||||
offset += hogfile->table[i].length;
|
||||
|
||||
#if LIB_HAS_DATE
|
||||
hogfile->table[i].timestamp = index[i].timestamp;
|
||||
#else
|
||||
hogfile->table[i].timestamp = 0;
|
||||
#endif
|
||||
#if LIB_HAS_DATE
|
||||
hogfile->table[i].timestamp = index[i].timestamp;
|
||||
#else
|
||||
hogfile->table[i].timestamp = 0;
|
||||
#endif
|
||||
|
||||
#if LIB_HAS_FLAGS
|
||||
hogfile->table[i].flags = index[i].flags;
|
||||
#else
|
||||
hogfile->table[i].flags = 0;
|
||||
#endif
|
||||
}
|
||||
#if LIB_HAS_FLAGS
|
||||
hogfile->table[i].flags = index[i].flags;
|
||||
#else
|
||||
hogfile->table[i].flags = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
return hogfile;
|
||||
return hogfile;
|
||||
}
|
||||
|
||||
void close_hogfile(library *hogfile)
|
||||
{
|
||||
fclose(hogfile->fp);
|
||||
free(hogfile->table);
|
||||
free(hogfile);
|
||||
fclose(hogfile->fp);
|
||||
free(hogfile->table);
|
||||
free(hogfile);
|
||||
}
|
||||
|
||||
copy_file(FILE *ofp,FILE *ifp,int length)
|
||||
{
|
||||
char *buffer;
|
||||
char *buffer;
|
||||
|
||||
buffer = malloc(BUFFER_SIZE);
|
||||
if (!buffer) {
|
||||
printf("Error allocating buffer\n");
|
||||
exit(10);
|
||||
}
|
||||
buffer = malloc(BUFFER_SIZE);
|
||||
if (!buffer) {
|
||||
printf("Error allocating buffer\n");
|
||||
exit(10);
|
||||
}
|
||||
|
||||
while (length) {
|
||||
int n,read_len;
|
||||
while (length) {
|
||||
int n,read_len;
|
||||
|
||||
read_len = min(length,BUFFER_SIZE);
|
||||
read_len = min(length,BUFFER_SIZE);
|
||||
|
||||
n = fread( buffer, 1, read_len, ifp );
|
||||
if ( n != read_len ) {
|
||||
printf( "Error reading file\n");
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
n = fread( buffer, 1, read_len, ifp );
|
||||
if ( n != read_len ) {
|
||||
printf( "Error reading file\n");
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fwrite( buffer, 1, read_len, ofp) != read_len ) {
|
||||
printf("Error writing file\n");
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
if (fwrite( buffer, 1, read_len, ofp) != read_len ) {
|
||||
printf("Error writing file\n");
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
length -= read_len;
|
||||
}
|
||||
length -= read_len;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
free(buffer);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//returns 1 if extracted ok
|
||||
int extract_file_by_index(library *hogfile,int index)
|
||||
{
|
||||
int length;
|
||||
FILE *ofp;
|
||||
int length;
|
||||
FILE *ofp;
|
||||
|
||||
ofp = fopen( hogfile->table[index].name, "wb" );
|
||||
if ( ofp == NULL ) {
|
||||
printf( "Error opening '%s'\n", hogfile->table[index].name );
|
||||
return 0;
|
||||
}
|
||||
ofp = fopen( hogfile->table[index].name, "wb" );
|
||||
if ( ofp == NULL ) {
|
||||
printf( "Error opening '%s'\n", hogfile->table[index].name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
length = hogfile->table[index].length;
|
||||
length = hogfile->table[index].length;
|
||||
|
||||
fseek(hogfile->fp,hogfile->table[index].offset,SEEK_SET);
|
||||
fseek(hogfile->fp,hogfile->table[index].offset,SEEK_SET);
|
||||
|
||||
copy_file(ofp,hogfile->fp,hogfile->table[index].length);
|
||||
copy_file(ofp,hogfile->fp,hogfile->table[index].length);
|
||||
|
||||
fclose(ofp);
|
||||
fclose(ofp);
|
||||
|
||||
#ifdef LIB_HAS_DATE
|
||||
ofp = fopen(hogfile->table[index].name, "r+b");
|
||||
_dos_setftime(fileno(ofp),(hogfile->table[index].timestamp>>16),(hogfile->table[index].timestamp&0xFFFF));
|
||||
fclose(ofp);
|
||||
#endif
|
||||
#ifdef LIB_HAS_DATE
|
||||
ofp = fopen(hogfile->table[index].name, "r+b");
|
||||
_dos_setftime(fileno(ofp),(hogfile->table[index].timestamp>>16),(hogfile->table[index].timestamp&0xFFFF));
|
||||
fclose(ofp);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
extract_file_by_name(char *hogname,char *filename)
|
||||
{
|
||||
library *hogfile;
|
||||
int i;
|
||||
library *hogfile;
|
||||
int i;
|
||||
|
||||
hogfile = open_hogfile(hogname);
|
||||
hogfile = open_hogfile(hogname);
|
||||
|
||||
if (!hogfile) {
|
||||
printf("Error opening library <%s>\n",hogname);
|
||||
exit(7);
|
||||
}
|
||||
if (!hogfile) {
|
||||
printf("Error opening library <%s>\n",hogname);
|
||||
exit(7);
|
||||
}
|
||||
|
||||
for (i=0;i<hogfile->nfiles;i++)
|
||||
if (!stricmp(filename,hogfile->table[i].name)) {
|
||||
int ok;
|
||||
printf(" Extracting %s\n",hogfile->table[i].name);
|
||||
ok = extract_file_by_index(hogfile,i);
|
||||
if (!ok) {
|
||||
printf("Error extracting <%s> from <%s>\n",hogfile->table[i].name,hogname);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
for (i=0;i<hogfile->nfiles;i++)
|
||||
if (!stricmp(filename,hogfile->table[i].name)) {
|
||||
int ok;
|
||||
printf(" Extracting %s\n",hogfile->table[i].name);
|
||||
ok = extract_file_by_index(hogfile,i);
|
||||
if (!ok) {
|
||||
printf("Error extracting <%s> from <%s>\n",hogfile->table[i].name,hogname);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i==hogfile->nfiles)
|
||||
printf("Error: couldn't find file <%s> in <%s>\n",filename,hogname);
|
||||
if (i==hogfile->nfiles)
|
||||
printf("Error: couldn't find file <%s> in <%s>\n",filename,hogname);
|
||||
|
||||
close_hogfile(hogfile);
|
||||
close_hogfile(hogfile);
|
||||
}
|
||||
|
||||
extract_all_files(char *hogname)
|
||||
{
|
||||
library *hogfile;
|
||||
int i;
|
||||
library *hogfile;
|
||||
int i;
|
||||
|
||||
hogfile = open_hogfile(hogname);
|
||||
hogfile = open_hogfile(hogname);
|
||||
|
||||
if (!hogfile) {
|
||||
printf("Error opening library <%s>\n",hogname);
|
||||
exit(7);
|
||||
}
|
||||
if (!hogfile) {
|
||||
printf("Error opening library <%s>\n",hogname);
|
||||
exit(7);
|
||||
}
|
||||
|
||||
for (i=0;i<hogfile->nfiles;i++) {
|
||||
int ok;
|
||||
for (i=0;i<hogfile->nfiles;i++) {
|
||||
int ok;
|
||||
|
||||
printf(" Extracting %s\n",hogfile->table[i].name);
|
||||
ok = extract_file_by_index(hogfile,i);
|
||||
printf(" Extracting %s\n",hogfile->table[i].name);
|
||||
ok = extract_file_by_index(hogfile,i);
|
||||
|
||||
if (!ok) {
|
||||
printf("Error extracting <%s> from <%s>\n",hogfile->table[i].name,hogname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
printf("Error extracting <%s> from <%s>\n",hogfile->table[i].name,hogname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
close_hogfile(hogfile);
|
||||
close_hogfile(hogfile);
|
||||
}
|
||||
|
||||
#define YEAR(t) (((t & 0xFE000000) >> 25) + 80)
|
||||
@@ -243,35 +243,35 @@ extract_all_files(char *hogname)
|
||||
|
||||
list_files(char *hogname)
|
||||
{
|
||||
library *hogfile;
|
||||
int i;
|
||||
library *hogfile;
|
||||
int i;
|
||||
|
||||
hogfile = open_hogfile(hogname);
|
||||
hogfile = open_hogfile(hogname);
|
||||
|
||||
if (!hogfile) {
|
||||
printf("Error opening library <%s>\n",hogname);
|
||||
exit(7);
|
||||
}
|
||||
if (!hogfile) {
|
||||
printf("Error opening library <%s>\n",hogname);
|
||||
exit(7);
|
||||
}
|
||||
|
||||
printf("Contents of %s:\n",hogname);
|
||||
printf("Contents of %s:\n",hogname);
|
||||
|
||||
printf(" Name Size Date/Time Flags\n");
|
||||
printf(" -------------- ----- ------------------ -------\n");
|
||||
printf(" Name Size Date/Time Flags\n");
|
||||
printf(" -------------- ----- ------------------ -------\n");
|
||||
|
||||
for (i=0;i<hogfile->nfiles;i++) {
|
||||
printf(" %-12s %7d",hogfile->table[i].name,hogfile->table[i].length);
|
||||
for (i=0;i<hogfile->nfiles;i++) {
|
||||
printf(" %-12s %7d",hogfile->table[i].name,hogfile->table[i].length);
|
||||
|
||||
if (hogfile->table[i].timestamp) {
|
||||
if (hogfile->table[i].timestamp) {
|
||||
int32_t t = hogfile->table[i].timestamp;
|
||||
printf(" %2d/%02d/%02d %2d:%02d:%02d",MONTH(t),DAY(t),YEAR(t),HOUR(t),MINUTE(t),SECOND(t));
|
||||
}
|
||||
else
|
||||
printf(" ");
|
||||
printf(" %2d/%02d/%02d %2d:%02d:%02d",MONTH(t),DAY(t),YEAR(t),HOUR(t),MINUTE(t),SECOND(t));
|
||||
}
|
||||
else
|
||||
printf(" ");
|
||||
|
||||
printf(" %8x\n",hogfile->table[i].flags);
|
||||
}
|
||||
printf(" %8x\n",hogfile->table[i].flags);
|
||||
}
|
||||
|
||||
close_hogfile(hogfile);
|
||||
close_hogfile(hogfile);
|
||||
}
|
||||
|
||||
#define REMOVE_EOL(s) remove_char((s),'\n')
|
||||
@@ -280,220 +280,218 @@ list_files(char *hogname)
|
||||
|
||||
void remove_char( char * s, char c )
|
||||
{
|
||||
char *p;
|
||||
p = strchr(s,c);
|
||||
if (p) *p = '\0';
|
||||
char *p;
|
||||
p = strchr(s,c);
|
||||
if (p) *p = '\0';
|
||||
}
|
||||
|
||||
#define MAX_LINE_LEN 160
|
||||
|
||||
int parse_listfile(char *listfile_name,char ***filenames_ptr)
|
||||
{
|
||||
FILE *fp;
|
||||
char inputline[MAX_LINE_LEN+1];
|
||||
int count;
|
||||
char **filenames;
|
||||
FILE *fp;
|
||||
char inputline[MAX_LINE_LEN+1];
|
||||
int count;
|
||||
char **filenames;
|
||||
|
||||
fp = fopen( listfile_name, "rt" );
|
||||
fp = fopen( listfile_name, "rt" );
|
||||
|
||||
if (!fp) {
|
||||
printf("Error: can't open file list <%s>\n",listfile_name);
|
||||
exit(3);
|
||||
}
|
||||
if (!fp) {
|
||||
printf("Error: can't open file list <%s>\n",listfile_name);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
count = 0;
|
||||
|
||||
while (fgets(inputline, MAX_LINE_LEN, fp )) {
|
||||
char filename[MAX_LINE_LEN+1];
|
||||
REMOVE_EOL(inputline);
|
||||
REMOVE_COMMENTS(inputline);
|
||||
if (strlen(inputline) > 0) {
|
||||
sscanf( inputline, " %s ", filename );
|
||||
if ( strlen( filename ) > 0 )
|
||||
count++;
|
||||
}
|
||||
}
|
||||
while (fgets(inputline, MAX_LINE_LEN, fp )) {
|
||||
char filename[MAX_LINE_LEN+1];
|
||||
REMOVE_EOL(inputline);
|
||||
REMOVE_COMMENTS(inputline);
|
||||
if (strlen(inputline) > 0) {
|
||||
sscanf( inputline, " %s ", filename );
|
||||
if ( strlen( filename ) > 0 )
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
fseek(fp,0,SEEK_SET);
|
||||
fseek(fp,0,SEEK_SET);
|
||||
|
||||
filenames = malloc(sizeof(*filenames) * count);
|
||||
filenames = malloc(sizeof(*filenames) * count);
|
||||
|
||||
count = 0;
|
||||
count = 0;
|
||||
|
||||
while (fgets(inputline, MAX_LINE_LEN, fp )) {
|
||||
char filename[MAX_LINE_LEN+1];
|
||||
REMOVE_EOL(inputline);
|
||||
REMOVE_COMMENTS(inputline);
|
||||
if (strlen(inputline) > 0) {
|
||||
sscanf( inputline, " %s ", filename );
|
||||
if ( strlen( filename ) > 0 ) {
|
||||
filenames[count] = malloc(strlen(filename)+1);
|
||||
strcpy(filenames[count],filename);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (fgets(inputline, MAX_LINE_LEN, fp )) {
|
||||
char filename[MAX_LINE_LEN+1];
|
||||
REMOVE_EOL(inputline);
|
||||
REMOVE_COMMENTS(inputline);
|
||||
if (strlen(inputline) > 0) {
|
||||
sscanf( inputline, " %s ", filename );
|
||||
if ( strlen( filename ) > 0 ) {
|
||||
filenames[count] = malloc(strlen(filename)+1);
|
||||
strcpy(filenames[count],filename);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
fclose(fp);
|
||||
|
||||
*filenames_ptr = filenames;
|
||||
*filenames_ptr = filenames;
|
||||
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
create_new_library(char *hogname, int nfiles, char **filenames)
|
||||
{
|
||||
int i,table_pos;
|
||||
FILE *hog_fp;
|
||||
index_entry *index;
|
||||
char ext[_MAX_EXT];
|
||||
int i,table_pos;
|
||||
FILE *hog_fp;
|
||||
index_entry *index;
|
||||
char ext[_MAX_EXT];
|
||||
|
||||
index = malloc(sizeof(index_entry) * nfiles);
|
||||
if (!index) {
|
||||
printf("Error allocating index table\n");
|
||||
exit(9);
|
||||
}
|
||||
index = malloc(sizeof(index_entry) * nfiles);
|
||||
if (!index) {
|
||||
printf("Error allocating index table\n");
|
||||
exit(9);
|
||||
}
|
||||
|
||||
//open the new file
|
||||
hog_fp = fopen( hogname, "wb" );
|
||||
if ( hog_fp == NULL ) {
|
||||
printf( "Error opening file <%s>\n",hogname);
|
||||
exit(1);
|
||||
}
|
||||
//open the new file
|
||||
hog_fp = fopen( hogname, "wb" );
|
||||
if ( hog_fp == NULL ) {
|
||||
printf( "Error opening file <%s>\n",hogname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//write the tag
|
||||
if (fwrite( LIBRARY_TAG, strlen(LIBRARY_TAG), 1, hog_fp )!=1) {
|
||||
printf("Error writing tag tp file <%s>\n",hogname);
|
||||
fclose( hog_fp );
|
||||
exit(1);
|
||||
}
|
||||
//write the tag
|
||||
if (fwrite( LIBRARY_TAG, strlen(LIBRARY_TAG), 1, hog_fp )!=1) {
|
||||
printf("Error writing tag tp file <%s>\n",hogname);
|
||||
fclose( hog_fp );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//write number of files
|
||||
if (fwrite(&nfiles,sizeof(int),1,hog_fp)!=1) {
|
||||
printf("Error writing count to file <%s>\n",hogname);
|
||||
fclose( hog_fp );
|
||||
exit(1);
|
||||
}
|
||||
//write number of files
|
||||
if (fwrite(&nfiles,sizeof(int),1,hog_fp)!=1) {
|
||||
printf("Error writing count to file <%s>\n",hogname);
|
||||
fclose( hog_fp );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//save file position of index table
|
||||
table_pos = ftell(hog_fp);
|
||||
//save file position of index table
|
||||
table_pos = ftell(hog_fp);
|
||||
|
||||
//write dummy index
|
||||
if (fwrite(index,sizeof(*index),nfiles,hog_fp)!=nfiles) {
|
||||
printf("Error writing index to file <%s>\n",hogname);
|
||||
fclose( hog_fp );
|
||||
exit(1);
|
||||
}
|
||||
//write dummy index
|
||||
if (fwrite(index,sizeof(*index),nfiles,hog_fp)!=nfiles) {
|
||||
printf("Error writing index to file <%s>\n",hogname);
|
||||
fclose( hog_fp );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//write files (& build index)
|
||||
for (i=0;i<nfiles;i++) {
|
||||
FILE *ifp;
|
||||
uint16_t date,time;
|
||||
//write files (& build index)
|
||||
for (i=0;i<nfiles;i++) {
|
||||
FILE *ifp;
|
||||
uint16_t date,time;
|
||||
|
||||
ifp = fopen(filenames[i],"rb");
|
||||
if ( ifp == NULL ) {
|
||||
printf( "Error opening input file <%s>\n",filenames[i]);
|
||||
fclose(hog_fp);
|
||||
exit(10);
|
||||
}
|
||||
ifp = fopen(filenames[i],"rb");
|
||||
if ( ifp == NULL ) {
|
||||
printf( "Error opening input file <%s>\n",filenames[i]);
|
||||
fclose(hog_fp);
|
||||
exit(10);
|
||||
}
|
||||
|
||||
_splitpath(filenames[i],NULL,NULL,index[i].name,ext);
|
||||
strcat(index[i].name,ext);
|
||||
index[i].len = filelength(fileno(ifp));
|
||||
_splitpath(filenames[i],NULL,NULL,index[i].name,ext);
|
||||
strcat(index[i].name,ext);
|
||||
index[i].len = filelength(fileno(ifp));
|
||||
|
||||
#ifdef LIB_HAS_DATE
|
||||
_dos_getftime(fileno(ifp), &date,&time);
|
||||
index[i].timestamp = (date << 16) + time;
|
||||
#endif
|
||||
#ifdef LIB_HAS_DATE
|
||||
_dos_getftime(fileno(ifp), &date,&time);
|
||||
index[i].timestamp = (date << 16) + time;
|
||||
#endif
|
||||
|
||||
#ifdef LIB_HAS_FLAGS
|
||||
index[i].flags = 0;
|
||||
#endif
|
||||
#ifdef LIB_HAS_FLAGS
|
||||
index[i].flags = 0;
|
||||
#endif
|
||||
|
||||
copy_file(hog_fp,ifp,index[i].len);
|
||||
}
|
||||
copy_file(hog_fp,ifp,index[i].len);
|
||||
}
|
||||
|
||||
//now write the real index
|
||||
fseek(hog_fp,table_pos,SEEK_SET);
|
||||
if (fwrite(index,sizeof(*index),nfiles,hog_fp)!=nfiles) {
|
||||
printf("Error writing index to file <%s>\n",hogname);
|
||||
fclose( hog_fp );
|
||||
exit(1);
|
||||
}
|
||||
//now write the real index
|
||||
fseek(hog_fp,table_pos,SEEK_SET);
|
||||
if (fwrite(index,sizeof(*index),nfiles,hog_fp)!=nfiles) {
|
||||
printf("Error writing index to file <%s>\n",hogname);
|
||||
fclose( hog_fp );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fclose( hog_fp );
|
||||
fclose( hog_fp );
|
||||
}
|
||||
|
||||
add_files(char *hogname, int argc, char *argv[])
|
||||
{
|
||||
library *hogfile;
|
||||
int nfiles,i;
|
||||
char **filenames;
|
||||
library *hogfile;
|
||||
int nfiles,i;
|
||||
char **filenames;
|
||||
|
||||
hogfile = open_hogfile(hogname);
|
||||
hogfile = open_hogfile(hogname);
|
||||
|
||||
if (hogfile) {
|
||||
printf("Sorry, cannot add files to existing library <%s>\n",hogname);
|
||||
exit(4);
|
||||
}
|
||||
if (hogfile) {
|
||||
printf("Sorry, cannot add files to existing library <%s>\n",hogname);
|
||||
exit(4);
|
||||
}
|
||||
|
||||
//hog doesn't exist, so create new one
|
||||
//hog doesn't exist, so create new one
|
||||
|
||||
if (argc != 1) {
|
||||
printf("Error: input for add files must be a listfile\n");
|
||||
exit(2);
|
||||
}
|
||||
if (argc != 1) {
|
||||
printf("Error: input for add files must be a listfile\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
nfiles = parse_listfile(argv[0],&filenames);
|
||||
nfiles = parse_listfile(argv[0],&filenames);
|
||||
|
||||
create_new_library(hogname,nfiles,filenames);
|
||||
create_new_library(hogname,nfiles,filenames);
|
||||
|
||||
//now free filename list
|
||||
for (i=0;i<nfiles;i++)
|
||||
free(filenames[i]);
|
||||
free(filenames);
|
||||
//now free filename list
|
||||
for (i=0;i<nfiles;i++)
|
||||
free(filenames[i]);
|
||||
free(filenames);
|
||||
}
|
||||
|
||||
|
||||
show_help()
|
||||
{
|
||||
printf( "Usage: mvlutil command hogfile [file1 [file2] [...]]\n" );
|
||||
printf( "Valid commands:\n");
|
||||
printf( " a add files\n");
|
||||
printf( " l list files\n");
|
||||
printf( " x extract files\n");
|
||||
printf( "Usage: mvlutil command hogfile [file1 [file2] [...]]\n" );
|
||||
printf( "Valid commands:\n");
|
||||
printf( " a add files\n");
|
||||
printf( " l list files\n");
|
||||
printf( " x extract files\n");
|
||||
}
|
||||
*/
|
||||
int main(int argc, char * argv[] )
|
||||
{
|
||||
/* char command;
|
||||
char *hogname;
|
||||
int main(int argc, char *argv[]) {
|
||||
/* char command;
|
||||
char *hogname;
|
||||
|
||||
if ( argc < 3 ) {
|
||||
show_help();
|
||||
exit(1);
|
||||
}
|
||||
if ( argc < 3 ) {
|
||||
show_help();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
hogname = argv[2];
|
||||
command = tolower(argv[1][0]);
|
||||
hogname = argv[2];
|
||||
command = tolower(argv[1][0]);
|
||||
|
||||
if (command == 'a') {
|
||||
add_files(hogname,argc-3,argv+3);
|
||||
}
|
||||
else if (command == 'l') {
|
||||
list_files(hogname);
|
||||
}
|
||||
else if (command == 'x') {
|
||||
if (argv[1][1])
|
||||
extract_file_by_name(hogname,&argv[1][1]);
|
||||
else
|
||||
extract_all_files(hogname);
|
||||
}
|
||||
else {
|
||||
show_help();
|
||||
exit(2);
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
if (command == 'a') {
|
||||
add_files(hogname,argc-3,argv+3);
|
||||
}
|
||||
else if (command == 'l') {
|
||||
list_files(hogname);
|
||||
}
|
||||
else if (command == 'x') {
|
||||
if (argv[1][1])
|
||||
extract_file_by_name(hogname,&argv[1][1]);
|
||||
else
|
||||
extract_all_files(hogname);
|
||||
}
|
||||
else {
|
||||
show_help();
|
||||
exit(2);
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -90,315 +90,245 @@
|
||||
extern char *Proxy_server;
|
||||
extern int16_t Proxy_port;
|
||||
|
||||
|
||||
#ifdef __LINUX__
|
||||
pthread_create_fp df_pthread_create = NULL;
|
||||
pthread_exit_fp df_pthread_exit = NULL;
|
||||
pthread_detach_fp df_pthread_detach = NULL;
|
||||
pthread_self_fp df_pthread_self = NULL;
|
||||
|
||||
bool inet_LoadThreadLib(void)
|
||||
{
|
||||
if(df_pthread_create)
|
||||
return true;
|
||||
bool inet_LoadThreadLib(void) {
|
||||
if (df_pthread_create)
|
||||
return true;
|
||||
|
||||
void *lib;
|
||||
void *lib;
|
||||
|
||||
lib = dlopen("libpthread.so",RTLD_GLOBAL|RTLD_NOW);
|
||||
if(!lib)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
lib = dlopen("libpthread.so", RTLD_GLOBAL | RTLD_NOW);
|
||||
if (!lib) {
|
||||
return false;
|
||||
}
|
||||
|
||||
df_pthread_create = (pthread_create_fp)dlsym(lib,"pthread_create");
|
||||
df_pthread_detach = (pthread_detach_fp)dlsym(lib,"pthread_detach");
|
||||
df_pthread_self = (pthread_self_fp)dlsym(lib,"pthread_self");
|
||||
df_pthread_create = (pthread_create_fp)dlsym(lib, "pthread_create");
|
||||
df_pthread_detach = (pthread_detach_fp)dlsym(lib, "pthread_detach");
|
||||
df_pthread_self = (pthread_self_fp)dlsym(lib, "pthread_self");
|
||||
|
||||
if(!df_pthread_create || !df_pthread_detach || !df_pthread_self)
|
||||
{
|
||||
df_pthread_create = NULL; //this variable I use to see if the library is loaded
|
||||
return false;
|
||||
}
|
||||
if (!df_pthread_create || !df_pthread_detach || !df_pthread_self) {
|
||||
df_pthread_create = NULL; // this variable I use to see if the library is loaded
|
||||
return false;
|
||||
}
|
||||
|
||||
// don't close the library...we need it open for future use
|
||||
// and we can't close it on atexit() because linux will segfault for some stupid reason
|
||||
return true;
|
||||
// don't close the library...we need it open for future use
|
||||
// and we can't close it on atexit() because linux will segfault for some stupid reason
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void InetGetFile::AbortGet()
|
||||
{
|
||||
if(m_bUseHTTP)
|
||||
{
|
||||
http->AbortGet();
|
||||
}
|
||||
else
|
||||
{
|
||||
ftp->AbortGet();
|
||||
}
|
||||
void InetGetFile::AbortGet() {
|
||||
if (m_bUseHTTP) {
|
||||
http->AbortGet();
|
||||
} else {
|
||||
ftp->AbortGet();
|
||||
}
|
||||
}
|
||||
|
||||
InetGetFile::InetGetFile(char *URL,char *localfile,char *proxyip,int16_t proxyport)
|
||||
{
|
||||
m_HardError = 0;
|
||||
http=NULL;
|
||||
ftp=NULL;
|
||||
if((URL==NULL)||(localfile==NULL))
|
||||
{
|
||||
m_HardError = INET_ERROR_BADPARMS;
|
||||
}
|
||||
InetGetFile::InetGetFile(char *URL, char *localfile, char *proxyip, int16_t proxyport) {
|
||||
m_HardError = 0;
|
||||
http = NULL;
|
||||
ftp = NULL;
|
||||
if ((URL == NULL) || (localfile == NULL)) {
|
||||
m_HardError = INET_ERROR_BADPARMS;
|
||||
}
|
||||
|
||||
if(strstr(URL,"http:"))
|
||||
{
|
||||
m_bUseHTTP = true;
|
||||
http = new ChttpGet(URL,localfile,proxyip,proxyport);
|
||||
if(http==NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
}
|
||||
else if(strstr(URL,"ftp:"))
|
||||
{
|
||||
m_bUseHTTP = false;
|
||||
ftp = new CFtpGet(URL,localfile);
|
||||
if(ftp==NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
}
|
||||
else if(strstr(URL,"HTTP:"))
|
||||
{
|
||||
m_bUseHTTP = true;
|
||||
http = new ChttpGet(URL,localfile,proxyip,proxyport);
|
||||
if(http==NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
}
|
||||
else if(strstr(URL,"FTP:"))
|
||||
{
|
||||
m_bUseHTTP = false;
|
||||
ftp = new CFtpGet(URL,localfile);
|
||||
if(ftp==NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_HardError = INET_ERROR_CANT_PARSE_URL;
|
||||
}
|
||||
Sleep(1000);
|
||||
if (strstr(URL, "http:")) {
|
||||
m_bUseHTTP = true;
|
||||
http = new ChttpGet(URL, localfile, proxyip, proxyport);
|
||||
if (http == NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
} else if (strstr(URL, "ftp:")) {
|
||||
m_bUseHTTP = false;
|
||||
ftp = new CFtpGet(URL, localfile);
|
||||
if (ftp == NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
} else if (strstr(URL, "HTTP:")) {
|
||||
m_bUseHTTP = true;
|
||||
http = new ChttpGet(URL, localfile, proxyip, proxyport);
|
||||
if (http == NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
} else if (strstr(URL, "FTP:")) {
|
||||
m_bUseHTTP = false;
|
||||
ftp = new CFtpGet(URL, localfile);
|
||||
if (ftp == NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
} else {
|
||||
m_HardError = INET_ERROR_CANT_PARSE_URL;
|
||||
}
|
||||
Sleep(1000);
|
||||
}
|
||||
|
||||
InetGetFile::InetGetFile(char *URL,char *localfile)
|
||||
{
|
||||
m_HardError = 0;
|
||||
http=NULL;
|
||||
ftp=NULL;
|
||||
if((URL==NULL)||(localfile==NULL))
|
||||
{
|
||||
m_HardError = INET_ERROR_BADPARMS;
|
||||
}
|
||||
if(strstr(URL,"http:"))
|
||||
{
|
||||
m_bUseHTTP = true;
|
||||
http = new ChttpGet(URL,localfile);
|
||||
if(http==NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
}
|
||||
else if(strstr(URL,"ftp:"))
|
||||
{
|
||||
m_bUseHTTP = false;
|
||||
ftp = new CFtpGet(URL,localfile);
|
||||
if(ftp==NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
}
|
||||
else if(strstr(URL,"HTTP:"))
|
||||
{
|
||||
m_bUseHTTP = true;
|
||||
http = new ChttpGet(URL,localfile);
|
||||
if(http==NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
}
|
||||
else if(strstr(URL,"FTP:"))
|
||||
{
|
||||
m_bUseHTTP = false;
|
||||
ftp = new CFtpGet(URL,localfile);
|
||||
if(ftp==NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_HardError = INET_ERROR_CANT_PARSE_URL;
|
||||
}
|
||||
Sleep(1000);
|
||||
InetGetFile::InetGetFile(char *URL, char *localfile) {
|
||||
m_HardError = 0;
|
||||
http = NULL;
|
||||
ftp = NULL;
|
||||
if ((URL == NULL) || (localfile == NULL)) {
|
||||
m_HardError = INET_ERROR_BADPARMS;
|
||||
}
|
||||
if (strstr(URL, "http:")) {
|
||||
m_bUseHTTP = true;
|
||||
http = new ChttpGet(URL, localfile);
|
||||
if (http == NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
} else if (strstr(URL, "ftp:")) {
|
||||
m_bUseHTTP = false;
|
||||
ftp = new CFtpGet(URL, localfile);
|
||||
if (ftp == NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
} else if (strstr(URL, "HTTP:")) {
|
||||
m_bUseHTTP = true;
|
||||
http = new ChttpGet(URL, localfile);
|
||||
if (http == NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
} else if (strstr(URL, "FTP:")) {
|
||||
m_bUseHTTP = false;
|
||||
ftp = new CFtpGet(URL, localfile);
|
||||
if (ftp == NULL)
|
||||
m_HardError = INET_ERROR_NO_MEMORY;
|
||||
} else {
|
||||
m_HardError = INET_ERROR_CANT_PARSE_URL;
|
||||
}
|
||||
Sleep(1000);
|
||||
}
|
||||
|
||||
InetGetFile::~InetGetFile()
|
||||
{
|
||||
if(http!=NULL) delete http;
|
||||
if(ftp!=NULL) delete ftp;
|
||||
InetGetFile::~InetGetFile() {
|
||||
if (http != NULL)
|
||||
delete http;
|
||||
if (ftp != NULL)
|
||||
delete ftp;
|
||||
}
|
||||
|
||||
BOOL InetGetFile::IsConnecting()
|
||||
{
|
||||
int state;
|
||||
if(m_bUseHTTP)
|
||||
{
|
||||
state = http->GetStatus();
|
||||
}
|
||||
else if(ftp)
|
||||
{
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(state == FTP_STATE_CONNECTING)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL InetGetFile::IsConnecting() {
|
||||
int state;
|
||||
if (m_bUseHTTP) {
|
||||
state = http->GetStatus();
|
||||
} else if (ftp) {
|
||||
state = ftp->GetStatus();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (state == FTP_STATE_CONNECTING) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL InetGetFile::IsReceiving()
|
||||
{
|
||||
int state;
|
||||
if(m_bUseHTTP)
|
||||
{
|
||||
state = http->GetStatus();
|
||||
}
|
||||
else if(ftp)
|
||||
{
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
if(state == FTP_STATE_RECEIVING)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
BOOL InetGetFile::IsReceiving() {
|
||||
int state;
|
||||
if (m_bUseHTTP) {
|
||||
state = http->GetStatus();
|
||||
} else if (ftp) {
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
if (state == FTP_STATE_RECEIVING) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL InetGetFile::IsFileReceived()
|
||||
{
|
||||
int state;
|
||||
if(m_bUseHTTP)
|
||||
{
|
||||
state = http->GetStatus();
|
||||
}
|
||||
else if(ftp)
|
||||
{
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
if(state == FTP_STATE_FILE_RECEIVED)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
BOOL InetGetFile::IsFileReceived() {
|
||||
int state;
|
||||
if (m_bUseHTTP) {
|
||||
state = http->GetStatus();
|
||||
} else if (ftp) {
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
if (state == FTP_STATE_FILE_RECEIVED) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL InetGetFile::IsFileError()
|
||||
{
|
||||
int state;
|
||||
if(m_HardError) return true;
|
||||
if(m_bUseHTTP)
|
||||
{
|
||||
state = http->GetStatus();
|
||||
}
|
||||
else if(ftp)
|
||||
{
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
switch(state)
|
||||
{
|
||||
BOOL InetGetFile::IsFileError() {
|
||||
int state;
|
||||
if (m_HardError)
|
||||
return true;
|
||||
if (m_bUseHTTP) {
|
||||
state = http->GetStatus();
|
||||
} else if (ftp) {
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
switch (state) {
|
||||
|
||||
case FTP_STATE_URL_PARSING_ERROR:
|
||||
case FTP_STATE_HOST_NOT_FOUND:
|
||||
case FTP_STATE_DIRECTORY_INVALID:
|
||||
case FTP_STATE_FILE_NOT_FOUND:
|
||||
case FTP_STATE_CANT_CONNECT:
|
||||
case FTP_STATE_LOGIN_ERROR:
|
||||
case FTP_STATE_INTERNAL_ERROR:
|
||||
case FTP_STATE_SOCKET_ERROR:
|
||||
case FTP_STATE_UNKNOWN_ERROR:
|
||||
case FTP_STATE_RECV_FAILED:
|
||||
case FTP_STATE_CANT_WRITE_FILE:
|
||||
return true;
|
||||
case FTP_STATE_CONNECTING:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case FTP_STATE_URL_PARSING_ERROR:
|
||||
case FTP_STATE_HOST_NOT_FOUND:
|
||||
case FTP_STATE_DIRECTORY_INVALID:
|
||||
case FTP_STATE_FILE_NOT_FOUND:
|
||||
case FTP_STATE_CANT_CONNECT:
|
||||
case FTP_STATE_LOGIN_ERROR:
|
||||
case FTP_STATE_INTERNAL_ERROR:
|
||||
case FTP_STATE_SOCKET_ERROR:
|
||||
case FTP_STATE_UNKNOWN_ERROR:
|
||||
case FTP_STATE_RECV_FAILED:
|
||||
case FTP_STATE_CANT_WRITE_FILE:
|
||||
return true;
|
||||
case FTP_STATE_CONNECTING:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int InetGetFile::GetErrorCode()
|
||||
{
|
||||
int state;
|
||||
if(m_HardError) return m_HardError;
|
||||
if(m_bUseHTTP)
|
||||
{
|
||||
state = http->GetStatus();
|
||||
}
|
||||
else if(ftp)
|
||||
{
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
switch(state)
|
||||
{
|
||||
int InetGetFile::GetErrorCode() {
|
||||
int state;
|
||||
if (m_HardError)
|
||||
return m_HardError;
|
||||
if (m_bUseHTTP) {
|
||||
state = http->GetStatus();
|
||||
} else if (ftp) {
|
||||
state = ftp->GetStatus();
|
||||
}
|
||||
switch (state) {
|
||||
|
||||
case FTP_STATE_URL_PARSING_ERROR:
|
||||
return INET_ERROR_CANT_PARSE_URL;
|
||||
case FTP_STATE_URL_PARSING_ERROR:
|
||||
return INET_ERROR_CANT_PARSE_URL;
|
||||
|
||||
case FTP_STATE_HOST_NOT_FOUND:
|
||||
return INET_ERROR_HOST_NOT_FOUND;
|
||||
case FTP_STATE_HOST_NOT_FOUND:
|
||||
return INET_ERROR_HOST_NOT_FOUND;
|
||||
|
||||
case FTP_STATE_DIRECTORY_INVALID:
|
||||
case FTP_STATE_FILE_NOT_FOUND:
|
||||
return INET_ERROR_BAD_FILE_OR_DIR;
|
||||
|
||||
case FTP_STATE_DIRECTORY_INVALID:
|
||||
case FTP_STATE_FILE_NOT_FOUND:
|
||||
return INET_ERROR_BAD_FILE_OR_DIR;
|
||||
case FTP_STATE_CANT_CONNECT:
|
||||
case FTP_STATE_LOGIN_ERROR:
|
||||
case FTP_STATE_INTERNAL_ERROR:
|
||||
case FTP_STATE_SOCKET_ERROR:
|
||||
case FTP_STATE_UNKNOWN_ERROR:
|
||||
case FTP_STATE_RECV_FAILED:
|
||||
|
||||
case FTP_STATE_CANT_CONNECT:
|
||||
case FTP_STATE_LOGIN_ERROR:
|
||||
case FTP_STATE_INTERNAL_ERROR:
|
||||
case FTP_STATE_SOCKET_ERROR:
|
||||
case FTP_STATE_UNKNOWN_ERROR:
|
||||
case FTP_STATE_RECV_FAILED:
|
||||
return INET_ERROR_UNKNOWN_ERROR;
|
||||
|
||||
return INET_ERROR_UNKNOWN_ERROR;
|
||||
|
||||
case FTP_STATE_CANT_WRITE_FILE:
|
||||
return INET_ERROR_CANT_WRITE_FILE;
|
||||
default:
|
||||
return INET_ERROR_NO_ERROR;
|
||||
}
|
||||
case FTP_STATE_CANT_WRITE_FILE:
|
||||
return INET_ERROR_CANT_WRITE_FILE;
|
||||
default:
|
||||
return INET_ERROR_NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
int InetGetFile::GetTotalBytes()
|
||||
{
|
||||
if(m_bUseHTTP)
|
||||
{
|
||||
return http->GetTotalBytes();
|
||||
}
|
||||
else if(ftp)
|
||||
{
|
||||
return ftp->GetTotalBytes();
|
||||
}
|
||||
else return 0;
|
||||
int InetGetFile::GetTotalBytes() {
|
||||
if (m_bUseHTTP) {
|
||||
return http->GetTotalBytes();
|
||||
} else if (ftp) {
|
||||
return ftp->GetTotalBytes();
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int InetGetFile::GetBytesIn()
|
||||
{
|
||||
if(m_bUseHTTP)
|
||||
{
|
||||
return http->GetBytesIn();
|
||||
}
|
||||
else if(ftp)
|
||||
{
|
||||
return ftp->GetBytesIn();
|
||||
}
|
||||
else return 0;
|
||||
int InetGetFile::GetBytesIn() {
|
||||
if (m_bUseHTTP) {
|
||||
return http->GetBytesIn();
|
||||
} else if (ftp) {
|
||||
return ftp->GetBytesIn();
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -23,79 +23,50 @@
|
||||
#include "CFtp.h"
|
||||
#include "Chttpget.h"
|
||||
|
||||
InetGetFile::InetGetFile(char *URL, char *localfile) {}
|
||||
|
||||
InetGetFile::InetGetFile(char *URL,char *localfile)
|
||||
{
|
||||
}
|
||||
InetGetFile::~InetGetFile() {}
|
||||
|
||||
InetGetFile::~InetGetFile()
|
||||
{
|
||||
}
|
||||
BOOL InetGetFile::IsFileReceived() { return false; }
|
||||
BOOL InetGetFile::IsFileError() { return true; }
|
||||
|
||||
BOOL InetGetFile::IsFileReceived()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
BOOL InetGetFile::IsFileError()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
BOOL InetGetFile::IsConnecting() { return true; }
|
||||
|
||||
BOOL InetGetFile::IsConnecting()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
BOOL InetGetFile::IsReceiving() { return false; }
|
||||
|
||||
BOOL InetGetFile::IsReceiving()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int InetGetFile::GetErrorCode() { return 0; }
|
||||
|
||||
int InetGetFile::GetErrorCode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int InetGetFile::GetBytesIn() { return 0; }
|
||||
|
||||
int InetGetFile::GetBytesIn()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int InetGetFile::GetTotalBytes() { return 0; }
|
||||
|
||||
int InetGetFile::GetTotalBytes()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InetGetFile::AbortGet()
|
||||
{
|
||||
}
|
||||
void InetGetFile::AbortGet() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
CFtpGet::CFtpGet(char *URL,char *localfile,char *Username,char *Password){}
|
||||
CFtpGet::~CFtpGet(){}
|
||||
int CFtpGet::GetStatus(){return 0;}
|
||||
uint32_t CFtpGet::GetBytesIn(){return 0;}
|
||||
uint32_t CFtpGet::GetTotalBytes(){return 0;}
|
||||
void CFtpGet::AbortGet(){}
|
||||
void CFtpGet::WorkerThread(){}
|
||||
int CFtpGet::ConnectControlSocket(){return 0;}
|
||||
int CFtpGet::LoginHost(){return 0;}
|
||||
uint32_t CFtpGet::SendFTPCommand(char *command){return 0;}
|
||||
uint32_t CFtpGet::ReadFTPServerReply(){return 0;}
|
||||
uint32_t CFtpGet::GetFile(){return 0;}
|
||||
uint32_t CFtpGet::IssuePort(){return 0;}
|
||||
uint32_t CFtpGet::ReadDataChannel(){return 0;}
|
||||
void CFtpGet::FlushControlChannel(){}
|
||||
CFtpGet::CFtpGet(char *URL, char *localfile, char *Username, char *Password) {}
|
||||
CFtpGet::~CFtpGet() {}
|
||||
int CFtpGet::GetStatus() { return 0; }
|
||||
uint32_t CFtpGet::GetBytesIn() { return 0; }
|
||||
uint32_t CFtpGet::GetTotalBytes() { return 0; }
|
||||
void CFtpGet::AbortGet() {}
|
||||
void CFtpGet::WorkerThread() {}
|
||||
int CFtpGet::ConnectControlSocket() { return 0; }
|
||||
int CFtpGet::LoginHost() { return 0; }
|
||||
uint32_t CFtpGet::SendFTPCommand(char *command) { return 0; }
|
||||
uint32_t CFtpGet::ReadFTPServerReply() { return 0; }
|
||||
uint32_t CFtpGet::GetFile() { return 0; }
|
||||
uint32_t CFtpGet::IssuePort() { return 0; }
|
||||
uint32_t CFtpGet::ReadDataChannel() { return 0; }
|
||||
void CFtpGet::FlushControlChannel() {}
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
ChttpGet::ChttpGet(char *URL,char *localfile){}
|
||||
ChttpGet::~ChttpGet(){}
|
||||
int ChttpGet::GetStatus(){return 0;}
|
||||
uint32_t ChttpGet::GetBytesIn(){return 0;}
|
||||
uint32_t GetTotalBytes(){return 0;}
|
||||
void AbortGet(){}
|
||||
void WorkerThread(){}
|
||||
int ConnectSocket(){return 0;}
|
||||
char *GetHTTPLine(){return "ERR";}
|
||||
uint32_t ReadDataChannel(){return 0;}
|
||||
|
||||
ChttpGet::ChttpGet(char *URL, char *localfile) {}
|
||||
ChttpGet::~ChttpGet() {}
|
||||
int ChttpGet::GetStatus() { return 0; }
|
||||
uint32_t ChttpGet::GetBytesIn() { return 0; }
|
||||
uint32_t GetTotalBytes() { return 0; }
|
||||
void AbortGet() {}
|
||||
void WorkerThread() {}
|
||||
int ConnectSocket() { return 0; }
|
||||
char *GetHTTPLine() { return "ERR"; }
|
||||
uint32_t ReadDataChannel() { return 0; }
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// InsSongDlg.cpp : implementation file
|
||||
//
|
||||
@@ -32,54 +32,43 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CInsSongDlg dialog
|
||||
|
||||
|
||||
CInsSongDlg::CInsSongDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CInsSongDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CInsSongDlg)
|
||||
m_SongPath = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
CInsSongDlg::CInsSongDlg(CWnd *pParent /*=NULL*/) : CDialog(CInsSongDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CInsSongDlg)
|
||||
m_SongPath = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CInsSongDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CInsSongDlg)
|
||||
DDX_Text(pDX, IDC_EDIT, m_SongPath);
|
||||
//}}AFX_DATA_MAP
|
||||
void CInsSongDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CInsSongDlg)
|
||||
DDX_Text(pDX, IDC_EDIT, m_SongPath);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CInsSongDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CInsSongDlg)
|
||||
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CInsSongDlg)
|
||||
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CInsSongDlg message handlers
|
||||
|
||||
BOOL CInsSongDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
BOOL CInsSongDlg::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CInsSongDlg::OnBrowse() {
|
||||
CFileDialog opendlg(TRUE, "osf", NULL, OFN_PATHMUSTEXIST, "Outrage Stream Files(*.osf)|*.osf||", this);
|
||||
CEdit *edit = (CEdit *)GetDlgItem(IDC_EDIT);
|
||||
|
||||
void CInsSongDlg::OnBrowse()
|
||||
{
|
||||
CFileDialog opendlg(TRUE, "osf", NULL, OFN_PATHMUSTEXIST, "Outrage Stream Files(*.osf)|*.osf||", this);
|
||||
CEdit *edit = (CEdit *)GetDlgItem(IDC_EDIT);
|
||||
// get filename to play
|
||||
if (opendlg.DoModal() != IDOK) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get filename to play
|
||||
if (opendlg.DoModal() != IDOK) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
edit->SetWindowText((LPCTSTR)opendlg.GetPathName());
|
||||
edit->SetWindowText((LPCTSTR)opendlg.GetPathName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_INSSONGDLG_H__B4518671_1FF8_11D2_B2B3_00A0C94B8467__INCLUDED_)
|
||||
#define AFX_INSSONGDLG_H__B4518671_1FF8_11D2_B2B3_00A0C94B8467__INCLUDED_
|
||||
@@ -28,35 +28,32 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CInsSongDlg dialog
|
||||
|
||||
class CInsSongDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CInsSongDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
CInsSongDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CInsSongDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CInsSongDlg)
|
||||
enum { IDD = IDD_INSERT_SONG };
|
||||
CString m_SongPath;
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CInsSongDlg)
|
||||
enum { IDD = IDD_INSERT_SONG };
|
||||
CString m_SongPath;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CInsSongDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CInsSongDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CInsSongDlg)
|
||||
afx_msg void OnBrowse();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CInsSongDlg)
|
||||
afx_msg void OnBrowse();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// PlaySongDlg.cpp : implementation file
|
||||
//
|
||||
@@ -34,80 +34,67 @@ static char THIS_FILE[] = __FILE__;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPlaySongDlg dialog
|
||||
|
||||
|
||||
CPlaySongDlg::CPlaySongDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CPlaySongDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CPlaySongDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CPlaySongDlg::CPlaySongDlg(CWnd *pParent /*=NULL*/) : CDialog(CPlaySongDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(CPlaySongDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CPlaySongDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CPlaySongDlg)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
void CPlaySongDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CPlaySongDlg)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPlaySongDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CPlaySongDlg)
|
||||
ON_WM_TIMER()
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
//{{AFX_MSG_MAP(CPlaySongDlg)
|
||||
ON_WM_TIMER()
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPlaySongDlg message handlers
|
||||
|
||||
BOOL CPlaySongDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
BOOL CPlaySongDlg::OnInitDialog() {
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// set up stream to play.
|
||||
m_Stream.Open((LPCTSTR)m_StreamName);
|
||||
SetTimer(0, 100, NULL);
|
||||
// set up stream to play.
|
||||
m_Stream.Open((LPCTSTR)m_StreamName);
|
||||
SetTimer(0, 100, NULL);
|
||||
|
||||
// okay we should start playing the song
|
||||
CProgressCtrl *progress = (CProgressCtrl *)GetDlgItem(IDC_PLAYPROGRESS);
|
||||
progress->SetRange(0, m_Stream.GetLength()/1024);
|
||||
// okay we should start playing the song
|
||||
CProgressCtrl *progress = (CProgressCtrl *)GetDlgItem(IDC_PLAYPROGRESS);
|
||||
progress->SetRange(0, m_Stream.GetLength() / 1024);
|
||||
|
||||
m_Stream.Play();
|
||||
m_Stream.Play();
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CPlaySongDlg::OnTimer(UINT nIDEvent) {
|
||||
CProgressCtrl *progress = (CProgressCtrl *)GetDlgItem(IDC_PLAYPROGRESS);
|
||||
CStatic *text = (CStatic *)GetDlgItem(IDC_STATUS_TEXT);
|
||||
char buf[80];
|
||||
sprintf(buf, "%s (%d%%)", (LPCTSTR)m_StreamName, m_Stream.GetPos() * 100 / m_Stream.GetLength());
|
||||
|
||||
void CPlaySongDlg::OnTimer(UINT nIDEvent)
|
||||
{
|
||||
CProgressCtrl *progress = (CProgressCtrl *)GetDlgItem(IDC_PLAYPROGRESS);
|
||||
CStatic *text = (CStatic *)GetDlgItem(IDC_STATUS_TEXT);
|
||||
char buf[80];
|
||||
sprintf(buf, "%s (%d%%)", (LPCTSTR)m_StreamName, m_Stream.GetPos()*100/m_Stream.GetLength());
|
||||
text->SetWindowText(buf);
|
||||
progress->SetPos(m_Stream.GetPos() / 1024);
|
||||
|
||||
text->SetWindowText(buf);
|
||||
progress->SetPos(m_Stream.GetPos()/1024);
|
||||
MusicPlayFrame();
|
||||
|
||||
MusicPlayFrame();
|
||||
if (m_Stream.State() == STRM_STOPPED || m_Stream.State() == STRM_INVALID) {
|
||||
OnOK();
|
||||
}
|
||||
|
||||
if (m_Stream.State() == STRM_STOPPED || m_Stream.State() == STRM_INVALID) {
|
||||
OnOK();
|
||||
}
|
||||
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
void CPlaySongDlg::OnDestroy() {
|
||||
CDialog::OnDestroy();
|
||||
|
||||
void CPlaySongDlg::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
|
||||
KillTimer(0);
|
||||
m_Stream.Close();
|
||||
KillTimer(0);
|
||||
m_Stream.Close();
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Descent 3
|
||||
* Copyright (C) 2024 Parallax Software
|
||||
*
|
||||
* 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 3 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 received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_PLAYSONGDLG_H__932821D1_1D86_11D2_B2B3_00A0C94B8467__INCLUDED_)
|
||||
#define AFX_PLAYSONGDLG_H__932821D1_1D86_11D2_B2B3_00A0C94B8467__INCLUDED_
|
||||
@@ -30,39 +30,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPlaySongDlg dialog
|
||||
|
||||
|
||||
class CPlaySongDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
class CPlaySongDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
AudioStream m_Stream;
|
||||
CString m_StreamName;
|
||||
CPlaySongDlg(CWnd* pParent = NULL); // standard constructor
|
||||
AudioStream m_Stream;
|
||||
CString m_StreamName;
|
||||
CPlaySongDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CPlaySongDlg)
|
||||
enum { IDD = IDD_PLAYSONG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CPlaySongDlg)
|
||||
enum { IDD = IDD_PLAYSONG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPlaySongDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPlaySongDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CPlaySongDlg)
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CPlaySongDlg)
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user