gmon.out
analysis1.ods
wozmaker
-Makefile
+Makefile*
res/*.xcf
.qmake.stash
+release/
+win64/
if (Global::a2rSize > (60 + Uint32LE(Global::a2r->strmSize)))
{
- Global::metadata = (A2RMetadata *)((uint8_t *)Global::a2r + (60 + Uint32LE(Global::a2r->strmSize)));
+ Global::metadata = (Metadata *)((uint8_t *)Global::a2r + (60 + Uint32LE(Global::a2r->strmSize)));
// Make sure it's plausible metadata
if (memcmp(Global::metadata->metaTag, "META", 4) != 0)
Global::metadata = NULL;
+ else
+ UnpackMetadata(Global::metadata);
}
// Unpack TMNG & XTMG streams to simplify analysis
return true;
}
+
+void UnpackMetadata(Metadata * data)
+{
+ uint32_t start = 0;
+ uint32_t end = Uint32LE(data->metaSize);
+ uint32_t i = 0;
+ Global::metaCount = 0;
+
+ while (start < end)
+ {
+ if (i < 255)
+ Global::meta[Global::metaCount][i++] = data->data[start];
+
+ start++;
+
+ if (data->data[start] == '\x0A')
+ {
+ Global::meta[Global::metaCount][i] = 0;
+ Global::metaCount++;
+ i = 0;
+ start++;
+ }
+ }
+}
+
+
+uint8_t * GetMetadata(const char * keyword)
+{
+ uint32_t kwLen = strlen(keyword);
+
+ for(uint8_t i=0; i<Global::metaCount; i++)
+ {
+ if ((strlen((char *)Global::meta[i]) >= kwLen)
+ && (memcmp(Global::meta[i], keyword, kwLen) == 0))
+ {
+ return &Global::meta[i][kwLen];
+ }
+ }
+
+ return NULL;
+}
+
+
+uint16_t GetRequiredMachineBits(void)
+{
+ uint8_t * kw = GetMetadata("requires_machine\x09");
+ uint32_t kwLen = strlen((char *)kw);
+ uint16_t bits = 0;
+ char type[8];
+ uint8_t typeLen = 0;
+
+ for(uint32_t i=0; i<kwLen; i++)
+ {
+ type[typeLen++] = kw[i];
+
+ if ((kw[i + 1] == '|') || (kw[i + 1] == '\0'))
+ {
+ type[typeLen] = 0;
+
+ if (strcmp(type, "2") == 0)
+ bits |= 0x001;
+ else if (strcmp(type, "2+") == 0)
+ bits |= 0x002;
+ else if (strcmp(type, "2e") == 0)
+ bits |= 0x004;
+ else if (strcmp(type, "2c") == 0)
+ bits |= 0x008;
+ else if (strcmp(type, "2e+") == 0)
+ bits |= 0x010;
+ else if (strcmp(type, "2gs") == 0)
+ bits |= 0x020;
+ else if (strcmp(type, "2c+") == 0)
+ bits |= 0x040;
+ else if (strcmp(type, "3") == 0)
+ bits |= 0x080;
+ else if (strcmp(type, "3+") == 0)
+ bits |= 0x100;
+
+ typeLen = 0;
+ i++;
+ }
+ }
+
+ return bits;
+}
+
+
+uint16_t GetRequiredRAMInK(void)
+{
+ char * kw = (char *)GetMetadata("requires_ram\x09");
+
+ if (strcmp(kw, "16K") == 0)
+ return 16;
+ else if (strcmp(kw, "24K") == 0)
+ return 24;
+ else if (strcmp(kw, "32K") == 0)
+ return 32;
+ else if (strcmp(kw, "48K") == 0)
+ return 48;
+ else if (strcmp(kw, "64K") == 0)
+ return 64;
+ else if (strcmp(kw, "128K") == 0)
+ return 128;
+ else if (strcmp(kw, "256K") == 0)
+ return 256;
+ else if (strcmp(kw, "512K") == 0)
+ return 512;
+ else if (strcmp(kw, "768K") == 0)
+ return 768;
+ else if (strcmp(kw, "1M") == 0)
+ return 1024;
+ else if (strcmp(kw, "1.25M") == 0)
+ return 1280;
+ else if (strcmp(kw, "1.5M+") == 0)
+ return 1536;
+
+ return 0;
+}
+/*
+METADATA Keywords (standard)
+----------------------------
+title, subtitle, publisher, developer, copyright, version, language, requires_ram, requires_machine, notes, side, side_name, contributor, image_date
+
+ram: 16K|24K|32K|48K|64K|128K|256K|512K|768K|1M|1.25M|1.5M+|Unknown
+mch: 2|2+|2e|2c|2e+|2gs|2c+|3|3+
+*/
+
// may not be compiled on an architecture that supports little endian
// natively.
+struct Metadata
+{
+ uint8_t metaTag[4]; // "META"
+ uint32_t metaSize; // Size of the META chunk
+ uint8_t data[]; // Variable length array of metadata
+};
+
struct A2RStream
{
uint8_t location; // Quarter track for this stream
uint8_t data[]; // Variable length array for stream data
};
-struct A2RMetadata
-{
- uint8_t metaTag[4]; // "META"
- uint32_t metaSize; // Size of the META chunk
- uint8_t data[]; // Variable length array of metadata
-};
-
struct A2R
{
// Header
uint16_t reserved;
};
-struct WOZMetadata
-{
- uint8_t metaTag[4]; // "META"
- uint32_t metaSize; // Size of the META chunk
- uint8_t data[]; // Variable length array of metadata
-};
-
struct WOZ
{
// Header
uint8_t * ReadFile(const char * filename, uint32_t * size);
bool LoadA2R(const char * filename);
bool WriteWOZFile(const char * filename);
+void UnpackMetadata(Metadata * data);
+uint8_t * GetMetadata(const char * keyword);
+uint16_t GetRequiredMachineBits(void);
+uint16_t GetRequiredRAMInK(void);
// Inline functions ("get" functions--need to write "set" functions)
A2R * Global::a2r = NULL;
uint32_t Global::a2rSize = 0;
-A2RMetadata * Global::metadata;
+Metadata * Global::metadata;
A2RStream * Global::stream[800];
uint32_t Global::numStreams = 0;
uint8_t Global::bitStream[80000];
uint32_t Global::bStreamLen[141] = { 0 };
uint32_t Global::bStreamLenBits[141] = { 0 };
+uint8_t Global::meta[32][256] = { 0 };
+uint8_t Global::metaCount = 0;
+
#include <stdint.h>
class A2R;
-class A2RMetadata;
class A2RStream;
+class Metadata;
class Global
{
public:
static A2R * a2r;
static uint32_t a2rSize;
- static A2RMetadata * metadata;
+ static Metadata * metadata;
static A2RStream * stream[800];
static uint32_t numStreams;
static uint8_t bitStream[80000];
static uint8_t bStream[141][80000];
static uint32_t bStreamLen[141];
static uint32_t bStreamLenBits[141];
+ static uint8_t meta[32][256];
+ static uint8_t metaCount;
};
#endif // __GLOBAL_H__
#include "mainwidget.h"
#include "navwidget.h"
#include "nibblewidget.h"
+#include "settingsdialog.h"
#include "waveformwidget.h"
loadFile = CreateAction(tr("&Open"), tr("Open A2R"), tr("Open an A2R file"), QIcon(), QKeySequence(tr("ctrl+o")));
connect(loadFile, SIGNAL(triggered()), this, SLOT(HandleLoadFile()));
- newGame = CreateAction(tr("&New"), tr("New Game"), tr("Start a new game of Warehouse Man Deluxe"), QIcon(), QKeySequence(tr("ctrl+n")));
-// connect(newGame, SIGNAL(triggered()), this, SLOT(HandleNewGame()));
+ saveFile = CreateAction(tr("&Save"), tr("Save WOZ"), tr("Save a WOZ file"), QIcon(), QKeySequence(tr("ctrl+s")));
+ connect(saveFile, SIGNAL(triggered()), this, SLOT(HandleSaveFile()));
+
+ settings = CreateAction(tr("&Disk Settings"), tr("Disk Settings"), tr("Settings for the loaded A2R file"), QIcon(), QKeySequence(tr("ctrl+d")));
+ connect(settings, SIGNAL(triggered()), this, SLOT(HandleSettings()));
undoAction = CreateAction(tr("&Undo"), tr(""), tr(""), QIcon(), QKeySequence(tr("ctrl+z")));
// connect(undoAction, SIGNAL(triggered()), this, SLOT(HandleUndo()));
QMenu * menu = menuBar()->addMenu(tr("&File"));
menu->addAction(loadFile);
+ menu->addAction(saveFile);
+ menu->addAction(settings);
menu->addSeparator();
// menu->addAction(undoAction);
// menu->addAction(resetLevel);
}
+void MainWin::HandleSaveFile(void)
+{
+}
+
+
+void MainWin::HandleSettings(void)
+{
+ SettingsDialog dlg(this);
+
+ if (dlg.exec() == false)
+ return;
+
+ // Deal with stuff here, since user hit "OK" button
+}
+
+
void MainWin::AboutWozMaker(void)
{
QMessageBox::about(this, tr("About WOZ Maker"), tr("WOZ Maker v1.0.0\n\nWritten by James Hammons\n\nCopyright (C) 2018 Underground Software"));
protected slots:
void closeEvent(QCloseEvent * event);
void HandleLoadFile(void);
+ void HandleSaveFile(void);
+ void HandleSettings(void);
void AboutWozMaker(void);
-// bool LoadA2R(const QString);
private:
MainWidget * mainWidget;
InfoWidget * infoWidget;
NavWidget * navWidget;
QAction * loadFile;
+ QAction * saveFile;
+ QAction * settings;
- QAction * newGame;
QAction * undoAction;
-
QAction * gameOptions;
QAction * gameStats;
-
QAction * appExit;
QAction * appAbout;
QAction * resetLevel;
--- /dev/null
+//
+// settingsdialog.cpp: Dialog for changing Architektonas settings
+//
+// Part of the Architektonas Project
+// (C) 2011 Underground Software
+// See the README and GPLv3 files for licensing and warranty information
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// WHO WHEN WHAT
+// --- ---------- ------------------------------------------------------------
+// JLH 06/04/2011 Created this file
+
+#include "settingsdialog.h"
+//#include "baseunittab.h"
+//#include "generaltab.h"
+
+
+SettingsDialog::SettingsDialog(QWidget * parent/*= 0*/): QDialog(parent)
+{
+// tabWidget = new QTabWidget;
+// generalTab = new GeneralTab(this);
+// baseunitTab = new BaseUnitTab(this);
+// tabWidget->addTab(generalTab, tr("General"));
+// tabWidget->addTab(baseunitTab, tr("Base Unit"));
+
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ QVBoxLayout * mainLayout = new QVBoxLayout;
+// mainLayout->addWidget(tabWidget);
+ mainLayout->addWidget(buttonBox);
+ setLayout(mainLayout);
+
+ setWindowTitle(tr("WOZ Maker Disk Settings"));
+}
+
+
+SettingsDialog::~SettingsDialog()
+{
+}
+
--- /dev/null
+#ifndef __SETTINGSDIALOG_H__
+#define __SETTINGSDIALOG_H__
+
+#include <QtWidgets>
+
+//class GeneralTab;
+//class BaseUnitTab;
+
+class SettingsDialog: public QDialog
+{
+ Q_OBJECT
+
+ public:
+ SettingsDialog(QWidget * parent = 0);
+ ~SettingsDialog();
+
+ private:
+// QTabWidget * tabWidget;
+ QDialogButtonBox * buttonBox;
+
+ public:
+// GeneralTab * generalTab;
+// BaseUnitTab * baseunitTab;
+};
+
+#endif // __SETTINGSDIALOG_H__
+
# Use 'qmake -o Makefile wozmaker.pro'
-CONFIG += qt warn_on release debug
+CONFIG += qt warn_on release c++11
RESOURCES += res/resources.qrc
#LIBS += -Ldxflib/lib -ldxf
#LIBS += -lao
src/mainwin.h \
src/navwidget.h \
src/nibblewidget.h \
+ src/settingsdialog.h \
src/waveformwidget.h
SOURCES = \
src/mainwin.cpp \
src/navwidget.cpp \
src/nibblewidget.cpp \
+ src/settingsdialog.cpp \
src/waveformwidget.cpp