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,279 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkDataView.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// ChunkDataView.cpp : implementation file
//
#include "stdafx.h"
#include "ChunkView.h"
#include "ChunkDataView.h"
#include "ChunkViewDoc.h"
#include "ChunkFileImage.h"
#include "HexToString.h"
#include <assert.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChunkDataView
IMPLEMENT_DYNCREATE(CChunkDataView, CListView)
CChunkDataView::CChunkDataView() :
WordSize(WORD_SIZE_BYTE),
DisplayMode(DISPLAY_MODE_HEX)
{
}
CChunkDataView::~CChunkDataView()
{
}
BEGIN_MESSAGE_MAP(CChunkDataView, CListView)
//{{AFX_MSG_MAP(CChunkDataView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChunkDataView drawing
void CChunkDataView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CChunkDataView diagnostics
#ifdef _DEBUG
void CChunkDataView::AssertValid() const
{
CListView::AssertValid();
}
void CChunkDataView::Dump(CDumpContext& dc) const
{
CListView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChunkDataView message handlers
void CChunkDataView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
CListCtrl &list = GetListCtrl();
long flags = list.GetStyle();
flags |= LVS_REPORT;
SetWindowLong(list.GetSafeHwnd(), GWL_STYLE, flags);
//list.SetFont ();
::SendMessage (list, WM_SETFONT, (WPARAM)GetStockObject (ANSI_FIXED_FONT), 0L);
}
void CChunkDataView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
if (this == pSender) return;
// Get the document and currently selected chunk
CListCtrl &list = GetListCtrl();
CChunkViewDoc * doc= (CChunkViewDoc *)GetDocument();
const ChunkImageClass * chunk = doc->Get_Cur_Chunk();
// Reset the list
list.DeleteAllItems();
// Rebuild the list view
if (chunk != NULL) {
Display_Chunk(chunk);
}
}
void CChunkDataView::Display_Chunk(const ChunkImageClass * chunk)
{
CListCtrl &list = GetListCtrl();
CChunkViewDoc * doc= (CChunkViewDoc *)GetDocument();
if (chunk->Get_Data() == NULL) {
Display_Chunk_Sub_Chunks(chunk);
} else {
switch (DisplayMode) {
case DISPLAY_MODE_HEX:
Display_Chunk_Hex(chunk);
break;
case DISPLAY_MODE_MICROCHUNKS:
Display_Chunk_Micro_Chunks(chunk);
break;
};
}
}
void CChunkDataView::Display_Chunk_Sub_Chunks(const ChunkImageClass * chunk)
{
char _buf[256];
Reset_Columns();
CListCtrl &list = GetListCtrl();
static LV_COLUMN IDColumn = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 160, "Chunk ID", 0,0 };
static LV_COLUMN LengthColumn = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 160, "Chunk Length", 0,0 };
list.InsertColumn(0, &IDColumn);
list.InsertColumn(1, &LengthColumn);
for (int i=0; i<chunk->Get_Child_Count(); i++) {
const ChunkImageClass * child = chunk->Get_Child(i);
sprintf(_buf,"0x%08X",child->Get_ID());
int list_item = list.InsertItem(i, _buf);
sprintf(_buf,"0x%08X",child->Get_Length());
list.SetItemText(list_item, 1, _buf);
}
}
void CChunkDataView::Display_Chunk_Hex(const ChunkImageClass * chunk)
{
Reset_Columns();
CListCtrl &list = GetListCtrl();
static LV_COLUMN HexColumn = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 750, "Hex Dump", 0,0 };
list.InsertColumn(0, &HexColumn);
HexToStringClass * hexconverter = Create_Hex_Converter(chunk->Get_Data(),chunk->Get_Length());
assert(hexconverter != NULL);
int rowcounter = 0;
while (!hexconverter->Is_Done()) {
list.InsertItem(rowcounter++,hexconverter->Get_Next_Line());
}
Destroy_Hex_Converter(hexconverter);
}
void CChunkDataView::Display_Chunk_Micro_Chunks(const ChunkImageClass * chunk)
{
Reset_Columns();
CListCtrl &list = GetListCtrl();
static LV_COLUMN IDColumn = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 48, "ID", 0,0 };
static LV_COLUMN LengthColumn = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 48, "Size", 0,0 };
static LV_COLUMN DataColumn = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 750, "Micro Chunk Data", 0,0 };
list.InsertColumn(0, &IDColumn);
list.InsertColumn(1, &LengthColumn);
list.InsertColumn(2, &DataColumn);
int rowcounter = 0;
const uint8 * workptr = chunk->Get_Data();
static char _buf[256];
while (workptr < chunk->Get_Data() + chunk->Get_Length()) {
uint8 micro_id = *workptr++;
uint8 micro_size = *workptr++;
// Add a line for the id
CString tmp_string;
tmp_string.Format("%02x",micro_id);
int list_item = list.InsertItem(rowcounter++, tmp_string);
// Set the size (second column)
tmp_string.Format("%02x",micro_size);
list.SetItemText(list_item, 1, tmp_string);
// Set the first line of hex data
HexToStringClass * hexconverter = Create_Hex_Converter(workptr,micro_size);
tmp_string = hexconverter->Get_Next_Line();
list.SetItemText(list_item, 2, tmp_string);
while (!hexconverter->Is_Done()) {
tmp_string = hexconverter->Get_Next_Line();
list_item = list.InsertItem(rowcounter++, "");
list.SetItemText(list_item, 2, tmp_string);
}
workptr += micro_size;
Destroy_Hex_Converter(hexconverter);
}
}
void CChunkDataView::Reset_Columns(void)
{
CListCtrl &list = GetListCtrl();
BOOL hascolumns = TRUE;
while (hascolumns) {
hascolumns = list.DeleteColumn(0);
}
}
HexToStringClass * CChunkDataView::Create_Hex_Converter(const uint8 * data,const uint32 size)
{
HexToStringClass * hexconv = NULL;
switch(WordSize) {
case WORD_SIZE_LONG:
hexconv = new HexToStringLongClass(data,size);
break;
case WORD_SIZE_SHORT:
hexconv = new HexToStringShortClass(data,size);
break;
default:
hexconv = new HexToStringByteClass(data,size);
break;
}
return hexconv;
}
void CChunkDataView::Destroy_Hex_Converter(HexToStringClass * hexconv)
{
assert(hexconv != NULL);
delete hexconv;
}

View File

@@ -0,0 +1,128 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkDataView.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#if !defined(AFX_CHUNKDATAVIEW_H__FD83E2D7_72AE_11D3_BB4D_00902742EA14__INCLUDED_)
#define AFX_CHUNKDATAVIEW_H__FD83E2D7_72AE_11D3_BB4D_00902742EA14__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ChunkDataView.h : header file
//
#include "bittype.h"
class ChunkImageClass;
class HexToStringClass;
/////////////////////////////////////////////////////////////////////////////
// CChunkDataView view
class CChunkDataView : public CListView
{
protected:
CChunkDataView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CChunkDataView)
// Attributes
public:
enum WordSizeType
{
WORD_SIZE_BYTE = 0,
WORD_SIZE_SHORT = 1,
WORD_SIZE_LONG = 2
};
enum DisplayModeType
{
DISPLAY_MODE_HEX = 0,
DISPLAY_MODE_MICROCHUNKS,
};
void Set_Word_Size(WordSizeType wordsize) { WordSize = wordsize; OnUpdate(NULL,0,NULL); }
WordSizeType Get_Word_Size(void) { return WordSize; }
void Set_Display_Mode(DisplayModeType displaymode) { DisplayMode = displaymode; OnUpdate(NULL,0,NULL); }
DisplayModeType Get_Display_Mode(void) { return DisplayMode; }
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChunkDataView)
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 ~CChunkDataView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
void Display_Chunk(const ChunkImageClass * chunk);
void Display_Chunk_Sub_Chunks(const ChunkImageClass * chunk);
void Display_Chunk_Hex(const ChunkImageClass * chunk);
void Display_Chunk_Micro_Chunks(const ChunkImageClass * chunk);
void Reset_Columns(void);
HexToStringClass * Create_Hex_Converter(const uint8 * data,const uint32 size);
void Destroy_Hex_Converter(HexToStringClass * hexconv);
DisplayModeType DisplayMode;
WordSizeType WordSize;
// Generated message map functions
protected:
//{{AFX_MSG(CChunkDataView)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHUNKDATAVIEW_H__FD83E2D7_72AE_11D3_BB4D_00902742EA14__INCLUDED_)

View File

@@ -0,0 +1,223 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkFileImage.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "stdafx.h"
#include <assert.h>
#include "ChunkFileImage.h"
#include "rawfile.h"
#include "chunkio.h"
ChunkFileImageClass::ChunkFileImageClass(void) :
RootNode(NULL)
{
}
ChunkFileImageClass::~ChunkFileImageClass(void)
{
Reset();
}
void ChunkFileImageClass::Reset(void)
{
// have to handle the fact that there isn't one root node,
ChunkImageClass * node_to_delete = RootNode;
while (node_to_delete) {
ChunkImageClass * sibling = node_to_delete->Sibling;
delete node_to_delete;
node_to_delete = sibling;
}
}
void ChunkFileImageClass::Load(const char * filename)
{
RawFileClass file(filename);
file.Open();
ChunkLoadClass cload(&file);
cload.Open_Chunk();
RootNode = new ChunkImageClass;
RootNode->Load(cload);
cload.Close_Chunk();
// while we have more top-level chunks, load them and link them
// to the root through its sibling pointer
while (cload.Open_Chunk()) {
ChunkImageClass * root_sibling = new ChunkImageClass;
root_sibling->Load(cload);
RootNode->Add_Sibling(root_sibling);
cload.Close_Chunk();
}
file.Close();
}
ChunkImageClass::ChunkImageClass(void) :
Child(NULL),
Sibling(NULL),
Data(NULL),
ID(0),
Length(0)
{
}
ChunkImageClass::~ChunkImageClass(void)
{
// Delete our children
ChunkImageClass * child = Child;
while (child) {
ChunkImageClass * child_sibling = child->Sibling;
delete child;
child = child_sibling;
}
// Delete our data
if (Data != NULL) {
delete Data;
}
}
void ChunkImageClass::Load(ChunkLoadClass & cload)
{
ID = cload.Cur_Chunk_ID();
Length = cload.Cur_Chunk_Length();
if (cload.Contains_Chunks()) {
while (cload.Open_Chunk()) {
ChunkImageClass * new_child = new ChunkImageClass;
new_child->Load(cload);
Add_Child(new_child);
cload.Close_Chunk();
}
} else {
if (Length > 0) {
Data = new uint8[Length];
cload.Read(Data,Length);
}
}
}
void ChunkImageClass::Add_Child(ChunkImageClass * new_child)
{
assert(new_child != NULL);
assert(new_child->Sibling == NULL);
// need to add to the tail...
if (Child == NULL) {
Child = new_child;
} else {
Child->Add_Sibling(new_child);
}
}
void ChunkImageClass::Add_Sibling(ChunkImageClass * new_sibling)
{
// Need to add to the tail so we display chunks in
// the same order they appear in the file, so we
// search for the tail.
ChunkImageClass * tail = this;
while (tail->Sibling != NULL) {
tail = tail->Sibling;
}
tail->Sibling = new_sibling;
assert(new_sibling->Sibling == NULL);
}
int ChunkImageClass::Get_Child_Count(void) const
{
int count = 0;
ChunkImageClass * child = Child;
while (child != NULL) {
count++;
child = child->Sibling;
}
return count;
}
const ChunkImageClass * ChunkImageClass::Get_Child(int i) const
{
int count = 0;
ChunkImageClass * child = Child;
while (child != NULL && count < i) {
count++;
child = child->Sibling;
}
assert(count == i);
return child;
}
int ChunkImageClass::Get_Sibling_Count(void) const
{
// NOTE: counts 'this' as a sibling.
int count = 0;
const ChunkImageClass * sibling = this;
while (sibling != NULL) {
count++;
sibling = sibling->Sibling;
}
return count;
}
const ChunkImageClass * ChunkImageClass::Get_Sibling(int i) const
{
// NOTE: sibling(0) is 'this' (just makes some other code simpler...)
int count = 0;
const ChunkImageClass * sibling = this;
while (sibling != NULL && count < i) {
count++;
sibling = sibling->Sibling;
}
assert(count == i);
return sibling;
}

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/>.
*/
/***********************************************************************************************
*** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkFileImage.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef CHUNKFILEIMAGE_H
#define CHUNKFILEIMAGE_H
#include "bittype.h"
class ChunkLoadClass;
class ChunkImageClass;
class ChunkFileImageClass
{
public:
ChunkFileImageClass(void);
~ChunkFileImageClass(void);
void Reset(void);
void Load(const char * filename);
const ChunkImageClass * Get_Root(void) const { return RootNode; }
protected:
ChunkImageClass * RootNode;
};
class ChunkImageClass
{
public:
ChunkImageClass(void);
~ChunkImageClass(void);
void Load(ChunkLoadClass & cload);
void Add_Child(ChunkImageClass * child);
uint32 Get_ID(void) const { return ID; }
uint32 Get_Length(void) const { return Length; }
const uint8 * Get_Data(void) const { return Data; }
int Get_Child_Count(void) const;
const ChunkImageClass * Get_Child(int i) const;
int Get_Sibling_Count(void) const;
const ChunkImageClass * Get_Sibling(int i) const;
protected:
void Add_Sibling(ChunkImageClass * sibling);
ChunkImageClass * Child;
ChunkImageClass * Sibling;
unsigned char * Data;
unsigned long ID;
unsigned long Length;
friend class ChunkFileImageClass;
};
#endif

View File

@@ -0,0 +1,145 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkTreeView.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// ChunkTreeView.cpp : implementation file
//
#include "stdafx.h"
#include "ChunkView.h"
#include "ChunkTreeView.h"
#include "ChunkViewDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChunkTreeView
IMPLEMENT_DYNCREATE(CChunkTreeView, CTreeView)
CChunkTreeView::CChunkTreeView()
{
}
CChunkTreeView::~CChunkTreeView()
{
}
BEGIN_MESSAGE_MAP(CChunkTreeView, CTreeView)
//{{AFX_MSG_MAP(CChunkTreeView)
ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChunkTreeView drawing
void CChunkTreeView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CChunkTreeView diagnostics
#ifdef _DEBUG
void CChunkTreeView::AssertValid() const
{
CTreeView::AssertValid();
}
void CChunkTreeView::Dump(CDumpContext& dc) const
{
CTreeView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChunkTreeView message handlers
void CChunkTreeView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// Reset the entire tree view
CTreeCtrl &tree = GetTreeCtrl();
tree.DeleteAllItems();
// Set the style attributes
long flags = tree.GetStyle();
flags |= TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_DISABLEDRAGDROP;
SetWindowLong(tree.GetSafeHwnd(), GWL_STYLE, flags);
// Get the chunk tree
CChunkViewDoc * doc = (CChunkViewDoc *)GetDocument();
const ChunkImageClass * chunk = doc->Get_File_Image().Get_Root();
// Build the tree control to reflect the chunk tree
for (int i=0; i<chunk->Get_Sibling_Count(); i++) {
Insert_Chunk(chunk->Get_Sibling(i));
}
}
void CChunkTreeView::Insert_Chunk(const ChunkImageClass * chunk, HTREEITEM Parent)
{
char name[256];
sprintf(name,"Chunk ID: 0x%08X Length: %d",chunk->Get_ID(),chunk->Get_Length());
CTreeCtrl &tree = GetTreeCtrl();
HTREEITEM tree_item = tree.InsertItem(name, Parent);
tree.SetItem(tree_item, TVIF_PARAM,0,0,0,0,0, (long) chunk);
for (int i=0; i<chunk->Get_Child_Count(); i++) {
Insert_Chunk(chunk->Get_Child(i),tree_item);
}
}
void CChunkTreeView::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
CChunkViewDoc * doc = (CChunkViewDoc *)GetDocument();
doc->Set_Cur_Chunk((ChunkImageClass *) pNMTreeView->itemNew.lParam);
doc->UpdateAllViews(this); // update all of the other views
*pResult = 0;
}

View File

@@ -0,0 +1,96 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkTreeView.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#if !defined(AFX_CHUNKTREEVIEW_H__FD83E2D6_72AE_11D3_BB4D_00902742EA14__INCLUDED_)
#define AFX_CHUNKTREEVIEW_H__FD83E2D6_72AE_11D3_BB4D_00902742EA14__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ChunkTreeView.h : header file
//
class ChunkImageClass;
/////////////////////////////////////////////////////////////////////////////
// CChunkTreeView view
class CChunkTreeView : public CTreeView
{
protected:
CChunkTreeView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CChunkTreeView)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChunkTreeView)
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 ~CChunkTreeView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
void Insert_Chunk(const ChunkImageClass * chunk, HTREEITEM Parent = TVI_ROOT);
// Generated message map functions
protected:
//{{AFX_MSG(CChunkTreeView)
afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHUNKTREEVIEW_H__FD83E2D6_72AE_11D3_BB4D_00902742EA14__INCLUDED_)

View File

@@ -0,0 +1,189 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkView.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// ChunkView.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "ChunkView.h"
#include "MainFrm.h"
#include "ChunkViewDoc.h"
#include "ChunkViewView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChunkViewApp
BEGIN_MESSAGE_MAP(CChunkViewApp, CWinApp)
//{{AFX_MSG_MAP(CChunkViewApp)
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()
/////////////////////////////////////////////////////////////////////////////
// CChunkViewApp construction
CChunkViewApp::CChunkViewApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CChunkViewApp object
CChunkViewApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CChunkViewApp initialization
BOOL CChunkViewApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(6); // 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(CChunkViewDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CChunkViewView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
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 CChunkViewApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CChunkViewApp message handlers

View File

@@ -0,0 +1,204 @@
# Microsoft Developer Studio Project File - Name="ChunkView" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=ChunkView - 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 "ChunkView.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 "ChunkView.mak" CFG="ChunkView - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ChunkView - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "ChunkView - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/Commando/Code/Tools/ChunkView", POHCAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "ChunkView - 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 "..\..\wwlib" /I "..\..\wwdebug" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /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 wwdebug.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\Libs\Release"
!ELSEIF "$(CFG)" == "ChunkView - 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 /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\wwlib" /I "..\..\wwdebug" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /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 wwdebug.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:"..\..\Libs\Debug"
!ENDIF
# Begin Target
# Name "ChunkView - Win32 Release"
# Name "ChunkView - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ChunkDataView.cpp
# End Source File
# Begin Source File
SOURCE=.\ChunkFileImage.cpp
# End Source File
# Begin Source File
SOURCE=.\ChunkTreeView.cpp
# End Source File
# Begin Source File
SOURCE=.\ChunkView.cpp
# End Source File
# Begin Source File
SOURCE=.\ChunkView.rc
# End Source File
# Begin Source File
SOURCE=.\ChunkViewDoc.cpp
# End Source File
# Begin Source File
SOURCE=.\ChunkViewView.cpp
# End Source File
# Begin Source File
SOURCE=.\HexToString.cpp
# End Source File
# Begin Source File
SOURCE=.\MainFrm.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ChunkDataView.h
# End Source File
# Begin Source File
SOURCE=.\ChunkFileImage.h
# End Source File
# Begin Source File
SOURCE=.\ChunkTreeView.h
# End Source File
# Begin Source File
SOURCE=.\ChunkView.h
# End Source File
# Begin Source File
SOURCE=.\ChunkViewDoc.h
# End Source File
# Begin Source File
SOURCE=.\ChunkViewView.h
# End Source File
# Begin Source File
SOURCE=.\HexToString.h
# End Source File
# Begin Source File
SOURCE=.\MainFrm.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\ChunkView.ico
# End Source File
# Begin Source File
SOURCE=.\res\ChunkView.rc2
# End Source File
# Begin Source File
SOURCE=.\res\ChunkViewDoc.ico
# End Source File
# Begin Source File
SOURCE=.\res\Toolbar.bmp
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,86 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkView.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// ChunkView.h : main header file for the CHUNKVIEW application
//
#if !defined(AFX_CHUNKVIEW_H__53C69A64_72AB_11D3_BB4D_00902742EA14__INCLUDED_)
#define AFX_CHUNKVIEW_H__53C69A64_72AB_11D3_BB4D_00902742EA14__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
/////////////////////////////////////////////////////////////////////////////
// CChunkViewApp:
// See ChunkView.cpp for the implementation of this class
//
class CChunkViewApp : public CWinApp
{
public:
CChunkViewApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChunkViewApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CChunkViewApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHUNKVIEW_H__53C69A64_72AB_11D3_BB4D_00902742EA14__INCLUDED_)

View File

@@ -0,0 +1,372 @@
//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_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\ChunkView.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\ChunkView.ico"
IDR_CHUNKVTYPE ICON DISCARDABLE "res\\ChunkViewDoc.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_MAINFRAME TOOLBAR DISCARDABLE 24, 24
BEGIN
BUTTON ID_FILE_OPEN
SEPARATOR
BUTTON ID_DISPLAY_HEX
BUTTON ID_DISPLAY_MICROCHUNKS
SEPARATOR
BUTTON ID_WORDMODE_BYTE
BUTTON ID_WORDMODE_SHORT
BUTTON ID_WORDMODE_LONG
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
END
POPUP "&Help"
BEGIN
MENUITEM "&About ChunkView...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"N", ID_FILE_NEW, VIRTKEY, CONTROL
"O", ID_FILE_OPEN, VIRTKEY, CONTROL
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
"X", ID_EDIT_CUT, VIRTKEY, CONTROL
"C", ID_EDIT_COPY, VIRTKEY, CONTROL
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
VK_F6, ID_NEXT_PANE, VIRTKEY
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About ChunkView"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "ChunkView Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 1999",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
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 "CompanyName", "\0"
VALUE "FileDescription", "ChunkView MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "ChunkView\0"
VALUE "LegalCopyright", "Copyright (C) 1999\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "ChunkView.EXE\0"
VALUE "ProductName", "ChunkView Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\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, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "ChunkView\n\nChunkV\n\n\nChunkView.Document\nChunkV Document"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "ChunkView"
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
ID_DISPLAY_HEX "Set the display mode to HEX"
ID_DISPLAY_MICROCHUNKS "Set the display mode to micro chunks"
ID_WORDMODE_LONG "Display hex data as longs"
ID_WORDMODE_SHORT "Display hex data as 16bit values"
ID_WORDMODE_BYTE "Display hex data as bytes"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\ChunkView.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,140 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkViewDoc.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// ChunkViewDoc.cpp : implementation of the CChunkViewDoc class
//
#include "stdafx.h"
#include "ChunkView.h"
#include "ChunkViewDoc.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChunkViewDoc
IMPLEMENT_DYNCREATE(CChunkViewDoc, CDocument)
BEGIN_MESSAGE_MAP(CChunkViewDoc, CDocument)
//{{AFX_MSG_MAP(CChunkViewDoc)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CChunkViewDoc construction/destruction
CChunkViewDoc::CChunkViewDoc() :
m_pCurChunk(NULL)
{
// TODO: add one-time construction code here
}
CChunkViewDoc::~CChunkViewDoc()
{
}
BOOL CChunkViewDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CChunkViewDoc serialization
void CChunkViewDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
}
else
{
m_ChunkFileImage.Load(ar.m_strFileName);
}
}
/////////////////////////////////////////////////////////////////////////////
// CChunkViewDoc diagnostics
#ifdef _DEBUG
void CChunkViewDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CChunkViewDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChunkViewDoc commands
const ChunkFileImageClass & CChunkViewDoc::Get_File_Image(void)
{
return m_ChunkFileImage;
}
void CChunkViewDoc::Set_Cur_Chunk(ChunkImageClass * cur_chunk)
{
// The ChunkTreeView calls this when the user clicks on a particular chunk
if (m_pCurChunk != cur_chunk) {
m_pCurChunk = cur_chunk;
}
}
const ChunkImageClass * CChunkViewDoc::Get_Cur_Chunk(void)
{
return m_pCurChunk;
}

View File

@@ -0,0 +1,103 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkViewDoc.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// ChunkViewDoc.h : interface of the CChunkViewDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHUNKVIEWDOC_H__53C69A6A_72AB_11D3_BB4D_00902742EA14__INCLUDED_)
#define AFX_CHUNKVIEWDOC_H__53C69A6A_72AB_11D3_BB4D_00902742EA14__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ChunkFileImage.h"
class CChunkViewDoc : public CDocument
{
protected: // create from serialization only
CChunkViewDoc();
DECLARE_DYNCREATE(CChunkViewDoc)
// Attributes
public:
// Operations
public:
const ChunkFileImageClass & Get_File_Image(void);
const ChunkImageClass * Get_Cur_Chunk(void);
void Set_Cur_Chunk(ChunkImageClass * cur_chunk);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChunkViewDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CChunkViewDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
ChunkFileImageClass m_ChunkFileImage;
ChunkImageClass * m_pCurChunk;
// Generated message map functions
protected:
//{{AFX_MSG(CChunkViewDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHUNKVIEWDOC_H__53C69A6A_72AB_11D3_BB4D_00902742EA14__INCLUDED_)

View File

@@ -0,0 +1,116 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkViewView.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// ChunkViewView.cpp : implementation of the CChunkViewView class
//
#include "stdafx.h"
#include "ChunkView.h"
#include "ChunkViewDoc.h"
#include "ChunkViewView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChunkViewView
IMPLEMENT_DYNCREATE(CChunkViewView, CView)
BEGIN_MESSAGE_MAP(CChunkViewView, CView)
//{{AFX_MSG_MAP(CChunkViewView)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CChunkViewView construction/destruction
CChunkViewView::CChunkViewView()
{
}
CChunkViewView::~CChunkViewView()
{
}
BOOL CChunkViewView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CChunkViewView drawing
void CChunkViewView::OnDraw(CDC* pDC)
{
CChunkViewDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CChunkViewView diagnostics
#ifdef _DEBUG
void CChunkViewView::AssertValid() const
{
CView::AssertValid();
}
void CChunkViewView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CChunkViewDoc* CChunkViewView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CChunkViewDoc)));
return (CChunkViewDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChunkViewView message handlers

View File

@@ -0,0 +1,101 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/ChunkViewView.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// ChunkViewView.h : interface of the CChunkViewView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHUNKVIEWVIEW_H__53C69A6C_72AB_11D3_BB4D_00902742EA14__INCLUDED_)
#define AFX_CHUNKVIEWVIEW_H__53C69A6C_72AB_11D3_BB4D_00902742EA14__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CChunkViewView : public CView
{
protected: // create from serialization only
CChunkViewView();
DECLARE_DYNCREATE(CChunkViewView)
// Attributes
public:
CChunkViewDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChunkViewView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CChunkViewView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CChunkViewView)
// 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 ChunkViewView.cpp
inline CChunkViewDoc* CChunkViewView::GetDocument()
{ return (CChunkViewDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHUNKVIEWVIEW_H__53C69A6C_72AB_11D3_BB4D_00902742EA14__INCLUDED_)

View File

@@ -0,0 +1,212 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/HexToString.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "stdafx.h"
#include "HexToString.h"
#include <ctype.h>
const int BYTES_PER_LINE = 16;
const int SHORTS_PER_LINE = 8;
const int LONGS_PER_LINE = 4;
HexToStringClass::HexToStringClass(const uint8 * data,uint32 size) :
Data(data),
Size(size)
{
}
/*******************************************************************************************
**
** HexToStringByteClass
**
*******************************************************************************************/
HexToStringByteClass::HexToStringByteClass(const uint8 * data,uint32 size) :
HexToStringClass(data,size)
{
Reset();
}
void HexToStringByteClass::Reset(void)
{
CurPos = Data;
}
bool HexToStringByteClass::Is_Done(void)
{
return CurPos >= Data + Size;
}
CString HexToStringByteClass::Get_Next_Line(void)
{
if (Is_Done()) return CString("");
int i;
CString line_string;
CString tmp_string;
const uint8 * workptr = CurPos;
uint32 offset = (uint32)(CurPos - Data);
int bytes_to_eat = min(BYTES_PER_LINE,Size - offset);
// print hex dump
line_string.Format("%08x: ",offset);
for (i=0; i<bytes_to_eat; i++) {
tmp_string.Format("%02X ",*workptr++);
line_string += tmp_string;
}
// print blanks at end of buffer
for (i=0; i<BYTES_PER_LINE - bytes_to_eat; i++)
{
line_string += CString(" ");
}
// spaces separate the hex from the characters
line_string += CString(" ");
workptr = CurPos;
// print the characters
for (i=0; i<bytes_to_eat; i++) {
if (isalnum(*workptr)) {
tmp_string.Format("%c",*workptr);
} else {
tmp_string.Format(".");
}
line_string += tmp_string;
workptr++;
}
CurPos = workptr;
return line_string;
}
/*******************************************************************************************
**
** HexToStringShortClass
**
*******************************************************************************************/
HexToStringShortClass::HexToStringShortClass(const uint8 * data,uint32 size) :
HexToStringClass(data,size)
{
// Round size down to the nearest word
Size &= ~1;
Reset();
}
void HexToStringShortClass::Reset(void)
{
CurPos = (uint16*)Data;
}
bool HexToStringShortClass::Is_Done(void)
{
uint32 offset = (uint32)((uint8*)CurPos - Data);
return offset >= Size;
}
CString HexToStringShortClass::Get_Next_Line(void)
{
if (Is_Done()) return CString("");
int i;
CString line_string;
CString tmp_string;
const uint16 * workptr = CurPos;
uint32 offset = (uint32)((uint8*)CurPos - Data);
int shorts_to_eat = min(SHORTS_PER_LINE,(Size - offset) / sizeof(uint16)); //yeah shorts_to_eat!
// print hex dump
line_string.Format("%08x: ",offset);
for (i=0; i<shorts_to_eat; i++) {
tmp_string.Format("%04X ",*workptr++);
line_string += tmp_string;
}
CurPos = workptr;
return line_string;
}
/*******************************************************************************************
**
** HexToStringLongClass
**
*******************************************************************************************/
HexToStringLongClass::HexToStringLongClass(const uint8 * data,uint32 size) :
HexToStringClass(data,size)
{
// Round size down to the nearest long
Size &= ~3;
Reset();
}
void HexToStringLongClass::Reset(void)
{
CurPos = (uint32*)Data;
}
bool HexToStringLongClass::Is_Done(void)
{
uint32 offset = (uint32)((uint8*)CurPos - Data);
return offset >= Size;
}
CString HexToStringLongClass::Get_Next_Line(void)
{
if (Is_Done()) return CString("");
int i;
CString line_string;
CString tmp_string;
const uint32 * workptr = CurPos;
uint32 offset = (uint32)((uint8*)CurPos - Data);
int longs_to_eat = min(LONGS_PER_LINE,(Size - offset)/sizeof(uint32));
// print hex dump
line_string.Format("%08x: ",offset);
for (i=0; i<longs_to_eat; i++) {
tmp_string.Format("%08X ",*workptr++);
line_string += tmp_string;
}
CurPos = workptr;
return line_string;
}

View File

@@ -0,0 +1,109 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/HexToString.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef HEXTOSTRING_H
#define HEXTOSTRING_H
#include "stdafx.h"
#include "bittype.h"
class HexToStringClass
{
public:
HexToStringClass(const uint8 * data,uint32 size);
virtual bool Is_Done(void) = 0;
virtual CString Get_Next_Line(void) = 0;
protected:
const uint8 * Data;
uint32 Size;
};
class HexToStringByteClass : public HexToStringClass
{
public:
HexToStringByteClass(const uint8 * data,uint32 size);
bool Is_Done(void);
CString Get_Next_Line(void);
private:
void Reset(void);
const uint8 * CurPos;
};
class HexToStringShortClass : public HexToStringClass
{
public:
HexToStringShortClass(const uint8 * data,uint32 size);
bool Is_Done(void);
CString Get_Next_Line(void);
private:
void Reset(void);
const uint16 * CurPos;
};
class HexToStringLongClass : public HexToStringClass
{
public:
HexToStringLongClass(const uint8 * data,uint32 size);
bool Is_Done(void);
CString Get_Next_Line(void);
private:
void Reset(void);
const uint32 * CurPos;
};
#endif

View File

@@ -0,0 +1,233 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/MainFrm.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:46a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "ChunkView.h"
#include "MainFrm.h"
#include "ChunkDataView.h"
#include "ChunkTreeView.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)
ON_WM_CREATE()
ON_COMMAND(ID_DISPLAY_HEX, OnDisplayHex)
ON_UPDATE_COMMAND_UI(ID_DISPLAY_HEX, OnUpdateDisplayHex)
ON_COMMAND(ID_DISPLAY_MICROCHUNKS, OnDisplayMicrochunks)
ON_UPDATE_COMMAND_UI(ID_DISPLAY_MICROCHUNKS, OnUpdateDisplayMicrochunks)
ON_COMMAND(ID_WORDMODE_BYTE, OnWordmodeByte)
ON_UPDATE_COMMAND_UI(ID_WORDMODE_BYTE, OnUpdateWordmodeByte)
ON_COMMAND(ID_WORDMODE_SHORT, OnWordmodeShort)
ON_UPDATE_COMMAND_UI(ID_WORDMODE_SHORT, OnUpdateWordmodeShort)
ON_COMMAND(ID_WORDMODE_LONG, OnWordmodeLong)
ON_UPDATE_COMMAND_UI(ID_WORDMODE_LONG, OnUpdateWordmodeLong)
//}}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.CreateEx(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndReBar.Create(this) ||
!m_wndReBar.AddBar(&m_wndToolBar))
{
TRACE0("Failed to create rebar\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
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// Create the main splitter window for the application
BOOL ok = m_wndSplitter.CreateStatic (this, 1, 2);
ASSERT(ok);
if (!ok) return FALSE;
// Create the two sub views
ok &= m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CChunkTreeView),CSize(200,10),pContext);
ok &= m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CChunkDataView),CSize(340,10),pContext);
ASSERT(ok);
if (!ok) return FALSE;
return TRUE;
}
CChunkDataView * CMainFrame::Get_Data_View(void)
{
return (CChunkDataView *)m_wndSplitter.GetPane(0,1);
}
CChunkTreeView * CMainFrame::Get_Tree_View(void)
{
return (CChunkTreeView *)m_wndSplitter.GetPane(0,0);
}
void CMainFrame::OnDisplayHex()
{
Get_Data_View()->Set_Display_Mode(CChunkDataView::DISPLAY_MODE_HEX);
}
void CMainFrame::OnUpdateDisplayHex(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(Get_Data_View()->Get_Display_Mode() == CChunkDataView::DISPLAY_MODE_HEX);
}
void CMainFrame::OnDisplayMicrochunks()
{
Get_Data_View()->Set_Display_Mode(CChunkDataView::DISPLAY_MODE_MICROCHUNKS);
}
void CMainFrame::OnUpdateDisplayMicrochunks(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(Get_Data_View()->Get_Display_Mode() == CChunkDataView::DISPLAY_MODE_MICROCHUNKS);
}
void CMainFrame::OnWordmodeByte()
{
Get_Data_View()->Set_Word_Size(CChunkDataView::WORD_SIZE_BYTE);
}
void CMainFrame::OnUpdateWordmodeByte(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(Get_Data_View()->Get_Word_Size() == CChunkDataView::WORD_SIZE_BYTE);
}
void CMainFrame::OnWordmodeShort()
{
Get_Data_View()->Set_Word_Size(CChunkDataView::WORD_SIZE_SHORT);
}
void CMainFrame::OnUpdateWordmodeShort(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(Get_Data_View()->Get_Word_Size() == CChunkDataView::WORD_SIZE_SHORT);
}
void CMainFrame::OnWordmodeLong()
{
Get_Data_View()->Set_Word_Size(CChunkDataView::WORD_SIZE_LONG);
}
void CMainFrame::OnUpdateWordmodeLong(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(Get_Data_View()->Get_Word_Size() == CChunkDataView::WORD_SIZE_LONG);
}

View File

@@ -0,0 +1,116 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/MainFrm.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__53C69A68_72AB_11D3_BB4D_00902742EA14__INCLUDED_)
#define AFX_MAINFRM_H__53C69A68_72AB_11D3_BB4D_00902742EA14__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CChunkDataView;
class CChunkTreeView;
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
CChunkDataView * Get_Data_View(void);
CChunkTreeView * Get_Tree_View(void);
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CReBar m_wndReBar;
CSplitterWnd m_wndSplitter;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDisplayHex();
afx_msg void OnUpdateDisplayHex(CCmdUI* pCmdUI);
afx_msg void OnDisplayMicrochunks();
afx_msg void OnUpdateDisplayMicrochunks(CCmdUI* pCmdUI);
afx_msg void OnWordmodeByte();
afx_msg void OnUpdateWordmodeByte(CCmdUI* pCmdUI);
afx_msg void OnWordmodeShort();
afx_msg void OnUpdateWordmodeShort(CCmdUI* pCmdUI);
afx_msg void OnWordmodeLong();
afx_msg void OnUpdateWordmodeLong(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__53C69A68_72AB_11D3_BB4D_00902742EA14__INCLUDED_)

View File

@@ -0,0 +1,45 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/***********************************************************************************************
*** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/StdAfx.cpp $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:46a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// stdafx.cpp : source file that includes just the standard includes
// ChunkView.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,65 @@
/*
** 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 : ChunkView *
* *
* $Archive:: /Commando/Code/Tools/ChunkView/StdAfx.h $*
* *
* Author:: Greg Hjelstrom *
* *
* $Modtime:: 9/28/99 9:48a $*
* *
* $Revision:: 2 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// 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__53C69A66_72AB_11D3_BB4D_00902742EA14__INCLUDED_)
#define AFX_STDAFX_H__53C69A66_72AB_11D3_BB4D_00902742EA14__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#include <afxcview.h> // MFC views
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__53C69A66_72AB_11D3_BB4D_00902742EA14__INCLUDED_)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,24 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by ChunkView.rc
//
#define IDD_ABOUTBOX 100
#define IDR_MAINFRAME 128
#define IDR_CHUNKVTYPE 129
#define ID_DISPLAY_HEX 32771
#define ID_DISPLAY_MICROCHUNKS 32772
#define ID_WORDMODE_LONG 32773
#define ID_WORDMODE_SHORT 32774
#define ID_WORDMODE_BYTE 32775
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 32776
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif