Initial commit of Command & Conquer Renegade source code.

This commit is contained in:
LFeenanEA
2025-02-27 16:39:46 +00:00
parent 74ab8fa5e0
commit 58ed459113
4918 changed files with 1366710 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
/*
** 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/>.
*/
// FindDialog.cpp : implementation file
//
#include "stdafx.h"
#include "wdump.h"
#include "FindDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// Static data.
char FindDialog::_FindString [MAX_FIND_STRING_LENGTH + 1] = "";
bool FindDialog::_Found;
/////////////////////////////////////////////////////////////////////////////
// FindDialog dialog
FindDialog::FindDialog(CWnd* pParent /*=NULL*/)
: CDialog(FindDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(FindDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void FindDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(FindDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(FindDialog, CDialog)
//{{AFX_MSG_MAP(FindDialog)
ON_EN_CHANGE(IDC_FIND_STRING, OnChangeFindString)
ON_EN_UPDATE(IDC_FIND_STRING, OnUpdateFindString)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// FindDialog message handlers
BOOL FindDialog::OnInitDialog()
{
CDialog::OnInitDialog();
((CEdit*) GetDlgItem (IDC_FIND_STRING))->SetLimitText (MAX_FIND_STRING_LENGTH);
GetDlgItem (IDC_FIND_STRING)->SetWindowText (_FindString);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void FindDialog::OnChangeFindString()
{
GetDlgItem (IDC_FIND_STRING)->GetWindowText (_FindString, MAX_FIND_STRING_LENGTH);
}
void FindDialog::OnUpdateFindString()
{
GetDlgItem (IDOK)->EnableWindow (GetDlgItem (IDC_FIND_STRING)->GetWindowTextLength() > 0);
}

View File

@@ -0,0 +1,94 @@
/*
** 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_FINDDIALOG_H__C38C0FF8_E89B_11D3_A398_009027447394__INCLUDED_)
#define AFX_FINDDIALOG_H__C38C0FF8_E89B_11D3_A398_009027447394__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FindDialog.h : header file
//
// Defines.
#define MAX_FIND_STRING_LENGTH 255
/////////////////////////////////////////////////////////////////////////////
// FindDialog dialog
class FindDialog : public CDialog
{
// Construction
public:
FindDialog(CWnd* pParent = NULL); // standard constructor
static const char *String()
{
return (_FindString);
}
static void Compare (const char *string)
{
_Found |= (strstr (string, _FindString) != NULL);
}
static bool Found()
{
return (_Found);
}
static void Found (bool found)
{
_Found = found;
}
// Dialog Data
//{{AFX_DATA(FindDialog)
enum { IDD = IDD_TOOLS_FIND };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(FindDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(FindDialog)
virtual BOOL OnInitDialog();
afx_msg void OnChangeFindString();
afx_msg void OnUpdateFindString();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
static bool _Found;
static char _FindString [MAX_FIND_STRING_LENGTH + 1];
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FINDDIALOG_H__C38C0FF8_E89B_11D3_A398_009027447394__INCLUDED_)

2334
Code/Tools/wdump/chunk_d.cpp Normal file

File diff suppressed because it is too large Load Diff

252
Code/Tools/wdump/chunk_d.h Normal file
View File

@@ -0,0 +1,252 @@
/*
** 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/>.
*/
// Chunk_D.h: interface for the ChunkData class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHUNK_D_H__41C157F9_5631_11D1_8CDB_006097C6A583__INCLUDED_)
#define AFX_CHUNK_D_H__41C157F9_5631_11D1_8CDB_006097C6A583__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class ChunkItem;
class ChunkType {
public:
ChunkType(const char *name, void (*callback)(ChunkItem *item, CListCtrl *List), bool wrapper = false) {Name = name;Callback = callback; Wrapper = wrapper;};
const char *Name;
bool Wrapper;
void (*Callback)(ChunkItem *, CListCtrl *list);
};
class ChunkTableClass {
public:
ChunkTableClass();
~ChunkTableClass();
ChunkType *Lookup(int ID);
void NewType(int ID, const char *name, void (*callback)(ChunkItem *item, CListCtrl *list) = 0, bool wrapper = false);
protected:
CMapPtrToPtr Types;
static void AddItem(CListCtrl *List, int &Counter, const char *Name, const char *Value, const char *Type="string");
static void AddItem(CListCtrl *List, int &Counter, const char *Name, uint32 Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, uint16 Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, uint8 Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, uint8 *Value, int Count);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, float32 Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, uint32 *Value, int Count);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, float32 *Value, int Count);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, IOVector3Struct *Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, IOVector4Struct *Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, W3dQuaternionStruct *Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, W3dRGBStruct *Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, W3dRGBStruct *Value, int count);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, W3dRGBAStruct *Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, W3dTexCoordStruct *Value, int Count);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, W3dTexCoordStruct *Value);
static void AddItem(CListCtrl *List, int &Counter, const char *Name, Vector3i *Value);
static void AddItem(CListCtrl *List, int &Counter, const char *name, W3dShaderStruct * shader);
static void AddItem(CListCtrl *List, int &Counter, const char *name, W3dPS2ShaderStruct * shader);
static void AddItemVersion(CListCtrl *List,int &Counter,uint32 version);
static void List_Subitems(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MESH(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MESH_HEADER(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_VERTICES(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_NORMALS(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_SURRENDER_NORMALS(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_TEXCOORDS(ChunkItem *Item, CListCtrl *List);
static void List_O_W3D_CHUNK_MATERIALS(ChunkItem *Item, CListCtrl *List);
static void List_O_W3D_CHUNK_TRIANGLES(ChunkItem *Item, CListCtrl *List);
static void List_O_W3D_CHUNK_QUADRANGLES(ChunkItem *Item, CListCtrl *List);
static void List_O_W3D_CHUNK_SURRENDER_TRIANGLES(ChunkItem *Item, CListCtrl *List);
static void List_O_W3D_CHUNK_POV_TRIANGLES(ChunkItem *Item, CListCtrl *List);
static void List_O_W3D_CHUNK_POV_QUADRANGLES(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MESH_USER_TEXT(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_COLORS(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_INFLUENCES(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_DAMAGE(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_DAMAGE_HEADER(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_DAMAGE_VERTICES(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_DAMAGE_COLORS(ChunkItem *Item, CListCtrl *List);
static void List_O_W3D_CHUNK_MATERIALS2(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MATERIALS3(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL3(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL3_NAME(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL3_INFO(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL3_DC_MAP(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MAP3_FILENAME(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MAP3_INFO(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL3_DI_MAP(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL3_SC_MAP(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL3_SI_MAP(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_MESH_HEADER3(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_TRIANGLES(ChunkItem * Item, CListCtrl *List);
static void List_W3D_CHUNK_PER_TRI_MATERIALS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_SHADE_INDICES(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL_INFO(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_SHADERS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_PS2_SHADERS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_MATERIALS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_MATERIAL(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_MATERIAL_NAME(ChunkItem *Item,CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_MATERIAL_INFO(ChunkItem *Item,CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_MAPPER_ARGS0(ChunkItem *Item,CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_MAPPER_ARGS1(ChunkItem *Item,CListCtrl *List);
static void List_W3D_CHUNK_TEXTURES(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_TEXTURE(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_TEXTURE_NAME(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_TEXTURE_INFO(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_MATERIAL_PASS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_VERTEX_MATERIAL_IDS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_SHADER_IDS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_DCG(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_DIG(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_SCG(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_TEXTURE_STAGE(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_TEXTURE_IDS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_STAGE_TEXCOORDS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_PER_FACE_TEXCOORD_IDS(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_AABTREE(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_AABTREE_HEADER(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_AABTREE_POLYINDICES(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_AABTREE_NODES(ChunkItem * Item,CListCtrl *List);
static void List_W3D_CHUNK_HIERARCHY(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_HIERARCHY_HEADER(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_PIVOTS(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_PIVOT_FIXUPS(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_ANIMATION(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_ANIMATION_HEADER(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_ANIMATION_CHANNEL(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_BIT_CHANNEL(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_HMODEL(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_HMODEL_HEADER(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_NODE(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_COLLISION_NODE(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_SKIN_NODE(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_HMODEL_AUX_DATA(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_SHADOW_NODE(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_LODMODEL(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_LODMODEL_HEADER(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_LOD(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_COLLECTION(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_COLLECTION_HEADER(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_COLLECTION_OBJ_NAME(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_PLACEHOLDER(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_TRANSFORM_NODE(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_POINTS(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_LIGHT(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_LIGHT_INFO(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_SPOT_LIGHT_INFO(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_NEAR_ATTENUATION(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_FAR_ATTENUATION(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_HEADER(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_USER_DATA(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_INFO(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_INFOV2(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_PROPS(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_COLOR_KEYFRAME(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_OPACITY_KEYFRAME(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_SIZE_KEYFRAME(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_ROTATION_KEYFRAMES(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_FRAME_KEYFRAMES(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_EMITTER_BLUR_TIME_KEYFRAMES(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_AGGREGATE(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_AGGREGATE_HEADER(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_AGGREGATE_INFO(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_TEXTURE_REPLACER_INFO(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_AGGREGATE_CLASS_INFO(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_HLOD(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_HLOD_HEADER(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_HLOD_LOD_ARRAY(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_HLOD_LOD_ARRAY_HEADER(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_HLOD_SUB_OBJECT(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_BOX(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_NULL_OBJECT(ChunkItem * Item,CListCtrl * List);
static void List_W3D_CHUNK_PRELIT_UNLIT(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_PRELIT_VERTEX(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_PRELIT_LIGHTMAP_MULTI_PASS(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_PRELIT_LIGHTMAP_MULTI_TEXTURE(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_LIGHTSCAPE(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_LIGHTSCAPE_LIGHT(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_LIGHT_TRANSFORM(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_DAZZLE(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_DAZZLE_NAME(ChunkItem *Item, CListCtrl *List);
static void List_W3D_CHUNK_DAZZLE_TYPENAME(ChunkItem *Item, CListCtrl *List);
};
class ChunkItem {
public:
ChunkItem(ChunkLoadClass &cload); // constructor copies header and data into buffer
~ChunkItem();
int ID;
ChunkType *Type;
int Length;
void *Data;
CList<ChunkItem *, ChunkItem *> Chunks; // wrapper chunks will have members here.
protected:
static ChunkTableClass ChunkTable;
};
class ChunkData
{
public:
void Release_Data();
ChunkData();
virtual ~ChunkData();
bool Load(const char *Filename);
CList<ChunkItem *, ChunkItem *> Chunks;
protected:
void Add_Chunk(ChunkLoadClass &cload, ChunkItem *Parent = 0); // add a chunk to the list of chunks maintained by ChunkData
};
#endif // !defined(AFX_CHUNK_D_H__41C157F9_5631_11D1_8CDB_006097C6A583__INCLUDED_)

View File

@@ -0,0 +1,149 @@
/*
** 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/>.
*/
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "wdump.h"
#include "wdtview.h"
#include "wdLview.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
CRect r;
GetClientRect(r);
// TODO: Add your specialized code here and/or call the base class
if (!m_SplitWnd.CreateStatic(this, 1,2) ||
!m_SplitWnd.CreateView(0, 0, RUNTIME_CLASS(CWDumpTreeView), CSize(300,0), pContext) ||
!m_SplitWnd.CreateView(0, 1, RUNTIME_CLASS(CWDumpListView), CSize(0,0), pContext)) {
return FALSE;
} else {
return TRUE;
}
// return CFrameWnd::OnCreateClient(lpcs, pContext); }
/* return m_wndSplitter.Create( this,
2, 2, // TODO: adjust the number of rows, columns
CSize( 10, 10 ), // TODO: adjust the minimum pane size
pContext );*/
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

View File

@@ -0,0 +1,79 @@
/*
** 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/>.
*/
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__41C157EB_5631_11D1_8CDB_006097C6A583__INCLUDED_)
#define AFX_MAINFRM_H__41C157EB_5631_11D1_8CDB_006097C6A583__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
protected:
CSplitterWnd m_SplitWnd;
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
public:
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
// 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 Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__41C157EB_5631_11D1_8CDB_006097C6A583__INCLUDED_)

View File

@@ -0,0 +1,924 @@
/*
** 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 S T U D I O S ***
***********************************************************************************************
* *
* Project Name : G *
* *
* $Archive:: /G/wdump/RAWFILEM.CPP $*
* *
* $Author:: Eric_c $*
* *
* $Modtime:: 7/28/97 3:36p $*
* *
* $Revision:: 3 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* RawFileMClass::Bias -- Bias a file with a specific starting position and length. *
* RawFileMClass::Close -- Perform a closure of the file. *
* RawFileMClass::Create -- Creates an empty file. *
* RawFileMClass::Delete -- Deletes the file object from the disk. *
* RawFileMClass::Error -- Handles displaying a file error message. *
* RawFileMClass::Get_Date_Time -- Gets the date and time the file was last modified. *
* RawFileMClass::Is_Available -- Checks to see if the specified file is available to open. *
* RawFileMClass::Open -- Assigns name and opens file in one operation. *
* RawFileMClass::Open -- Opens the file object with the rights specified. *
* RawFileMClass::RawFileMClass -- Simple constructor for a file object. *
* RawFileMClass::Raw_Seek -- Performs a seek on the unbiased file *
* RawFileMClass::Read -- Reads the specified number of bytes into a memory buffer. *
* RawFileMClass::Seek -- Reposition the file pointer as indicated. *
* RawFileMClass::Set_Date_Time -- Sets the date and time the file was last modified. *
* RawFileMClass::Set_Name -- Manually sets the name for a file object. *
* RawFileMClass::Size -- Determines size of file (in bytes). *
* RawFileMClass::Write -- Writes the specified data to the buffer specified. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "always.h"
#include "rawfilem.h"
#include <direct.h>
#include <share.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/***********************************************************************************************
* RawFileMClass::Error -- Handles displaying a file error message. *
* *
* Display an error message as indicated. If it is allowed to retry, then pressing a key *
* will return from this function. Otherwise, it will exit the program with "exit()". *
* *
* INPUT: error -- The error number (same as the DOSERR.H error numbers). *
* *
* canretry -- Can this routine exit normally so that retrying can occur? If this is *
* false, then the program WILL exit in this routine. *
* *
* filename -- Optional filename to report with this error. If no filename is *
* supplied, then no filename is listed in the error message. *
* *
* OUTPUT: none, but this routine might not return at all if the "canretry" parameter is *
* false or the player pressed ESC. *
* *
* WARNINGS: This routine may not return at all. It handles being in text mode as well as *
* if in a graphic mode. *
* *
* HISTORY: *
* 10/17/1994 JLB : Created. *
*=============================================================================================*/
void RawFileMClass::Error(int, int, char const * )
{
}
/***********************************************************************************************
* RawFileMClass::RawFileMClass -- Simple constructor for a file object. *
* *
* This constructor is called when a file object is created with a supplied filename, but *
* not opened at the same time. In this case, an assumption is made that the supplied *
* filename is a constant string. A duplicate of the filename string is not created since *
* it would be wasteful in that case. *
* *
* INPUT: filename -- The filename to assign to this file object. *
* *
* OUTPUT: none *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/17/1994 JLB : Created. *
*=============================================================================================*/
RawFileMClass::RawFileMClass(char const * filename) :
Rights(0),
BiasStart(0),
BiasLength(-1),
Handle(NULL_HANDLE),
Filename(filename),
Date(0),
Time(0),
Allocated(false)
{
}
/***********************************************************************************************
* RawFileMClass::Set_Name -- Manually sets the name for a file object. *
* *
* This routine will set the name for the file object to the name specified. This name is *
* duplicated in free store. This allows the supplied name to be a temporarily constructed *
* text string. Setting the name in this fashion doesn't affect the closed or opened state *
* of the file. *
* *
* INPUT: filename -- The filename to assign to this file object. *
* *
* OUTPUT: Returns with a pointer to the allocated copy of this filename. This pointer is *
* guaranteed to remain valid for the duration of this file object or until the name *
* is changed -- whichever is sooner. *
* *
* WARNINGS: Because of the allocation this routine must perform, memory could become *
* fragmented. *
* *
* HISTORY: *
* 10/17/1994 JLB : Created. *
*=============================================================================================*/
char const * RawFileMClass::Set_Name(char const * filename)
{
if (Filename != NULL && Allocated) {
free((char *)Filename);
Filename = NULL;
Allocated = false;
}
if (filename == NULL) return(NULL);
Bias(0);
Filename = strdup(filename);
if (Filename == NULL) {
Error(ENOMEM, false, filename);
}
Allocated = true;
return(Filename);
}
/***********************************************************************************************
* RawFileMClass::Open -- Assigns name and opens file in one operation. *
* *
* This routine will assign the specified filename to the file object and open it at the *
* same time. If the file object was already open, then it will be closed first. If the *
* file object was previously assigned a filename, then it will be replaced with the new *
* name. Typically, this routine is used when an anonymous file object has been crated and *
* now it needs to be assigned a name and opened. *
* *
* INPUT: filename -- The filename to assign to this file object. *
* *
* rights -- The open file access rights to use. *
* *
* OUTPUT: bool; Was the file opened? The return value of this is moot, since the open file *
* is designed to never return unless it succeeded. *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/17/1994 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Open(char const * filename, int rights)
{
Set_Name(filename);
return(Open(rights));
}
/***********************************************************************************************
* RawFileMClass::Open -- Opens the file object with the rights specified. *
* *
* This routine is used to open the specified file object with the access rights indicated. *
* This only works if the file has already been assigned a filename. It is guaranteed, by *
* the error handler, that this routine will always return with success. *
* *
* INPUT: rights -- The file access rights to use when opening this file. This is a *
* combination of READ and/or WRITE bit flags. *
* *
* OUTPUT: bool; Was the file opened successfully? This will always return true by reason of *
* the error handler. *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/17/1994 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Open(int rights)
{
Close();
/*
** Verify that there is a filename associated with this file object. If not, then this is a
** big error condition.
*/
if (Filename == NULL) {
Error(ENOENT, false);
}
/*
** Record the access rights used for this open call. These rights will be used if the
** file object is duplicated.
*/
Rights = rights;
/*
** Repetitively try to open the file. Abort if a fatal error condition occurs.
*/
for (;;) {
/*
** Try to open the file according to the access rights specified.
*/
switch (rights) {
/*
** If the access rights are not recognized, then report this as
** an invalid access code.
*/
default:
Error_Number = EINVAL;
break;
case READ:
Handle = CreateFileA(Filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
break;
case WRITE:
Handle = CreateFileA(Filename, GENERIC_WRITE, 0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
break;
case READ|WRITE:
Handle = CreateFileA(Filename, GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
break;
}
/*
** Biased files must be positioned past the bias start position.
*/
if (BiasStart != 0 || BiasLength != -1) {
Seek(0, SEEK_SET);
}
/*
** If the handle indicates the file is not open, then this is an error condition.
** For the case of the file cannot be found, then allow a retry. All other cases
** are fatal.
*/
if (Handle == NULL_HANDLE) {
return(false);
// Error(GetLastError(), false, Filename);
// continue;
}
break;
}
return(true);
}
/***********************************************************************************************
* RawFileMClass::Is_Available -- Checks to see if the specified file is available to open. *
* *
* This routine will examine the disk system to see if the specified file can be opened *
* or not. Use this routine before opening a file in order to make sure that is available *
* or to perform other necessary actions. *
* *
* INPUT: force -- Should this routine keep retrying until the file becomes available? If *
* in this case it doesn't become available, then the program will abort. *
* *
* OUTPUT: bool; Is the file available to be opened? *
* *
* WARNINGS: Depending on the parameter passed in, this routine may never return. *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
bool RawFileMClass::Is_Available(int forced)
{
if (Filename == NULL) return(false);
/*
** If the file is already open, then is must have already passed the availability check.
** Return true in this case.
*/
if (Is_Open()) return(true);
/*
** If this is a forced check, then go through the normal open channels, since those
** channels ensure that the file must exist.
*/
if (forced) {
RawFileMClass::Open(READ);
RawFileMClass::Close();
return(true);
}
/*
** Perform a raw open of the file. If this open fails for ANY REASON, including a missing
** CD-ROM, this routine will return a failure condition. In all but the missing file
** condition, go through the normal error recover channels.
*/
for (;;) {
Handle = CreateFileA(Filename, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (Handle == NULL_HANDLE) {
return(false);
}
break;
}
/*
** Since the file could be opened, then close it and return that the file exists.
*/
if (!CloseHandle(Handle)) {
Error(GetLastError(), false, Filename);
}
Handle = NULL_HANDLE;
return(true);
}
/***********************************************************************************************
* RawFileMClass::Close -- Perform a closure of the file. *
* *
* Close the file object. In the rare case of an error, handle it as appropriate. *
* *
* INPUT: none *
* *
* OUTPUT: none *
* *
* WARNINGS: Some rare error conditions may cause this routine to abort the program. *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
void RawFileMClass::Close(void)
{
/*
** If the file is open, then close it. If the file is already closed, then just return. This
** isn't considered an error condition.
*/
if (Is_Open()) {
/*
** Try to close the file. If there was an error (who knows what that could be), then
** call the error routine.
*/
if (!CloseHandle(Handle)) {
Error(GetLastError(), false, Filename);
}
/*
** At this point the file must have been closed. Mark the file as empty and return.
*/
Handle = NULL_HANDLE;
}
}
/***********************************************************************************************
* RawFileMClass::Read -- Reads the specified number of bytes into a memory buffer. *
* *
* This routine will read the specified number of bytes and place the data into the buffer *
* indicated. It is legal to call this routine with a request for more bytes than are in *
* the file. This condition can result in fewer bytes being read than requested. Determine *
* this by examining the return value. *
* *
* INPUT: buffer -- Pointer to the buffer to read data into. If NULL is passed, no read *
* is performed. *
* *
* size -- The number of bytes to read. If NULL is passed, then no read is *
* performed. *
* *
* OUTPUT: Returns with the number of bytes read into the buffer. If this number is less *
* than requested, it indicates that the file has been exhausted. *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Read(void * buffer, int size)
{
long bytesread = 0; // Running count of the number of bytes read into the buffer.
int opened = false; // Was the file opened by this routine?
/*
** If the file isn't opened, open it. This serves as a convenience
** for the programmer.
*/
if (!Is_Open()) {
/*
** The error check here is moot. Open will never return unless it succeeded.
*/
if (!Open(READ)) {
return(0);
}
opened = true;
}
/*
** A biased file has the requested read length limited to the bias length of
** the file.
*/
if (BiasLength != -1) {
int remainder = BiasLength - Seek(0);
size = size < remainder ? size : remainder;
}
long total = 0;
while (size > 0) {
bytesread = 0;
if (!ReadFile(Handle, buffer, size, &(unsigned long&)bytesread, NULL)) {
size -= bytesread;
total += bytesread;
Error(GetLastError(), true, Filename);
continue;
}
size -= bytesread;
total += bytesread;
if (bytesread == 0) break;
}
bytesread = total;
/*
** Close the file if it was opened by this routine and return
** the actual number of bytes read into the buffer.
*/
if (opened) Close();
return(bytesread);
}
/***********************************************************************************************
* RawFileMClass::Write -- Writes the specified data to the buffer specified. *
* *
* This routine will write the data specified to the file. *
* *
* INPUT: buffer -- The buffer that holds the data to write. *
* *
* size -- The number of bytes to write to the file. *
* *
* OUTPUT: Returns with the number of bytes written to the file. This routine catches the *
* case of a disk full condition, so this routine will always return with the number *
* matching the size request. *
* *
* WARNINGS: A fatal file condition could cause this routine to never return. *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Write(void const * buffer, int size)
{
long bytesread = 0;
int opened = false; // Was the file manually opened?
/*
** Check to open status of the file. If the file is open, then merely write to
** it. Otherwise, open the file for writing and then close the file when the
** output is finished.
*/
if (!Is_Open()) {
if (!Open(WRITE)) {
return(0);
}
opened = true;
}
if (!WriteFile(Handle, buffer, size, &(unsigned long&)bytesread, NULL)) {
Error(GetLastError(), false, Filename);
}
/*
** Fixup the bias length if necessary.
*/
if (BiasLength != -1) {
if (Raw_Seek(0) > BiasStart+BiasLength) {
BiasLength = Raw_Seek(0) - BiasStart;
}
}
/*
** If this routine had to open the file, then close it before returning.
*/
if (opened) {
Close();
}
/*
** Return with the number of bytes written. This will always be the number of bytes
** requested, since the case of the disk being full is caught by this routine.
*/
return(bytesread);
}
/***********************************************************************************************
* RawFileMClass::Seek -- Reposition the file pointer as indicated. *
* *
* Use this routine to move the filepointer to the position indicated. It can move either *
* relative to current position or absolute from the beginning or ending of the file. This *
* routine will only return if it successfully performed the seek. *
* *
* INPUT: pos -- The position to seek to. This is interpreted as relative to the position *
* indicated by the "dir" parameter. *
* *
* dir -- The relative position to relate the seek to. This can be either SEEK_SET *
* for the beginning of the file, SEEK_CUR for the current position, or *
* SEEK_END for the end of the file. *
* *
* OUTPUT: This routine returns the position that the seek ended up at. *
* *
* WARNINGS: If there was a file error, then this routine might never return. *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Seek(int pos, int dir)
{
/*
** A file that is biased will have a seek operation modified so that the file appears to
** exist only within the bias range. All bytes outside of this range appear to be
** non-existant.
*/
if (BiasLength != -1) {
switch (dir) {
case SEEK_SET:
if (pos > BiasLength) {
pos = BiasLength;
}
pos += BiasStart;
break;
case SEEK_CUR:
break;
case SEEK_END:
dir = SEEK_SET;
pos += BiasStart + BiasLength;
// pos = (pos <= BiasStart+BiasLength) ? pos : BiasStart+BiasLength;
// pos = (pos >= BiasStart) ? pos : BiasStart;
break;
}
/*
** Perform the modified raw seek into the file.
*/
long newpos = Raw_Seek(pos, dir) - BiasStart;
/*
** Perform a final double check to make sure the file position fits with the bias range.
*/
if (newpos < 0) {
newpos = Raw_Seek(BiasStart, SEEK_SET) - BiasStart;
}
if (newpos > BiasLength) {
newpos = Raw_Seek(BiasStart+BiasLength, SEEK_SET) - BiasStart;
}
return(newpos);
}
/*
** If the file is not biased in any fashion, then the normal seek logic will
** work just fine.
*/
return(Raw_Seek(pos, dir));
}
/***********************************************************************************************
* RawFileMClass::Size -- Determines size of file (in bytes). *
* *
* Use this routine to determine the size of the file. The file must exist or this is an *
* error condition. *
* *
* INPUT: none *
* *
* OUTPUT: Returns with the number of bytes in the file. *
* *
* WARNINGS: This routine handles error conditions and will not return unless the file *
* exists and can successfully be queried for file length. *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Size(void)
{
int size = 0;
/*
** A biased file already has its length determined.
*/
if (BiasLength != -1) {
return(BiasLength);
}
/*
** If the file is open, then proceed normally.
*/
if (Is_Open()) {
size = GetFileSize(Handle, NULL);
/*
** If there was in internal error, then call the error function.
*/
if (size == 0xFFFFFFFF) {
Error(GetLastError(), false, Filename);
}
} else {
/*
** If the file wasn't open, then open the file and call this routine again. Count on
** the fact that the open function must succeed.
*/
if (Open()) {
size = Size();
/*
** Since we needed to open the file we must remember to close the file when the
** size has been determined.
*/
Close();
}
}
BiasLength = size-BiasStart;
return(BiasLength);
}
/***********************************************************************************************
* RawFileMClass::Create -- Creates an empty file. *
* *
* This routine will create an empty file from the file object. The file object's filename *
* must already have been assigned before this routine will function. *
* *
* INPUT: none *
* *
* OUTPUT: bool; Was the file successfully created? This routine will always return true. *
* *
* WARNINGS: A fatal error condition could occur with this routine. Especially if the disk *
* is full or a read-only media was selected. *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Create(void)
{
Close();
if (Open(WRITE)) {
/*
** A biased file must be at least as long as the bias offset. Seeking to the
** appropriate start offset has the effect of lengthening the file to the
** correct length.
*/
if (BiasLength != -1) {
Seek(0, SEEK_SET);
}
Close();
return(true);
}
return(false);
}
/***********************************************************************************************
* RawFileMClass::Delete -- Deletes the file object from the disk. *
* *
* This routine will delete the file object from the disk. If the file object doesn't *
* exist, then this routine will return as if it had succeeded (since the effect is the *
* same). *
* *
* INPUT: none *
* *
* OUTPUT: bool; Was the file deleted? If the file was already missing, the this value will *
* be false. *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Delete(void)
{
/*
** If the file was open, then it must be closed first.
*/
Close();
/*
** If there is no filename associated with this object, then this indicates a fatal error
** condition. Report this and abort.
*/
if (!Filename) {
Error(ENOENT, false);
}
/*
** Repetitively try to delete the file if possible. Either return with success, or
** abort the program with an error.
*/
for (;;) {
/*
** If the file is already missing, then return with this fact. No action is necessary.
** This can occur as this section loops if the file exists on a floppy and the floppy
** was removed, the file deleted on another machine, and then the floppy was
** reinserted. Admittedly, this is a rare case, but is handled here.
*/
if (!Is_Available()) {
return(false);
}
if (!DeleteFile(Filename)) {
Error(GetLastError(), false, Filename);
return(false);
}
break;
}
/*
** DOS reports that the file was successfully deleted. Return with this fact.
*/
return(true);
}
/***********************************************************************************************
* RawFileMClass::Get_Date_Time -- Gets the date and time the file was last modified. *
* *
* Use this routine to get the date and time of the file. *
* *
* INPUT: none *
* *
* OUTPUT: Returns with the file date and time as a long. *
* Use the YEAR(long), MONTH(),.... *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 11/14/1995 DRD : Created. *
* 07/13/1996 JLB : Handles win32 method. *
*=============================================================================================*/
unsigned long RawFileMClass::Get_Date_Time(void)
{
BY_HANDLE_FILE_INFORMATION info;
if (GetFileInformationByHandle(Handle, &info)) {
WORD dosdate;
WORD dostime;
FileTimeToDosDateTime(&info.ftLastWriteTime, &dosdate, &dostime);
return((dosdate << 16) | dostime);
}
return(0);
}
/***********************************************************************************************
* RawFileMClass::Set_Date_Time -- Sets the date and time the file was last modified. *
* *
* Use this routine to set the date and time of the file. *
* *
* INPUT: the file date and time as a long *
* *
* OUTPUT: successful or not if the file date and time was changed. *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 11/14/1995 DRD : Created. *
* 07/13/1996 JLB : Handles win 32 method *
*=============================================================================================*/
bool RawFileMClass::Set_Date_Time(unsigned long datetime)
{
if (RawFileMClass::Is_Open()) {
BY_HANDLE_FILE_INFORMATION info;
if (GetFileInformationByHandle(Handle, &info)) {
FILETIME filetime;
if (DosDateTimeToFileTime((WORD)(datetime >> 16), (WORD)(datetime & 0x0FFFF), &filetime)) {
return(SetFileTime(Handle, &info.ftCreationTime, &filetime, &filetime) != 0);
}
}
}
return(false);
}
/***********************************************************************************************
* RawFileMClass::Bias -- Bias a file with a specific starting position and length. *
* *
* This will bias a file by giving it an artificial starting position and length. By *
* using this routine, it is possible to 'fool' the file into ignoring a header and *
* trailing extra data. An example of this would be a file inside of a mixfile. *
* *
* INPUT: start -- The starting offset that will now be considered the start of the *
* file. *
* *
* length -- The forced length of the file. For files that are opened for write, *
* this serves as the artificial constraint on the file's length. For *
* files opened for read, this limits the usable file size. *
* *
* OUTPUT: none *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 06/02/1996 JLB : Created. *
*=============================================================================================*/
void RawFileMClass::Bias(int start, int length)
{
if (start == 0) {
BiasStart = 0;
BiasLength = -1;
return;
}
BiasLength = RawFileMClass::Size();
BiasStart += start;
if (length != -1) {
BiasLength = BiasLength < length ? BiasLength : length;
}
BiasLength = BiasLength > 0 ? BiasLength : 0;
/*
** Move the current file offset to a legal position if necessary and the
** file was open.
*/
if (Is_Open()) {
RawFileMClass::Seek(0, SEEK_SET);
}
}
/***********************************************************************************************
* RawFileMClass::Raw_Seek -- Performs a seek on the unbiased file *
* *
* This will perform a seek on the file as if it were unbiased. This is in spite of any *
* bias setting the file may have. The ability to perform a raw seek in this fasion is *
* necessary to maintain the bias ability. *
* *
* INPUT: pos -- The position to seek the file relative to the "dir" parameter. *
* *
* dir -- The origin of the seek operation. *
* *
* OUTPUT: Returns with the new position of the seek operation. *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 08/04/1996 JLB : Created. *
*=============================================================================================*/
int RawFileMClass::Raw_Seek(int pos, int dir)
{
/*
** If the file isn't opened, then this is a fatal error condition.
*/
if (!Is_Open()) {
Error(EBADF, false, Filename);
}
switch (dir) {
case SEEK_SET:
dir = FILE_BEGIN;
break;
case SEEK_CUR:
dir = FILE_CURRENT;
break;
case SEEK_END:
dir = FILE_END;
break;
}
pos = SetFilePointer(Handle, pos, NULL, dir);
/*
** If there was an error in the seek, then bail with an error condition.
*/
if (pos == 0xFFFFFFFF) {
Error(GetLastError(), false, Filename);
}
/*
** Return with the new position of the file. This will range between zero and the number of
** bytes the file contains.
*/
return(pos);
}

324
Code/Tools/wdump/rawfilem.h Normal file
View File

@@ -0,0 +1,324 @@
/*
** 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 S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Command & Conquer *
* *
* $Archive:: /G/wdump/RAWFILEM.H $*
* *
* $Author:: Eric_c $*
* *
* $Modtime:: 7/28/97 3:36p $*
* *
* $Revision:: 3 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* RawFileMClass::File_Name -- Returns with the filename associate with the file object. *
* RawFileMClass::RawFileMClass -- Default constructor for a file object. *
* RawFileMClass::~RawFileMClass -- Default deconstructor for a file object. *
* RawFileMClass::Is_Open -- Checks to see if the file is open or not. *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef RAWFILEM_Hx
#define RAWFILEM_Hx
#include <errno.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include "win.h"
#define NULL_HANDLE INVALID_HANDLE_VALUE
#define HANDLE_TYPE HANDLE
#include "wwfile.h"
#ifdef NEVER
/*
** This is a duplicate of the error numbers. The error handler for the RawFileMClass handles
** these errors. If the error routine is overridden and additional errors are defined, then
** use numbers starting with 100. Note that these errors here are listed in numerical order.
** These errors are defined in the standard header file "ERRNO.H".
*/
EZERO, // Non-error.
EINVFNC, // Invalid function number.
ENOFILE, // File not found.
ENOENT=ENOFILE, // No such file or directory.
ENOPATH, // Path not found.
EMFILE, // Too many open files.
EACCES, // Permission denied.
EBADF, // Bad file number.
ECONTR, // Memory blocks destroyed.
ENOMEM, // Not enough core memory.
EINVMEM, // Invalid memory block address.
EINVENV, // Invalid environment.
EINVFMT, // Invalid format.
EINVACC, // Invalid access code.
EINVDAT, // Invalid data.
EFAULT, // Unknown error.
EINVDRV, // Invalid drive specified.
ENODEV=EINVDRV, // No such device.
ECURDIR, // Attempt to remove CurDir.
ENOTSAM, // Not same device.
ENMFILE, // No more files.
EINVAL, // Invalid argument.
E2BIG, // Argument list too long.
ENOEXEC, // exec format error.
EXDEV, // Cross-device link.
ENFILE, // Too many open files.
ECHILD, // No child process.
ENOTTY, // not used
ETXTBSY, // not used
EFBIG, // not used
ENOSPC, // No space left on device.
ESPIPE, // Illegal seek.
EROFS, // Read-only file system.
EMLINK, // not used
EPIPE, // Broken pipe.
EDOM, // Math argument.
ERANGE, // Result too large.
EEXIST, // File already exists.
EDEADLOCK, // Locking violation.
EPERM, // Operation not permitted.
ESRCH, // not used
EINTR, // Interrupted function call.
EIO, // Input/output error.
ENXIO, // No such device or address.
EAGAIN, // Resource temporarily unavailable.
ENOTBLK, // not used
EBUSY, // Resource busy.
ENOTDIR, // not used
EISDIR, // not used
EUCLEAN, // not used
#endif
#ifndef WWERROR
#define WWERROR -1
#endif
/*
** This is the definition of the raw file class. It is derived from the abstract base FileClass
** and handles the interface to the low level DOS routines. This is the first class in the
** chain of derived file classes that actually performs a useful function. With this class,
** I/O is possible. More sophisticated features, such as packed files, CD-ROM support,
** file caching, and XMS/EMS memory support, are handled by derived classes.
**
** Of particular importance is the need to override the error routine if more sophisticated
** error handling is required. This is more than likely if greater functionality is derived
** from this base class.
*/
class RawFileMClass : public FileClass
{
typedef FileClass BASECLASS;
public:
/*
** This is a record of the access rights used to open the file. These rights are
** used if the file object is duplicated.
*/
int Rights;
int Error_Number; // added by ehc to allow multithread library usage
RawFileMClass(char const *filename);
RawFileMClass(void);
RawFileMClass (RawFileMClass const & f);
RawFileMClass & operator = (RawFileMClass const & f);
virtual ~RawFileMClass(void);
virtual char const * File_Name(void) const;
virtual char const * Set_Name(char const *filename);
virtual int Create(void);
virtual int Delete(void);
virtual bool Is_Available(int forced=false);
virtual bool Is_Open(void) const;
virtual int Open(char const *filename, int rights=READ);
virtual int Open(int rights=READ);
virtual int Read(void *buffer, int size);
virtual int Seek(int pos, int dir=SEEK_CUR);
virtual int Size(void);
virtual int Write(void const *buffer, int size);
virtual void Close(void);
virtual unsigned long Get_Date_Time(void);
virtual bool Set_Date_Time(unsigned long datetime);
virtual void Error(int error, int canretry = false, char const * filename=NULL);
void Bias(int start, int length=-1);
HANDLE_TYPE Get_File_Handle(void) { return (Handle); };
/*
** These bias values enable a sub-portion of a file to appear as if it
** were the whole file. This comes in very handy for multi-part files such as
** mixfiles.
*/
int BiasStart;
int BiasLength;
protected:
/*
** This function returns the largest size a low level DOS read or write may
** perform. Larger file transfers are performed in chunks of this size or less.
*/
int Transfer_Block_Size(void) {return (int)((unsigned)UINT_MAX)-16L;};
int Raw_Seek(int pos, int dir=SEEK_CUR);
private:
/*
** This is the low level DOS handle. A -1 indicates an empty condition.
*/
HANDLE_TYPE Handle;
/*
** This points to the filename as a NULL terminated string. It may point to either a
** constant or an allocated string as indicated by the "Allocated" flag.
*/
char const * Filename;
//
// file date and time are in the following formats:
//
// date bits 0-4 day (0-31)
// bits 5-8 month (1-12)
// bits 9-15 year (0-119 representing 1980-2099)
//
// time bits 0-4 second/2 (0-29)
// bits 5-10 minutes (0-59)
// bits 11-15 hours (0-23)
//
unsigned short Date;
unsigned short Time;
/*
** Filenames that were assigned as part of the construction process
** are not allocated. It is assumed that the filename string is a
** constant in that case and thus making duplication unnecessary.
** This value will be non-zero if the filename has be allocated
** (using strdup()).
*/
bool Allocated;
};
/***********************************************************************************************
* RawFileMClass::File_Name -- Returns with the filename associate with the file object. *
* *
* Use this routine to determine what filename is associated with this file object. If no *
* filename has yet been assigned, then this routing will return NULL. *
* *
* INPUT: none *
* *
* OUTPUT: Returns with a pointer to the file name associated with this file object or NULL *
* if one doesn't exist. *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
inline char const * RawFileMClass::File_Name(void) const
{
return(Filename);
}
/***********************************************************************************************
* RawFileMClass::RawFileMClass -- Default constructor for a file object. *
* *
* This constructs a null file object. A null file object has no file handle or filename *
* associated with it. In order to use a file object created in this fashion it must be *
* assigned a name and then opened. *
* *
* INPUT: none *
* *
* OUTPUT: none *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
inline RawFileMClass::RawFileMClass(void) :
Rights(READ),
BiasStart(0),
BiasLength(-1),
Handle(INVALID_HANDLE_VALUE),
Filename(0),
Date(0),
Time(0),
Allocated(false)
{
}
/***********************************************************************************************
* RawFileMClass::~RawFileMClass -- Default deconstructor for a file object. *
* *
* This constructs a null file object. A null file object has no file handle or filename *
* associated with it. In order to use a file object created in this fashion it must be *
* assigned a name and then opened. *
* *
* INPUT: none *
* *
* OUTPUT: none *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
inline RawFileMClass::~RawFileMClass(void)
{
Close();
if (Allocated && Filename) {
free((char *)Filename);
Filename = NULL;
Allocated = false;
}
}
/***********************************************************************************************
* RawFileMClass::Is_Open -- Checks to see if the file is open or not. *
* *
* Use this routine to determine if the file is open. It returns true if it is. *
* *
* INPUT: none *
* *
* OUTPUT: bool; Is the file open? *
* *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 10/18/1994 JLB : Created. *
*=============================================================================================*/
inline bool RawFileMClass::Is_Open(void) const
{
return(Handle != INVALID_HANDLE_VALUE);
}
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,13 @@
//
// WDUMP.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...
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,24 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by wdump.rc
//
#define IDD_ABOUTBOX 100
#define IDR_MAINFRAME 128
#define IDR_WDUMPTYPE 129
#define IDD_TOOLS_FIND 130
#define IDC_FIND_STRING 1000
#define IDC_FIND_WHAT 1002
#define IDM_TOOLS_FIND 32771
#define IDM_TOOLS_FIND_NEXT 32772
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32774
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,24 @@
/*
** 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
// wdump.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

50
Code/Tools/wdump/stdafx.h Normal file
View File

@@ -0,0 +1,50 @@
/*
** 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__41C157E9_5631_11D1_8CDB_006097C6A583__INCLUDED_)
#define AFX_STDAFX_H__41C157E9_5631_11D1_8CDB_006097C6A583__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
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcview.h> // treeview class
#include <afxtempl.h> // CList class
#include <afxdlgs.h> // FileDialog class
#include "chunkio.h"
#include "vector3i.h"
#include "w3d_file.h"
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__41C157E9_5631_11D1_8CDB_006097C6A583__INCLUDED_)

View File

@@ -0,0 +1,144 @@
/*
** 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/>.
*/
// WDView.cpp : implementation file
//
#include "stdafx.h"
#include "wdump.h"
#include "WDEView.h"
#include "wdumpdoc.h"
#include "chunk_d.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWDumpEditView
IMPLEMENT_DYNCREATE(CWDumpEditView, CEditView)
CWDumpEditView::CWDumpEditView()
{
}
CWDumpEditView::~CWDumpEditView()
{
}
BEGIN_MESSAGE_MAP(CWDumpEditView, CEditView)
//{{AFX_MSG_MAP(CWDumpEditView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWDumpEditView drawing
void CWDumpEditView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CWDumpEditView diagnostics
#ifdef _DEBUG
void CWDumpEditView::AssertValid() const
{
CEditView::AssertValid();
}
void CWDumpEditView::Dump(CDumpContext& dc) const
{
CEditView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CWDumpEditView message handlers
void CWDumpEditView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// TODO: Add your specialized code here and/or call the base class
CEdit &edit = GetEditCtrl();
edit.SetReadOnly(TRUE);
CWdumpDoc *doc= (CWdumpDoc *) GetDocument();
ChunkItem *item = doc->m_ChunkItem;
if(item == 0) {
edit.SetWindowText("Load a chunk file and select the chunk in the tree view to see it's hex data here.");
return; // no selected chunk item, leave a clear screen.
}
char *text = Build_Hex_Text((unsigned char *) item->Data, item->Length);
edit.SetWindowText(text);
delete text;
}
char * CWDumpEditView::Build_Hex_Text(unsigned char * Source, int Length)
{
if(Source == 0) {
char *c = new char[256];
sprintf(c, "This chunk is a wrapper chunk for other chunks. It's total length is %d", Length);
return c;
}
int per_line = 16;
int lines = Length / per_line;
int buf_size = Length * 5 + per_line * 5;
char *buffer = new char[buf_size];
char *dest = buffer;
while(lines--) {
if(lines == 0) {
per_line = Length % per_line;
}
int counter = 0;
do {
sprintf(dest, "%02x ", Source[counter]);
dest += 3;
} while(++counter < per_line);
*dest++ = ' ';
*dest++ = ' ';
counter = 0;
do {
char c = Source[counter];
if(c >= 32 && c <= 192)
*dest++ = c;
else
*dest++ = '.';
} while(++counter < per_line);
*dest++ = '\r';
*dest++ = '\n';
Source += per_line;
}
*dest = 0;
return buffer;
}

View File

@@ -0,0 +1,73 @@
/*
** 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_WDVIEW_H__41C157F8_5631_11D1_8CDB_006097C6A583__INCLUDED_)
#define AFX_WDVIEW_H__41C157F8_5631_11D1_8CDB_006097C6A583__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// WDView.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CWDumpEditView view
class CWDumpEditView : public CEditView
{
protected:
CWDumpEditView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CWDumpEditView)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWDumpEditView)
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CWDumpEditView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
char * Build_Hex_Text(unsigned char *Source, int Length);
//{{AFX_MSG(CWDumpEditView)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WDVIEW_H__41C157F8_5631_11D1_8CDB_006097C6A583__INCLUDED_)

View File

@@ -0,0 +1,108 @@
/*
** 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/>.
*/
// WDLView.cpp : implementation file
//
#include "stdafx.h"
#include "wdump.h"
#include "WDLView.h"
#include "WDumpDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWDumpListView
IMPLEMENT_DYNCREATE(CWDumpListView, CListView)
CWDumpListView::CWDumpListView()
{
}
CWDumpListView::~CWDumpListView()
{
}
BEGIN_MESSAGE_MAP(CWDumpListView, CListView)
//{{AFX_MSG_MAP(CWDumpListView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWDumpListView drawing
void CWDumpListView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CWDumpListView diagnostics
#ifdef _DEBUG
void CWDumpListView::AssertValid() const
{
CListView::AssertValid();
}
void CWDumpListView::Dump(CDumpContext& dc) const
{
CListView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CWDumpListView message handlers
void CWDumpListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CListCtrl &list = GetListCtrl();
CWdumpDoc *doc= (CWdumpDoc *) GetDocument();
ChunkItem *item = doc->m_ChunkItem;
list.DeleteAllItems();
if((item != 0) && (item->Type != 0) && (item->Type->Callback != 0)) {
(*item->Type->Callback)(item, &list);
}
}
void CWDumpListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
CListCtrl &list = GetListCtrl();
long flags = list.GetStyle();
flags |= LVS_REPORT;
SetWindowLong(list.GetSafeHwnd(), GWL_STYLE, flags);
static LV_COLUMN Name_Column = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 230, "Name", 0,0 };
static LV_COLUMN Type_Column = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 70, "Type", 0,0 };
static LV_COLUMN Value_Column = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 300, "Value", 0,0 };
list.InsertColumn(0, &Name_Column);
list.InsertColumn(1, &Type_Column);
list.InsertColumn(2, &Value_Column);
}

View File

@@ -0,0 +1,74 @@
/*
** 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_WDLVIEW_H__6C0D7C07_56CD_11D1_8CDC_006097C6A583__INCLUDED_)
#define AFX_WDLVIEW_H__6C0D7C07_56CD_11D1_8CDC_006097C6A583__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// WDLView.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CWDumpListView view
class CWDumpListView : public CListView
{
protected:
CWDumpListView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CWDumpListView)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWDumpListView)
public:
virtual void OnInitialUpdate();
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CWDumpListView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CWDumpListView)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WDLVIEW_H__6C0D7C07_56CD_11D1_8CDC_006097C6A583__INCLUDED_)

View File

@@ -0,0 +1,296 @@
/*
** 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/>.
*/
// WDTView.cpp : implementation file
//
#include "stdafx.h"
#include "wdump.h"
#include "WDTView.h"
#include "wdumpdoc.h"
#include "chunk_d.h"
#include "finddialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWDumpTreeView
IMPLEMENT_DYNCREATE(CWDumpTreeView, CTreeView)
CWDumpTreeView::CWDumpTreeView()
{
}
CWDumpTreeView::~CWDumpTreeView()
{
}
BEGIN_MESSAGE_MAP(CWDumpTreeView, CTreeView)
//{{AFX_MSG_MAP(CWDumpTreeView)
ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
ON_COMMAND(IDM_TOOLS_FIND, OnToolsFind)
ON_COMMAND(IDM_TOOLS_FIND_NEXT, OnToolsFindNext)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWDumpTreeView drawing
void CWDumpTreeView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CWDumpTreeView diagnostics
#ifdef _DEBUG
void CWDumpTreeView::AssertValid() const
{
CTreeView::AssertValid();
}
void CWDumpTreeView::Dump(CDumpContext& dc) const
{
CTreeView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CWDumpTreeView message handlers
void CWDumpTreeView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// add all the chunk items to the view
CTreeCtrl &tree = GetTreeCtrl();
tree.DeleteAllItems();
long flags = tree.GetStyle();
flags |= TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_DISABLEDRAGDROP;
SetWindowLong(tree.GetSafeHwnd(), GWL_STYLE, flags);
CWdumpDoc *doc= (CWdumpDoc *) GetDocument();
ChunkData *data = &doc->m_ChunkData;
POSITION p = data->Chunks.GetHeadPosition();
while(p) {
ChunkItem *item = data->Chunks.GetNext(p);
InsertItem(item);
}
}
void CWDumpTreeView::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
CWdumpDoc *doc= (CWdumpDoc *) GetDocument();
doc->m_ChunkItem = (ChunkItem *) pNMTreeView->itemNew.lParam;
doc->UpdateAllViews(this);
*pResult = 0;
}
void CWDumpTreeView::InsertItem(ChunkItem * item, HTREEITEM Parent)
{
const char *name;
if(item->Type)
name = item->Type->Name;
else {
static char _buf[256];
sprintf(_buf,"Unknown: id=0x%X",item->ID);
name = _buf;
}
CTreeCtrl &tree = GetTreeCtrl();
HTREEITEM tree_item = tree.InsertItem(name, Parent);
tree.SetItem(tree_item, TVIF_PARAM,0,0,0,0,0, (long) item);
POSITION p = item->Chunks.GetHeadPosition();
while(p != 0) {
ChunkItem *subitem = item->Chunks.GetNext(p);
InsertItem(subitem, tree_item);
}
}
void CWDumpTreeView::OnToolsFind()
{
FindDialog finder;
if (finder.DoModal() == IDOK) {
// If there is a string go find it.
if (strlen (FindDialog::String()) > 0) {
OnToolsFindNext();
}
}
}
void CWDumpTreeView::OnToolsFindNext()
{
ChunkItem *matchedchunkitem;
// If no string go request one.
if (strlen (FindDialog::String()) == 0) {
OnToolsFind();
} else {
FindDialog::Found (false);
// Iterate over all chunks in the hierarchy. If a match is found select the tree
// item that corresponds to the matched chunk item.
{
CWaitCursor waitcursor;
HTREEITEM selectedtreeitem;
ChunkItem *selectedchunkitem;
SearchStateEnum searchstate;
CWdumpDoc *doc = (CWdumpDoc *) GetDocument();
ChunkData *data = &doc->m_ChunkData;
POSITION p;
// Get the currently selected chunk item.
selectedtreeitem = GetTreeCtrl().GetSelectedItem();
if (selectedtreeitem != NULL) {
selectedchunkitem = (ChunkItem*) GetTreeCtrl().GetItemData (selectedtreeitem);
searchstate = FIND_SELECTED_ITEM;
} else {
selectedchunkitem = NULL;
searchstate = FIND_STRING;
}
p = 0;
matchedchunkitem = NULL;
while (true) {
ChunkItem *chunkitem;
// Get the root chunk item.
if (p == 0) {
p = data->Chunks.GetHeadPosition();
if (p == 0) break;
}
chunkitem = data->Chunks.GetNext (p);
matchedchunkitem = FindChunkItem (selectedchunkitem, chunkitem, searchstate);
if ((matchedchunkitem != NULL) || (searchstate == SEARCH_WRAPPED)) break;
}
}
// Was a match found?
if (matchedchunkitem != NULL) {
SelectTreeItem (GetTreeCtrl().GetRootItem(), matchedchunkitem);
} else {
const char *controlstring = "Cannot find \"%s\".";
char *message;
message = new char [strlen (controlstring) + strlen (FindDialog::String())];
ASSERT (message != NULL);
sprintf (message, controlstring, FindDialog::String());
MessageBox (message, "Find String", MB_OK | MB_ICONEXCLAMATION);
delete [] message;
}
}
}
ChunkItem *CWDumpTreeView::FindChunkItem (ChunkItem *selectedchunkitem, ChunkItem *chunkitem, SearchStateEnum &searchstate)
{
// Searching for the currently selected item or looking for a match?
switch (searchstate) {
case FIND_SELECTED_ITEM:
// Searching for the currently selected chunk item.
if (chunkitem == selectedchunkitem) {
searchstate = FIND_STRING;
}
break;
case FIND_STRING:
// Searching for a string associated with the chunk item.
if (chunkitem == selectedchunkitem) {
searchstate = SEARCH_WRAPPED;
return (NULL);
} else {
if ((chunkitem != 0) && (chunkitem->Type != 0) && (chunkitem->Type->Callback != 0)) {
(*chunkitem->Type->Callback)(chunkitem, NULL);
}
if (FindDialog::Found()) return (chunkitem);
}
break;
case SEARCH_WRAPPED:
// This case should never occur at this point. As soon as it has been detected
// that the search has wrapped the stack should unwind immediately.
ASSERT (FALSE);
return (NULL);
break;
}
// Iterate over all chunks in the hierarchy. Return immediately if a match is found or if the search has wrapped.
POSITION p = chunkitem->Chunks.GetHeadPosition();
while (p != 0) {
ChunkItem *subchunkitem, *matchedchunkitem;
subchunkitem = chunkitem->Chunks.GetNext (p);
matchedchunkitem = FindChunkItem (selectedchunkitem, subchunkitem, searchstate);
if ((matchedchunkitem != NULL) || (searchstate == SEARCH_WRAPPED)) return (matchedchunkitem);
}
// No match found.
return (NULL);
}
void CWDumpTreeView::SelectTreeItem (HTREEITEM treeitem, ChunkItem *chunkitem)
{
CTreeCtrl &tree = GetTreeCtrl();
// Select a tree item that matches the given chunk item. Recurse if necessary.
while (treeitem != NULL) {
HTREEITEM subtreeitem;
if (tree.GetItemData (treeitem) == (DWORD) chunkitem) {
tree.SelectItem (treeitem);
}
subtreeitem = tree.GetChildItem (treeitem);
if (subtreeitem != NULL) {
SelectTreeItem (subtreeitem, chunkitem);
}
treeitem = tree.GetNextSiblingItem (treeitem);
}
}

View File

@@ -0,0 +1,85 @@
/*
** 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_WDTVIEW_H__41C157F7_5631_11D1_8CDB_006097C6A583__INCLUDED_)
#define AFX_WDTVIEW_H__41C157F7_5631_11D1_8CDB_006097C6A583__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// WDTView.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CWDumpTreeView view
class ChunkItem;
class CWDumpTreeView : public CTreeView
{
protected:
CWDumpTreeView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CWDumpTreeView)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWDumpTreeView)
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CWDumpTreeView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
enum SearchStateEnum {
FIND_SELECTED_ITEM,
FIND_STRING,
SEARCH_WRAPPED
};
void InsertItem(ChunkItem *item, HTREEITEM Parent = TVI_ROOT);
ChunkItem *FindChunkItem (ChunkItem *selectedchunkitem, ChunkItem *chunkitem, SearchStateEnum &searchstate);
void SelectTreeItem (HTREEITEM treeitem, ChunkItem *chunkitem);
//{{AFX_MSG(CWDumpTreeView)
afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnToolsFind();
afx_msg void OnToolsFindNext();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WDTVIEW_H__41C157F7_5631_11D1_8CDB_006097C6A583__INCLUDED_)

252
Code/Tools/wdump/wdump.cpp Normal file
View File

@@ -0,0 +1,252 @@
/*
** 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/>.
*/
// wdump.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "wdump.h"
#include "MainFrm.h"
#include "wdumpDoc.h"
#include "wdView.h"
#include "FCNTL.H"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWdumpApp
BEGIN_MESSAGE_MAP(CWdumpApp, CWinApp)
//{{AFX_MSG_MAP(CWdumpApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWdumpApp construction
CWdumpApp::CWdumpApp()
: DumpTextures(false), NoWindow(false), TextureDumpFile(0)
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CWdumpApp object
CWdumpApp theApp;
// private class declaration of a CCommandLineInfo class that knows about our special options
class CWDumpCommandLineInfo : public CCommandLineInfo
{
virtual void ParseParam(const TCHAR* pszParam,BOOL bFlag,BOOL bLast)
{
if (bFlag)
{
if(pszParam[0] == 't') {
theApp.DumpTextures = true;
ParseLast(bLast);
return;
}
if(pszParam[0] == 'q') {
theApp.NoWindow = true;
ParseLast(bLast);
return;
}
}
CCommandLineInfo::ParseParam(pszParam, bFlag, bLast);
}
};
/////////////////////////////////////////////////////////////////////////////
// CWdumpApp initialization
BOOL CWdumpApp::InitInstance()
{
// 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
// Change the registry key under which our settings are stored.
// You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Westwood Studios"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CWdumpDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CWdumpView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CWDumpCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// note: if any other dump types are enabled, they should probably open different files.
if(DumpTextures) {
TextureDumpFile = fopen("textures.txt", "a");
}
if(NoWindow) {
if(cmdInfo.m_nShellCommand == CWDumpCommandLineInfo::FileOpen) {
const char *c = strrchr(cmdInfo.m_strFileName, '\\');
if(c == 0)
c = (LPCTSTR) cmdInfo.m_strFileName;
if(*c == '\\')
c++;
Filename = c;
/* STARTUPINFO info;
GetStartupInfo(&info);
if(info.hStdOutput == NULL) {
AllocConsole(); // Allocate console window
freopen("CONOUT$", "a", stdout);
freopen("CONIN$", "r", stdin);
} else {
int CrtInput;
int CrtOutput;
if ( (CrtInput =_open_osfhandle((long) info.hStdInput, _O_RDONLY)) != -1) {
if ( (CrtOutput = _open_osfhandle((long) info.hStdOutput, _O_APPEND)) != -1) {
_dup2( CrtInput, 0);
_dup2( CrtOutput, 1);
}
}
// stdin = (struct _iobuf * ) info.hStdInput;
// stdout = (struct _iobuf * ) info.hStdOutput;
}
*/
CWdumpDoc *doc = (CWdumpDoc *) pDocTemplate->OpenDocumentFile(cmdInfo.m_strFileName, FALSE);
/* if(info.hStdOutput == NULL) {
printf("Press return to close this window..");
getchar();
FreeConsole();
}
*/
CloseAllDocuments(TRUE);
PostQuitMessage(0);
return TRUE;
}
}
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
POSITION p = pDocTemplate->GetFirstDocPosition();
CWdumpDoc *doc = (CWdumpDoc *) pDocTemplate->GetNextDoc(p);
doc->UpdateAllViews(0);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CWdumpApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CWdumpApp commands

251
Code/Tools/wdump/wdump.dsp Normal file
View File

@@ -0,0 +1,251 @@
# Microsoft Developer Studio Project File - Name="wdump" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=wdump - 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 "wdump.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 "wdump.mak" CFG="wdump - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wdump - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "wdump - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "wdump - Win32 Profile" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/G/wdump", JDKAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "wdump - 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 6
# 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 /MD /W3 /GX /O2 /I "..\..\ww3d2" /I "..\..\wwlib" /I "..\..\wwmath" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "G_CODE_BASE" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 wwlib.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcd.lib" /libpath:"..\libs\release" /libpath:"..\..\libs\release"
!ELSEIF "$(CFG)" == "wdump - 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 6
# 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 /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\ww3d2" /I "..\..\wwlib" /I "..\..\wwmath" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "G_CODE_BASE" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 wwlib.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /libpath:"..\libs\debug" /libpath:"..\..\libs\debug"
# SUBTRACT LINK32 /incremental:no
!ELSEIF "$(CFG)" == "wdump - Win32 Profile"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "wdump___"
# PROP BASE Intermediate_Dir "wdump___"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Profile"
# PROP Intermediate_Dir "Profile"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\ww3d" /I "..\..\library" /I "..\ww3d" /I "..\library" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "G_CODE_BASE" /FR /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\ww3d2" /I "..\..\wwlib" /I "..\..\wwmath" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "G_CODE_BASE" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 library.lib ww3d.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcd.lib" /libpath:"..\libs\release" /libpath:"..\..\libs\release"
# ADD LINK32 wwlib.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /libpath:"..\libs\profile" /libpath:"..\..\libs\profile"
!ENDIF
# Begin Target
# Name "wdump - Win32 Release"
# Name "wdump - Win32 Debug"
# Name "wdump - Win32 Profile"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Chunk_D.cpp
# End Source File
# Begin Source File
SOURCE=.\FindDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\MainFrm.cpp
# End Source File
# Begin Source File
SOURCE=.\RawfileM.cpp
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\WDEView.cpp
# End Source File
# Begin Source File
SOURCE=.\WDLView.cpp
# End Source File
# Begin Source File
SOURCE=.\WDTView.cpp
# End Source File
# Begin Source File
SOURCE=.\wdump.cpp
# End Source File
# Begin Source File
SOURCE=.\wdump.rc
# End Source File
# Begin Source File
SOURCE=.\wdumpDoc.cpp
# End Source File
# Begin Source File
SOURCE=.\wdView.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Chunk_D.h
# End Source File
# Begin Source File
SOURCE=.\FindDialog.h
# End Source File
# Begin Source File
SOURCE=.\MainFrm.h
# End Source File
# Begin Source File
SOURCE=.\RawfileM.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=.\WDEView.h
# End Source File
# Begin Source File
SOURCE=.\WDLView.h
# End Source File
# Begin Source File
SOURCE=.\WDTView.h
# End Source File
# Begin Source File
SOURCE=.\wdump.h
# End Source File
# Begin Source File
SOURCE=.\wdumpDoc.h
# End Source File
# Begin Source File
SOURCE=.\wdView.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\Toolbar.bmp
# End Source File
# Begin Source File
SOURCE=.\res\wdump.ico
# End Source File
# Begin Source File
SOURCE=.\res\wdump.rc2
# End Source File
# Begin Source File
SOURCE=.\res\wdumpDoc.ico
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

73
Code/Tools/wdump/wdump.h Normal file
View File

@@ -0,0 +1,73 @@
/*
** 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/>.
*/
// wdump.h : main header file for the WDUMP application
//
#if !defined(AFX_WDUMP_H__41C157E7_5631_11D1_8CDB_006097C6A583__INCLUDED_)
#define AFX_WDUMP_H__41C157E7_5631_11D1_8CDB_006097C6A583__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
/////////////////////////////////////////////////////////////////////////////
// CWdumpApp:
// See wdump.cpp for the implementation of this class
//
class CWdumpApp : public CWinApp
{
public:
CWdumpApp();
bool DumpTextures; // output texture usage to stdout
bool NoWindow; // don't open window
CString Filename;
FILE * TextureDumpFile;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWdumpApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CWdumpApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
extern CWdumpApp theApp;
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WDUMP_H__41C157E7_5631_11D1_8CDB_006097C6A583__INCLUDED_)

391
Code/Tools/wdump/wdump.rc Normal file
View File

@@ -0,0 +1,391 @@
//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
/////////////////////////////////////////////////////////////////////////////
// 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
#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_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\r\n"
"#include ""res\\wdump.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\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\\wdump.ico"
IDR_WDUMPTYPE ICON DISCARDABLE "res\\wdumpDoc.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
BEGIN
BUTTON ID_FILE_OPEN
SEPARATOR
BUTTON ID_APP_ABOUT
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
MENUITEM SEPARATOR
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
MENUITEM "S&plit", ID_WINDOW_SPLIT
END
POPUP "Tools"
BEGIN
MENUITEM "Find...", IDM_TOOLS_FIND
MENUITEM "Find Next\tF3", IDM_TOOLS_FIND_NEXT
END
POPUP "&Help"
BEGIN
MENUITEM "&About wdump...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
VK_F3, IDM_TOOLS_FIND_NEXT, VIRTKEY, NOINVERT
VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Westwood 3D File Viewer"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "Westwood 3D File Viewer v3.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 1997 Westwood Studios",IDC_STATIC,40,24,
119,8
DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP
LTEXT "Written by Eric Cosky, Greg Hjelstrom",IDC_STATIC,40,39,
119,8,SS_NOPREFIX
END
IDD_TOOLS_FIND DIALOG DISCARDABLE 0, 0, 245, 62
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Find String"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_FIND_STRING,65,22,100,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "Find Next",IDOK,188,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,188,24,50,14
LTEXT "Find what:",IDC_FIND_WHAT,17,26,34,8
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
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", "\0"
VALUE "FileDescription", "wdump MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "wdump\0"
VALUE "LegalCopyright", "Copyright (C) 1997\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "wdump.EXE\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "wdump Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\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_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 210
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_TOOLS_FIND, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 238
TOPMARGIN, 7
BOTTOMMARGIN, 55
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "wdump\n\nWdump\n\n\nWdump.Document\nWdump Document"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "WDump"
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_EXT "EXT"
ID_INDICATOR_CAPS "CAP"
ID_INDICATOR_NUM "NUM"
ID_INDICATOR_SCRL "SCRL"
ID_INDICATOR_OVR "OVR"
ID_INDICATOR_REC "REC"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_NEW "Create a new document\nNew"
ID_FILE_OPEN "Open an existing document\nOpen"
ID_FILE_CLOSE "Close the active document\nClose"
ID_FILE_SAVE "Save the active document\nSave"
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_MRU_FILE1 "Open this document"
ID_FILE_MRU_FILE2 "Open this document"
ID_FILE_MRU_FILE3 "Open this document"
ID_FILE_MRU_FILE4 "Open this document"
ID_FILE_MRU_FILE5 "Open this document"
ID_FILE_MRU_FILE6 "Open this document"
ID_FILE_MRU_FILE7 "Open this document"
ID_FILE_MRU_FILE8 "Open this document"
ID_FILE_MRU_FILE9 "Open this document"
ID_FILE_MRU_FILE10 "Open this document"
ID_FILE_MRU_FILE11 "Open this document"
ID_FILE_MRU_FILE12 "Open this document"
ID_FILE_MRU_FILE13 "Open this document"
ID_FILE_MRU_FILE14 "Open this document"
ID_FILE_MRU_FILE15 "Open this document"
ID_FILE_MRU_FILE16 "Open this document"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_CLEAR "Erase the selection\nErase"
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
ID_EDIT_FIND "Find the specified text\nFind"
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
ID_EDIT_UNDO "Undo the last action\nUndo"
ID_EDIT_REDO "Redo the previously undone action\nRedo"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Change the window size"
AFX_IDS_SCMOVE "Change the window position"
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE DISCARDABLE
BEGIN
IDM_TOOLS_FIND "Find first occurence of a string in the Value field"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#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
#include "res\wdump.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,135 @@
/*
** 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/>.
*/
// wdumpDoc.cpp : implementation of the CWdumpDoc class
//
#include "stdafx.h"
#include "wdump.h"
#include "wdumpDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWdumpDoc
IMPLEMENT_DYNCREATE(CWdumpDoc, CDocument)
BEGIN_MESSAGE_MAP(CWdumpDoc, CDocument)
//{{AFX_MSG_MAP(CWdumpDoc)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWdumpDoc construction/destruction
CWdumpDoc::CWdumpDoc()
{
// TODO: add one-time construction code here
m_ChunkItem = 0;
}
CWdumpDoc::~CWdumpDoc()
{
}
BOOL CWdumpDoc::OnNewDocument()
{
m_ChunkItem = 0;
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CWdumpDoc serialization
void CWdumpDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
Read_File(ar.m_strFileName);
}
}
/////////////////////////////////////////////////////////////////////////////
// CWdumpDoc diagnostics
#ifdef _DEBUG
void CWdumpDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CWdumpDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CWdumpDoc commands
void CWdumpDoc::OnFileOpen()
{
static char szFilter[] = "W3D Files (*.w3d)|*.w3d|WLT Files (*.wlt)|*.wlt|WHT Files (*.wht)|*.wht|WHA Files (*.wha)|*.wha|WTM Files (*.wtm)|*.wtm|All Files (*.*)|*.*||";
CFileDialog f( true,
NULL,
NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
szFilter);
if(f.DoModal() != IDOK) return;
// Add this filename to recent file list (MRU).
// NOTE: This call is not made by the framework.
//Moumine 1/2/2002 1:10:02 PM -- Project W3DShellExt needs to leave this out
#if ! defined _W3DSHELLEXT
theApp.AddToRecentFileList (f.m_ofn.lpstrFile);
#endif
m_ChunkItem = 0;
UpdateAllViews(0);
Read_File(f.m_ofn.lpstrFile);
}
void CWdumpDoc::Read_File(const char *filename)
{
m_ChunkData.Load(filename);
m_ChunkItem = 0;
UpdateAllViews(0);
}

View File

@@ -0,0 +1,83 @@
/*
** 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/>.
*/
// wdumpDoc.h : interface of the CWdumpDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_WDUMPDOC_H__41C157ED_5631_11D1_8CDB_006097C6A583__INCLUDED_)
#define AFX_WDUMPDOC_H__41C157ED_5631_11D1_8CDB_006097C6A583__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "chunk_d.h"
class CWdumpDoc : public CDocument
{
//Moumine 1/2/2002 11:12:25 AM ---Need this as public in project W3dShellExt
#if ! defined _W3DSHELLEXT
protected: // create from serialization only
#else
public:
#endif
CWdumpDoc();
protected:
DECLARE_DYNCREATE(CWdumpDoc)
void Read_File(const char *filename);
// Attributes
public:
ChunkData m_ChunkData;
ChunkItem *m_ChunkItem;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWdumpDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CWdumpDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CWdumpDoc)
afx_msg void OnFileOpen();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WDUMPDOC_H__41C157ED_5631_11D1_8CDB_006097C6A583__INCLUDED_)

100
Code/Tools/wdump/wdview.cpp Normal file
View File

@@ -0,0 +1,100 @@
/*
** 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/>.
*/
// wdumpView.cpp : implementation of the CWdumpView class
//
#include "stdafx.h"
#include "wdump.h"
#include "wdumpDoc.h"
#include "wdView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWdumpView
IMPLEMENT_DYNCREATE(CWdumpView, CView)
BEGIN_MESSAGE_MAP(CWdumpView, CView)
//{{AFX_MSG_MAP(CWdumpView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWdumpView construction/destruction
CWdumpView::CWdumpView()
{
// TODO: add construction code here
}
CWdumpView::~CWdumpView()
{
}
BOOL CWdumpView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CWdumpView drawing
void CWdumpView::OnDraw(CDC* pDC)
{
CWdumpDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CWdumpView diagnostics
#ifdef _DEBUG
void CWdumpView::AssertValid() const
{
CView::AssertValid();
}
void CWdumpView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CWdumpDoc* CWdumpView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWdumpDoc)));
return (CWdumpDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CWdumpView message handlers

81
Code/Tools/wdump/wdview.h Normal file
View File

@@ -0,0 +1,81 @@
/*
** 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/>.
*/
// wdumpView.h : interface of the CWdumpView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_WDUMPVIEW_H__41C157EF_5631_11D1_8CDB_006097C6A583__INCLUDED_)
#define AFX_WDUMPVIEW_H__41C157EF_5631_11D1_8CDB_006097C6A583__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CWdumpView : public CView
{
protected: // create from serialization only
CWdumpView();
DECLARE_DYNCREATE(CWdumpView)
// Attributes
public:
CWdumpDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWdumpView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CWdumpView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CWdumpView)
// 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()
};
#ifndef _DEBUG // debug version in wdumpView.cpp
inline CWdumpDoc* CWdumpView::GetDocument()
{ return (CWdumpDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WDUMPVIEW_H__41C157EF_5631_11D1_8CDB_006097C6A583__INCLUDED_)