mirror of
https://github.com/electronicarts/CnC_Renegade.git
synced 2025-12-16 15:41:39 -05:00
Initial commit of Command & Conquer Renegade source code.
This commit is contained in:
518
Code/Tools/WWConfig/AudioConfigDialog.cpp
Normal file
518
Code/Tools/WWConfig/AudioConfigDialog.cpp
Normal file
@@ -0,0 +1,518 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// AudioConfigDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "wwconfig.h"
|
||||
#include "audioconfigdialog.h"
|
||||
#include "wwaudio.h"
|
||||
#include "locale_api.h"
|
||||
#include "wwconfig_ids.h"
|
||||
#include "..\..\combat\specialbuilds.h"
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Constants
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
COL_DRIVER_NAME = 0,
|
||||
};
|
||||
|
||||
/*
|
||||
#ifdef MULTIPLAYERDEMO
|
||||
const char *RENEGADE_SUB_KEY_NAME_AUDIO = "Software\\Westwood\\RenegadeMPDemo\\Sound";
|
||||
#else
|
||||
const char *RENEGADE_SUB_KEY_NAME_AUDIO = "Software\\Westwood\\Renegade\\Sound";
|
||||
#endif // MULTIPLAYERDEMO
|
||||
*/
|
||||
|
||||
#if defined(FREEDEDICATEDSERVER)
|
||||
const char *RENEGADE_SUB_KEY_NAME_AUDIO = "Software\\Westwood\\RenegadeFDS\\Sound";
|
||||
#elif defined(MULTIPLAYERDEMO)
|
||||
const char *RENEGADE_SUB_KEY_NAME_AUDIO = "Software\\Westwood\\RenegadeMPDemo\\Sound";
|
||||
#elif defined(BETACLIENT)
|
||||
const char *RENEGADE_SUB_KEY_NAME_AUDIO = "Software\\Westwood\\RenegadeBeta\\Sound";
|
||||
#else
|
||||
const char *RENEGADE_SUB_KEY_NAME_AUDIO = "Software\\Westwood\\Renegade\\Sound";
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AudioConfigDialogClass
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
AudioConfigDialogClass::AudioConfigDialogClass(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(AudioConfigDialogClass::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(AudioConfigDialogClass)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
CDialog::Create (AudioConfigDialogClass::IDD, pParent);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DoDataExchange
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
AudioConfigDialogClass::DoDataExchange (CDataExchange *pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(AudioConfigDialogClass)
|
||||
DDX_Control(pDX, IDC_SOUND_EFFECTS_SLIDER, m_SoundVolSlider);
|
||||
DDX_Control(pDX, IDC_MUSIC_SLIDER, m_MusicVolSlider);
|
||||
DDX_Control(pDX, IDC_DIALOG_SLIDER, m_DialogVolSlider);
|
||||
DDX_Control(pDX, IDC_CINEMATIC_SLIDER, m_CinematicVolSlider);
|
||||
DDX_Control(pDX, IDC_DRIVER_LIST, m_ListCtrl);
|
||||
//}}AFX_DATA_MAP
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(AudioConfigDialogClass, CDialog)
|
||||
//{{AFX_MSG_MAP(AudioConfigDialogClass)
|
||||
ON_WM_DESTROY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnInitDialog
|
||||
//
|
||||
// Modified: 12/06/2001 by MML - Retrieving strings from Locomoto file.
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BOOL
|
||||
AudioConfigDialogClass::OnInitDialog (void)
|
||||
{
|
||||
char string [_MAX_PATH];
|
||||
|
||||
CDialog::OnInitDialog ();
|
||||
|
||||
//
|
||||
// Set all the static strings for this dialog.
|
||||
//
|
||||
Locale_GetString( IDS_DRIVER, string );
|
||||
SetDlgItemText( IDC_DRIVER, string );
|
||||
|
||||
Locale_GetString( IDS_VOLUME, string );
|
||||
SetDlgItemText( IDC_VOLUME, string );
|
||||
|
||||
Locale_GetString( IDS_SOUND_EFFECTS, string );
|
||||
SetDlgItemText( IDC_SOUND_EFFECTS_CHECK, string );
|
||||
|
||||
Locale_GetString( IDS_MUSIC, string );
|
||||
SetDlgItemText( IDC_MUSIC_CHECK, string );
|
||||
|
||||
Locale_GetString( IDS_DIALOG, string );
|
||||
SetDlgItemText( IDC_DIALOG_CHECK, string );
|
||||
|
||||
Locale_GetString( IDS_CINEMATIC, string);
|
||||
SetDlgItemText( IDC_CINEMATIC_CHECK, string );
|
||||
|
||||
Locale_GetString( IDS_QUALITY, string );
|
||||
SetDlgItemText( IDC_QUALITY, string );
|
||||
SendDlgItemMessage (IDC_QUALITY_COMBO, CB_RESETCONTENT, 0, 0);
|
||||
SendDlgItemMessage (IDC_QUALITY_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_8_BIT, string));
|
||||
SendDlgItemMessage (IDC_QUALITY_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_16_BIT, string));
|
||||
|
||||
Locale_GetString( IDS_PLAYBACK_RATE, string );
|
||||
SetDlgItemText( IDC_PLAYBACK_RATE, string );
|
||||
SendDlgItemMessage (IDC_RATE_COMBO, CB_RESETCONTENT, 0, 0);
|
||||
SendDlgItemMessage (IDC_RATE_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_11_KHZ, string));
|
||||
SendDlgItemMessage (IDC_RATE_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_22_KHZ, string));
|
||||
SendDlgItemMessage (IDC_RATE_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_44_KHZ, string));
|
||||
|
||||
Locale_GetString( IDS_SPEAKER_SETUP, string );
|
||||
SetDlgItemText( IDC_SPEAKER_SETUP, string );
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_RESETCONTENT, 0, 0);
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_2_SPEAKER, string));
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_HEADPHONE, string));
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_SURROUND_SOUND, string));
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_ADDSTRING, 0, (LPARAM)Locale_GetString (IDS_4_SPEAKER, string));
|
||||
|
||||
Locale_GetString( IDS_STEREO, string );
|
||||
SetDlgItemText( IDC_STEREO_CHECK, string );
|
||||
|
||||
//
|
||||
// Startup the audio library
|
||||
//
|
||||
new WWAudioClass;
|
||||
WWAudioClass::Get_Instance ()->Initialize ();
|
||||
|
||||
//
|
||||
// Read the audio library's settings from the registry
|
||||
//
|
||||
StringClass device_name;
|
||||
bool is_stereo = true;
|
||||
int bits = 16;
|
||||
int hertz = 44100;
|
||||
bool sound_on = true;
|
||||
bool music_on = true;
|
||||
bool dialog_on = true;
|
||||
bool cinematic_on = true;
|
||||
float sound_vol = 1.0F;
|
||||
float music_vol = 1.0F;
|
||||
float dialog_vol = 1.0F;
|
||||
float cinematic_vol = 1.0F;
|
||||
int speaker_type = 0;
|
||||
|
||||
WWAudioClass::Get_Instance ()->Load_From_Registry (RENEGADE_SUB_KEY_NAME_AUDIO,
|
||||
device_name, is_stereo, bits, hertz, sound_on,
|
||||
music_on, dialog_on, cinematic_on, sound_vol,
|
||||
music_vol, dialog_vol, cinematic_vol, speaker_type);
|
||||
|
||||
//
|
||||
// Setup the sound volume controls
|
||||
//
|
||||
m_SoundVolSlider.SetRange (0, 100);
|
||||
m_SoundVolSlider.SetPos (static_cast<int>(sound_vol * 100));
|
||||
SendDlgItemMessage (IDC_SOUND_EFFECTS_CHECK, BM_SETCHECK, (WPARAM)sound_on);
|
||||
|
||||
//
|
||||
// Setup the music volume controls
|
||||
//
|
||||
m_MusicVolSlider.SetRange (0, 100);
|
||||
m_MusicVolSlider.SetPos (static_cast<int>(music_vol * 100));
|
||||
SendDlgItemMessage (IDC_MUSIC_CHECK, BM_SETCHECK, (WPARAM)music_on);
|
||||
|
||||
//
|
||||
// Setup the dialog volume controls
|
||||
//
|
||||
m_DialogVolSlider.SetRange (0, 100);
|
||||
m_DialogVolSlider.SetPos (static_cast<int>(dialog_vol * 100));
|
||||
SendDlgItemMessage (IDC_DIALOG_CHECK, BM_SETCHECK, (WPARAM)dialog_on);
|
||||
|
||||
//
|
||||
// Setup the cinematic volume controls
|
||||
//
|
||||
m_CinematicVolSlider.SetRange (0, 100);
|
||||
m_CinematicVolSlider.SetPos (static_cast<int>(cinematic_vol * 100));
|
||||
SendDlgItemMessage (IDC_CINEMATIC_CHECK, BM_SETCHECK, (WPARAM)cinematic_on);
|
||||
|
||||
//
|
||||
// Check the stereo box if necessary
|
||||
//
|
||||
SendDlgItemMessage (IDC_STEREO_CHECK, BM_SETCHECK, (WPARAM)is_stereo);
|
||||
|
||||
//
|
||||
// Select the appropriate quality combobox entry
|
||||
//
|
||||
switch (bits)
|
||||
{
|
||||
case 8:
|
||||
SendDlgItemMessage (IDC_QUALITY_COMBO, CB_SETCURSEL, (WPARAM)0);
|
||||
break;
|
||||
|
||||
default:
|
||||
case 16:
|
||||
SendDlgItemMessage (IDC_QUALITY_COMBO, CB_SETCURSEL, (WPARAM)1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Select the appropriate kHz combobox entry
|
||||
//
|
||||
switch (hertz)
|
||||
{
|
||||
case 11025:
|
||||
SendDlgItemMessage (IDC_RATE_COMBO, CB_SETCURSEL, (WPARAM)0);
|
||||
break;
|
||||
|
||||
case 22050:
|
||||
SendDlgItemMessage (IDC_RATE_COMBO, CB_SETCURSEL, (WPARAM)1);
|
||||
break;
|
||||
|
||||
default:
|
||||
case 44100:
|
||||
SendDlgItemMessage (IDC_RATE_COMBO, CB_SETCURSEL, (WPARAM)2);
|
||||
break;
|
||||
}
|
||||
|
||||
// Select the appropriate speaker setup combobox entry
|
||||
switch (speaker_type) {
|
||||
|
||||
default:
|
||||
case 0:
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_SETCURSEL, (WPARAM)0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_SETCURSEL, (WPARAM)1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_SETCURSEL, (WPARAM)2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_SETCURSEL, (WPARAM)3);
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Configure the list control
|
||||
//
|
||||
m_ListCtrl.SetExtendedStyle (m_ListCtrl.GetExtendedStyle () | LVS_EX_FULLROWSELECT);
|
||||
m_ListCtrl.InsertColumn (COL_DRIVER_NAME, "Driver Name");
|
||||
|
||||
//
|
||||
// Size the columns
|
||||
//
|
||||
CRect rect;
|
||||
m_ListCtrl.GetClientRect (&rect);
|
||||
int width = rect.Width () - ::GetSystemMetrics (SM_CXVSCROLL);
|
||||
m_ListCtrl.SetColumnWidth (0, width);
|
||||
|
||||
//
|
||||
// Loop over all the drivers
|
||||
//
|
||||
bool selected_default = false;
|
||||
int driver_count = WWAudioClass::Get_Instance ()->Get_3D_Device_Count ();
|
||||
for (int index = 0; index < driver_count; index ++) {
|
||||
|
||||
//
|
||||
// Get information about this sound driver
|
||||
//
|
||||
WWAudioClass::DRIVER_INFO_STRUCT *driver_info = NULL;
|
||||
if (WWAudioClass::Get_Instance ()->Get_3D_Device (index, &driver_info)) {
|
||||
|
||||
//
|
||||
// Add an entry to the list for this driver
|
||||
//
|
||||
int item_index = m_ListCtrl.InsertItem (0xFF, driver_info->name);
|
||||
if (item_index >= 0) {
|
||||
m_ListCtrl.SetItemData (item_index, (DWORD)driver_info->driver);
|
||||
|
||||
//
|
||||
// Select this entry if its the default
|
||||
//
|
||||
if (::lstrcmpi (device_name, driver_info->name) == 0) {
|
||||
m_ListCtrl.SetItemState (item_index, LVIS_SELECTED, LVIS_SELECTED);
|
||||
selected_default = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Select the first entry by default (if necessary)
|
||||
//
|
||||
if (selected_default == false) {
|
||||
m_ListCtrl.SetItemState (0, LVIS_SELECTED, LVIS_SELECTED);
|
||||
}
|
||||
|
||||
//
|
||||
// Update the enabled state of the volume sliders
|
||||
//
|
||||
Update_Slider_Enable_State ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnDestroy
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
AudioConfigDialogClass::OnDestroy (void)
|
||||
{
|
||||
//
|
||||
// Shutdown the audio library
|
||||
//
|
||||
WWAudioClass::Get_Instance ()->Shutdown ();
|
||||
delete WWAudioClass::Get_Instance ();
|
||||
|
||||
CDialog::OnDestroy ();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Apply_Changes
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
AudioConfigDialogClass::Apply_Changes (void)
|
||||
{
|
||||
StringClass device_name;
|
||||
int hertz = 44100;
|
||||
int bits = 16;
|
||||
int speaker_type = 0;
|
||||
bool is_stereo = true;
|
||||
bool sound_on = true;
|
||||
bool music_on = true;
|
||||
bool dialog_on = true;
|
||||
bool cinematic_on = true;
|
||||
float sound_vol = 1.0F;
|
||||
float music_vol = 1.0F;
|
||||
float dialog_vol = 1.0F;
|
||||
float cinematic_vol = 1.0F;
|
||||
|
||||
//
|
||||
// Get the volume settings
|
||||
//
|
||||
sound_vol = m_SoundVolSlider.GetPos () / 100.0F;
|
||||
music_vol = m_MusicVolSlider.GetPos () / 100.0F;
|
||||
dialog_vol = m_DialogVolSlider.GetPos () / 100.0F;
|
||||
cinematic_vol = m_CinematicVolSlider.GetPos() / 100.0F;
|
||||
|
||||
//
|
||||
// Get the volume controls
|
||||
//
|
||||
sound_on = (SendDlgItemMessage (IDC_SOUND_EFFECTS_CHECK, BM_GETCHECK) == 1);
|
||||
music_on = (SendDlgItemMessage (IDC_MUSIC_CHECK, BM_GETCHECK) == 1);
|
||||
dialog_on = (SendDlgItemMessage (IDC_DIALOG_CHECK, BM_GETCHECK) == 1);
|
||||
cinematic_on = (SendDlgItemMessage (IDC_CINEMATIC_CHECK, BM_GETCHECK) == 1);
|
||||
|
||||
//
|
||||
// Get the name of the selected device
|
||||
//
|
||||
int selected_item = m_ListCtrl.GetNextItem (-1, LVNI_ALL | LVNI_SELECTED);
|
||||
if (selected_item >= 0) {
|
||||
device_name = (const char *)m_ListCtrl.GetItemText (selected_item, 0);
|
||||
}
|
||||
|
||||
//
|
||||
// Get the stereo flag from the dialog
|
||||
//
|
||||
is_stereo = bool(SendDlgItemMessage (IDC_STEREO_CHECK, BM_GETCHECK) == 1);
|
||||
|
||||
//
|
||||
// Get the playback bit rate from the dialog
|
||||
//
|
||||
int quality_cursel = SendDlgItemMessage (IDC_QUALITY_COMBO, CB_GETCURSEL);
|
||||
if (quality_cursel == 0) {
|
||||
bits = 8;
|
||||
} else if (quality_cursel == 1) {
|
||||
bits = 16;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the playback rate from the controls
|
||||
//
|
||||
int rate_cursel = SendDlgItemMessage (IDC_RATE_COMBO, CB_GETCURSEL);
|
||||
if (rate_cursel == 0) {
|
||||
hertz = 11025;
|
||||
} else if (rate_cursel == 1) {
|
||||
hertz = 22050;
|
||||
} else if (rate_cursel == 2) {
|
||||
hertz = 44100;
|
||||
}
|
||||
|
||||
// Get the speaker setup from the controls.
|
||||
speaker_type = SendDlgItemMessage (IDC_SPEAKER_COMBO, CB_GETCURSEL);
|
||||
|
||||
//
|
||||
// Store these settings in the registry
|
||||
//
|
||||
WWAudioClass::Get_Instance ()->Save_To_Registry (RENEGADE_SUB_KEY_NAME_AUDIO,
|
||||
device_name, is_stereo, bits, hertz,
|
||||
sound_on, music_on, dialog_on, cinematic_on,
|
||||
sound_vol, music_vol, dialog_vol, cinematic_vol, speaker_type);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// WindowProc
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
LRESULT
|
||||
AudioConfigDialogClass::WindowProc
|
||||
(
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
{
|
||||
if (message == (WM_USER + 101)) {
|
||||
Apply_Changes ();
|
||||
}
|
||||
|
||||
return CDialog::WindowProc(message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Update_Slider_Enable_State
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
AudioConfigDialogClass::Update_Slider_Enable_State (void)
|
||||
{
|
||||
BOOL sound_enabled = IsDlgButtonChecked (IDC_SOUND_EFFECTS_CHECK);
|
||||
BOOL music_enabled = IsDlgButtonChecked (IDC_MUSIC_CHECK);
|
||||
BOOL dialog_enabled = IsDlgButtonChecked (IDC_DIALOG_CHECK);
|
||||
BOOL cinematic_enabled = IsDlgButtonChecked (IDC_CINEMATIC_CHECK);
|
||||
|
||||
//
|
||||
// Enable the slider's based on the state of the check boxes
|
||||
//
|
||||
::EnableWindow (::GetDlgItem (m_hWnd, IDC_SOUND_EFFECTS_SLIDER), sound_enabled);
|
||||
::EnableWindow (::GetDlgItem (m_hWnd, IDC_MUSIC_SLIDER), music_enabled);
|
||||
::EnableWindow (::GetDlgItem (m_hWnd, IDC_DIALOG_SLIDER), dialog_enabled);
|
||||
::EnableWindow (::GetDlgItem (m_hWnd, IDC_CINEMATIC_SLIDER), cinematic_enabled);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnCommand
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BOOL
|
||||
AudioConfigDialogClass::OnCommand (WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (LOWORD (wParam)) {
|
||||
|
||||
//
|
||||
// Update the enabled state of the volume sliders
|
||||
//
|
||||
case IDC_SOUND_EFFECTS_CHECK:
|
||||
case IDC_MUSIC_CHECK:
|
||||
case IDC_DIALOG_CHECK:
|
||||
case IDC_CINEMATIC_CHECK:
|
||||
Update_Slider_Enable_State();
|
||||
break;
|
||||
}
|
||||
|
||||
return CDialog::OnCommand (wParam, lParam);
|
||||
}
|
||||
93
Code/Tools/WWConfig/AudioConfigDialog.h
Normal file
93
Code/Tools/WWConfig/AudioConfigDialog.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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_AUDIOCONFIGDIALOG_H__A52D1748_C2C5_4536_A5E2_50988E5D5AB2__INCLUDED_)
|
||||
#define AFX_AUDIOCONFIGDIALOG_H__A52D1748_C2C5_4536_A5E2_50988E5D5AB2__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AudioConfigDialogClass
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
class AudioConfigDialogClass : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
AudioConfigDialogClass(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(AudioConfigDialogClass)
|
||||
enum { IDD = IDD_AUDIO_CONFIG };
|
||||
CSliderCtrl m_MusicVolSlider;
|
||||
CSliderCtrl m_SoundVolSlider;
|
||||
CSliderCtrl m_DialogVolSlider;
|
||||
CSliderCtrl m_CinematicVolSlider;
|
||||
CListCtrl m_ListCtrl;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(AudioConfigDialogClass)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(AudioConfigDialogClass)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void Apply_Changes (void);
|
||||
|
||||
private:
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void Update_Slider_Enable_State (void);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Private member data
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_AUDIOCONFIGDIALOG_H__A52D1748_C2C5_4536_A5E2_50988E5D5AB2__INCLUDED_)
|
||||
BIN
Code/Tools/WWConfig/Debug/EZGIMEX.sbr
Normal file
BIN
Code/Tools/WWConfig/Debug/EZGIMEX.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/Debug/StdAfx.sbr
Normal file
BIN
Code/Tools/WWConfig/Debug/StdAfx.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/Debug/WWConfig.pch
Normal file
BIN
Code/Tools/WWConfig/Debug/WWConfig.pch
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/Debug/WWConfig.res
Normal file
BIN
Code/Tools/WWConfig/Debug/WWConfig.res
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/Debug/locale.sbr
Normal file
BIN
Code/Tools/WWConfig/Debug/locale.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/Debug/rawfile.sbr
Normal file
BIN
Code/Tools/WWConfig/Debug/rawfile.sbr
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/Debug/wwfile.sbr
Normal file
BIN
Code/Tools/WWConfig/Debug/wwfile.sbr
Normal file
Binary file not shown.
374
Code/Tools/WWConfig/DriverVersionWarning.cpp
Normal file
374
Code/Tools/WWConfig/DriverVersionWarning.cpp
Normal file
@@ -0,0 +1,374 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// DriverVersionWarning.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "wwconfig.h"
|
||||
#include "videoconfigdialog.h"
|
||||
#include "DriverVersionWarning.h"
|
||||
#include "dx8caps.h"
|
||||
#include "cpudetect.h"
|
||||
#include "dx8wrapper.h"
|
||||
#include "registry.h"
|
||||
#include "formconv.h"
|
||||
#include "locale_api.h"
|
||||
#include "wwconfig_ids.h"
|
||||
|
||||
|
||||
extern int GlobalExitValue;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
static StringClass VersionWarningString;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DriverVersionWarning dialog
|
||||
|
||||
|
||||
DriverVersionWarning::DriverVersionWarning(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(DriverVersionWarning::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(DriverVersionWarning)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void DriverVersionWarning::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(DriverVersionWarning)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(DriverVersionWarning, CDialog)
|
||||
//{{AFX_MSG_MAP(DriverVersionWarning)
|
||||
ON_BN_CLICKED(IDC_DISABLE_DRIVER_VERSION_DIALOG_CHECKBOX, OnDisableDriverVersionDialogCheckbox)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DriverVersionWarning message handlers
|
||||
//
|
||||
// Modified: 12/06/2001 by MML - Retrieving strings from Locomoto file.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void Get_Driver_Version_Warning_String(StringClass& str, DX8Caps& caps)
|
||||
{
|
||||
DX8Caps::DriverVersionStatusType status=caps.Get_Driver_Version_Status();
|
||||
|
||||
if (status!=DX8Caps::DRIVER_STATUS_BAD) {
|
||||
// str="Driver version is GOOD";
|
||||
str = StringClass( Locale_GetString( IDS_GOOD_DRIVER ));
|
||||
return;
|
||||
}
|
||||
|
||||
StringClass driver_name(0,true);
|
||||
driver_name=caps.Get_Driver_Name();
|
||||
|
||||
// str.Format(
|
||||
// "Your current video card driver version is known to cause problems with Renegade. If you encounter problems while playing Renegade, please refer to the readme.txt for instructions on how to update your video card driver.\n"
|
||||
// "\n"
|
||||
// "Driver: %s\n"
|
||||
// "Driver version: %d.%d (Status: BAD)\n",
|
||||
// driver_name,
|
||||
// caps.Get_Driver_Build_Version()/100,
|
||||
// caps.Get_Driver_Build_Version()%100);
|
||||
|
||||
StringClass format_string( Locale_GetString( IDS_KNOW_PROBLEMS ));
|
||||
format_string += "\n\n";
|
||||
format_string += StringClass( Locale_GetString( IDS_DRIVER_NAME ));
|
||||
format_string += "\n";
|
||||
format_string += StringClass( Locale_GetString( IDS_DRIVER_VERSION ));
|
||||
format_string += "\n";
|
||||
|
||||
str.Format( format_string,
|
||||
driver_name,
|
||||
caps.Get_Driver_Build_Version()/100,
|
||||
caps.Get_Driver_Build_Version()%100 );
|
||||
|
||||
switch (caps.Get_Vendor()) {
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
case DX8Caps::VENDOR_NVIDIA:
|
||||
if (driver_name=="nv4_disp.dll" || driver_name=="nvdd32.dll") {
|
||||
// str += "Recommended version: 21.81 or higher\n";
|
||||
str += StringClass( Locale_GetString( IDS_VERSION_MIN1 ));
|
||||
}
|
||||
break;
|
||||
|
||||
case DX8Caps::VENDOR_ATI:
|
||||
if (driver_name=="ati2dvag.dll") {
|
||||
// str += "Recommended version: 3281 or higher\n";
|
||||
str += StringClass( Locale_GetString( IDS_VERSION_MIN2 ));
|
||||
}
|
||||
break;
|
||||
|
||||
case DX8Caps::VENDOR_3DFX:
|
||||
// str += "There is no driver support for 3Dfx. Website www.x3dfx.com has some unofficial drivers.\n";
|
||||
str += StringClass( Locale_GetString( IDS_NO_DRIVER_SUPPORT ));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CheckDriverVersion
|
||||
|
||||
void CheckDriverVersion()
|
||||
{
|
||||
//
|
||||
// Attempt to open the registry key
|
||||
//
|
||||
RegistryClass render_registry(RENEGADE_SUB_KEY_NAME_RENDER);
|
||||
if (!render_registry.Is_Valid()) return;
|
||||
|
||||
int disabled=render_registry.Get_Int( "DriverVersionCheckDisabled" );
|
||||
if (disabled>=87) return;
|
||||
|
||||
IDirect3D8* d3d=NULL;
|
||||
D3DCAPS8 tmp_caps;
|
||||
const D3DCAPS8* d3dcaps=NULL;
|
||||
D3DADAPTER_IDENTIFIER8 adapter_id;
|
||||
|
||||
VideoConfigDialogClass* video=VideoConfigDialogClass::Get_Instance();
|
||||
if (video) {
|
||||
d3d=DX8Wrapper::_Get_D3D8();
|
||||
d3d->AddRef();
|
||||
d3dcaps=&video->Get_Current_Caps();
|
||||
adapter_id=video->Get_Current_Adapter_Identifier();
|
||||
}
|
||||
else {
|
||||
// Init D3D
|
||||
Init_D3D_To_WW3_Conversion();
|
||||
d3d=Direct3DCreate8(D3D_SDK_VERSION); // TODO: handle failure cases...
|
||||
if (!d3d) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Select device. If there is already a device selected in the registry, use it.
|
||||
|
||||
int current_adapter_index=D3DADAPTER_DEFAULT;
|
||||
|
||||
//
|
||||
// Load the render device settings from the registry
|
||||
//
|
||||
char device_name[256] = { 0 };
|
||||
render_registry.Get_String( VALUE_NAME_RENDER_DEVICE_NAME, device_name, sizeof(device_name));
|
||||
|
||||
int adapter_count = d3d->GetAdapterCount();
|
||||
for (int adapter_index=0; adapter_index<adapter_count; adapter_index++) {
|
||||
D3DADAPTER_IDENTIFIER8 id;
|
||||
::ZeroMemory(&id, sizeof(D3DADAPTER_IDENTIFIER8));
|
||||
HRESULT res = d3d->GetAdapterIdentifier(adapter_index,D3DENUM_NO_WHQL_LEVEL,&id);
|
||||
// If device ok, check if it matches the currently set adapter name
|
||||
if (res == D3D_OK) {
|
||||
StringClass name(id.Description,true);
|
||||
if (name==device_name) {
|
||||
current_adapter_index=adapter_index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(d3d->GetDeviceCaps(
|
||||
current_adapter_index,
|
||||
D3DDEVTYPE_HAL,
|
||||
&tmp_caps))) {
|
||||
d3d->Release();
|
||||
return;
|
||||
}
|
||||
|
||||
::ZeroMemory(&adapter_id, sizeof(D3DADAPTER_IDENTIFIER8));
|
||||
if (FAILED( d3d->GetAdapterIdentifier(
|
||||
current_adapter_index,
|
||||
D3DENUM_NO_WHQL_LEVEL,
|
||||
&adapter_id))) {
|
||||
d3d->Release();
|
||||
return;
|
||||
}
|
||||
|
||||
d3dcaps=&tmp_caps;
|
||||
|
||||
}
|
||||
|
||||
DX8Caps caps(d3d,*d3dcaps,WW3D_FORMAT_UNKNOWN,adapter_id);
|
||||
d3d->Release();
|
||||
d3d=NULL;
|
||||
|
||||
// Beta message - remember to remove!
|
||||
/* bool unknown_device=false;
|
||||
switch (caps.Get_Vendor()) {
|
||||
default:
|
||||
case DX8Caps::VENDOR_UNKNOWN:
|
||||
unknown_device=true;
|
||||
break;
|
||||
case DX8Caps::VENDOR_NVIDIA:
|
||||
unknown_device=(caps.Get_Device()==DX8Caps::DEVICE_NVIDIA_UNKNOWN);
|
||||
break;
|
||||
case DX8Caps::VENDOR_ATI:
|
||||
unknown_device=(caps.Get_Device()==DX8Caps::DEVICE_ATI_UNKNOWN);
|
||||
break;
|
||||
case DX8Caps::VENDOR_INTEL:
|
||||
unknown_device=(caps.Get_Device()==DX8Caps::DEVICE_INTEL_UNKNOWN);
|
||||
break;
|
||||
case DX8Caps::VENDOR_S3:
|
||||
unknown_device=(caps.Get_Device()==DX8Caps::DEVICE_S3_UNKNOWN);
|
||||
break;
|
||||
case DX8Caps::VENDOR_POWERVR:
|
||||
unknown_device=(caps.Get_Device()==DX8Caps::DEVICE_POWERVR_UNKNOWN);
|
||||
break;
|
||||
case DX8Caps::VENDOR_MATROX:
|
||||
unknown_device=(caps.Get_Device()==DX8Caps::DEVICE_MATROX_UNKNOWN);
|
||||
break;
|
||||
case DX8Caps::VENDOR_3DFX:
|
||||
unknown_device=(caps.Get_Device()==DX8Caps::DEVICE_3DFX_UNKNOWN);
|
||||
break;
|
||||
case DX8Caps::VENDOR_3DLABS:
|
||||
unknown_device=(caps.Get_Device()==DX8Caps::DEVICE_3DLABS_UNKNOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
if (unknown_device) {
|
||||
|
||||
VersionWarningString=
|
||||
"Renegade doesn't recognize your videocard.\n"
|
||||
"While you will most likely be able to play\n"
|
||||
"the game without problems, we would still\n"
|
||||
"like to add your video card in our datebase.\n"
|
||||
"Please send email to jani@westwood.com and\n"
|
||||
"tell what your system configuration is. Please\n"
|
||||
"include a file called sysinfo.txt from Renegade\n"
|
||||
"folder (c:\\westwood\\renegade by default)\n"
|
||||
"\n"
|
||||
"Thanks!";
|
||||
DriverVersionWarning dlg;
|
||||
dlg.DoModal();
|
||||
}
|
||||
*/
|
||||
render_registry.Set_Int( "DriverVersionCheckDisabled", 87 ); // Disable checking if driver version is good
|
||||
GlobalExitValue=0;
|
||||
|
||||
// IML: Disable driver warning message.
|
||||
#if 0
|
||||
DX8Caps::DriverVersionStatusType status=caps.Get_Driver_Version_Status();
|
||||
switch (status) {
|
||||
default:
|
||||
case DX8Caps::DRIVER_STATUS_GOOD:
|
||||
case DX8Caps::DRIVER_STATUS_OK:
|
||||
case DX8Caps::DRIVER_STATUS_UNKNOWN:
|
||||
render_registry.Set_Int( "DriverVersionCheckDisabled", 87 ); // Disable checking if driver version is good
|
||||
break;
|
||||
case DX8Caps::DRIVER_STATUS_BAD:
|
||||
{
|
||||
Get_Driver_Version_Warning_String(VersionWarningString,caps);
|
||||
|
||||
DriverVersionWarning dlg;
|
||||
dlg.DoModal();
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DriverVersionWarning::OnDisableDriverVersionDialogCheckbox()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
int is_disabled = SendDlgItemMessage (IDC_DISABLE_DRIVER_VERSION_DIALOG_CHECKBOX, BM_GETCHECK);
|
||||
RegistryClass render_registry(RENEGADE_SUB_KEY_NAME_RENDER);
|
||||
if (!render_registry.Is_Valid()) return;
|
||||
render_registry.Set_Int( "DriverVersionCheckDisabled", is_disabled ? 87 : 0 );
|
||||
}
|
||||
|
||||
int DriverVersionWarning::DoModal()
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
|
||||
return CDialog::DoModal();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnInitDialog
|
||||
//
|
||||
// Modified: 12/06/2001 by MML - Retrieving strings from Locomoto file.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BOOL DriverVersionWarning::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
//
|
||||
// Set all the static strings for this dialog.
|
||||
//
|
||||
char string[ _MAX_PATH ];
|
||||
|
||||
// Message
|
||||
SetDlgItemText(IDC_DRIVER_VERSION_WARNING_TEXT,VersionWarningString);
|
||||
|
||||
// Title
|
||||
Locale_GetString( IDS_WARNING, string );
|
||||
SetWindowText((LPCTSTR) string );
|
||||
|
||||
// Checkbox
|
||||
Locale_GetString( IDS_DO_NOT_SHOW_MSG_AGAIN, string );
|
||||
SetDlgItemText( IDC_DISABLE_DRIVER_VERSION_DIALOG_CHECKBOX, string );
|
||||
|
||||
// Buttons
|
||||
Locale_GetString( IDS_OK, string );
|
||||
SetDlgItemText( IDOK, string );
|
||||
|
||||
Locale_GetString( IDS_CANCEL, string );
|
||||
SetDlgItemText( IDCANCEL, string );
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void DriverVersionWarning::OnCancel()
|
||||
{
|
||||
// TODO: Add extra cleanup here
|
||||
|
||||
GlobalExitValue=1;
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
void DriverVersionWarning::OnOK()
|
||||
{
|
||||
// TODO: Add extra validation here
|
||||
|
||||
GlobalExitValue=0;
|
||||
CDialog::OnOK();
|
||||
}
|
||||
69
Code/Tools/WWConfig/DriverVersionWarning.h
Normal file
69
Code/Tools/WWConfig/DriverVersionWarning.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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_DRIVERVERSIONWARNING_H__F4848D9F_148E_40CD_816C_93816E58C585__INCLUDED_)
|
||||
#define AFX_DRIVERVERSIONWARNING_H__F4848D9F_148E_40CD_816C_93816E58C585__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// DriverVersionWarning.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DriverVersionWarning dialog
|
||||
|
||||
class DriverVersionWarning : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
DriverVersionWarning(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(DriverVersionWarning)
|
||||
enum { IDD = IDD_DRIVER_VERSION_WARNING };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(DriverVersionWarning)
|
||||
public:
|
||||
virtual int DoModal();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(DriverVersionWarning)
|
||||
afx_msg void OnDisableDriverVersionDialogCheckbox();
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void OnCancel();
|
||||
virtual void OnOK();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_DRIVERVERSIONWARNING_H__F4848D9F_148E_40CD_816C_93816E58C585__INCLUDED_)
|
||||
205
Code/Tools/WWConfig/EZGIMEX.cpp
Normal file
205
Code/Tools/WWConfig/EZGIMEX.cpp
Normal file
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
/* Copyright (C) Electronic Arts Canada Inc. 1994-1998. All rights reserved. */
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* ANSI Standard File and Memory Interface v1.04 */
|
||||
/* */
|
||||
/* by FrANK G. Barchard, EAC */
|
||||
/* */
|
||||
/* Code Module - May 24, 1995 */
|
||||
/* */
|
||||
/*------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Module Notes: */
|
||||
/* ------------- */
|
||||
/* This modules makes an easy basis for new Gimex low level */
|
||||
/* functions. You will need to make the following changes: */
|
||||
/* */
|
||||
/* function what to change */
|
||||
/* -------- -------------- */
|
||||
/* galloc/free put in your memory manager */
|
||||
/* LIBHANDLE.handle handle for your file system */
|
||||
/* gopen/gwopen fopen, fseek, ftell (find file size) */
|
||||
/* gclose fclose */
|
||||
/* gread fread and possibly memcpy */
|
||||
/* gwrite fwrite */
|
||||
/* gseek fseek */
|
||||
/* */
|
||||
/* The other routines should not need changing. */
|
||||
/* */
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
/* And increase stream buffer */
|
||||
/*
|
||||
setvbuf(f, NULL, _IOFBF, FILE_BUFFER_SIZE);
|
||||
*/
|
||||
|
||||
#define __NOINLINE__ 1
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "gimex.h"
|
||||
//#include "wnd_file.h"
|
||||
|
||||
/* Memory Functions */
|
||||
|
||||
int galloccount=0;
|
||||
|
||||
void * GCALL galloc(long size)
|
||||
{
|
||||
++galloccount;
|
||||
return(malloc((size_t)size));
|
||||
}
|
||||
|
||||
int GCALL gfree(void *memptr)
|
||||
{
|
||||
--galloccount;
|
||||
free(memptr);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* get motorola memory */
|
||||
|
||||
unsigned long ggetm(void *src, int bytes)
|
||||
{
|
||||
unsigned char *s = (unsigned char *) src;
|
||||
unsigned long value;
|
||||
|
||||
value = 0L;
|
||||
while (bytes--)
|
||||
{
|
||||
value = (value<<8) + ((*s++));
|
||||
}
|
||||
return(value);
|
||||
}
|
||||
|
||||
/* get intel memory */
|
||||
|
||||
unsigned long ggeti(void *src, int bytes)
|
||||
{
|
||||
unsigned char *s = (unsigned char *) src;
|
||||
int i = 0;
|
||||
unsigned long value;
|
||||
|
||||
value = 0L;
|
||||
while (bytes--)
|
||||
{
|
||||
value += ((*s++)) << (i);
|
||||
i += 8;
|
||||
}
|
||||
return(value);
|
||||
}
|
||||
|
||||
/* put motorolla memory */
|
||||
|
||||
void gputm(void *dst, unsigned long data, int bytes)
|
||||
{
|
||||
unsigned char *d = (unsigned char *) dst;
|
||||
unsigned long pval;
|
||||
|
||||
data <<= (4-bytes)*8;
|
||||
while (bytes)
|
||||
{
|
||||
pval = data >> 24;
|
||||
*d++ = (unsigned char) pval;
|
||||
data <<= 8;
|
||||
--bytes;
|
||||
}
|
||||
}
|
||||
|
||||
/* put intel memory */
|
||||
|
||||
void gputi(void *dst, unsigned long data, int bytes)
|
||||
{
|
||||
unsigned char *d = (unsigned char *) dst;
|
||||
unsigned long pval;
|
||||
|
||||
while (bytes)
|
||||
{
|
||||
pval = data;
|
||||
*d++ = (unsigned char) pval;
|
||||
data >>= 8;
|
||||
--bytes;
|
||||
}
|
||||
}
|
||||
|
||||
/* File Functions */
|
||||
|
||||
GSTREAM * GCALL gopen(const char *filename)
|
||||
{
|
||||
FILE *handle;
|
||||
|
||||
handle = fopen( filename, "r+b" );
|
||||
if ( !handle ) {
|
||||
handle = fopen( filename, "rb" );
|
||||
}
|
||||
return((GSTREAM *) handle);
|
||||
}
|
||||
|
||||
GSTREAM * GCALL gwopen(const char *filename)
|
||||
{
|
||||
FILE *handle;
|
||||
|
||||
handle = fopen(filename,"w+b");
|
||||
if (!handle)
|
||||
handle = fopen(filename,"wb");
|
||||
|
||||
return((GSTREAM *) handle);
|
||||
}
|
||||
|
||||
int GCALL gclose(GSTREAM *g)
|
||||
{
|
||||
int ok=1;
|
||||
if (g)
|
||||
ok = !fclose((FILE*) g);
|
||||
return(ok);
|
||||
}
|
||||
|
||||
int GCALL gread(GSTREAM *g, void *buf, long size)
|
||||
{
|
||||
return(fread(buf, (size_t) 1, (size_t) size, (FILE *) g));
|
||||
}
|
||||
|
||||
int GCALL gwrite(GSTREAM *g, void *buf, long size)
|
||||
{
|
||||
return(fwrite(buf, (size_t)1, (size_t)size, (FILE *) g));
|
||||
}
|
||||
|
||||
int GCALL gseek(GSTREAM *g, long offset)
|
||||
{
|
||||
return(!fseek((FILE *) g, offset, SEEK_SET));
|
||||
}
|
||||
|
||||
long GCALL glen(GSTREAM *g)
|
||||
{
|
||||
long len;
|
||||
long oldpos = gtell(g);
|
||||
fseek((FILE *)g, 0, SEEK_END);
|
||||
len = gtell(g);
|
||||
fseek((FILE *)g, oldpos, SEEK_SET);
|
||||
return(len);
|
||||
}
|
||||
|
||||
long GCALL gtell(GSTREAM *g)
|
||||
{
|
||||
return(ftell((FILE *) g));
|
||||
}
|
||||
|
||||
514
Code/Tools/WWConfig/Locale_API.cpp
Normal file
514
Code/Tools/WWConfig/Locale_API.cpp
Normal file
@@ -0,0 +1,514 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S *
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE
|
||||
* $Archive: /Commando/Code/Tools/WWConfig/Locale_API.cpp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* PROGRAMMER
|
||||
* $Author: Ian_l $
|
||||
*
|
||||
* VERSION INFO
|
||||
* $Modtime: 1/09/02 11:02a $
|
||||
* $Revision: 2 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <Windows.h>
|
||||
#include <wtypes.h>
|
||||
#include "locale.h"
|
||||
#include "locale_api.h"
|
||||
#include "rawfile.h"
|
||||
#include "wwconfig_ids.h"
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* DEFINES */
|
||||
/****************************************************************************/
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// NOTE: if USE_MULTI_FILE_FORMAT is "true", then a .lOC file must be in
|
||||
// the same directory as this file.
|
||||
//----------------------------------------------------------------------------
|
||||
#define USE_MULTI_FILE_FORMAT FALSE
|
||||
|
||||
#define LANGUAGE_IS_DBCS(l) (((l)==IDL_JAPANESE)||((l)==IDL_KOREAN)||((l)==IDL_CHINESE)) // [OYO]
|
||||
#define CODEPAGE_IS_DBCS(C) ((C==932)||(C==949)||(C==950)) // [OYO]
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* GLOBAL VARIABLES */
|
||||
/****************************************************************************/
|
||||
CHAR LanguageFile[ _MAX_PATH ];
|
||||
void * LocaleFile = NULL;
|
||||
int CodePage = GetACP();
|
||||
int LanguageID = 0;
|
||||
|
||||
/****************************************************************************/
|
||||
/* LOCALE API */
|
||||
/****************************************************************************/
|
||||
WCHAR * Remove_Quotes_Around_String ( WCHAR *old_string );
|
||||
void * Load_File ( const CHAR *filename, long *filesize );
|
||||
|
||||
//=============================================================================
|
||||
// These are wrapper functions around the LOCALE_ functions. I made these to
|
||||
// make using the single vs. multi language files more transparent to the program.
|
||||
//=============================================================================
|
||||
|
||||
bool Locale_Use_Multi_Language_Files ( void )
|
||||
{
|
||||
#if( USE_MULTI_FILE_FORMAT )
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* initialization */
|
||||
/****************************************************************************/
|
||||
|
||||
int Locale_Init ( int language, char *file )
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Check for a file passed in.
|
||||
//-------------------------------------------------------------------------
|
||||
if( file == NULL || file[0] == '/0' ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Initialize settings.
|
||||
//-------------------------------------------------------------------------
|
||||
strcpy( LanguageFile, file );
|
||||
LanguageID = language;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// If language == -1, then set based on CodePage.
|
||||
//-------------------------------------------------------------------------
|
||||
if( LanguageID == -1 ) {
|
||||
|
||||
switch( CodePage ) {
|
||||
|
||||
// Japanese
|
||||
case 932:
|
||||
LanguageID = IDL_JAPANESE;
|
||||
break;
|
||||
|
||||
// Korean
|
||||
case 949:
|
||||
LanguageID = IDL_KOREAN;
|
||||
break;
|
||||
|
||||
// Chinese
|
||||
case 950:
|
||||
LanguageID = IDL_CHINESE;
|
||||
break;
|
||||
|
||||
// English, French, and German
|
||||
case 1252:
|
||||
{
|
||||
LANGID langid = GetSystemDefaultLangID();
|
||||
WORD plangid = PRIMARYLANGID( langid );
|
||||
|
||||
switch( plangid ) {
|
||||
|
||||
// German
|
||||
case 0x07:
|
||||
LanguageID = IDL_GERMAN;
|
||||
break;
|
||||
|
||||
// French
|
||||
case 0x0c:
|
||||
LanguageID = IDL_FRENCH;
|
||||
break;
|
||||
|
||||
// English
|
||||
case 0x09:
|
||||
default:
|
||||
LanguageID = IDL_ENGLISH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LanguageID = IDL_ENGLISH;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Check for valid LanguageID range.
|
||||
//-------------------------------------------------------------------------
|
||||
if( LanguageID < 0 || LanguageID >= LOCALE_LANGUAGE_COUNT ) {
|
||||
LanguageID = 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Use English in the situation where Chinese, Korean, or Japanese was
|
||||
// requested but not available.
|
||||
//-------------------------------------------------------------------------
|
||||
if( LANGUAGE_IS_DBCS( LanguageID ) && !CODEPAGE_IS_DBCS( CodePage )) {
|
||||
LanguageID = IDL_ENGLISH;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Initialize the lx object.
|
||||
//-------------------------------------------------------------------------
|
||||
LOCALE_init();
|
||||
|
||||
#if( USE_MULTI_FILE_FORMAT )
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Set bank to use and load the appropriate table.
|
||||
//---------------------------------------------------------------------
|
||||
LOCALE_setbank(0);
|
||||
result = LOCALE_loadtable( LanguageFile, LanguageID );
|
||||
|
||||
#else
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Create a file buffer that holds all the strings in the file.
|
||||
//---------------------------------------------------------------------
|
||||
long filesize;
|
||||
HRSRC hRsrc;
|
||||
HGLOBAL hGlobal;
|
||||
int PrimaryLanguage = LANG_NEUTRAL;
|
||||
int SubLanguage = SUBLANG_DEFAULT;
|
||||
HMODULE module = GetModuleHandle( NULL );
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Find the string file in this program's resources.
|
||||
//-------------------------------------------------------------------------
|
||||
switch( LanguageID ) {
|
||||
|
||||
// Japanese
|
||||
case IDL_JAPANESE:
|
||||
PrimaryLanguage = LANG_JAPANESE;
|
||||
SubLanguage = SUBLANG_DEFAULT;
|
||||
break;
|
||||
|
||||
// Korean
|
||||
case IDL_KOREAN:
|
||||
PrimaryLanguage = LANG_KOREAN;
|
||||
SubLanguage = SUBLANG_DEFAULT;
|
||||
break;
|
||||
|
||||
// Chinese
|
||||
case IDL_CHINESE:
|
||||
PrimaryLanguage = LANG_CHINESE;
|
||||
SubLanguage = SUBLANG_DEFAULT;
|
||||
break;
|
||||
|
||||
// German
|
||||
case IDL_GERMAN:
|
||||
PrimaryLanguage = LANG_GERMAN;
|
||||
SubLanguage = SUBLANG_GERMAN;
|
||||
break;
|
||||
|
||||
// French
|
||||
case IDL_FRENCH:
|
||||
PrimaryLanguage = LANG_FRENCH;
|
||||
SubLanguage = SUBLANG_FRENCH;
|
||||
break;
|
||||
|
||||
// English
|
||||
case IDL_ENGLISH:
|
||||
PrimaryLanguage = LANG_ENGLISH;
|
||||
SubLanguage = SUBLANG_ENGLISH_US;
|
||||
break;
|
||||
|
||||
default:
|
||||
PrimaryLanguage = LANG_ENGLISH;
|
||||
SubLanguage = SUBLANG_ENGLISH_US;
|
||||
break;
|
||||
}
|
||||
|
||||
hRsrc = FindResourceEx( module, RT_RCDATA, "STRINGS", MAKELANGID( PrimaryLanguage, SubLanguage ));
|
||||
if ( hRsrc == NULL ) {
|
||||
hRsrc = FindResourceEx( module, RT_RCDATA, "STRINGS", MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ));
|
||||
}
|
||||
if ( hRsrc ) {
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Load the resource, lock the memory, grab a DC.
|
||||
//---------------------------------------------------------------------
|
||||
hGlobal = LoadResource( module, hRsrc );
|
||||
filesize = SizeofResource( module, hRsrc );
|
||||
|
||||
LocaleFile = (void*)malloc( filesize + 1 );
|
||||
memset( LocaleFile, '\0', filesize + 1 );
|
||||
memcpy( LocaleFile, (const void *)hGlobal, filesize );
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Free DS and memory used.
|
||||
//---------------------------------------------------------------------
|
||||
UnlockResource( hGlobal );
|
||||
FreeResource( hGlobal );
|
||||
}
|
||||
|
||||
if( LocaleFile == NULL ) {
|
||||
LocaleFile = Load_File( LanguageFile, &filesize );
|
||||
}
|
||||
|
||||
if( LocaleFile != NULL ) {
|
||||
result = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* restore */
|
||||
/************************************************************************/
|
||||
|
||||
void Locale_Restore ( void )
|
||||
{
|
||||
#if( USE_MULTI_FILE_FORMAT )
|
||||
LOCALE_freetable();
|
||||
LOCALE_restore();
|
||||
#else
|
||||
if( LocaleFile ) {
|
||||
free( LocaleFile );
|
||||
LocaleFile = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
* Load_File -- Allocates a buffer and loads the file into it. *
|
||||
* *
|
||||
* Get a string usine Resource ID and a buffer. *
|
||||
* *
|
||||
* INPUT: int StringID -- The resource number of the string. *
|
||||
* CHAR *String -- The buffer to place the text in. *
|
||||
* *
|
||||
* OUTPUT: Returns with a pointer to the buffer. *
|
||||
* *
|
||||
* WARNINGS: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 12/10/2001 MML : Created. *
|
||||
*==============================================================================*/
|
||||
|
||||
const CHAR* Locale_GetString( int StringID, CHAR *String )
|
||||
{
|
||||
static CHAR buffer[ _MAX_PATH ];
|
||||
static WCHAR wide_buffer[ _MAX_PATH ];
|
||||
|
||||
memset( buffer, '\0', _MAX_PATH );
|
||||
memset( wide_buffer, '\0', _MAX_PATH );
|
||||
|
||||
#if( USE_MULTI_FILE_FORMAT )
|
||||
wcscpy( wide_buffer, (WCHAR *)LOCALE_getstring( StringID ));
|
||||
#else
|
||||
wcscpy( wide_buffer, (WCHAR *)LOCALE_getstr( LocaleFile, StringID ));
|
||||
#endif
|
||||
|
||||
Remove_Quotes_Around_String( wide_buffer );
|
||||
WideCharToMultiByte( CodePage, 0, wide_buffer, _MAX_PATH, buffer, _MAX_PATH, NULL, NULL );
|
||||
|
||||
if( String != NULL ) {
|
||||
strncpy( String, buffer, _MAX_PATH );
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
* Load_File -- Allocates a buffer and loads the file into it. *
|
||||
* *
|
||||
* Get a string usine Resource ID and a buffer. *
|
||||
* *
|
||||
* INPUT: int StringID -- The resource number of the string. *
|
||||
* WCHAR *String -- The buffer to place the text in. *
|
||||
* *
|
||||
* OUTPUT: Returns with a pointer to the buffer. *
|
||||
* *
|
||||
* WARNINGS: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 12/10/2001 MML : Created. *
|
||||
*==============================================================================*/
|
||||
|
||||
const WCHAR* Locale_GetString( int StringID, WCHAR *String )
|
||||
{
|
||||
static WCHAR wide_buffer[ _MAX_PATH ];
|
||||
|
||||
memset( wide_buffer, '\0', _MAX_PATH );
|
||||
|
||||
#if( USE_MULTI_FILE_FORMAT )
|
||||
wcscpy( wide_buffer, (WCHAR *)LOCALE_getstring( StringID ));
|
||||
#else
|
||||
wcscpy( wide_buffer, (WCHAR *)LOCALE_getstr( LocaleFile, StringID ));
|
||||
#endif
|
||||
|
||||
Remove_Quotes_Around_String( wide_buffer );
|
||||
|
||||
if( String != NULL ) {
|
||||
wcsncpy( String, wide_buffer, _MAX_PATH );
|
||||
}
|
||||
return wide_buffer;
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
* Load_File -- Allocates a buffer and loads the file into it. *
|
||||
* *
|
||||
* Get a string usine Resource ID and a buffer. *
|
||||
* *
|
||||
* INPUT: int StringID -- The resource number of the string. *
|
||||
* *
|
||||
* OUTPUT: Returns with a pointer to the buffer. *
|
||||
* *
|
||||
* WARNINGS: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 12/10/2001 MML : Created. *
|
||||
*==============================================================================*/
|
||||
|
||||
const WCHAR* Locale_GetString( int StringID )
|
||||
{
|
||||
static WCHAR wide_buffer[ _MAX_PATH ];
|
||||
|
||||
memset( wide_buffer, '\0', _MAX_PATH );
|
||||
|
||||
#if( USE_MULTI_FILE_FORMAT )
|
||||
wcscpy( wide_buffer, (WCHAR *)LOCALE_getstring( StringID ));
|
||||
#else
|
||||
wcscpy( wide_buffer, (WCHAR *)LOCALE_getstr( LocaleFile, StringID ));
|
||||
#endif
|
||||
|
||||
Remove_Quotes_Around_String( wide_buffer );
|
||||
|
||||
return wide_buffer;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* formating strings */
|
||||
/****************************************************************************/
|
||||
|
||||
WCHAR *Remove_Quotes_Around_String ( WCHAR *old_string )
|
||||
{
|
||||
WCHAR wide_buffer[ _MAX_PATH * 3 ];
|
||||
WCHAR * letter = old_string;
|
||||
int length;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// If string is not NULL...
|
||||
//----------------------------------------------------------------------
|
||||
if ( *letter == '"' ) {
|
||||
|
||||
letter++;
|
||||
wcscpy( wide_buffer, letter );
|
||||
|
||||
length = wcslen( wide_buffer );
|
||||
|
||||
if ( wide_buffer[ wcslen( wide_buffer )-1 ] == '"' ) {
|
||||
wide_buffer[ wcslen( wide_buffer )-1 ] = '\0';
|
||||
}
|
||||
wcscpy( old_string, wide_buffer );
|
||||
}
|
||||
|
||||
return( old_string );
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
* Load_File -- Allocates a buffer and loads the file into it. *
|
||||
* *
|
||||
* This is the C++ replacement for the Load_Alloc_Data function. It will *
|
||||
* allocate the memory big enough to hold the file & read the file into it. *
|
||||
* *
|
||||
* INPUT: file -- The file to read. *
|
||||
* mem -- The memory system to use for allocation. *
|
||||
* *
|
||||
* OUTPUT: Returns with a pointer to the allocated and filled memory block. *
|
||||
* *
|
||||
* WARNINGS: none *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 10/17/1994 JLB : Created. *
|
||||
*==============================================================================*/
|
||||
|
||||
void * Load_File ( const char *filename, long *filesize )
|
||||
{
|
||||
int size, bytes_read;
|
||||
void *ptr = NULL;
|
||||
// StandardFileClass file;
|
||||
RawFileClass file;
|
||||
|
||||
if ( filename == NULL || filename[0] == '\0' ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Open file in READ ONLY mode. If fails, exit.
|
||||
//-------------------------------------------------------------------------
|
||||
// file.Open( filename, MODE_READ_ONLY );
|
||||
file.Open( filename, FileClass::READ );
|
||||
// if( !file.Query_Open()) {
|
||||
if( !file.Is_Open()) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Get filesize and create a buffer.
|
||||
//-------------------------------------------------------------------------
|
||||
// size = file.Query_Size();
|
||||
size = file.Size();
|
||||
ptr = (void*)malloc(size + 1);
|
||||
if ( !ptr ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Read data into the buffer, close the file.
|
||||
//-------------------------------------------------------------------------
|
||||
memset( ptr, '\0', size + 1 );
|
||||
// bytes_read = file.Read( ptr, size );
|
||||
bytes_read = file.Read( ptr, size );
|
||||
// file.Close();
|
||||
file.Close();
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Check return bytes. It should match the file size.
|
||||
//-------------------------------------------------------------------------
|
||||
assert( bytes_read == size );
|
||||
if ( bytes_read != size ) {
|
||||
free(ptr);
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if ( filesize != NULL ) {
|
||||
*filesize = (long)size;
|
||||
}
|
||||
return( ptr );
|
||||
}
|
||||
|
||||
60
Code/Tools/WWConfig/Locale_API.h
Normal file
60
Code/Tools/WWConfig/Locale_API.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
/************************************************************************************************
|
||||
* C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S *
|
||||
*************************************************************************************************
|
||||
*
|
||||
* FILE
|
||||
* $Archive: /Commando/Code/Tools/WWConfig/Locale_API.h $
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* PROGRAMMER
|
||||
* $Author: Maria_l $
|
||||
*
|
||||
* VERSION INFO
|
||||
* $Modtime: 12/07/01 2:05p $
|
||||
* $Revision: 1 $
|
||||
*
|
||||
*************************************************************************************************/
|
||||
|
||||
#ifndef LOCALE_API_H
|
||||
#define LOCALE_API_H
|
||||
|
||||
#include <STDLIB.H>
|
||||
|
||||
/****************************************************************************/
|
||||
/* GLOBAL VARIABLES */
|
||||
/****************************************************************************/
|
||||
extern int CodePage;
|
||||
extern void * LocaleFile;
|
||||
extern int LanguageID;
|
||||
extern CHAR LanguageFile[];
|
||||
|
||||
/****************************************************************************/
|
||||
/* LOCALE API */
|
||||
/****************************************************************************/
|
||||
int Locale_Init ( int language, CHAR *file );
|
||||
void Locale_Restore ( void );
|
||||
const CHAR * Locale_GetString( int StringID, CHAR *String );
|
||||
const WCHAR * Locale_GetString( int StringID, WCHAR *String );
|
||||
const WCHAR * Locale_GetString( int StringID );
|
||||
bool Locale_Use_Multi_Language_Files ( void );
|
||||
|
||||
#endif
|
||||
BIN
Code/Tools/WWConfig/Localization/Locomoto.exe
Normal file
BIN
Code/Tools/WWConfig/Localization/Locomoto.exe
Normal file
Binary file not shown.
46
Code/Tools/WWConfig/Localization/Locomoto.txt
Normal file
46
Code/Tools/WWConfig/Localization/Locomoto.txt
Normal file
@@ -0,0 +1,46 @@
|
||||
locomoto v1.22 (Hide and Seek) Jun 23 1999 by Gerry Shaw, EAC
|
||||
USAGE: locomoto [-options] <sourcefile>
|
||||
|
||||
VERSION: WIN NT v1.22 (Hide and Seek), Spit v2.89
|
||||
SUMMARY: locomoto string compiler tool
|
||||
SPIT environment variable is LOCOMOTO_OPTS
|
||||
|
||||
@<file> response file, containing a list of options and files
|
||||
-v# verboseness 0=nothing,1=errors,2=default,3=extra,4=debug
|
||||
-cpp C++ style header files (const int vs default #define)
|
||||
-header# 0=does not create .h file,1=creates .h file (default)
|
||||
-id# specifies what column id values in (default 1, -1 for none)
|
||||
-index# create an index, # specifies what column index (-1 for none)
|
||||
-define# specifies what column the conditionals are in (default -1)
|
||||
-D... specifies conditional
|
||||
-strings#..# range of columns containing string values
|
||||
-check check for duplicate strings (default off - this is O(n^2))
|
||||
-ascii source file is ASCII encoded (default)
|
||||
-unicode source file is Unicode encoded, must be tab delimited
|
||||
-csv source file is a DataTableIndex, comma seperated file (default)
|
||||
-tab source file is tab delimited
|
||||
-multifile languages are stored in multiple files (default is off)
|
||||
-lc<char> character to indicate left side of a comment (default none)
|
||||
-rc<char> character to indicate right side of a comment (default none)
|
||||
|
||||
Notes: * Column values are 0 based. Column 'A' in Excel is column 0.
|
||||
* Use -1 to specify a column does not exist
|
||||
* Range syntax for strings is 3..6 for 4 columns of strings
|
||||
* If no string range is given than all left over columns with
|
||||
a column header are considered to have strings.
|
||||
* Conditionals are good when you want to share strings among
|
||||
different platforms. Put a pc or psx to limit the string
|
||||
to a specific platform. Use -Dpc to get only pc strings.
|
||||
* If using Unicode you must use tab delimited files
|
||||
* In general tab delimited is better than comma delimited
|
||||
* In order to use the new LOCALE_getstr API you must use the
|
||||
-multifile option to get each language in it's own .loc file.
|
||||
* Pathnames are taking from the top row of each column when
|
||||
using the multifiles.
|
||||
* Use -lc and -rc to allow for comments in the strings
|
||||
ie, "[winning team name] defeat [losing team name]."
|
||||
Use these options to handle the above example -lc[ -rc]
|
||||
|
||||
|
||||
locomoto -h # for this help
|
||||
locomoto -help # for web page
|
||||
8
Code/Tools/WWConfig/Localization/WWConfig_IDs.bat
Normal file
8
Code/Tools/WWConfig/Localization/WWConfig_IDs.bat
Normal file
@@ -0,0 +1,8 @@
|
||||
locomoto.exe @wwconfig_ids.rsp > wwconfig_ids.rpt
|
||||
|
||||
copy wwconfig_ids.h ..\wwconfig_ids.h
|
||||
copy *.loc ..\res\*.loc
|
||||
|
||||
|
||||
|
||||
|
||||
8
Code/Tools/WWConfig/Localization/WWConfig_IDs.rsp
Normal file
8
Code/Tools/WWConfig/Localization/WWConfig_IDs.rsp
Normal file
@@ -0,0 +1,8 @@
|
||||
-header1
|
||||
-id0
|
||||
-index1
|
||||
-strings2..7
|
||||
-unicode
|
||||
-tab1
|
||||
-multifile
|
||||
WWConfig_IDs.txt
|
||||
BIN
Code/Tools/WWConfig/Localization/WWConfig_IDs.txt
Normal file
BIN
Code/Tools/WWConfig/Localization/WWConfig_IDs.txt
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/Localization/WWConfig_IDs.xls
Normal file
BIN
Code/Tools/WWConfig/Localization/WWConfig_IDs.xls
Normal file
Binary file not shown.
1204
Code/Tools/WWConfig/PerformanceConfigDialog.cpp
Normal file
1204
Code/Tools/WWConfig/PerformanceConfigDialog.cpp
Normal file
File diff suppressed because it is too large
Load Diff
101
Code/Tools/WWConfig/PerformanceConfigDialog.h
Normal file
101
Code/Tools/WWConfig/PerformanceConfigDialog.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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_PERFORMANCECONFIGDIALOG_H__883CE8FB_E4D2_493A_84F0_C75F2A7826BB__INCLUDED_)
|
||||
#define AFX_PERFORMANCECONFIGDIALOG_H__883CE8FB_E4D2_493A_84F0_C75F2A7826BB__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
#include "vector.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// PerformanceConfigDialogClass dialog
|
||||
|
||||
class PerformanceConfigDialogClass : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
PerformanceConfigDialogClass(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(PerformanceConfigDialogClass)
|
||||
enum { IDD = IDD_PERFORMANCE_CONFIG };
|
||||
CSliderCtrl m_GeometrySlider;
|
||||
CSliderCtrl m_CharShadowsSlider;
|
||||
CSliderCtrl m_TextureDetailSlider;
|
||||
CSliderCtrl m_SurfaceEffectsSlider;
|
||||
CSliderCtrl m_PerformanceSlider;
|
||||
CSliderCtrl m_ParticleSlider;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(PerformanceConfigDialogClass)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(PerformanceConfigDialogClass)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnExpertCheck();
|
||||
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||
afx_msg void OnGraphicsAutoSetup();
|
||||
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void Apply_Changes (void);
|
||||
|
||||
private:
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void Build_Expert_Window_List (void);
|
||||
void Display_Expert_Settings (bool onoff);
|
||||
void Setup_Controls (void);
|
||||
void Update_Expert_Controls (int level);
|
||||
void Load_Values (void);
|
||||
void Determine_Performance_Setting (void);
|
||||
void Get_Settings (DynamicVectorClass<int> &settings);
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Private member data
|
||||
/////////////////////////////////////////////////////////////////
|
||||
DynamicVectorClass<HWND> ExpertWindowList;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_PERFORMANCECONFIGDIALOG_H__883CE8FB_E4D2_493A_84F0_C75F2A7826BB__INCLUDED_)
|
||||
BIN
Code/Tools/WWConfig/Release/WWConfig.pch
Normal file
BIN
Code/Tools/WWConfig/Release/WWConfig.pch
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/Release/WWConfig.res
Normal file
BIN
Code/Tools/WWConfig/Release/WWConfig.res
Normal file
Binary file not shown.
113
Code/Tools/WWConfig/Resource.h
Normal file
113
Code/Tools/WWConfig/Resource.h
Normal file
@@ -0,0 +1,113 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by WWConfig.rc
|
||||
//
|
||||
#define IDD_WWCONFIG_DIALOG 102
|
||||
#define IDD_AUDIO_CONFIG 107
|
||||
#define IDD_VIDEO_CONFIG 108
|
||||
#define IDD_PERFORMANCE_CONFIG 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDB_LOGO 130
|
||||
#define IDI_ADAPTER 132
|
||||
#define IDI_MONITOR 133
|
||||
#define IDI_AUDIO_DRIVER 134
|
||||
#define IDD_DRIVER_VERSION_WARNING 136
|
||||
#define IDC_TAB_CTRL 1000
|
||||
#define IDC_DRIVER_LIST 1001
|
||||
#define IDC_STEREO_CHECK 1002
|
||||
#define IDC_11KHZ_RADIO 1003
|
||||
#define IDC_22KHZ_RADIO 1004
|
||||
#define IDC_RESOLUTION_SLIDER 1004
|
||||
#define IDC_44KHZ_RADIO 1005
|
||||
#define IDC_BITDEPTH_COMBO 1005
|
||||
#define IDC_RESOLUTION_STATIC 1006
|
||||
#define IDC_EXPERT_CHECK 1007
|
||||
#define IDC_PERFORMANCE_SLIDER 1008
|
||||
#define IDC_TERRAIN_SHADOW_CHECK 1009
|
||||
#define IDC_CHAR_SHADOWS_SLIDER 1010
|
||||
#define IDC_LIGHTING_MODE_COMBO 1011
|
||||
#define IDC_8BIT_RADIO 1012
|
||||
#define IDC_TEXTURE_DETAIL_SLIDER 1012
|
||||
#define IDC_16BIT_RADIO 1013
|
||||
#define IDC_WINDOWED_CHECK 1013
|
||||
#define IDC_PARTICLE_DETAIL_SLIDER 1013
|
||||
#define IDC_TEXTURE_FILTER_MODE_COMBO 1014
|
||||
#define IDC_TEXTURE_FILTER_COMBO 1014
|
||||
#define IDC_SURFACE_DETAIL_SLIDER 1015
|
||||
#define IDC_EXPERT_GROUP 1016
|
||||
#define IDC_EXPERT_SETTINGS 1016
|
||||
#define IDC_GEOMETRY_DETAIL_SLIDER 1017
|
||||
#define IDC_RATE_COMBO 1018
|
||||
#define IDC_SPEAKER_COMBO 1019
|
||||
#define IDC_QUALITY_COMBO 1020
|
||||
#define IDC_SOUND_EFFECTS_SLIDER 1021
|
||||
#define IDC_MUSIC_SLIDER 1022
|
||||
#define IDC_SOUND_EFFECTS_CHECK 1023
|
||||
#define IDC_MUSIC_CHECK 1024
|
||||
#define IDC_BUTTON1 1024
|
||||
#define IDC_AUTO_CONFIG_BUTTON 1024
|
||||
#define IDC_DISABLE_DRIVER_VERSION_DIALOG_CHECKBOX 1025
|
||||
#define IDC_DIALOG_CHECK 1025
|
||||
#define IDC_DRIVER_VERSION_WARNING_TEXT 1026
|
||||
#define IDC_CINEMATIC_SLIDER 1026
|
||||
#define IDC_CINEMATIC_CHECK 1027
|
||||
#define IDC_DIALOG_SLIDER2 1028
|
||||
#define IDC_DIALOG_SLIDER 1028
|
||||
#define IDC_QUALITY 1029
|
||||
#define IDC_STATIC1 1030
|
||||
#define IDC_DETAIL 1030
|
||||
#define IDC_STATIC2 1031
|
||||
#define IDC_STATIC3 1032
|
||||
#define IDC_PLAYBACK_RATE 1032
|
||||
#define IDC_HIGH_DESC 1032
|
||||
#define IDC_STATIC4 1033
|
||||
#define IDC_RESOLUTION 1033
|
||||
#define IDC_GEOMETRY_DETAIL 1033
|
||||
#define IDC_STATIC5 1034
|
||||
#define IDC_SPEAKER_SETUP 1034
|
||||
#define IDC_BIT_DEPTH 1034
|
||||
#define IDC_STATIC6 1035
|
||||
#define IDC_STATIC7 1036
|
||||
#define IDC_VOLUME 1036
|
||||
#define IDC_CHARACTER_SHADOWS 1036
|
||||
#define IDC_STATIC8 1037
|
||||
#define IDC_DRIVER 1037
|
||||
#define IDC_STATIC9 1038
|
||||
#define IDC_LOW_DESC 1038
|
||||
#define IDC_STATIC10 1039
|
||||
#define IDC_TEXTURE_DETAIL 1039
|
||||
#define IDC_STATIC11 1040
|
||||
#define IDC_LOW1 1040
|
||||
#define IDC_STATIC12 1041
|
||||
#define IDC_LOW2 1041
|
||||
#define IDC_STATIC13 1042
|
||||
#define IDC_PARTICLE_DETAIL 1042
|
||||
#define IDC_STATIC14 1043
|
||||
#define IDC_LOW3 1043
|
||||
#define IDC_STATIC15 1044
|
||||
#define IDC_LOW4 1044
|
||||
#define IDC_STATIC16 1045
|
||||
#define IDC_SURFACE_EFFECT_DETAIL 1045
|
||||
#define IDC_STATIC17 1046
|
||||
#define IDC_LOW5 1046
|
||||
#define IDC_STATIC18 1047
|
||||
#define IDC_HIGH1 1047
|
||||
#define IDC_STATIC19 1048
|
||||
#define IDC_LIGHTING_MODE 1048
|
||||
#define IDC_STATIC20 1049
|
||||
#define IDC_TEXTURE_FILTER 1049
|
||||
#define IDC_HIGH2 1050
|
||||
#define IDC_HIGH3 1051
|
||||
#define IDC_HIGH4 1052
|
||||
#define IDC_HIGH5 1053
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 137
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1054
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
26
Code/Tools/WWConfig/StdAfx.cpp
Normal file
26
Code/Tools/WWConfig/StdAfx.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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
|
||||
// WWConfig.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
||||
45
Code/Tools/WWConfig/StdAfx.h
Normal file
45
Code/Tools/WWConfig/StdAfx.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__984972E3_2E06_4346_BC60_881DC04AE2FD__INCLUDED_)
|
||||
#define AFX_STDAFX_H__984972E3_2E06_4346_BC60_881DC04AE2FD__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#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 Automation classes
|
||||
#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
|
||||
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__984972E3_2E06_4346_BC60_881DC04AE2FD__INCLUDED_)
|
||||
686
Code/Tools/WWConfig/VideoConfigDialog.cpp
Normal file
686
Code/Tools/WWConfig/VideoConfigDialog.cpp
Normal file
@@ -0,0 +1,686 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// VideoConfigDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "wwconfig.h"
|
||||
#include "videoconfigdialog.h"
|
||||
#include "ww3d.h"
|
||||
#include "assetmgr.h"
|
||||
#include "locale_api.h"
|
||||
#include "wwconfig_ids.h"
|
||||
#include "assetstatus.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
static VideoConfigDialogClass* VideoConfigDialogInstance;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Globals
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
WW3DAssetManager *_TheAssetMgr = NULL;;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Local prototypes
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
int _cdecl ResolutionSortCallback (const void *elem1, const void *elem2);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Constants
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
COL_DEVICE_NAME = 0
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// VideoConfigDialogClass
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
VideoConfigDialogClass::VideoConfigDialogClass (CWnd *pParent)
|
||||
: CurrentBitDepth (16),
|
||||
CurrentWidth (800),
|
||||
CurrentHeight (600),
|
||||
CurrentDriverIndex (0),
|
||||
CurrentIsWindowed (false),
|
||||
CDialog(VideoConfigDialogClass::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(VideoConfigDialogClass)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
WWASSERT(!VideoConfigDialogInstance); // Only one can exist at a time!
|
||||
VideoConfigDialogInstance=this;
|
||||
CDialog::Create (VideoConfigDialogClass::IDD, pParent);
|
||||
return ;
|
||||
}
|
||||
|
||||
VideoConfigDialogClass::~VideoConfigDialogClass ()
|
||||
{
|
||||
VideoConfigDialogInstance=NULL;
|
||||
}
|
||||
|
||||
VideoConfigDialogClass* VideoConfigDialogClass::Get_Instance ()
|
||||
{
|
||||
return VideoConfigDialogInstance;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DoDataExchange
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::DoDataExchange (CDataExchange *pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(VideoConfigDialogClass)
|
||||
DDX_Control(pDX, IDC_RESOLUTION_SLIDER, m_ResSliderCtrl);
|
||||
DDX_Control(pDX, IDC_DRIVER_LIST, m_DriverListCtrl);
|
||||
//}}AFX_DATA_MAP
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(VideoConfigDialogClass, CDialog)
|
||||
//{{AFX_MSG_MAP(VideoConfigDialogClass)
|
||||
ON_WM_DESTROY()
|
||||
ON_NOTIFY(LVN_ITEMCHANGED, IDC_DRIVER_LIST, OnItemchangedDriverList)
|
||||
ON_CBN_SELCHANGE(IDC_BITDEPTH_COMBO, OnSelchangeBitdepthCombo)
|
||||
ON_WM_HSCROLL()
|
||||
ON_BN_CLICKED(IDC_WINDOWED_CHECK, OnWindowedCheck)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnInitDialog
|
||||
//
|
||||
// Modified: 12/06/2001 by MML - Retrieving strings from Locomoto file.
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BOOL
|
||||
VideoConfigDialogClass::OnInitDialog (void)
|
||||
{
|
||||
char string [_MAX_PATH];
|
||||
|
||||
CDialog::OnInitDialog ();
|
||||
|
||||
//
|
||||
// Set all the static strings for this dialog.
|
||||
//
|
||||
Locale_GetString( IDS_DRIVER, string );
|
||||
SetDlgItemText( IDC_DRIVER, string );
|
||||
|
||||
Locale_GetString( IDS_DISPLAY, string );
|
||||
SetDlgItemText( IDC_STATIC2, string );
|
||||
|
||||
Locale_GetString( IDS_RESOLUTION, string );
|
||||
SetDlgItemText( IDC_RESOLUTION, string );
|
||||
|
||||
Locale_GetString( IDS_COLOR_DEPTH, string );
|
||||
SetDlgItemText( IDC_BIT_DEPTH, string );
|
||||
|
||||
Locale_GetString( IDS_WINDOWED_MODE, string );
|
||||
SetDlgItemText( IDC_WINDOWED_CHECK, string );
|
||||
|
||||
//
|
||||
// Initialize the engine
|
||||
//
|
||||
_TheAssetMgr = new WW3DAssetManager;
|
||||
WW3D::Init (m_hWnd);
|
||||
AssetStatusClass::Peek_Instance()->Enable_Reporting (false);
|
||||
|
||||
//
|
||||
// Load the render device settings from the registry
|
||||
//
|
||||
char device_name[256] = { 0 };
|
||||
int texture_depth = 0;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int bit_depth = 0;
|
||||
int windowed = 0;
|
||||
if (WW3D::Registry_Load_Render_Device (RENEGADE_SUB_KEY_NAME_RENDER, device_name, 256,
|
||||
width, height, bit_depth, windowed, texture_depth))
|
||||
{
|
||||
if (width != -1) {
|
||||
CurrentWidth = width;
|
||||
}
|
||||
|
||||
if (height != -1) {
|
||||
CurrentHeight = height;
|
||||
}
|
||||
|
||||
if (bit_depth != -1) {
|
||||
CurrentBitDepth = bit_depth;
|
||||
}
|
||||
|
||||
if (windowed != -1) {
|
||||
CurrentIsWindowed = bool(windowed == 1);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set the extended styles for the list control
|
||||
//
|
||||
m_DriverListCtrl.SetExtendedStyle (m_DriverListCtrl.GetExtendedStyle () | LVS_EX_FULLROWSELECT);
|
||||
|
||||
//
|
||||
// Configure the columns
|
||||
//
|
||||
m_DriverListCtrl.InsertColumn (COL_DEVICE_NAME, "Device Name");
|
||||
|
||||
//
|
||||
// Populate the render device list control
|
||||
//
|
||||
bool found_default_entry = false;
|
||||
int driver_count = WW3D::Get_Render_Device_Count ();
|
||||
for (int index = 0; index < driver_count; index ++) {
|
||||
const RenderDeviceDescClass &device_desc = WW3D::Get_Render_Device_Desc (index);
|
||||
|
||||
//
|
||||
// Build a human readable name for this driver
|
||||
//
|
||||
CString driver_name;
|
||||
driver_name.Format ("%s - %s", device_desc.Get_Device_Name (), device_desc.Get_Hardware_Name ());
|
||||
|
||||
//
|
||||
// Add this driver to the list control
|
||||
//
|
||||
int item_index = m_DriverListCtrl.InsertItem (0xFF, driver_name);
|
||||
if (item_index >= 0) {
|
||||
m_DriverListCtrl.SetItemData (item_index, index);
|
||||
}
|
||||
|
||||
//
|
||||
// Check to see if this is the default entry
|
||||
//
|
||||
const char *render_device_name = WW3D::Get_Render_Device_Name (index);
|
||||
if (::lstrcmpi (device_name, render_device_name) == 0) {
|
||||
m_DriverListCtrl.SetItemState (item_index, LVIS_SELECTED, LVIS_SELECTED);
|
||||
found_default_entry = true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set the "windowed mode" checkbox
|
||||
//
|
||||
SendDlgItemMessage (IDC_WINDOWED_CHECK, BM_SETCHECK, (WPARAM)CurrentIsWindowed);
|
||||
|
||||
//
|
||||
// Select the first entry for deafult (if necessary)
|
||||
//
|
||||
if (found_default_entry == false) {
|
||||
m_DriverListCtrl.SetItemState (0, LVIS_SELECTED, LVIS_SELECTED);
|
||||
}
|
||||
|
||||
//
|
||||
// Size the columns
|
||||
//
|
||||
CRect rect;
|
||||
m_DriverListCtrl.GetClientRect (&rect);
|
||||
int col_width = rect.Width () - ::GetSystemMetrics (SM_CXVSCROLL);
|
||||
m_DriverListCtrl.SetColumnWidth (0, col_width);
|
||||
|
||||
//
|
||||
// Build the resolution list for the currently selected device
|
||||
//
|
||||
Update_Display_Settings ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnDestroy
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::OnDestroy (void)
|
||||
{
|
||||
//
|
||||
// Shutdown the engine
|
||||
//
|
||||
WW3D::Shutdown ();
|
||||
delete _TheAssetMgr;
|
||||
_TheAssetMgr = NULL;
|
||||
|
||||
CDialog::OnDestroy ();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Update_Display_Settings
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::Update_Display_Settings (void)
|
||||
{
|
||||
//
|
||||
// Get the selected device
|
||||
//
|
||||
int selected_index = m_DriverListCtrl.GetNextItem (-1, LVNI_ALL | LVNI_SELECTED);
|
||||
if (selected_index < 0) {
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
// Lookup the device description for the selected device
|
||||
//
|
||||
CurrentDriverIndex = (int)m_DriverListCtrl.GetItemData (selected_index);
|
||||
const RenderDeviceDescClass &driver_info = WW3D::Get_Render_Device_Desc (CurrentDriverIndex);
|
||||
ResolutionList = driver_info.Enumerate_Resolutions ();
|
||||
CurrentCaps=driver_info.Get_Caps();
|
||||
CurrentAdapterIdentifier=driver_info.Get_Adapter_Identifier();
|
||||
|
||||
//
|
||||
// Update the dialog controls
|
||||
//
|
||||
Update_Color_Combo ();
|
||||
Update_Resolution_Slider ();
|
||||
Select_Default_Resolution ();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Update_Resolution_Slider
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::Update_Resolution_Slider (void)
|
||||
{
|
||||
//
|
||||
// Lookup the device description for the selected device
|
||||
//
|
||||
const RenderDeviceDescClass &driver_info = WW3D::Get_Render_Device_Desc (CurrentDriverIndex);
|
||||
ResolutionList = driver_info.Enumerate_Resolutions ();
|
||||
|
||||
//
|
||||
// Filter out any resolutions that don't fit the current
|
||||
// bit depth
|
||||
//
|
||||
for (int index = 0; index < ResolutionList.Count (); index ++) {
|
||||
const ResolutionDescClass &res_desc = ResolutionList[index];
|
||||
|
||||
//
|
||||
// Remove this resolution if it doesn't fit the current
|
||||
// bit depth
|
||||
//
|
||||
if (res_desc.BitDepth != CurrentBitDepth || res_desc.Width < 640 || res_desc.Height < 480) {
|
||||
ResolutionList.Delete (index);
|
||||
index --;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Sort the entries
|
||||
//
|
||||
if (ResolutionList.Count () > 0) {
|
||||
::qsort (&ResolutionList[0], ResolutionList.Count (), sizeof (ResolutionList[0]), ResolutionSortCallback);
|
||||
}
|
||||
|
||||
//
|
||||
// Configure the slider control
|
||||
//
|
||||
m_ResSliderCtrl.ClearTics ();
|
||||
m_ResSliderCtrl.SetRange (0, ResolutionList.Count () - 1);
|
||||
|
||||
//
|
||||
// Setup the tick marks
|
||||
//
|
||||
for (index = 0; index < ResolutionList.Count (); index ++) {
|
||||
m_ResSliderCtrl.SetTic (index);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Update_Color_Combo
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::Update_Color_Combo (void)
|
||||
{
|
||||
//
|
||||
// Start fresh
|
||||
//
|
||||
SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_RESETCONTENT);
|
||||
|
||||
//
|
||||
// Loop over all the resolutions and add the different
|
||||
// bit-depths to the combo box
|
||||
//
|
||||
bool selected = false;
|
||||
for (int index = 0; index < ResolutionList.Count (); index ++) {
|
||||
|
||||
const ResolutionDescClass &res_desc = ResolutionList[index];
|
||||
|
||||
char string [_MAX_PATH];
|
||||
CString color_string;
|
||||
|
||||
//
|
||||
// Make a display string out of the bit depth
|
||||
//
|
||||
Locale_GetString (IDS_BIT, string);
|
||||
color_string.Format ("%d %s", res_desc.BitDepth, string);
|
||||
|
||||
//
|
||||
// Check to see if this string is already in the combobox
|
||||
//
|
||||
int item_index = SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_FINDSTRINGEXACT, 0, (LPARAM)(LPCTSTR)color_string);
|
||||
if (item_index == CB_ERR) {
|
||||
|
||||
//
|
||||
// Add this entry to the combobox
|
||||
//
|
||||
int item_index = SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)color_string);
|
||||
if (item_index != CB_ERR) {
|
||||
SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_SETITEMDATA, (WPARAM)item_index, (LPARAM)res_desc.BitDepth);
|
||||
|
||||
//
|
||||
// Select this entry if its the current bit depth
|
||||
//
|
||||
if (res_desc.BitDepth == CurrentBitDepth) {
|
||||
SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_SETCURSEL, (WPARAM)item_index);
|
||||
selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Select the first entry by default
|
||||
//
|
||||
if (!selected) {
|
||||
SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_SETCURSEL, 0);
|
||||
CurrentBitDepth = SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_GETITEMDATA, 0);
|
||||
if (CurrentBitDepth <= 0) {
|
||||
CurrentBitDepth = 16;
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Select_Default_Resolution
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::Select_Default_Resolution (void)
|
||||
{
|
||||
int best_selection = 0;
|
||||
float best_width_err = 1000.0F;
|
||||
float best_height_err = 1000.0F;
|
||||
|
||||
//
|
||||
// Loop over all the available resolutions and try to select
|
||||
// the one that most closely matches the desired resolution
|
||||
//
|
||||
for (int index = 0; index < ResolutionList.Count (); index ++) {
|
||||
const ResolutionDescClass &res_desc = ResolutionList[index];
|
||||
|
||||
//
|
||||
// Calculate how far off this resolution is from the one
|
||||
// we want to select
|
||||
//
|
||||
float width_err = WWMath::Fabs(((float)CurrentWidth / (float)res_desc.Width) - 1.0F);
|
||||
float height_err = WWMath::Fabs(((float)CurrentHeight / (float)res_desc.Height) - 1.0F);
|
||||
|
||||
//
|
||||
// Is this the closest match so far?
|
||||
//
|
||||
if (width_err <= best_width_err && height_err <= best_height_err) {
|
||||
best_width_err = width_err;
|
||||
best_height_err = height_err;
|
||||
best_selection = index;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Select the closest match
|
||||
//
|
||||
m_ResSliderCtrl.SetPos (best_selection);
|
||||
Update_Resolution_Text ();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Update_Resolution_Text
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::Update_Resolution_Text (void)
|
||||
{
|
||||
int res_index = m_ResSliderCtrl.GetPos ();
|
||||
if (res_index >= 0) {
|
||||
|
||||
//
|
||||
// Make a display string for the current resolution
|
||||
//
|
||||
const ResolutionDescClass &res_desc = ResolutionList[res_index];
|
||||
CString res_string;
|
||||
res_string.Format ("%d x %d", res_desc.Width, res_desc.Height);
|
||||
|
||||
//
|
||||
// Set the text of the dialog control
|
||||
//
|
||||
SetDlgItemText (IDC_RESOLUTION_STATIC, res_string);
|
||||
|
||||
//
|
||||
// Store the current width and height
|
||||
//
|
||||
CurrentWidth = res_desc.Width;
|
||||
CurrentHeight = res_desc.Height;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnItemchangedDriverList
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::OnItemchangedDriverList
|
||||
(
|
||||
NMHDR * pNMHDR,
|
||||
LRESULT * pResult
|
||||
)
|
||||
{
|
||||
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
||||
(*pResult) = 0;
|
||||
|
||||
//
|
||||
// If the selection state changed, then update the resolution
|
||||
// list for this device
|
||||
//
|
||||
if (pNMListView->uChanged & LVIF_STATE) {
|
||||
Update_Display_Settings ();
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ResolutionSortCallback
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
int _cdecl
|
||||
ResolutionSortCallback (const void *elem1, const void *elem2)
|
||||
{
|
||||
const ResolutionDescClass *res1 = ((const ResolutionDescClass *)elem1);
|
||||
const ResolutionDescClass *res2 = ((const ResolutionDescClass *)elem2);
|
||||
|
||||
int retval = 0;
|
||||
|
||||
//
|
||||
// Sort based on bit-depth first
|
||||
//
|
||||
if (res1->BitDepth < res2->BitDepth) {
|
||||
retval = -1;
|
||||
} else if (res1->BitDepth > res2->BitDepth) {
|
||||
retval = 1;
|
||||
} else {
|
||||
|
||||
//
|
||||
// Sort based on width next
|
||||
//
|
||||
if (res1->Width < res2->Width) {
|
||||
retval = -1;
|
||||
} else if (res1->Width > res2->Width) {
|
||||
retval = 1;
|
||||
} else {
|
||||
|
||||
//
|
||||
// Sort based on height last
|
||||
//
|
||||
if (res1->Height < res2->Height) {
|
||||
retval = -1;
|
||||
} else if (res1->Height > res2->Height) {
|
||||
retval = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnSelchangeBitdepthCombo
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::OnSelchangeBitdepthCombo (void)
|
||||
{
|
||||
int index = SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_GETCURSEL);
|
||||
if (index != CB_ERR) {
|
||||
|
||||
//
|
||||
// Update the current bit depth
|
||||
//
|
||||
CurrentBitDepth = SendDlgItemMessage (IDC_BITDEPTH_COMBO, CB_GETITEMDATA, (WPARAM)index);
|
||||
if (CurrentBitDepth <= 0) {
|
||||
CurrentBitDepth = 16;
|
||||
}
|
||||
|
||||
//
|
||||
// Update the dialog controls
|
||||
//
|
||||
Update_Resolution_Slider ();
|
||||
Select_Default_Resolution ();
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnHScroll
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::OnHScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
|
||||
{
|
||||
CDialog::OnHScroll (nSBCode, nPos, pScrollBar);
|
||||
|
||||
//
|
||||
// Simply update the display text on the dialog to reflect the new resolution
|
||||
//
|
||||
Update_Resolution_Text ();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Apply_Changes
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::Apply_Changes (void)
|
||||
{
|
||||
//
|
||||
// Save the changes to the registry
|
||||
//
|
||||
WW3D::Registry_Save_Render_Device (RENEGADE_SUB_KEY_NAME_RENDER, CurrentDriverIndex,
|
||||
CurrentWidth, CurrentHeight, CurrentBitDepth, CurrentIsWindowed, WW3D::Get_Texture_Bitdepth());
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// WindowProc
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
LRESULT
|
||||
VideoConfigDialogClass::WindowProc
|
||||
(
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
{
|
||||
if (message == (WM_USER + 101)) {
|
||||
Apply_Changes ();
|
||||
}
|
||||
|
||||
return CDialog::WindowProc(message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnWindowedCheck
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
VideoConfigDialogClass::OnWindowedCheck (void)
|
||||
{
|
||||
CurrentIsWindowed = (SendDlgItemMessage (IDC_WINDOWED_CHECK, BM_GETCHECK) == 1);
|
||||
return ;
|
||||
}
|
||||
133
Code/Tools/WWConfig/VideoConfigDialog.h
Normal file
133
Code/Tools/WWConfig/VideoConfigDialog.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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_VIDEOCONFIGDIALOG_H__BE670D78_397C_4AFE_A45A_C7798BA1869B__INCLUDED_)
|
||||
#define AFX_VIDEOCONFIGDIALOG_H__BE670D78_397C_4AFE_A45A_C7798BA1869B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
#include "vector.h"
|
||||
#include "rddesc.h"
|
||||
#include "..\..\combat\specialbuilds.h"
|
||||
|
||||
/*
|
||||
#ifdef MULTIPLAYERDEMO
|
||||
#define RENEGADE_SUB_KEY_NAME_RENDER "Software\\Westwood\\RenegadeMPDemo\\Render"
|
||||
#else
|
||||
#define RENEGADE_SUB_KEY_NAME_RENDER "Software\\Westwood\\Renegade\\Render"
|
||||
#endif // MULTIPLAYERDEMO
|
||||
*/
|
||||
|
||||
#if defined(FREEDEDICATEDSERVER)
|
||||
#define RENEGADE_SUB_KEY_NAME_RENDER "Software\\Westwood\\RenegadeFDS\\Render"
|
||||
#elif defined(MULTIPLAYERDEMO)
|
||||
#define RENEGADE_SUB_KEY_NAME_RENDER "Software\\Westwood\\RenegadeMPDemo\\Render"
|
||||
#elif defined(BETACLIENT)
|
||||
#define RENEGADE_SUB_KEY_NAME_RENDER "Software\\Westwood\\RenegadeBeta\\Render"
|
||||
#else
|
||||
#define RENEGADE_SUB_KEY_NAME_RENDER "Software\\Westwood\\Renegade\\Render"
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// VideoConfigDialogClass
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
class VideoConfigDialogClass : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
VideoConfigDialogClass(CWnd* pParent = NULL); // standard constructor
|
||||
~VideoConfigDialogClass();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(VideoConfigDialogClass)
|
||||
enum { IDD = IDD_VIDEO_CONFIG };
|
||||
CSliderCtrl m_ResSliderCtrl;
|
||||
CListCtrl m_DriverListCtrl;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(VideoConfigDialogClass)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(VideoConfigDialogClass)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnItemchangedDriverList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnSelchangeBitdepthCombo();
|
||||
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||
afx_msg void OnWindowedCheck();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void Apply_Changes (void);
|
||||
static VideoConfigDialogClass* Get_Instance();
|
||||
|
||||
int Get_Current_Bit_Depth() const { return CurrentBitDepth; }
|
||||
int Get_Current_Driver_Index() const { return CurrentDriverIndex; }
|
||||
const D3DADAPTER_IDENTIFIER8& Get_Current_Adapter_Identifier() const { return CurrentAdapterIdentifier; }
|
||||
const D3DCAPS8& Get_Current_Caps() const { return CurrentCaps; }
|
||||
|
||||
private:
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void Update_Display_Settings (void);
|
||||
void Update_Color_Combo (void);
|
||||
void Update_Resolution_Slider (void);
|
||||
void Update_Resolution_Text (void);
|
||||
void Select_Default_Resolution (void);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Private member data
|
||||
/////////////////////////////////////////////////////////////////
|
||||
DynamicVectorClass<ResolutionDescClass> ResolutionList;
|
||||
int CurrentWidth;
|
||||
int CurrentHeight;
|
||||
int CurrentBitDepth;
|
||||
bool CurrentIsWindowed;
|
||||
int CurrentDriverIndex;
|
||||
D3DCAPS8 CurrentCaps;
|
||||
D3DADAPTER_IDENTIFIER8 CurrentAdapterIdentifier;
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_VIDEOCONFIGDIALOG_H__BE670D78_397C_4AFE_A45A_C7798BA1869B__INCLUDED_)
|
||||
156
Code/Tools/WWConfig/WWConfig.cpp
Normal file
156
Code/Tools/WWConfig/WWConfig.cpp
Normal file
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// WWConfig.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "WWConfig.h"
|
||||
#include "WWConfigDlg.h"
|
||||
#include "argv.h"
|
||||
#include "locale_api.h"
|
||||
#include "wwconfig_ids.h"
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
int GlobalExitValue=1;
|
||||
void AutoConfigSettings();
|
||||
void CheckDriverVersion();
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CWWConfigApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CWWConfigApp, CWinApp)
|
||||
//{{AFX_MSG_MAP(CWWConfigApp)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG
|
||||
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CWWConfigApp construction
|
||||
|
||||
CWWConfigApp::CWWConfigApp()
|
||||
{
|
||||
// TODO: add construction code here,
|
||||
// Place all significant initialization in InitInstance
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// The one and only CWWConfigApp object
|
||||
|
||||
CWWConfigApp theApp;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CWWConfigApp initialization
|
||||
// Modified: 12/06/2001 by MML - Retrieving strings from Locomoto file.
|
||||
|
||||
BOOL CWWConfigApp::InitInstance()
|
||||
{
|
||||
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.
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#ifdef _AFXDLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
#else
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Get the Command line parameters.
|
||||
//-------------------------------------------------------------------------
|
||||
CString cmd(m_lpCmdLine);
|
||||
|
||||
//=========================================================================
|
||||
// Init the strings.
|
||||
//=========================================================================
|
||||
int language = -1;
|
||||
|
||||
if( cmd.Find( "-French") !=-1 ) {
|
||||
language = IDL_FRENCH;
|
||||
} else if( cmd.Find( "-German") !=-1 ) {
|
||||
language = IDL_GERMAN;
|
||||
} else if( cmd.Find( "-Japanese") !=-1 ) {
|
||||
language = IDL_JAPANESE;
|
||||
} else if( cmd.Find( "-Korean") !=-1 ) {
|
||||
language = IDL_KOREAN;
|
||||
} else if( cmd.Find( "-Chinese") !=-1 ) {
|
||||
language = IDL_CHINESE;
|
||||
} else if( cmd.Find( "-English") !=-1 ) {
|
||||
language = IDL_ENGLISH;
|
||||
}
|
||||
|
||||
Locale_Init( language, "WWConfig.loc" );
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
if (cmd.Find("-autoconfig")!=-1) {
|
||||
AutoConfigSettings();
|
||||
}
|
||||
else if (cmd.Find("-driverversion")!=-1) {
|
||||
CheckDriverVersion();
|
||||
}
|
||||
else {
|
||||
CWWConfigDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
int nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: Place code here to handle when the dialog is
|
||||
// dismissed with OK
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: Place code here to handle when the dialog is
|
||||
// dismissed with Cancel
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Free the strings.
|
||||
//-------------------------------------------------------------------------
|
||||
Locale_Restore();
|
||||
|
||||
// Since the dialog has been closed, return FALSE so that we exit the
|
||||
// application, rather than start the application's message pump.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CWWConfigApp::ExitInstance()
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
|
||||
CWinApp::ExitInstance();
|
||||
return GlobalExitValue;
|
||||
}
|
||||
266
Code/Tools/WWConfig/WWConfig.dsp
Normal file
266
Code/Tools/WWConfig/WWConfig.dsp
Normal file
@@ -0,0 +1,266 @@
|
||||
# Microsoft Developer Studio Project File - Name="WWConfig" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=WWConfig - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "WWConfig.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "WWConfig.mak" CFG="WWConfig - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "WWConfig - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "WWConfig - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""$/Commando/Code/Tools/WWConfig", KDBEAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "WWConfig - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 6
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 5
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\DirectX\include" /I "..\..\combat" /I "..\..\wwdebug" /I "..\..\wwmath" /I "..\..\ww3d2" /I "..\..\wwphys" /I "..\..\wwlib" /I "..\..\wwaudio" /I "..\..\miles6\include" /I "..\..\wwsaveload" /I "..\..\wwnet" /I "..\wwctrl" /I "..\..\wwtranslatedb" /I "..\..\wwbitpack" /I "..\..\wwutil" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 umbra.lib wwaudio.lib ..\..\miles6\lib\win\mss32.lib wwsaveload.lib ww3d2.lib wwdebug.lib wwlib.lib wwmath.lib wwphys.lib wwutil.lib winmm.lib ddraw.lib dinput.lib dxguid.lib dsound.lib vfw32.lib wsock32.lib wwtranslatedb.lib d3dx8.lib d3d8.lib /nologo /subsystem:windows /pdb:"..\..\..\Run\WWConfig.pdb" /map:"..\..\..\Run\WWConfig.map" /debug /machine:I386 /out:"..\..\..\Run\WWConfig.exe" /pdbtype:sept /libpath:"../../libs/release" /libpath:"../../directx\lib" /libpath:"../../umbra/lib/win32-x86"
|
||||
|
||||
!ELSEIF "$(CFG)" == "WWConfig - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 6
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 5
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\DirectX\include" /I "..\..\combat" /I "..\..\wwdebug" /I "..\..\wwmath" /I "..\..\ww3d2" /I "..\..\wwphys" /I "..\..\wwlib" /I "..\..\wwaudio" /I "..\..\miles6\include" /I "..\..\wwsaveload" /I "..\..\wwnet" /I "..\wwctrl" /I "..\..\wwtranslatedb" /I "..\..\wwbitpack" /I "..\..\wwutil" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /GZ /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
|
||||
# ADD RSC /l 0x409 /i "Res\\" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
|
||||
# ADD LINK32 wwnet.lib umbrad.lib wwaudio.lib ..\..\miles6\lib\win\mss32.lib wwsaveload.lib ww3d2.lib wwdebug.lib wwlib.lib wwmath.lib wwphys.lib wwutil.lib winmm.lib ddraw.lib dinput.lib dxguid.lib dsound.lib vfw32.lib wsock32.lib wwtranslatedb.lib d3dx8.lib d3d8.lib /nologo /subsystem:windows /pdb:"..\..\..\Run\WWConfigD.pdb" /map:"..\..\..\Run\WWConfigD.map" /debug /machine:I386 /out:"..\..\..\Run\WWConfigD.exe" /pdbtype:sept /libpath:"../../directx\lib" /libpath:"../../libs/debug" /libpath:"../../umbra/lib/win32-x86"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "WWConfig - Win32 Release"
|
||||
# Name "WWConfig - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AudioConfigDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DriverVersionWarning.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\EZGIMEX.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\locale.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Locale_API.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PerformanceConfigDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\WWLib\rawfile.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"stdafx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\VideoConfigDialog.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WWConfig.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WWConfigDlg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\WWLib\wwfile.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AudioConfigDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DriverVersionWarning.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gimex.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\locale.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Locale_API.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PerformanceConfigDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\WWLib\rawfile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\VideoConfigDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WWConfig.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wwconfig_ids.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WWConfigDlg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\WWLib\wwfile.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\ico00001.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\ico00002.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\icon1.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Res\IDL_CHINESE.loc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Res\IDL_ENGLISH.loc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Res\IDL_FRENCH.loc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Res\IDL_GERMAN.loc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Res\IDL_JAPANESE.loc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Res\IDL_KOREAN.loc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\logo.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\WWConfig.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WWConfig.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\WWConfig.rc2
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ReadMe.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
37
Code/Tools/WWConfig/WWConfig.dsw
Normal file
37
Code/Tools/WWConfig/WWConfig.dsw
Normal file
@@ -0,0 +1,37 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "WWConfig"=.\WWConfig.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/Commando/Code/Tools/WWConfig", KDBEAAAA
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/Commando/Code/Tools/WWConfig", KDBEAAAA
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
68
Code/Tools/WWConfig/WWConfig.h
Normal file
68
Code/Tools/WWConfig/WWConfig.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// WWConfig.h : main header file for the WWCONFIG application
|
||||
//
|
||||
|
||||
#if !defined(AFX_WWCONFIG_H__6A04BB13_FAE7_4BC6_B177_89B9B0F23C84__INCLUDED_)
|
||||
#define AFX_WWCONFIG_H__6A04BB13_FAE7_4BC6_B177_89B9B0F23C84__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CWWConfigApp:
|
||||
// See WWConfig.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CWWConfigApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CWWConfigApp();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CWWConfigApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
virtual int ExitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
|
||||
//{{AFX_MSG(CWWConfigApp)
|
||||
// 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}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_WWCONFIG_H__6A04BB13_FAE7_4BC6_B177_89B9B0F23C84__INCLUDED_)
|
||||
472
Code/Tools/WWConfig/WWConfig.rc
Normal file
472
Code/Tools/WWConfig/WWConfig.rc
Normal file
@@ -0,0 +1,472 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Japanese resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
|
||||
#pragma code_page(932)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Data
|
||||
//
|
||||
|
||||
STRINGS RCDATA DISCARDABLE "res\\idl_japanese.loc"
|
||||
#endif // Japanese resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Korean resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
|
||||
#pragma code_page(949)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Data
|
||||
//
|
||||
|
||||
STRINGS RCDATA DISCARDABLE "res\\idl_korean.loc"
|
||||
#endif // Korean resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Chinese (Taiwan) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL
|
||||
#pragma code_page(950)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Data
|
||||
//
|
||||
|
||||
STRINGS RCDATA DISCARDABLE "res\\idl_chinese.loc"
|
||||
#endif // Chinese (Taiwan) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// German (Germany) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Data
|
||||
//
|
||||
|
||||
STRINGS RCDATA DISCARDABLE "res\\idl_german.loc"
|
||||
#endif // German (Germany) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Data
|
||||
//
|
||||
|
||||
STRINGS RCDATA DISCARDABLE "res\\idl_english.loc"
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
|
||||
"#ifdef _WIN32\r\n"
|
||||
"LANGUAGE 9, 1\r\n"
|
||||
"#pragma code_page(1252)\r\n"
|
||||
"#endif //_WIN32\r\n"
|
||||
"#include ""res\\WWConfig.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||
"#include ""afxres.rc"" // Standard components\r\n"
|
||||
"#endif\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON DISCARDABLE "res\\WWConfig.ico"
|
||||
IDI_ADAPTER ICON DISCARDABLE "res\\icon1.ico"
|
||||
IDI_MONITOR ICON DISCARDABLE "res\\ico00001.ico"
|
||||
IDI_AUDIO_DRIVER ICON DISCARDABLE "res\\ico00002.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_WWCONFIG_DIALOG DIALOGEX 0, 0, 291, 271
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "",IDOK,171,250,50,14
|
||||
PUSHBUTTON "",IDCANCEL,234,250,50,14
|
||||
CONTROL 130,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE |
|
||||
SS_REALSIZEIMAGE | SS_SUNKEN,7,7,277,29
|
||||
CONTROL "Tab1",IDC_TAB_CTRL,"SysTabControl32",0x0,7,43,277,200
|
||||
END
|
||||
|
||||
IDD_AUDIO_CONFIG DIALOGEX 0, 0, 272, 182
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
EXSTYLE WS_EX_CONTROLPARENT
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDI_AUDIO_DRIVER,IDC_STATIC,7,19,20,20
|
||||
LTEXT "Driver:",IDC_DRIVER,7,7,38,8
|
||||
CONTROL "List1",IDC_DRIVER_LIST,"SysListView32",LVS_REPORT |
|
||||
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
|
||||
LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER |
|
||||
WS_BORDER | WS_TABSTOP,47,7,218,36
|
||||
GROUPBOX "Volume",IDC_VOLUME,7,52,258,75
|
||||
CONTROL "Sound Effects:",IDC_SOUND_EFFECTS_CHECK,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,15,66,94,10
|
||||
CONTROL "Slider1",IDC_SOUND_EFFECTS_SLIDER,"msctls_trackbar32",
|
||||
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,117,66,140,10
|
||||
CONTROL "Music:",IDC_MUSIC_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,15,80,94,10
|
||||
CONTROL "Slider1",IDC_MUSIC_SLIDER,"msctls_trackbar32",TBS_BOTH |
|
||||
TBS_NOTICKS | WS_TABSTOP,117,80,140,10
|
||||
LTEXT "Quality:",IDC_QUALITY,7,136,74,8
|
||||
COMBOBOX IDC_QUALITY_COMBO,7,145,74,56,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Playback Rate:",IDC_PLAYBACK_RATE,98,136,74,8
|
||||
COMBOBOX IDC_RATE_COMBO,98,145,74,68,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Stereo",IDC_STEREO_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,7,167,258,8
|
||||
CONTROL "Dialog:",IDC_DIALOG_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,15,94,94,10
|
||||
CONTROL "Slider1",IDC_CINEMATIC_SLIDER,"msctls_trackbar32",
|
||||
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,117,108,140,10
|
||||
CONTROL "Cinematic:",IDC_CINEMATIC_CHECK,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,15,108,94,10
|
||||
CONTROL "Slider1",IDC_DIALOG_SLIDER,"msctls_trackbar32",TBS_BOTH |
|
||||
TBS_NOTICKS | WS_TABSTOP,117,94,140,10
|
||||
COMBOBOX IDC_SPEAKER_COMBO,191,145,74,68,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Speaker Setup:",IDC_SPEAKER_SETUP,191,136,74,8
|
||||
END
|
||||
|
||||
IDD_VIDEO_CONFIG DIALOGEX 0, 0, 272, 182
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
EXSTYLE WS_EX_CONTROLPARENT
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Driver:",IDC_DRIVER,7,7,38,8
|
||||
CONTROL "List1",IDC_DRIVER_LIST,"SysListView32",LVS_REPORT |
|
||||
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
|
||||
LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | WS_BORDER |
|
||||
WS_TABSTOP,47,7,218,64
|
||||
GROUPBOX "",IDC_STATIC2,7,81,258,86
|
||||
LTEXT "Color Depth:",IDC_BIT_DEPTH,15,125,70,8
|
||||
COMBOBOX IDC_BITDEPTH_COMBO,92,125,51,83,CBS_DROPDOWNLIST |
|
||||
CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
ICON IDI_ADAPTER,IDC_STATIC,7,18,20,20
|
||||
CONTROL "Slider1",IDC_RESOLUTION_SLIDER,"msctls_trackbar32",
|
||||
WS_TABSTOP,92,103,82,12
|
||||
LTEXT "640 x 480",IDC_RESOLUTION_STATIC,181,103,72,8
|
||||
CONTROL "Windowed Mode",IDC_WINDOWED_CHECK,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,15,147,243,10
|
||||
ICON IDI_ADAPTER,IDC_STATIC,7,18,20,20
|
||||
LTEXT "Resolution:",IDC_RESOLUTION,15,103,70,8
|
||||
END
|
||||
|
||||
IDD_PERFORMANCE_CONFIG DIALOGEX 0, 0, 272, 182
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
EXSTYLE WS_EX_CONTROLPARENT
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
GROUPBOX "Detail",IDC_DETAIL,7,7,258,25
|
||||
LTEXT "Low (fastest)",IDC_LOW_DESC,13,16,68,8,0,WS_EX_RIGHT
|
||||
CONTROL "Slider1",IDC_PERFORMANCE_SLIDER,"msctls_trackbar32",
|
||||
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,90,16,92,12
|
||||
LTEXT "High (slowest)",IDC_HIGH_DESC,190,16,68,8
|
||||
CONTROL "Expert Mode",IDC_EXPERT_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,7,39,152,10
|
||||
GROUPBOX "Expert Settings",IDC_EXPERT_SETTINGS,7,56,258,119
|
||||
LTEXT "Geometry Detail:",IDC_GEOMETRY_DETAIL,13,70,77,8
|
||||
CONTROL "Slider1",IDC_GEOMETRY_DETAIL_SLIDER,"msctls_trackbar32",
|
||||
TBS_AUTOTICKS | WS_TABSTOP,137,70,88,10
|
||||
LTEXT "Character Shadows:",IDC_CHARACTER_SHADOWS,13,82,77,8
|
||||
CONTROL "Slider1",IDC_CHAR_SHADOWS_SLIDER,"msctls_trackbar32",
|
||||
TBS_AUTOTICKS | WS_TABSTOP,137,82,88,10
|
||||
LTEXT "Texture Detail:",IDC_TEXTURE_DETAIL,13,94,77,8
|
||||
CONTROL "Slider1",IDC_TEXTURE_DETAIL_SLIDER,"msctls_trackbar32",
|
||||
TBS_AUTOTICKS | WS_TABSTOP,137,94,88,10
|
||||
LTEXT "Particle Detail:",IDC_PARTICLE_DETAIL,13,106,77,8
|
||||
CONTROL "Slider1",IDC_PARTICLE_DETAIL_SLIDER,"msctls_trackbar32",
|
||||
TBS_AUTOTICKS | WS_TABSTOP,137,106,88,10
|
||||
LTEXT "Surface Effect Detail:",IDC_SURFACE_EFFECT_DETAIL,13,
|
||||
118,77,8
|
||||
CONTROL "Slider1",IDC_SURFACE_DETAIL_SLIDER,"msctls_trackbar32",
|
||||
TBS_AUTOTICKS | WS_TABSTOP,137,118,88,10
|
||||
LTEXT "Lighting Mode:",IDC_LIGHTING_MODE,13,135,114,8
|
||||
COMBOBOX IDC_LIGHTING_MODE_COMBO,13,144,114,69,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Terrain Casts Shadows",IDC_TERRAIN_SHADOW_CHECK,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,13,161,225,8
|
||||
PUSHBUTTON "Auto Config",IDC_AUTO_CONFIG_BUTTON,168,39,97,14
|
||||
LTEXT "Texture Filter:",IDC_TEXTURE_FILTER,147,135,111,8
|
||||
COMBOBOX IDC_TEXTURE_FILTER_COMBO,147,144,111,69,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Low",IDC_LOW1,108,70,24,8
|
||||
RTEXT "Low",IDC_LOW2,108,82,24,8
|
||||
RTEXT "Low",IDC_LOW3,108,94,24,8
|
||||
RTEXT "Low",IDC_LOW4,108,106,24,8
|
||||
RTEXT "Low",IDC_LOW5,108,118,24,8
|
||||
LTEXT "High",IDC_HIGH1,231,70,26,8
|
||||
LTEXT "High",IDC_HIGH2,231,82,24,8
|
||||
LTEXT "High",IDC_HIGH3,231,94,24,8
|
||||
LTEXT "High",IDC_HIGH4,231,106,24,8
|
||||
LTEXT "High",IDC_HIGH5,231,118,24,8
|
||||
END
|
||||
|
||||
IDD_DRIVER_VERSION_WARNING DIALOG DISCARDABLE 0, 0, 186, 159
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Warning"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "",IDOK,65,138,50,14
|
||||
PUSHBUTTON "",IDCANCEL,125,138,50,14
|
||||
CONTROL "",IDC_DISABLE_DRIVER_VERSION_DIALOG_CHECKBOX,"Button",
|
||||
BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,116,163,
|
||||
18
|
||||
LTEXT "Static",IDC_DRIVER_VERSION_WARNING_TEXT,11,6,163,106
|
||||
END
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,8,0,0
|
||||
PRODUCTVERSION 1,8,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "Westwood Studios\0"
|
||||
VALUE "FileDescription", "\0"
|
||||
VALUE "FileVersion", "1, 8, 0, 0\0"
|
||||
VALUE "InternalName", "WWConfig\0"
|
||||
VALUE "LegalCopyright", "Copyright <20> 2002 Electronic Arts\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "WWConfig.exe\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "Renegade Config\0"
|
||||
VALUE "ProductVersion", "1, 8, 0, 0\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_WWCONFIG_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 284
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 264
|
||||
END
|
||||
|
||||
IDD_AUDIO_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 265
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 175
|
||||
END
|
||||
|
||||
IDD_VIDEO_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 265
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 175
|
||||
END
|
||||
|
||||
IDD_PERFORMANCE_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 265
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 175
|
||||
END
|
||||
|
||||
IDD_DRIVER_VERSION_WARNING, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 180
|
||||
TOPMARGIN, 3
|
||||
BOTTOMMARGIN, 152
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_LOGO BITMAP DISCARDABLE "res\\logo.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog Info
|
||||
//
|
||||
|
||||
IDD_AUDIO_CONFIG DLGINIT
|
||||
BEGIN
|
||||
IDC_QUALITY_COMBO, 0x403, 6, 0
|
||||
0x2038, 0x6942, 0x0074,
|
||||
IDC_QUALITY_COMBO, 0x403, 7, 0
|
||||
0x3631, 0x4220, 0x7469, "\000"
|
||||
IDC_RATE_COMBO, 0x403, 7, 0
|
||||
0x3131, 0x6b20, 0x7a48, "\000"
|
||||
IDC_RATE_COMBO, 0x403, 7, 0
|
||||
0x3232, 0x6b20, 0x7a48, "\000"
|
||||
IDC_RATE_COMBO, 0x403, 7, 0
|
||||
0x3434, 0x6b20, 0x7a48, "\000"
|
||||
0
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// French (France) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Data
|
||||
//
|
||||
|
||||
STRINGS RCDATA DISCARDABLE "res\\idl_french.loc"
|
||||
#endif // French (France) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#define _AFX_NO_SPLITTER_RESOURCES
|
||||
#define _AFX_NO_OLE_RESOURCES
|
||||
#define _AFX_NO_TRACKER_RESOURCES
|
||||
#define _AFX_NO_PROPERTY_RESOURCES
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE 9, 1
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
#include "res\WWConfig.rc2" // non-Microsoft Visual C++ edited resources
|
||||
#include "afxres.rc" // Standard components
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
288
Code/Tools/WWConfig/WWConfigDlg.cpp
Normal file
288
Code/Tools/WWConfig/WWConfigDlg.cpp
Normal file
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// WWConfigDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "wwconfig.h"
|
||||
#include "wwconfigdlg.h"
|
||||
#include "videoconfigdialog.h"
|
||||
#include "audioconfigdialog.h"
|
||||
#include "performanceconfigdialog.h"
|
||||
#include "locale_api.h"
|
||||
#include "wwconfig_ids.h"
|
||||
|
||||
extern int GlobalExitValue;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CWWConfigDlg
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
CWWConfigDlg::CWWConfigDlg (CWnd *pParent)
|
||||
: CurrentTab (0),
|
||||
CDialog(CWWConfigDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CWWConfigDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DoDataExchange
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
void
|
||||
CWWConfigDlg::DoDataExchange (CDataExchange *pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CWWConfigDlg)
|
||||
DDX_Control(pDX, IDC_TAB_CTRL, m_TabCtrl);
|
||||
//}}AFX_DATA_MAP
|
||||
return ;
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CWWConfigDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CWWConfigDlg)
|
||||
ON_WM_PAINT()
|
||||
ON_WM_QUERYDRAGICON()
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_CTRL, OnSelchangeTabCtrl)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnInitDialog
|
||||
//
|
||||
// Modified: 12/06/2001 by MML - Retrieving strings from Locomoto file.
|
||||
///////////////////////////////////////////////////////////////////
|
||||
BOOL
|
||||
CWWConfigDlg::OnInitDialog (void)
|
||||
{
|
||||
char string[ _MAX_PATH ];
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// Set the icon for this dialog. The framework does this automatically
|
||||
// when the application's main window is not a dialog
|
||||
SetIcon (m_hIcon, TRUE);
|
||||
SetIcon (m_hIcon, FALSE);
|
||||
|
||||
//
|
||||
// Set Title of Dialog.
|
||||
//
|
||||
Locale_GetString( IDS_WWCONFIG_TITLE, string );
|
||||
SetWindowText((LPCTSTR) string );
|
||||
|
||||
//
|
||||
// Set text on buttons.
|
||||
//
|
||||
Locale_GetString( IDS_OK, string );
|
||||
SetDlgItemText( IDOK, string );
|
||||
|
||||
Locale_GetString( IDS_CANCEL, string );
|
||||
SetDlgItemText( IDCANCEL, string );
|
||||
|
||||
//
|
||||
// Add a tab to the dialog for video configuration
|
||||
//
|
||||
TC_ITEM tab_info = { 0 };
|
||||
|
||||
Locale_GetString( IDS_VIDEO_TAB, string );
|
||||
tab_info.mask = TCIF_TEXT;
|
||||
// tab_info.pszText = "Video";
|
||||
tab_info.pszText = string;
|
||||
m_TabCtrl.InsertItem (0xFF, &tab_info);
|
||||
|
||||
//
|
||||
// Add a tab to the dialog for audio configuration
|
||||
//
|
||||
Locale_GetString( IDS_SOUND_TAB, string );
|
||||
tab_info.mask = TCIF_TEXT;
|
||||
// tab_info.pszText = "Sound";
|
||||
tab_info.pszText = string;
|
||||
m_TabCtrl.InsertItem (0xFF, &tab_info);
|
||||
|
||||
//
|
||||
// Add a tab to the dialog for performance configuration
|
||||
//
|
||||
Locale_GetString( IDS_PERFORMANCE_TAB, string );
|
||||
tab_info.mask = TCIF_TEXT;
|
||||
// tab_info.pszText = "Performance";
|
||||
tab_info.pszText = string;
|
||||
m_TabCtrl.InsertItem (0xFF, &tab_info);
|
||||
|
||||
//
|
||||
// Get the display rectangle of the tab control
|
||||
//
|
||||
CRect tab_rect;
|
||||
m_TabCtrl.GetWindowRect (&tab_rect);
|
||||
m_TabCtrl.AdjustRect (FALSE, &tab_rect);
|
||||
ScreenToClient (&tab_rect);
|
||||
|
||||
VideoConfigDialogClass *video_page = new VideoConfigDialogClass (this);
|
||||
AudioConfigDialogClass *audio_page = new AudioConfigDialogClass (this);
|
||||
PerformanceConfigDialogClass *performance_page = new PerformanceConfigDialogClass (this);
|
||||
|
||||
video_page->SetWindowPos ( NULL, tab_rect.left, tab_rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
audio_page->SetWindowPos ( NULL, tab_rect.left, tab_rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
performance_page->SetWindowPos ( NULL, tab_rect.left, tab_rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
|
||||
ConfigPages.Add ( video_page );
|
||||
ConfigPages.Add ( audio_page );
|
||||
ConfigPages.Add ( performance_page );
|
||||
|
||||
//
|
||||
// Display the first category page
|
||||
//
|
||||
ConfigPages[0]->ShowWindow( SW_SHOW );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnPaint
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
void
|
||||
CWWConfigDlg::OnPaint (void)
|
||||
{
|
||||
if (IsIconic())
|
||||
{
|
||||
CPaintDC dc(this);
|
||||
|
||||
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;
|
||||
|
||||
// Draw the icon
|
||||
dc.DrawIcon(x, y, m_hIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
CDialog::OnPaint();
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnQueryDragIcon
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
HCURSOR
|
||||
CWWConfigDlg::OnQueryDragIcon (void)
|
||||
{
|
||||
return (HCURSOR) m_hIcon;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnOK
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
void
|
||||
CWWConfigDlg::OnOK (void)
|
||||
{
|
||||
GlobalExitValue=0;
|
||||
//
|
||||
// Loop over each page and ask them to save themselves
|
||||
//
|
||||
for (int index = 0; index < ConfigPages.Count (); index ++) {
|
||||
ConfigPages[index]->SendMessage (WM_USER + 101);
|
||||
}
|
||||
|
||||
CDialog::OnOK ();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// OnSelchangeTabCtrl
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
void
|
||||
CWWConfigDlg::OnSelchangeTabCtrl
|
||||
(
|
||||
NMHDR * pNMHDR,
|
||||
LRESULT * pResult
|
||||
)
|
||||
{
|
||||
(*pResult) = 0;
|
||||
|
||||
//
|
||||
// Check to see if the user has selected a new tab
|
||||
//
|
||||
int newtab = m_TabCtrl.GetCurSel ();
|
||||
if (CurrentTab != newtab) {
|
||||
|
||||
//
|
||||
// Hide the old tab
|
||||
//
|
||||
if (CurrentTab < ConfigPages.Count () && ConfigPages[CurrentTab] != NULL) {
|
||||
ConfigPages[CurrentTab]->ShowWindow (SW_HIDE);
|
||||
}
|
||||
|
||||
//
|
||||
// Show the new tab
|
||||
//
|
||||
if (ConfigPages[newtab] != NULL) {
|
||||
ConfigPages[newtab]->ShowWindow (SW_SHOW);
|
||||
}
|
||||
|
||||
//
|
||||
// Remember what our new current tab is
|
||||
//
|
||||
CurrentTab = newtab;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
void CWWConfigDlg::OnCancel()
|
||||
{
|
||||
// TODO: Add extra cleanup here
|
||||
GlobalExitValue=1;
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
89
Code/Tools/WWConfig/WWConfigDlg.h
Normal file
89
Code/Tools/WWConfig/WWConfigDlg.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// WWConfigDlg.h : header file
|
||||
//
|
||||
|
||||
#if !defined(AFX_WWCONFIGDLG_H__7778B545_D680_49AC_A0CF_5F50AE8EBC40__INCLUDED_)
|
||||
#define AFX_WWCONFIGDLG_H__7778B545_D680_49AC_A0CF_5F50AE8EBC40__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
#include "vector.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CWWConfigDlg
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
class CWWConfigDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CWWConfigDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CWWConfigDlg)
|
||||
enum { IDD = IDD_WWCONFIG_DIALOG };
|
||||
CTabCtrl m_TabCtrl;
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CWWConfigDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CWWConfigDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnPaint();
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
virtual void OnOK();
|
||||
afx_msg void OnSelchangeTabCtrl(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
virtual void OnCancel();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Public methods
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Private member data
|
||||
/////////////////////////////////////////////////////////////////
|
||||
DynamicVectorClass<CDialog *> ConfigPages;
|
||||
int CurrentTab;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_WWCONFIGDLG_H__7778B545_D680_49AC_A0CF_5F50AE8EBC40__INCLUDED_)
|
||||
309
Code/Tools/WWConfig/gimex.h
Normal file
309
Code/Tools/WWConfig/gimex.h
Normal file
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
/* Copyright (C) Electronic Arts Canada Inc. 1994-1998. All rights reserved. */
|
||||
|
||||
/* ABSTRACT
|
||||
gimex.h - Graphics IMport EXport (GIMEX) v2.26
|
||||
@ */
|
||||
|
||||
#ifndef __GIMEX_H
|
||||
#define __GIMEX_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GimexVersion "2.26"
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Data Types */
|
||||
/****************************************************************************/
|
||||
|
||||
/* ARGB structure used for palettes/pixels */
|
||||
|
||||
#ifndef _ARGB_T
|
||||
#define _ARGB_T
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(PSX) || defined(DC)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char b,g,r,a;
|
||||
} ARGB;
|
||||
|
||||
#elif defined(SGI)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char a,b,g,r;
|
||||
} ARGB;
|
||||
|
||||
#else /* Mac */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char a,r,g,b;
|
||||
} ARGB;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Info structure describing bitmaps */
|
||||
|
||||
#define GIMEX_FRAMENAME_SIZE 32
|
||||
#define GIMEX_COMMENT_SIZE 256
|
||||
#define GIMEX_COLOURTBL_SIZE 256
|
||||
#define GIMEX_HOTSPOTTBL_SIZE 256
|
||||
#define GIMEX_HOTSPOTTBL_VALUES 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long signature; /* signature of gimex ie 'tga ' (optional) */
|
||||
long size; /* size of GINFO structure */
|
||||
int version; /* version number of GINFO structure (200) */
|
||||
int framenum; /* current frame */
|
||||
int width; /* width of bitmap in pixels */
|
||||
int height; /* height of bitmap in pixels */
|
||||
int bpp; /* bits per pixel (8 or 32) */
|
||||
int originalbpp; /* bits per pixel in original image (1 to 32) */
|
||||
int startcolour; /* first colour in palette */
|
||||
int numcolours; /* number of colours in original indexed palette */
|
||||
ARGB colourtbl[GIMEX_COLOURTBL_SIZE]; /* 8 bit palette */
|
||||
int subtype; /* internal format sub-type 0-default */
|
||||
int packed; /* type of packing on original image. 0 none, 1 run, n other */
|
||||
int quality; /* quality of lossy packing 0..100 */
|
||||
int framesize; /* size of frame in bytes */
|
||||
int alphabits; /* number of bits in alpha channel */
|
||||
int redbits; /* number of bits in red channel */
|
||||
int greenbits; /* number of bits in green channel */
|
||||
int bluebits; /* number of bits in blue channel */
|
||||
int centerx; /* center point relative to upper left corner */
|
||||
int centery;
|
||||
int defaultx; /* default coordinate point */
|
||||
int defaulty;
|
||||
int numhotspots; /* number of hot spots defined */
|
||||
char framename[GIMEX_FRAMENAME_SIZE]; /* null terminated name of frame/image */
|
||||
char comment[GIMEX_COMMENT_SIZE]; /* null terminated multiline user comment */
|
||||
int hotspottbl[GIMEX_HOTSPOTTBL_SIZE][GIMEX_HOTSPOTTBL_VALUES];/* up to 256 hot spots, XY pairs relative to upperleft */
|
||||
float dpi; /* dots per inch ie 72.0 */
|
||||
int reserved[3]; /* reserved for future use - set to zero */
|
||||
} GINFO;
|
||||
|
||||
#ifndef _GSTREAM_T
|
||||
#define _GSTREAM_T GIMEX
|
||||
typedef void GSTREAM; /* handle used for file functions */
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long signature; /* signature of gimex ie 'tga ' (optional) */
|
||||
long size; /* size of GINSTANCE structure */
|
||||
int frames; /* Number of frames in file */
|
||||
int framenum; /* current frame (optional) */
|
||||
GSTREAM *gstream; /* stream pointer for file */
|
||||
char *gref; /* gimex reference to additional memory used by module (optional) */
|
||||
} GINSTANCE;
|
||||
|
||||
/* Info structure describing bitmaps */
|
||||
|
||||
#define MAXMACTYPES 8
|
||||
#define MAXEXTENSIONS 8
|
||||
|
||||
#define GIMEX_EXTENSION_SIZE 8
|
||||
#define GIMEX_AUTHORSTR_SIZE 32
|
||||
#define GIMEX_VERSIONSTR_SIZE 8
|
||||
#define GIMEX_SHORTTYPESTR_SIZE 8
|
||||
#define GIMEX_WORDTYPESTR_SIZE 16
|
||||
#define GIMEX_LONGTYPESTR_SIZE 32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long signature; /* signature of gimex ie 'tga ' (optional) */
|
||||
long size; /* size of GABOUT structure */
|
||||
int version; /* version number of GABOUT structure (200) */
|
||||
unsigned int canimport :1; /* supports importing */
|
||||
unsigned int canexport :1; /* supports exporting */
|
||||
unsigned int importpacked :2; /* max import packed field 0..3 */
|
||||
unsigned int exportpacked :2; /* max export packed field 0..3 */
|
||||
unsigned int import8 :1; /* supports importing 8 bit indexed */
|
||||
unsigned int export8 :1; /* supports exporting 8 bit indexed */
|
||||
unsigned int import32 :1; /* supports importing 32 bit direct rgb */
|
||||
unsigned int export32 :1; /* supports exporting 32 bit direct rgb */
|
||||
unsigned int multiframe :1; /* supports multiple frames */
|
||||
unsigned int multifile :1; /* format requires additional files or resource fork */
|
||||
unsigned int multisize :1; /* supports different size per frame */
|
||||
unsigned int framebuffer :1; /* module requires memory to buffer entire frame */
|
||||
unsigned int external :1; /* module requires external tool or plugin */
|
||||
unsigned int usesfile :1; /* module is file based vs ads/printer/generator */
|
||||
unsigned int singlepalette :1; /* limited to a single palette per file */
|
||||
unsigned int greyscale :1; /* use maxcolours for number of levels */
|
||||
unsigned int startcolour :1; /* supports start colour */
|
||||
unsigned int dotsubtype :1; /* subtype based on extension */
|
||||
unsigned int resizable :1; /* read will respect ginfo width & height */
|
||||
unsigned int pad :11; /* pad bitfield to 32 bit boundary for inter compiler compatibility */
|
||||
int maxcolours; /* only use in 8 bit, 0 if module does not care */
|
||||
int maxframename; /* maximum characters in ginfo framename */
|
||||
int defaultquality; /* default pack quality */
|
||||
long mactype[MAXMACTYPES]; /* mac file system types used */
|
||||
char extensions[MAXEXTENSIONS][GIMEX_EXTENSION_SIZE]; /* null terminated extensions with '.' */
|
||||
char authorstr[GIMEX_AUTHORSTR_SIZE]; /* name of gimex module author */
|
||||
char versionstr[GIMEX_VERSIONSTR_SIZE]; /* version number of gimex module ie 1.00 */
|
||||
char shorttypestr[GIMEX_SHORTTYPESTR_SIZE]; /* 3 or 4 character type string ie TGA */
|
||||
char wordtypestr[GIMEX_WORDTYPESTR_SIZE]; /* single word type string ie Targa */
|
||||
char longtypestr[GIMEX_LONGTYPESTR_SIZE]; /* full name of data format ie True Vision Targa */
|
||||
} GABOUT;
|
||||
|
||||
/* Bitmap structure (optional) */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GINFO *ginfo;
|
||||
char *image;
|
||||
int rowbytes;
|
||||
} GBITMAP;
|
||||
|
||||
#define GMAKEID(a,b,c,d) (((long)(a)<<24)|((long)(b)<<16)|((long)(c)<<8)|(long)(d))
|
||||
|
||||
#ifndef gmin
|
||||
#define gmin(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef gmax
|
||||
#define gmax(a,b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#if !defined(GCALL)
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
||||
#define GCALL __stdcall
|
||||
#else
|
||||
#define GCALL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* disable unreferenced parameters warnings */
|
||||
#if defined(__WATCOMC__)
|
||||
#pragma warning 202 999999
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable : 4100)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/****************************************************************************/
|
||||
/* Gimex Module Example Prototypes */
|
||||
/****************************************************************************/
|
||||
|
||||
/* Example Information Functions */
|
||||
|
||||
GABOUT * GCALL aboutbmp(void);
|
||||
int GCALL isbmp(GSTREAM *g);
|
||||
|
||||
/* Example Import Functions */
|
||||
|
||||
int GCALL openbmp(GINSTANCE **gx, GSTREAM *g, char *pathname);
|
||||
GINFO * GCALL infobmp(GINSTANCE *gx, int framenum);
|
||||
int GCALL readbmp(GINSTANCE *gx, GINFO *ginfo, char *dest, int rowbytes);
|
||||
int GCALL closebmp(GINSTANCE *gx);
|
||||
|
||||
/* Example Export Functions */
|
||||
|
||||
int GCALL wopenbmp(GINSTANCE **gx, GSTREAM *g, char *pathname, int numframes);
|
||||
int GCALL writebmp(GINSTANCE *gx, GINFO *ginfo, char *source, int rowbytes);
|
||||
int GCALL wclosebmp(GINSTANCE *gx);
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* Application Module Prototypes */
|
||||
/****************************************************************************/
|
||||
|
||||
/* File Stream Functions */
|
||||
|
||||
GSTREAM * GCALL gopen(const char *pathname);
|
||||
GSTREAM * GCALL gwopen(const char *pathname);
|
||||
int GCALL gclose(GSTREAM *g);
|
||||
int GCALL gread(GSTREAM *g, void *buf, long size);
|
||||
int GCALL gwrite(GSTREAM *g, void *buf, long size);
|
||||
int GCALL gseek(GSTREAM *g, long offset);
|
||||
long GCALL glen(GSTREAM *g);
|
||||
long GCALL gtell(GSTREAM *g);
|
||||
|
||||
/* Memory Functions */
|
||||
|
||||
void * GCALL galloc(long size);
|
||||
int GCALL gfree(void *memptr);
|
||||
void gputm(void *memptr, unsigned long val, int numbytes);
|
||||
void gputi(void *memptr, unsigned long val, int numbytes);
|
||||
unsigned long ggetm(void *memptr, int numbytes);
|
||||
unsigned long ggeti(void *memptr, int numbytes);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Watcom Memory Functions */
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__WATCOMC__) && !defined(__NOINLINE__)
|
||||
#pragma aux ggeti = \
|
||||
"mov eax,[eax+ecx-4]" \
|
||||
"neg ecx" \
|
||||
"lea ecx,32[ecx*8]" \
|
||||
"shr eax,cl" \
|
||||
parm [eax] [ecx] \
|
||||
modify [eax ecx] \
|
||||
value [eax];
|
||||
|
||||
#pragma aux ggetm = \
|
||||
".586" \
|
||||
"mov eax,[eax]" \
|
||||
"bswap eax" \
|
||||
"neg ecx" \
|
||||
"lea ecx,32[ecx*8]" \
|
||||
"shr eax,cl" \
|
||||
parm [eax] [ecx] \
|
||||
modify [eax ecx] \
|
||||
value [eax];
|
||||
|
||||
unsigned long bswap(unsigned long val);
|
||||
#pragma aux bswap = "bswap eax" parm [eax] modify [eax] value [eax];
|
||||
|
||||
#define gputm(putmdest,putmdata,putmbytes) \
|
||||
(((int)(putmbytes)==4) ? ((void)(*((unsigned long *) (putmdest)) = bswap((unsigned long)(putmdata)))) \
|
||||
: (((int)(putmbytes)==1) ? ((void)(*((unsigned char *) (putmdest)) = (unsigned char)(putmdata))) \
|
||||
: (((int)(putmbytes)==2) ? ((void)(*((unsigned short *) (putmdest)) = (unsigned short)(bswap((unsigned long)(putmdata))>>16))) \
|
||||
: (((int)(putmbytes)==3) ? ((void)(*((unsigned char *) (putmdest)+2) = (unsigned char)(putmdata)),(void)(*((unsigned short *) (putmdest)) = (unsigned short)(bswap((unsigned long)(putmdata))>>8))) \
|
||||
: (void)0))))
|
||||
|
||||
#define gputi(putidest,putidata,putibytes) \
|
||||
(((int)(putibytes)==4) ? ((void)(*((unsigned long *) (putidest)) = ((unsigned long)(putidata)))) \
|
||||
: (((int)(putibytes)==1) ? ((void)(*((unsigned char *) (putidest)) = (unsigned char)(putidata))) \
|
||||
: (((int)(putibytes)==2) ? ((void)(*((unsigned short *) (putidest)) = (unsigned short)(putidata))) \
|
||||
: (((int)(putibytes)==3) ? ((void)(*((unsigned short *) (putidest)) = (unsigned short)(putidata)),(void)(*((unsigned char *) (putidest)+2) = (unsigned char)((unsigned long)(putidata)>>16))) \
|
||||
: (void)0))))
|
||||
|
||||
#endif /* __WATCOMC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GIMEX_H */
|
||||
/* END ABSTRACT */
|
||||
|
||||
|
||||
|
||||
900
Code/Tools/WWConfig/locale.cpp
Normal file
900
Code/Tools/WWConfig/locale.cpp
Normal file
@@ -0,0 +1,900 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
/* Copyright (C) Electronic Arts Canada Inc. 1998-1999. All rights reserved. */
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "gimex.h" /* for file and memory IO only */
|
||||
#include "locale.h"
|
||||
//#include "wnd_file.h"
|
||||
|
||||
|
||||
#define ASSERT assert
|
||||
#define VERIFY ASSERT
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* File Format Structures */
|
||||
/*************************************************************************/
|
||||
|
||||
#define LOCALEFILE_HEADERCHUNKID 0x48434f4c /* 'LOCH' */
|
||||
#define LOCALEFILE_INDEXCHUNKID 0x49434f4c /* 'LOCI' */
|
||||
#define LOCALEFILE_LANGUAGECHUNKID 0x4c434f4c /* 'LOCL' */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int ChunkID; /* 'LOCH' LOCALEFILE_HEADERCHUNKID */
|
||||
unsigned int ChunkSize; /* size of chunk in bytes */
|
||||
unsigned int Flags; /* 0=no index chunk present,1=index chunk present */
|
||||
unsigned int LanguageCount; /* number of language chunks in this file */
|
||||
/* unsigned int LanguageOffset[LanguageCount]; \\ offsets in bytes from start of file to language chunk */
|
||||
} LOCALEFILE_HEADERCHUNK;
|
||||
|
||||
/* offset LOCALEFILE_HEADERCHUNK_LANGUAGE_OFFSET bytes from the start of the chunk to the language offset table */
|
||||
#define LOCALEFILE_HEADERCHUNK_LANGUAGE_OFFSET sizeof(LOCALEFILE_HEADERCHUNK)
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int ChunkID; /* 'LOCI' LOCALEFILE_INDEXCHUNKID */
|
||||
unsigned int ChunkSize; /* size of chunk in bytes */
|
||||
unsigned int StringCount; /* number of string ids in this chunk (same value in all language chunks) */
|
||||
unsigned int pad; /* must be zero */
|
||||
/* STRINGID StringID[StringCount]; */
|
||||
/* { */
|
||||
/* unsigned short ID; \\ id that user gives to look up value */
|
||||
/* unsigned short Index; \\ index to look up value in language chunks */
|
||||
/* } */
|
||||
} LOCALEFILE_INDEXCHUNK;
|
||||
|
||||
/* offset LOCALEFILE_INDEXCHUNK_STRINGID_OFFSET bytes from the start of the chunk to the string id table */
|
||||
#define LOCALEFILE_INDEXCHUNK_STRINGID_OFFSET sizeof(LOCALEFILE_INDEXCHUNK)
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int ChunkID; /* 'LOCL' LOCALEFILE_LANGUAGECHUNKID */
|
||||
unsigned int ChunkSize; /* size of chunk in bytes including this header and all string data */
|
||||
unsigned int LanguageID; /* language strings are in for this bank */
|
||||
unsigned int StringCount; /* number of strings in this chunk */
|
||||
/* unsigned int StringOffset[StringCount]; \\ offsets in bytes from start of chunk to string */
|
||||
/* const char* Data[StringCount]; \\ StringCount null terminated strings */
|
||||
} LOCALEFILE_LANGUAGECHUNK;
|
||||
|
||||
/* offset LOCALEFILE_LANGUAGECHUNK_STRING_OFFSETbytes from the start of the chunk to the string offset table */
|
||||
#define LOCALEFILE_LANGUAGECHUNK_STRING_OFFSET sizeof(LOCALEFILE_LANGUAGECHUNK)
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* LOCALE_INSTANCE declaration */
|
||||
/*************************************************************************/
|
||||
|
||||
typedef LOCALEFILE_HEADERCHUNK HEADER;
|
||||
typedef LOCALEFILE_INDEXCHUNK INDEX;
|
||||
typedef LOCALEFILE_LANGUAGECHUNK BANK;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int BankIndex; /* current language bank set (0..BANK_COUNT-1) */
|
||||
BANK* pBank[LOCALE_BANK_COUNT]; /* array of string banks */
|
||||
INDEX* pIndex[LOCALE_BANK_COUNT]; /* array of string indices */
|
||||
} LOCALE_INSTANCE;
|
||||
|
||||
static LOCALE_INSTANCE *lx = NULL;
|
||||
|
||||
/*************************************************************************/
|
||||
/* initialization/restore */
|
||||
/*************************************************************************/
|
||||
|
||||
/* helper function to make assertions for initialization clearer */
|
||||
int LOCALE_isinitialized( void )
|
||||
{
|
||||
if ( lx == NULL ) {
|
||||
// TRACE("LOCALE API is not initialized - call LOCALE_init before calling LOCALE functions\n");
|
||||
}
|
||||
return( lx != NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_init - Init the localization module
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; int LOCALE_init(void)
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Initilizes everything needed to use the locale API. Can only be called
|
||||
; once until LOCALE_restore is called.
|
||||
;
|
||||
; Returns non-zero if everything went ok.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_restore
|
||||
;
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
int LOCALE_init(void)
|
||||
{
|
||||
int ok = 0;
|
||||
|
||||
/* ensure locale module is NOT already initialized */
|
||||
ASSERT(lx == NULL); /* can only call LOCALE_init after a restore or once, cannot double init locale API */
|
||||
|
||||
if( lx != NULL )
|
||||
return ok;
|
||||
|
||||
/* allocate instance */
|
||||
lx = (LOCALE_INSTANCE*)galloc(sizeof(LOCALE_INSTANCE));
|
||||
if (lx != NULL) {
|
||||
memset(lx, 0, sizeof(LOCALE_INSTANCE));
|
||||
ok = 1;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_restore - Free resources used by the locale module
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; void LOCALE_restore(void)
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Restores all resources used by the locale API. Can only be called after
|
||||
; LOCALE_init, and only once.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_init
|
||||
;
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
void LOCALE_restore(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
ASSERT(lx != NULL);
|
||||
|
||||
if( lx != NULL ) {
|
||||
|
||||
/* free any language tables */
|
||||
for (i = 0; i < LOCALE_BANK_COUNT; i++) {
|
||||
if (lx->pBank[i]) {
|
||||
LOCALE_setbank(i);
|
||||
LOCALE_freetable();
|
||||
}
|
||||
}
|
||||
|
||||
/* free instance */
|
||||
gfree(lx);
|
||||
lx = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/* attributes */
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_setbank - Set the current bank
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; void LOCALE_setbank(BankIndex)
|
||||
; int BankIndex; Number between 0 and LOCALE_BANK_COUNT - 1
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Sets the current bank to be active. All functions will now use this
|
||||
; bank for strings. A bank is slot where a string table is loaded.
|
||||
; More than one bank can have a table loaded but the locale functions
|
||||
; only work on one bank at a time, the active bank set by this function.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_getbank
|
||||
;
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
void LOCALE_setbank(int BankIndex)
|
||||
{
|
||||
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
if( lx != NULL ) {
|
||||
lx->BankIndex = BankIndex;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_getbank - Get the current bank
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; int LOCALE_getbank(void)
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Returns the bank index of the current bank.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_setbank
|
||||
;
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
int LOCALE_getbank(void)
|
||||
{
|
||||
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
if( lx != NULL ) {
|
||||
return lx->BankIndex;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_getbanklanguageid - Get the language id for the current bank
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; int LOCALE_getbanklanguageid(void)
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Returns the language id of the current bank. This id will match
|
||||
; the lanugage id in the header file generated by Locomoto
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_loadtable
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
int LOCALE_getbanklanguageid(void)
|
||||
{
|
||||
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
ASSERT(lx->pBank[lx->BankIndex]); /* must load a table into bank before calling this function */
|
||||
|
||||
if( lx != NULL && lx->pBank[lx->BankIndex] != NULL ) {
|
||||
return (int)(lx->pBank[lx->BankIndex]->LanguageID);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_getbankstringcount - Get the string count for the current bank
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; int LOCALE_getbankstringcount(void)
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Returns the number of strings in the current bank. If zero is
|
||||
; returned then this bank is empty.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_loadtable
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
int LOCALE_getbankstringcount(void)
|
||||
{
|
||||
int StringCount = 0;
|
||||
|
||||
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
|
||||
if (lx != NULL && lx->pBank[lx->BankIndex]) {
|
||||
StringCount = lx->pBank[lx->BankIndex]->StringCount;
|
||||
}
|
||||
return StringCount;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/* operations */
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_loadtable - Load a string table into the current bank
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; int LOCALE_loadtable(pathname, languageid)
|
||||
;
|
||||
; const char* pathname; // pathname of .loc file to load
|
||||
; int languageid; // language id to load (from .h file)
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Loads the specified language from the string file into the
|
||||
; current bank. Returns non zero if the operation was succesful.
|
||||
; The bank must be free before you can call LOCALE_loadtable. To
|
||||
; free a bank use the LOCALE_freetable function. To determine
|
||||
; if the bank is free use the LOCALE_getbankstringcount function.
|
||||
;
|
||||
; The languageid value is available in the .h file created by
|
||||
; locomoto.
|
||||
;
|
||||
; Returns non-zero if everthing is ok.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_freetable, LOCALE_getbankstringcount
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
static int readheader( GSTREAM* g )
|
||||
{
|
||||
int ok = 0;
|
||||
|
||||
/* read file header */
|
||||
LOCALEFILE_HEADERCHUNK header;
|
||||
int HeaderChunkSize = sizeof(LOCALEFILE_HEADERCHUNK);
|
||||
|
||||
// VERIFY(gread(g, &header, HeaderChunkSize) == HeaderChunkSize);
|
||||
if( gread(g, &header, HeaderChunkSize) != HeaderChunkSize ) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
ASSERT( header.ChunkID == LOCALEFILE_HEADERCHUNKID ); /* ensure that this is a valid .loc file */
|
||||
if ( header.ChunkID != LOCALEFILE_HEADERCHUNKID ) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* read index chunk if present */
|
||||
if ( header.Flags == 1 ) {
|
||||
|
||||
int IndexChunkSize;
|
||||
int IndexChunkPos = header.ChunkSize;
|
||||
|
||||
/* read index chunk size */
|
||||
// VERIFY(gseek(g, IndexChunkPos + 4));
|
||||
if( !gseek( g, IndexChunkPos + 4)) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
// VERIFY(gread(g, &IndexChunkSize, 4) == 4);
|
||||
if( gread( g, &IndexChunkSize, 4) != 4 ) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* alloc and read index chunk */
|
||||
lx->pIndex[lx->BankIndex] = (LOCALEFILE_INDEXCHUNK *)galloc((long)IndexChunkSize );
|
||||
if (lx->pIndex[lx->BankIndex]) {
|
||||
|
||||
// VERIFY(gseek(g, IndexChunkPos));
|
||||
gseek( g, IndexChunkPos );
|
||||
|
||||
// VERIFY(gread(g, lx->pIndex[lx->BankIndex], IndexChunkSize) == IndexChunkSize);
|
||||
if ( gread(g, lx->pIndex[lx->BankIndex], IndexChunkSize ) != IndexChunkSize ) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
ASSERT( lx->pIndex[lx->BankIndex]->ChunkID == LOCALEFILE_INDEXCHUNKID );
|
||||
if( lx->pIndex[lx->BankIndex]->ChunkID == LOCALEFILE_INDEXCHUNKID ) {
|
||||
ok = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// readstrings
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int readstrings( GSTREAM* g, int LanguageID )
|
||||
{
|
||||
int ok = 0;
|
||||
|
||||
int LanguageChunkOffsetPos = 16 + LanguageID*4;
|
||||
int LanguageChunkPos = 0;
|
||||
int LanguageChunkSize = -1;
|
||||
|
||||
/* read offset to language chunk */
|
||||
// VERIFY(gseek(g, (int)LanguageChunkOffsetPos));
|
||||
// VERIFY(gread(g, &LanguageChunkPos, 4) == 4);
|
||||
|
||||
if( !gseek( g, (int)LanguageChunkOffsetPos )) {
|
||||
return ok;
|
||||
}
|
||||
if( gread( g, &LanguageChunkPos, 4 ) != 4 ) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* read language chunk size */
|
||||
// VERIFY(gseek(g, LanguageChunkPos + 4));
|
||||
// VERIFY(gread(g, &LanguageChunkSize, 4) == 4);
|
||||
|
||||
if( !gseek( g, LanguageChunkPos + 4 )) {
|
||||
return ok;
|
||||
}
|
||||
if( gread( g, &LanguageChunkSize, 4 ) != 4 ) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* alloc and read language chunk */
|
||||
lx->pBank[lx->BankIndex] = (LOCALEFILE_LANGUAGECHUNK *)galloc((long)LanguageChunkSize);
|
||||
if (lx->pBank[lx->BankIndex]) {
|
||||
|
||||
// VERIFY(gseek(g, LanguageChunkPos));
|
||||
// VERIFY(gread(g, lx->pBank[lx->BankIndex], LanguageChunkSize) == LanguageChunkSize);
|
||||
|
||||
if( !gseek( g, LanguageChunkPos )) {
|
||||
return ok;
|
||||
}
|
||||
if( gread( g, lx->pBank[lx->BankIndex], LanguageChunkSize ) != LanguageChunkSize ) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
ASSERT(lx->pBank[lx->BankIndex]->ChunkID == LOCALEFILE_LANGUAGECHUNKID);
|
||||
ok = 1;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LOCALE_loadtable
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
int LOCALE_loadtable( const char* PathName, int LanguageID )
|
||||
{
|
||||
int ok = 0;
|
||||
GSTREAM* g;
|
||||
|
||||
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
ASSERT(lx->pBank[lx->BankIndex] == NULL); /* bank must be empty before loading a new table */
|
||||
ASSERT(lx->pIndex[lx->BankIndex] == NULL); /* bank must be empty before loading a new table */
|
||||
|
||||
if ( !LOCALE_isinitialized())
|
||||
return ok;
|
||||
|
||||
if( lx->pBank[lx->BankIndex] != NULL)
|
||||
return ok;
|
||||
|
||||
if( lx->pIndex[lx->BankIndex] != NULL)
|
||||
return ok;
|
||||
|
||||
g = gopen( PathName );
|
||||
if( g != NULL ) {
|
||||
|
||||
if( readheader(g)) {
|
||||
ok = readstrings( g, LanguageID );
|
||||
}
|
||||
gclose(g);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_purgetable - OBSOLETE
|
||||
;
|
||||
; Make all references to LOCALE_freetable
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_freetable - Free the string table in the current bank
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; void LOCALE_freetable(void)
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Frees the table loaded in the current bank. There must be a
|
||||
; table loaded in the current bank. Use LOCALE_getbankstringcount
|
||||
; to determine if the bank is free or not.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_loadtable, LOCALE_getbankstringcount
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
void LOCALE_freetable(void)
|
||||
{
|
||||
if( lx != NULL ) {
|
||||
|
||||
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
ASSERT(lx->pBank[lx->BankIndex]); /* table must be loaded before calling this function */
|
||||
|
||||
/* free string bank */
|
||||
if( lx->pBank[lx->BankIndex] != NULL ) {
|
||||
gfree(lx->pBank[lx->BankIndex]);
|
||||
lx->pBank[lx->BankIndex] = NULL;
|
||||
}
|
||||
/* if the bank has an index loaded, free that as well */
|
||||
if ( lx->pIndex[lx->BankIndex] != NULL ) {
|
||||
gfree(lx->pIndex[lx->BankIndex]);
|
||||
lx->pIndex[lx->BankIndex] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_getstring - Return the specified string from the current bank
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; const char* LOCALE_getstring( StringID )
|
||||
; int StringID; ID of string to return
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Returns the string specified from the current bank. There must
|
||||
; be a string table loaded into the current bank. Use the String
|
||||
; ID specified in the header file created by Locomoto. Note that
|
||||
; the string pointer is a const pointer. Do not modify the string
|
||||
; or the Locale library may return invalid results.
|
||||
;
|
||||
; If the .loc file was created with an index StringID can be any
|
||||
; valid integer in the range 0..65535. If no index was created
|
||||
; with the .loc file StringID will be a zero based array index.
|
||||
;
|
||||
; String is returned by const for a reason. Bad things will happen
|
||||
; if you modify it. You have been warned.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; LOCALE_loadtable, LOCALE_getbankstringcount
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
#include <stdlib.h> // for bsearch function
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// compare
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int compare ( const void* arg1, const void* arg2 )
|
||||
{
|
||||
const unsigned short* s1 = (const unsigned short*)(arg1);
|
||||
const unsigned short* s2 = (const unsigned short*)(arg2);
|
||||
return (*s1) - (*s2);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// getstringbyindex
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int getstringbyindex( unsigned short key, const INDEX* pIndex )
|
||||
{
|
||||
int index = 0;
|
||||
unsigned short* result;
|
||||
unsigned char* base; /* pointer to base of string id table */
|
||||
|
||||
ASSERT(LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
ASSERT(pIndex != NULL); /* index not loaded - .loc file must have index created (use -i option) */
|
||||
|
||||
if( !LOCALE_isinitialized())
|
||||
return -1;
|
||||
|
||||
if( pIndex == NULL )
|
||||
return -1;
|
||||
|
||||
base = ((unsigned char*)pIndex) + LOCALEFILE_INDEXCHUNK_STRINGID_OFFSET;
|
||||
result = (unsigned short*)bsearch((unsigned char *)&key, base, pIndex->StringCount, 4, compare);
|
||||
|
||||
if (result != NULL) {
|
||||
/* index is the second unsigned short */
|
||||
++result;
|
||||
index = *result;
|
||||
} else {
|
||||
index = -1;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LOCALE_getstring
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char* LOCALE_getstring( int StringID )
|
||||
{
|
||||
const char* p; /* pointer to string, NULL if string cannot be found */
|
||||
|
||||
ASSERT( LOCALE_isinitialized()); /* must call LOCALE_init before calling this function */
|
||||
|
||||
if( !LOCALE_isinitialized())
|
||||
return NULL;
|
||||
|
||||
/* get string array index from the index if it exists */
|
||||
if ( lx->pIndex[ lx->BankIndex ] != NULL ) {
|
||||
StringID = getstringbyindex((unsigned short)StringID, lx->pIndex[lx->BankIndex]);
|
||||
}
|
||||
|
||||
if ((StringID >= 0) && (StringID < (int)(lx->pBank[lx->BankIndex]->StringCount ))) {
|
||||
|
||||
unsigned int offset;
|
||||
|
||||
p = (const char*)(lx->pBank[lx->BankIndex]);
|
||||
offset = *(unsigned int*)(p + LOCALEFILE_LANGUAGECHUNK_STRING_OFFSET + StringID*4);
|
||||
p += offset;
|
||||
|
||||
} else {
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
;
|
||||
; ABSTRACT
|
||||
;
|
||||
; LOCALE_getstr - return selected string from the specified .loc file
|
||||
;
|
||||
;
|
||||
; SUMMARY
|
||||
;
|
||||
; #include "realfont.h"
|
||||
;
|
||||
; const char* LOCALE_getstr(stringid)
|
||||
;
|
||||
; int stringid; // string id to return
|
||||
;
|
||||
; DESCRIPTION
|
||||
;
|
||||
; Returns the string identified by stringid from the specified
|
||||
; .loc file. Use the string ID specified in the header file created
|
||||
; by Locomoto. Note that the string pointer is a const pointer. Do
|
||||
; not modify the string or the Locale library may return invalid results.
|
||||
;
|
||||
; If your strings are Unicode strings, cast the result to a const USTR *.
|
||||
;
|
||||
; If the .loc file was created with an index stringid can be any
|
||||
; valid integer in the range 0..65535. If no index was created
|
||||
; with the .loc file stringid will be a zero based array index.
|
||||
;
|
||||
; String is returned by const for a reason. Bad things will happen
|
||||
; if you modify it. You have been warned.
|
||||
;
|
||||
; SEE ALSO
|
||||
;
|
||||
; EXAMPLE
|
||||
;
|
||||
; locale_eg.c
|
||||
;
|
||||
; <HTML A HREF="locale_eg.c">Download the source<HTML /A>
|
||||
; <HTML A HREF="locale_eg.csv">locale_eg.csv<HTML /A> (example data)
|
||||
;
|
||||
; END ABSTRACT
|
||||
;
|
||||
*/
|
||||
|
||||
int LOCALElanguageid = 0;
|
||||
|
||||
const char* LOCALE_getstr( const void* pLocFile, int StringID )
|
||||
{
|
||||
const char* p = NULL; /* pointer to string, NULL if string cannot be found */
|
||||
|
||||
HEADER* pHeader;
|
||||
BANK* pBank;
|
||||
|
||||
ASSERT(pLocFile != NULL);
|
||||
|
||||
/* Must pass something in */
|
||||
if( pLocFile == NULL ) {
|
||||
return p;
|
||||
}
|
||||
|
||||
pHeader = (LOCALEFILE_HEADERCHUNK*)(pLocFile);
|
||||
ASSERT(pHeader->ChunkID == LOCALEFILE_HEADERCHUNKID);
|
||||
ASSERT(pHeader->LanguageCount >= 1);
|
||||
|
||||
if( pHeader->Flags == 1 ) {
|
||||
|
||||
/* file has an index */
|
||||
INDEX* pIndex = (INDEX*)((unsigned char*)(pLocFile) + pHeader->ChunkSize);
|
||||
StringID = getstringbyindex((unsigned short)StringID, pIndex);
|
||||
}
|
||||
|
||||
/* get pointer to string bank */
|
||||
{
|
||||
int offset = *((int*)(pLocFile) + 4 + LOCALElanguageid);
|
||||
pBank = (BANK*)((unsigned char*)(pLocFile) + offset);
|
||||
}
|
||||
|
||||
if ((StringID >= 0) && (StringID < (int)(pBank->StringCount))) {
|
||||
|
||||
unsigned int offset;
|
||||
|
||||
p = (const char*)(pBank);
|
||||
offset = *(unsigned int*)(p + LOCALEFILE_LANGUAGECHUNK_STRING_OFFSET + StringID*4);
|
||||
p += offset;
|
||||
|
||||
} else {
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
72
Code/Tools/WWConfig/locale.h
Normal file
72
Code/Tools/WWConfig/locale.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
/* Copyright (C) Electronic Arts Canada Inc. 1998-1999. All rights reserved. */
|
||||
|
||||
/* ABSTRACT
|
||||
locale.h - REAL fonts
|
||||
@ */
|
||||
|
||||
#ifndef __LOCALE_H
|
||||
#define __LOCALE_H 1
|
||||
|
||||
//#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
//#endif
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* LOCALE API */
|
||||
/****************************************************************************/
|
||||
const char * LOCALE_getstr( const void *localefile, int stringid );
|
||||
/* NOTE: this single function replaces the previous LOCALE API */
|
||||
|
||||
/****************************************************************************/
|
||||
/* OBSOLETE LOCALE API */
|
||||
/****************************************************************************/
|
||||
|
||||
/* This API is being retired in favor of the much simplier single LOCALE_getstr function. */
|
||||
|
||||
#define LOCALE_BANK_COUNT 8
|
||||
|
||||
/* initialization/restore */
|
||||
int LOCALE_init( void ); /* call before calling any other LOCALE functions */
|
||||
void LOCALE_restore( void ); /* free all memory/resources allocated by LOCALE */
|
||||
|
||||
/* attributes */
|
||||
void LOCALE_setbank( int bankindex ); /* bankindex >= 0 && bankindex < LOCALE_BANK_COUNT */
|
||||
int LOCALE_getbank( void ); /* returns current bank id */
|
||||
int LOCALE_getbanklanguageid( void ); /* returns language id of the current bank */
|
||||
int LOCALE_getbankstringcount( void ); /* returns the string string count in the current bank */
|
||||
|
||||
/* operations */
|
||||
int LOCALE_loadtable( const char *pathname, int languageid ); /* load table into the current bank */
|
||||
void LOCALE_freetable( void ); /* free table in the current bank */
|
||||
const char * LOCALE_getstring( int stringid ); /* use values in the .h file created by locomoto */
|
||||
|
||||
/* maintain backwards compatibility */
|
||||
#define LOCALE_purgetable LOCALE_freetable
|
||||
|
||||
|
||||
//#ifdef __cplusplus
|
||||
//}
|
||||
//#endif
|
||||
|
||||
#endif /* __LOCALE_H */
|
||||
/* END ABSTRACT */
|
||||
|
||||
BIN
Code/Tools/WWConfig/res/IDL_CHINESE.loc
Normal file
BIN
Code/Tools/WWConfig/res/IDL_CHINESE.loc
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/res/IDL_ENGLISH.loc
Normal file
BIN
Code/Tools/WWConfig/res/IDL_ENGLISH.loc
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/res/IDL_FRENCH.loc
Normal file
BIN
Code/Tools/WWConfig/res/IDL_FRENCH.loc
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/res/IDL_GERMAN.loc
Normal file
BIN
Code/Tools/WWConfig/res/IDL_GERMAN.loc
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/res/IDL_JAPANESE.loc
Normal file
BIN
Code/Tools/WWConfig/res/IDL_JAPANESE.loc
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/res/IDL_KOREAN.loc
Normal file
BIN
Code/Tools/WWConfig/res/IDL_KOREAN.loc
Normal file
Binary file not shown.
BIN
Code/Tools/WWConfig/res/WWConfig.ico
Normal file
BIN
Code/Tools/WWConfig/res/WWConfig.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
13
Code/Tools/WWConfig/res/WWConfig.rc2
Normal file
13
Code/Tools/WWConfig/res/WWConfig.rc2
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// WWCONFIG.RC2 - resources Microsoft Visual C++ does not edit directly
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#error this file is not editable by Microsoft Visual C++
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Add manually edited resources here...
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BIN
Code/Tools/WWConfig/res/ico00001.ico
Normal file
BIN
Code/Tools/WWConfig/res/ico00001.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
BIN
Code/Tools/WWConfig/res/ico00002.ico
Normal file
BIN
Code/Tools/WWConfig/res/ico00002.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
BIN
Code/Tools/WWConfig/res/icon1.ico
Normal file
BIN
Code/Tools/WWConfig/res/icon1.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
BIN
Code/Tools/WWConfig/res/logo.bmp
Normal file
BIN
Code/Tools/WWConfig/res/logo.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Reference in New Issue
Block a user