//
// Generic ROM loading
//
-uint32 JaguarLoadROM(uint8 * rom, char * path)
+uint32 JaguarLoadROM(uint8 * &rom, char * path)
{
// We really should have some kind of sanity checking for the ROM size here to prevent
// a buffer overflow... !!! FIX !!!
// Handle ZIP file loading here...
WriteLog("(ZIPped)...");
- uint8_t * buffer = NULL;
- romSize = GetFileFromZIP(path, FT_SOFTWARE, buffer);
+// uint8_t * buffer = NULL;
+// romSize = GetFileFromZIP(path, FT_SOFTWARE, buffer);
+ romSize = GetFileFromZIP(path, FT_SOFTWARE, rom);
if (romSize == 0)
{
return 0;
}
- memcpy(rom, buffer, romSize);
- delete[] buffer;
+// memcpy(rom, buffer, romSize);
+// delete[] buffer;
}
else
{
}
romSize = gzfilelength(fp);
+ rom = new uint8[romSize];
gzseek(fp, 0, SEEK_SET);
gzread(fp, rom, romSize);
gzclose(fp);
return romSize;
}
-//
-// Jaguar file loading
-//
-bool JaguarLoadFileOld(char * path)
-{
- jaguarROMSize = JaguarLoadROM(jaguarMainROM, path);
-
- if (jaguarROMSize == 0)
- {
-// WriteLog("VJ: Could not load ROM from file \"%s\"...\nAborting!\n", newPath);
- WriteLog("GUI: Could not load ROM from file \"%s\"...\nAborting load!\n", path);
-#warning "!!! Need error dialog here !!!"
-// Need to do something else here, like throw up an error dialog instead of aborting. !!! FIX !!!
-// log_done();
-// exit(0);
- return false; // This is a start...
- }
-
- jaguarMainROMCRC32 = crc32_calcCheckSum(jaguarMainROM, jaguarROMSize);
- WriteLog("CRC: %08X\n", (unsigned int)jaguarMainROMCRC32);
- EepromInit();
-
- jaguarRunAddress = 0x802000;
-
- char * ext = strrchr(path, '.'); // Get the file's extension for non-cartridge checking
-
-//NOTE: Should fix JaguarLoadROM() to replace .zip with what's *in* the zip (.abs, .j64, etc.)
-#warning "!!! Need more robust file type checking in JaguarLoadROM() !!!"
- if (strcasecmp(ext, ".rom") == 0)
- {
- // File extension ".ROM": Alpine image that loads/runs at $802000
- WriteLog("GUI: Setting up homebrew (ROM)... Run address: 00802000, length: %08X\n", jaguarROMSize);
-
- for(int i=jaguarROMSize-1; i>=0; i--)
- jaguarMainROM[0x2000 + i] = jaguarMainROM[i];
-
- memset(jaguarMainROM, 0xFF, 0x2000);
-/* memcpy(jaguar_mainRam, jaguar_mainRom, jaguarRomSize);
- memset(jaguar_mainRom, 0xFF, 0x600000);
- memcpy(jaguar_mainRom + 0x2000, jaguar_mainRam, jaguarRomSize);
- memset(jaguar_mainRam, 0x00, 0x400000);*/
-
-/*
-Stubulator ROM vectors...
-handler 001 at $00E00008
-handler 002 at $00E008DE
-handler 003 at $00E008E2
-handler 004 at $00E008E6
-handler 005 at $00E008EA
-handler 006 at $00E008EE
-handler 007 at $00E008F2
-handler 008 at $00E0054A
-handler 009 at $00E008FA
-handler 010 at $00000000
-handler 011 at $00000000
-handler 012 at $00E008FE
-handler 013 at $00E00902
-handler 014 at $00E00906
-handler 015 at $00E0090A
-handler 016 at $00E0090E
-handler 017 at $00E00912
-handler 018 at $00E00916
-handler 019 at $00E0091A
-handler 020 at $00E0091E
-handler 021 at $00E00922
-handler 022 at $00E00926
-handler 023 at $00E0092A
-handler 024 at $00E0092E
-handler 025 at $00E0107A
-handler 026 at $00E0107A
-handler 027 at $00E0107A
-handler 028 at $00E008DA
-handler 029 at $00E0107A
-handler 030 at $00E0107A
-handler 031 at $00E0107A
-handler 032 at $00000000
-
-Let's try setting up the illegal instruction vector for a stubulated jaguar...
-*/
-/* SET32(jaguar_mainRam, 0x08, 0x00E008DE);
- SET32(jaguar_mainRam, 0x0C, 0x00E008E2);
- SET32(jaguar_mainRam, 0x10, 0x00E008E6); // <-- Should be here (it is)...
- SET32(jaguar_mainRam, 0x14, 0x00E008EA);//*/
-
- // Try setting the vector to say, $1000 and putting an instruction there that loops forever:
- // This kludge works! Yeah!
- SET32(jaguarMainRAM, 0x10, 0x00001000);
- SET16(jaguarMainRAM, 0x1000, 0x60FE); // Here: bra Here
- }
- else if (strcasecmp(ext, ".abs") == 0)
- {
- // File extension ".ABS": Atari linker output file with header (w/o is useless to us here)
-
-/*
-ABS Format sleuthing (LBUGDEMO.ABS):
-
-000000 60 1B 00 00 05 0C 00 04 62 C0 00 00 04 28 00 00
-000010 12 A6 00 00 00 00 00 80 20 00 FF FF 00 80 25 0C
-000020 00 00 40 00
-
-DRI-format file detected...
-Text segment size = 0x0000050c bytes
-Data segment size = 0x000462c0 bytes
-BSS Segment size = 0x00000428 bytes
-Symbol Table size = 0x000012a6 bytes
-Absolute Address for text segment = 0x00802000
-Absolute Address for data segment = 0x0080250c
-Absolute Address for BSS segment = 0x00004000
-
-(CRZDEMO.ABS):
-000000 01 50 00 03 00 00 00 00 00 03 83 10 00 00 05 3b
-000010 00 1c 00 03 00 00 01 07 00 00 1d d0 00 03 64 98
-000020 00 06 8b 80 00 80 20 00 00 80 20 00 00 80 3d d0
-
-000030 2e 74 78 74 00 00 00 00 00 80 20 00 00 80 20 00 .txt (+36 bytes)
-000040 00 00 1d d0 00 00 00 a8 00 00 00 00 00 00 00 00
-000050 00 00 00 00 00 00 00 20
-000058 2e 64 74 61 00 00 00 00 00 80 3d d0 00 80 3d d0 .dta (+36 bytes)
-000068 00 03 64 98 00 00 1e 78 00 00 00 00 00 00 00 00
-000078 00 00 00 00 00 00 00 40
-000080 2e 62 73 73 00 00 00 00 00 00 50 00 00 00 50 00 .bss (+36 bytes)
-000090 00 06 8b 80 00 03 83 10 00 00 00 00 00 00 00 00
-0000a0 00 00 00 00 00 00 00 80
-
-Header size is $A8 bytes...
-
-BSD/COFF format file detected...
-3 sections specified
-Symbol Table offset = 230160 ($00038310)
-Symbol Table contains 1339 symbol entries ($0000053B)
-The additional header size is 28 bytes ($001C)
-Magic Number for RUN_HDR = 0x00000107
-Text Segment Size = 7632 ($00001DD0)
-Data Segment Size = 222360 ($00036498)
-BSS Segment Size = 428928 ($00068B80)
-Starting Address for executable = 0x00802000
-Start of Text Segment = 0x00802000
-Start of Data Segment = 0x00803dd0
-*/
- if (jaguarMainROM[0] == 0x60 && jaguarMainROM[1] == 0x1B)
- {
- uint32 loadAddress = GET32(jaguarMainROM, 0x16), //runAddress = GET32(jaguar_mainRom, 0x2A),
- codeSize = GET32(jaguarMainROM, 0x02) + GET32(jaguarMainROM, 0x06);
- WriteLog("GUI: Setting up homebrew (ABS-1)... Run address: %08X, length: %08X\n", loadAddress, codeSize);
-
- if (loadAddress < 0x800000)
- memcpy(jaguarMainRAM + loadAddress, jaguarMainROM + 0x24, codeSize);
- else
- {
- for(int i=codeSize-1; i>=0; i--)
- jaguarMainROM[(loadAddress - 0x800000) + i] = jaguarMainROM[i + 0x24];
-/* memcpy(jaguar_mainRam, jaguar_mainRom + 0x24, codeSize);
- memset(jaguar_mainRom, 0xFF, 0x600000);
- memcpy(jaguar_mainRom + (loadAddress - 0x800000), jaguar_mainRam, codeSize);
- memset(jaguar_mainRam, 0x00, 0x400000);*/
- }
-
- jaguarRunAddress = loadAddress;
- }
- else if (jaguarMainROM[0] == 0x01 && jaguarMainROM[1] == 0x50)
- {
- uint32 loadAddress = GET32(jaguarMainROM, 0x28), runAddress = GET32(jaguarMainROM, 0x24),
- codeSize = GET32(jaguarMainROM, 0x18) + GET32(jaguarMainROM, 0x1C);
- WriteLog("GUI: Setting up homebrew (ABS-2)... Run address: %08X, length: %08X\n", runAddress, codeSize);
-
- if (loadAddress < 0x800000)
- memcpy(jaguarMainRAM + loadAddress, jaguarMainROM + 0xA8, codeSize);
- else
- {
- for(int i=codeSize-1; i>=0; i--)
- jaguarMainROM[(loadAddress - 0x800000) + i] = jaguarMainROM[i + 0xA8];
-/* memcpy(jaguar_mainRam, jaguar_mainRom + 0xA8, codeSize);
- memset(jaguar_mainRom, 0xFF, 0x600000);
- memcpy(jaguar_mainRom + (loadAddress - 0x800000), jaguar_mainRam, codeSize);
- memset(jaguar_mainRam, 0x00, 0x400000);*/
- }
-
- jaguarRunAddress = runAddress;
- }
- else
- {
- WriteLog("GUI: Couldn't find correct ABS/COF format: %02X %02X\n", jaguarMainROM[0], jaguarMainROM[1]);
- return false;
- }
- }
- else if (strcasecmp(ext, ".jag") == 0)
- {
- // File extension ".JAG": Atari server file with header
-//NOTE: The bytes 'JAGR' should also be at position $1C...
-// Also, there's *always* a $601A header at position $00...
- if (jaguarMainROM[0] == 0x60 && jaguarMainROM[1] == 0x1A)
- {
- uint32 loadAddress = GET32(jaguarMainROM, 0x22), runAddress = GET32(jaguarMainROM, 0x2A);
-//This is not always right! Especially when converted via bin2jag1!!!
-//We should have access to the length of the furshlumiger file that was loaded anyway!
-//Now, we do! ;-)
-// uint32 progLength = GET32(jaguar_mainRom, 0x02);
-//jaguarRomSize
-//jaguarRunAddress
-// WriteLog("Jaguar: Setting up PD ROM... Run address: %08X, length: %08X\n", runAddress, progLength);
-// memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0x2E, progLength);
- WriteLog("GUI: Setting up homebrew (JAG)... Run address: %08X, length: %08X\n", runAddress, jaguarROMSize - 0x2E);
- memcpy(jaguarMainRAM + loadAddress, jaguarMainROM + 0x2E, jaguarROMSize - 0x2E);
-// SET32(jaguar_mainRam, 4, runAddress);
- jaguarRunAddress = runAddress;
- }
- else
- return false;
- }
- // .J64 (Jaguar cartridge ROM image) is implied by the FileList object...
-
- return true;
-}
-
//
// Jaguar file loading (second stab at it...)
// We do a more intelligent file analysis here instead of relying on (possible false)
bool JaguarLoadFile(char * path)
{
// NOTE: We can further clean this up by fixing JaguarLoadROM to load to a buffer
-// instead of assuming it goes into our ROM space.
- jaguarROMSize = JaguarLoadROM(jaguarMainROM, path);
+// instead of assuming it goes into our ROM space. (Now, we do! :-)
+ uint8 * buffer = NULL;
+ jaguarROMSize = JaguarLoadROM(buffer, path);
+// jaguarROMSize = JaguarLoadROM(jaguarMainROM, path);
if (jaguarROMSize == 0)
{
return false; // This is a start...
}
- jaguarMainROMCRC32 = crc32_calcCheckSum(jaguarMainROM, jaguarROMSize);
+// jaguarMainROMCRC32 = crc32_calcCheckSum(jaguarMainROM, jaguarROMSize);
+ jaguarMainROMCRC32 = crc32_calcCheckSum(buffer, jaguarROMSize);
WriteLog("CRC: %08X\n", (unsigned int)jaguarMainROMCRC32);
// TODO: Check for EEPROM file in ZIP file. If there is no EEPROM in the user's EEPROM
// directory, copy the one from the ZIP file, if it exists.
EepromInit();
jaguarRunAddress = 0x802000; // For non-BIOS runs, this is true
- int fileType = ParseFileType(jaguarMainROM[0], jaguarMainROM[1], jaguarROMSize);
+// int fileType = ParseFileType(jaguarMainROM[0], jaguarMainROM[1], jaguarROMSize);
+ int fileType = ParseFileType(buffer[0], buffer[1], jaguarROMSize);
if (fileType == JST_ROM)
+ {
+ memcpy(jagMemSpace + 0x800000, buffer, jaguarROMSize);
+ delete[] buffer;
return true;
+ }
else if (fileType == JST_ALPINE)
{
// File extension ".ROM": Alpine image that loads/runs at $802000
WriteLog("GUI: Setting up Alpine ROM... Run address: 00802000, length: %08X\n", jaguarROMSize);
- for(int i=jaguarROMSize-1; i>=0; i--)
- jaguarMainROM[0x2000 + i] = jaguarMainROM[i];
-
- memset(jaguarMainROM, 0xFF, 0x2000);
+// for(int i=jaguarROMSize-1; i>=0; i--)
+// jaguarMainROM[0x2000 + i] = jaguarMainROM[i];
+ memset(jagMemSpace + 0x800000, 0xFF, 0x2000);
+ memcpy(jagMemSpace + 0x802000, buffer, jaguarROMSize);
+ delete[] buffer;
// Maybe instead of this, we could try requiring the STUBULATOR ROM? Just a thought...
// Try setting the vector to say, $1000 and putting an instruction there that loops forever:
}
else if (fileType == JST_ABS_TYPE1)
{
- uint32 loadAddress = GET32(jaguarMainROM, 0x16),
- codeSize = GET32(jaguarMainROM, 0x02) + GET32(jaguarMainROM, 0x06);
+ // For ABS type 1, run address == load address
+// uint32 loadAddress = GET32(jaguarMainROM, 0x16),
+// codeSize = GET32(jaguarMainROM, 0x02) + GET32(jaguarMainROM, 0x06);
+ uint32 loadAddress = GET32(buffer, 0x16),
+ codeSize = GET32(buffer, 0x02) + GET32(buffer, 0x06);
WriteLog("GUI: Setting up homebrew (ABS-1)... Run address: %08X, length: %08X\n", loadAddress, codeSize);
+#if 0
if (loadAddress < 0x800000)
memcpy(jaguarMainRAM + loadAddress, jaguarMainROM + 0x24, codeSize);
else
for(int i=codeSize-1; i>=0; i--)
jaguarMainROM[(loadAddress - 0x800000) + i] = jaguarMainROM[i + 0x24];
}
+#else
+ memcpy(jagMemSpace + loadAddress, buffer + 0x24, codeSize);
+ delete[] buffer;
+#endif
jaguarRunAddress = loadAddress;
return true;
}
else if (fileType == JST_ABS_TYPE2)
{
- uint32 loadAddress = GET32(jaguarMainROM, 0x28), runAddress = GET32(jaguarMainROM, 0x24),
- codeSize = GET32(jaguarMainROM, 0x18) + GET32(jaguarMainROM, 0x1C);
+// uint32 loadAddress = GET32(jaguarMainROM, 0x28), runAddress = GET32(jaguarMainROM, 0x24),
+// codeSize = GET32(jaguarMainROM, 0x18) + GET32(jaguarMainROM, 0x1C);
+ uint32 loadAddress = GET32(buffer, 0x28), runAddress = GET32(buffer, 0x24),
+ codeSize = GET32(buffer, 0x18) + GET32(buffer, 0x1C);
WriteLog("GUI: Setting up homebrew (ABS-2)... Run address: %08X, length: %08X\n", runAddress, codeSize);
+#if 0
if (loadAddress < 0x800000)
memcpy(jaguarMainRAM + loadAddress, jaguarMainROM + 0xA8, codeSize);
else
for(int i=codeSize-1; i>=0; i--)
jaguarMainROM[(loadAddress - 0x800000) + i] = jaguarMainROM[i + 0xA8];
}
+#else
+ memcpy(jagMemSpace + loadAddress, buffer + 0xA8, codeSize);
+ delete[] buffer;
+#endif
jaguarRunAddress = runAddress;
return true;
}
else if (fileType == JST_JAGSERVER)
{
- uint32 loadAddress = GET32(jaguarMainROM, 0x22), runAddress = GET32(jaguarMainROM, 0x2A);
+// uint32 loadAddress = GET32(jaguarMainROM, 0x22), runAddress = GET32(jaguarMainROM, 0x2A);
+ uint32 loadAddress = GET32(buffer, 0x22), runAddress = GET32(buffer, 0x2A);
WriteLog("GUI: Setting up homebrew (Jag Server)... Run address: %08X, length: %08X\n", runAddress, jaguarROMSize - 0x2E);
- memcpy(jaguarMainRAM + loadAddress, jaguarMainROM + 0x2E, jaguarROMSize - 0x2E);
+// memcpy(jaguarMainRAM + loadAddress, jaguarMainROM + 0x2E, jaguarROMSize - 0x2E);
+ memcpy(jagMemSpace + loadAddress, buffer + 0x2E, jaguarROMSize - 0x2E);
+ delete[] buffer;
jaguarRunAddress = runAddress;
return true;
}
// JST = Jaguar Software Type
enum { JST_NONE = 0, JST_ROM, JST_ALPINE, JST_ABS_TYPE1, JST_ABS_TYPE2, JST_JAGSERVER };
-uint32 JaguarLoadROM(uint8 * rom, char * path);
+uint32 JaguarLoadROM(uint8 * &rom, char * path);
bool JaguarLoadFile(char * path);
uint32 GetFileFromZIP(const char * zipFile, FileType type, uint8 * &buffer);
uint32 ParseFileType(uint8 header1, uint8 header2, uint32 size);
{ 0x5CFF14AB, "Pinball Fantasies (World)", FF_ROM | FF_VERIFIED },
{ 0x5DDF9724, "Protector - Special Edition (World)", FF_ALPINE | FF_VERIFIED },
{ 0x5E2CDBC0, "Doom (World)", FF_ROM | FF_VERIFIED | FF_REQ_DSP },
- { 0x5F2C2774, "Battlesphere (World)", FF_ROM | FF_VERIFIED },
+ { 0x5F2C2774, "Battlesphere (World)", FF_ROM | FF_VERIFIED | FF_REQ_DSP },
{ 0x61C7EEC0, "Zero 5 (World)", FF_ROM | FF_VERIFIED },
{ 0x61EE6B62, "Arena Football '95", FF_ALPINE | FF_VERIFIED },
- { 0x67F9AB3A, "Battle Sphere Gold (World)", FF_ROM },
+ { 0x67F9AB3A, "Battle Sphere Gold (World)", FF_ROM | FF_REQ_DSP },
{ 0x687068D5, "[BIOS] Atari Jaguar CD (World)", FF_BIOS },
{ 0x6B2B95AD, "Tempest 2000 (World)", FF_ROM | FF_VERIFIED },
{ 0x6EB774EB, "Worms (World)", FF_ROM | FF_VERIFIED },
--- /dev/null
+//
+// alpinetab.cpp: "Alpine" tab on the settings dialog
+//
+// Part of the Virtual Jaguar Project
+// (C) 2011 Underground Software
+// See the README and GPLv3 files for licensing and warranty information
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// WHO WHEN WHAT
+// --- ---------- ------------------------------------------------------------
+// JLH 07/15/2011 Created this file
+
+#include "alpinetab.h"
+
+
+AlpineTab::AlpineTab(QWidget * parent/*= 0*/): QWidget(parent)
+{
+// antialiasChk = new QCheckBox(tr("Use Qt's built-in antialiasing"));
+
+// I'm thinking we should scan the bios folder for the 5 known BIOSes, and
+// just present a radio button to choose between them...
+ QLabel * label1 = new QLabel("ROM to load:");
+// QLabel * label2 = new QLabel("CD Boot ROM:");
+// QLabel * label3 = new QLabel("EEPROMs:");
+// QLabel * label4 = new QLabel("Software:");
+
+ edit1 = new QLineEdit("");
+// edit2 = new QLineEdit("");
+// edit3 = new QLineEdit("");
+// edit4 = new QLineEdit("");
+ edit1->setPlaceholderText("ROM to load when Virtual Jaguar loads");
+// edit2->setPlaceholderText("CD Boot ROM location");
+// edit3->setPlaceholderText("EEPROM path");
+// edit4->setPlaceholderText("Software path");
+
+ QVBoxLayout * layout1 = new QVBoxLayout;
+ layout1->addWidget(label1);
+// layout1->addWidget(label2);
+// layout1->addWidget(label3);
+// layout1->addWidget(label4);
+
+ QVBoxLayout * layout2 = new QVBoxLayout;
+ layout2->addWidget(edit1);
+// layout2->addWidget(edit2);
+// layout2->addWidget(edit3);
+// layout2->addWidget(edit4);
+
+ QHBoxLayout * layout3 = new QHBoxLayout;
+ layout3->addLayout(layout1);
+ layout3->addLayout(layout2);
+
+ QVBoxLayout * layout4 = new QVBoxLayout;
+ layout4->addLayout(layout3);
+
+ // Checkboxes...
+ writeROM = new QCheckBox(tr("Allow writes to cartridge ROM"));
+// useDSP = new QCheckBox(tr("Enable DSP"));
+// useHostAudio = new QCheckBox(tr("Enable audio playback"));
+// useUnknownSoftware = new QCheckBox(tr("Allow unknown software in file chooser"));
+
+ layout4->addWidget(writeROM);
+// layout4->addWidget(useDSP);
+// layout4->addWidget(useHostAudio);
+// layout4->addWidget(useUnknownSoftware);
+
+ setLayout(layout4);
+}
+
+AlpineTab::~AlpineTab()
+{
+}
--- /dev/null
+#ifndef __ALPINETAB_H__
+#define __ALPINETAB_H__
+
+#include <QtGui>
+
+class AlpineTab: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ AlpineTab(QWidget * parent = 0);
+ ~AlpineTab();
+
+ public:
+ QLineEdit * edit1;
+// QLineEdit * edit2;
+// QLineEdit * edit3;
+// QLineEdit * edit4;
+
+ QCheckBox * writeROM;
+// QCheckBox * useDSP;
+// QCheckBox * useHostAudio;
+// QCheckBox * useUnknownSoftware;
+};
+
+#endif // __ALPINETAB_H__
#include <QApplication>
#include "log.h"
#include "mainwin.h"
+#include "settings.h"
#include "types.h"
#ifdef __GCCWIN32__
// Here's the main application loop--short and simple...
int main(int argc, char * argv[])
{
+ // Normally, this would be read in from the settings module... :-P
+ vjs.hardwareTypeAlpine = false;
+
if (argc > 1)
{
if ((strcmp(argv[1], "--help") == 0) || (strcmp(argv[1], "-h") == 0)
"enough demand for it. :-)\n");
return 0;
}
+ if ((strcmp(argv[1], "--alpine") == 0) || (strcmp(argv[1], "-a") == 0))
+ {
+ printf("Alpine Mode enabled.\n");
+ vjs.hardwareTypeAlpine = true;
+ }
}
Q_INIT_RESOURCE(virtualjaguar); // This must the same name as the exe filename
#include "generaltab.h"
#include "controllertab.h"
+#include "alpinetab.h"
#include "settings.h"
tabWidget = new QTabWidget;
generalTab = new GeneralTab(this);
controllerTab = new ControllerTab(this);
+
+ if (vjs.hardwareTypeAlpine)
+ alpineTab = new AlpineTab(this);
+
tabWidget->addTab(generalTab, tr("General"));
tabWidget->addTab(controllerTab, tr("Controller"));
+ if (vjs.hardwareTypeAlpine)
+ tabWidget->addTab(alpineTab, tr("Alpine"));
+
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
generalTab->useBIOS->setChecked(vjs.useJaguarBIOS);
generalTab->useDSP->setChecked(vjs.DSPEnabled);
generalTab->useHostAudio->setChecked(vjs.audioEnabled);
+
+ if (vjs.hardwareTypeAlpine)
+ {
+ alpineTab->edit1->setText(vjs.alpineROMPath);
+ alpineTab->writeROM->setChecked(vjs.allowWritesToROM);
+ }
}
void ConfigDialog::UpdateVJSettings(void)
vjs.useJaguarBIOS = generalTab->useBIOS->isChecked();
vjs.DSPEnabled = generalTab->useDSP->isChecked();
vjs.audioEnabled = generalTab->useHostAudio->isChecked();
+
+ if (vjs.hardwareTypeAlpine)
+ {
+ strcpy(vjs.alpineROMPath, alpineTab->edit1->text().toAscii().data());
+ vjs.allowWritesToROM = alpineTab->writeROM->isChecked();
+ }
}
class GeneralTab;
class ControllerTab;
+class AlpineTab;
class ConfigDialog: public QDialog
{
public:
GeneralTab * generalTab;
ControllerTab * controllerTab;
+ AlpineTab * alpineTab;
};
#endif // __CONFIGDIALOG_H__
setCentralWidget(videoWidget);
setWindowIcon(QIcon(":/res/vj-icon.png"));
// setWindowTitle("Virtual Jaguar v2.0.0");
- setWindowTitle("Virtual Jaguar " VJ_RELEASE_VERSION );
+
+ QString title = QString(tr("Virtual Jaguar " VJ_RELEASE_VERSION ));
+
+ if (vjs.hardwareTypeAlpine)
+ title += QString(tr(" - Alpine Mode"));
+
+ setWindowTitle(title);
aboutWin = new AboutWindow(this);
filePickWin = new FilePickerWindow(this);
ntscAct->setChecked(vjs.hardwareTypeNTSC);
palAct->setChecked(!vjs.hardwareTypeNTSC);
+ // Load up the default ROM if in Alpine mode:
+ if (vjs.hardwareTypeAlpine)
+ {
+ bool romLoaded = (JaguarLoadFile(vjs.alpineROMPath) ? true : false);
+
+ if (romLoaded)
+ WriteLog("Alpine Mode: Successfully loaded file \"%s\".\n", vjs.alpineROMPath);
+ else
+ WriteLog("Alpine Mode: Unable to load file \"%s\"!\n", vjs.alpineROMPath);
+ }
+
// Do this in case original size isn't correct (mostly for the first-run case)
ResizeMainWindow();
return;
QString before = vjs.ROMPath;
+ QString alpineBefore = vjs.alpineROMPath;
bool audioBefore = vjs.audioEnabled;
dlg.UpdateVJSettings();
QString after = vjs.ROMPath;
+ QString alpineAfter = vjs.alpineROMPath;
bool audioAfter = vjs.audioEnabled;
bool allowOld = allowUnknownSoftware;
if ((before != after) || (allowOld != allowUnknownSoftware))
filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
+ // If the "Alpine" ROM is changed, then let's load it...
+ if (alpineBefore != alpineAfter)
+ {
+ if (!JaguarLoadFile(vjs.alpineROMPath))
+ {
+ // Oh crap, we couldn't get the file! Alert the media!
+ QMessageBox msg;
+ msg.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs.alpineROMPath));
+ msg.setIcon(QMessageBox::Warning);
+ msg.exec();
+ }
+ }
+
// If the "Enable audio" checkbox changed, then we have to re-init the DAC...
if (audioBefore != audioAfter)
{
SET32(jaguarMainRAM, 0, 0x00200000); // Set top of stack...
cartridgeLoaded = (JaguarLoadFile(file.toAscii().data()) ? true : false);
+ uint8_t * biosPointer = jaguarBootROM;
+
+ if (vjs.hardwareTypeAlpine)
+ {
+ if (biosAvailable & BIOS_STUB1)
+// memcpy(jagMemSpace + 0xE00000, jaguarDevBootROM1, 0x20000);
+ biosPointer = jaguarDevBootROM1;
+ else if (biosAvailable & BIOS_STUB2)
+// memcpy(jagMemSpace + 0xE00000, jaguarDevBootROM2, 0x20000);
+ biosPointer = jaguarDevBootROM2;
+ }
+// else
+// memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000);
+
+ memcpy(jagMemSpace + 0xE00000, biosPointer, 0x20000);
+
powerAct->setDisabled(false);
powerAct->setChecked(true);
powerButtonOn = false;
TogglePowerState();
-// QString newTitle = QString("Virtual Jaguar v2.0.0 - Now playing: %1")
- QString newTitle = QString("Virtual Jaguar " VJ_RELEASE_VERSION
- " - Now playing: %1")
- .arg(filePickWin->GetSelectedPrettyName());
- setWindowTitle(newTitle);
+ if (!vjs.hardwareTypeAlpine)
+ {
+ QString newTitle = QString("Virtual Jaguar " VJ_RELEASE_VERSION " - Now playing: %1")
+ .arg(filePickWin->GetSelectedPrettyName());
+ setWindowTitle(newTitle);
+ }
}
void MainWin::ToggleCDUsage(void)
vjs.useOpenGL = settings.value("useOpenGL", true).toBool();
vjs.glFilter = settings.value("glFilterType", 0).toInt();
vjs.renderType = settings.value("renderType", 0).toInt();
- strcpy(vjs.jagBootPath, settings.value("JagBootROM", "./bios/[BIOS] Atari Jaguar (USA, Europe).zip").toString().toAscii().data());
- strcpy(vjs.CDBootPath, settings.value("CDBootROM", "./bios/jagcd.rom").toString().toAscii().data());
+ vjs.allowWritesToROM = settings.value("writeROM", false).toBool();
+// strcpy(vjs.jagBootPath, settings.value("JagBootROM", "./bios/[BIOS] Atari Jaguar (USA, Europe).zip").toString().toAscii().data());
+// strcpy(vjs.CDBootPath, settings.value("CDBootROM", "./bios/jagcd.rom").toString().toAscii().data());
strcpy(vjs.EEPROMPath, settings.value("EEPROMs", "./eeproms/").toString().toAscii().data());
strcpy(vjs.ROMPath, settings.value("ROMs", "./software/").toString().toAscii().data());
+ strcpy(vjs.alpineROMPath, settings.value("DefaultROM", "").toString().toAscii().data());
WriteLog("MainWin: Paths\n");
//WriteLog(" jagBootPath = \"%s\"\n", vjs.jagBootPath);
//WriteLog(" CDBootPath = \"%s\"\n", vjs.CDBootPath);
settings.setValue("useOpenGL", vjs.useOpenGL);
settings.setValue("glFilterType", vjs.glFilter);
settings.setValue("renderType", vjs.renderType);
+ settings.setValue("writeROM", vjs.allowWritesToROM);
settings.setValue("JagBootROM", vjs.jagBootPath);
settings.setValue("CDBootROM", vjs.CDBootPath);
settings.setValue("EEPROMs", vjs.EEPROMPath);
settings.setValue("ROMs", vjs.ROMPath);
+ settings.setValue("DefaultROM", vjs.alpineROMPath);
settings.setValue("p1k_up", vjs.p1KeyBindings[BUTTON_U]);
settings.setValue("p1k_down", vjs.p1KeyBindings[BUTTON_D]);
extern int effect_start2, effect_start3, effect_start4, effect_start5, effect_start6;
#endif
+// Really, need to include memory.h for this, but it might interfere with some stuff...
+extern uint8 jagMemSpace[];
+
+// Internal variables
+
uint32 jaguar_active_memory_dumps = 0;
uint32 jaguarMainROMCRC32, jaguarROMSize, jaguarRunAddress;
exit(0);
}//*/
#endif
-
-#if 0
-//001A0110: move.w #$0, $F000E2.l ; Restore Blitter/GPU bus priorities
-//001A015C: rte ; Return from the interrupt
-static bool disassembleGo = false;
- if (m68kPC == 0x1A0110)
- {
- static char buffer[2048];
- m68k_disassemble(buffer, m68kPC, M68K_CPU_TYPE_68000);
- WriteLog("--> [M68K IRQ Routine start] %08X: %s", m68kPC, buffer);
- WriteLog("\t\tA0=%08X, A1=%08X, D0=%08X(cmd), D1=%08X(# bytes), D2=%08X\n",
- m68k_get_reg(NULL, M68K_REG_A0), m68k_get_reg(NULL, M68K_REG_A1),
- m68k_get_reg(NULL, M68K_REG_D0), m68k_get_reg(NULL, M68K_REG_D1), m68k_get_reg(NULL, M68K_REG_D2));
- disassembleGo = true;
- }
- else if (m68kPC == 0x1A015C)
- WriteLog("--> [M68K IRQ Routine end]\n");
-
- if (disassembleGo)
- {
- static char buffer[2048];
- m68k_disassemble(buffer, m68kPC, M68K_CPU_TYPE_68000);
- WriteLog("%08X: %s", m68kPC, buffer);
- WriteLog("\tD0=$%08X, D1=$%08X, D2=$%08X\n",
- m68k_get_reg(NULL, M68K_REG_D0), m68k_get_reg(NULL, M68K_REG_D1), m68k_get_reg(NULL, M68K_REG_D2));
- }
-#endif
}
#if 0
else if ((address >= 0x800000) && (address <= 0xDFFEFF))
retVal = jaguarMainROM[address - 0x800000];
else if ((address >= 0xE00000) && (address <= 0xE3FFFF))
- retVal = jaguarBootROM[address - 0xE00000];
+// retVal = jaguarBootROM[address - 0xE00000];
+// retVal = jaguarDevBootROM1[address - 0xE00000];
+ retVal = jagMemSpace[address];
else if ((address >= 0xDFFF00) && (address <= 0xDFFFFF))
retVal = CDROMReadByte(address);
else if ((address >= 0xF00000) && (address <= 0xF0FFFF))
else if ((address >= 0x800000) && (address <= 0xDFFEFE))
retVal = (jaguarMainROM[address - 0x800000] << 8) | jaguarMainROM[address - 0x800000 + 1];
else if ((address >= 0xE00000) && (address <= 0xE3FFFE))
- retVal = (jaguarBootROM[address - 0xE00000] << 8) | jaguarBootROM[address - 0xE00000 + 1];
+// retVal = (jaguarBootROM[address - 0xE00000] << 8) | jaguarBootROM[address - 0xE00000 + 1];
+// retVal = (jaguarDevBootROM1[address - 0xE00000] << 8) | jaguarDevBootROM1[address - 0xE00000 + 1];
+ retVal = (jagMemSpace[address] << 8) | jagMemSpace[address + 1];
else if ((address >= 0xDFFF00) && (address <= 0xDFFFFE))
retVal = CDROMReadWord(address, M68K);
else if ((address >= 0xF00000) && (address <= 0xF0FFFE))
else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFF))
data = CDROMReadByte(offset, who);
else if ((offset >= 0xE00000) && (offset < 0xE40000))
- data = jaguarBootROM[offset & 0x3FFFF];
+// data = jaguarBootROM[offset & 0x3FFFF];
+// data = jaguarDevBootROM1[offset & 0x3FFFF];
+ data = jagMemSpace[offset];
else if ((offset >= 0xF00000) && (offset < 0xF10000))
data = TOMReadByte(offset, who);
else if ((offset >= 0xF10000) && (offset < 0xF20000))
else if ((offset >= 0xDFFF00) && (offset <= 0xDFFFFE))
return CDROMReadWord(offset, who);
else if ((offset >= 0xE00000) && (offset <= 0xE3FFFE))
- return (jaguarBootROM[(offset+0) & 0x3FFFF] << 8) | jaguarBootROM[(offset+1) & 0x3FFFF];
+// return (jaguarBootROM[(offset+0) & 0x3FFFF] << 8) | jaguarBootROM[(offset+1) & 0x3FFFF];
+// return (jaguarDevBootROM1[(offset+0) & 0x3FFFF] << 8) | jaguarDevBootROM1[(offset+1) & 0x3FFFF];
+ return (jagMemSpace[offset + 0] << 8) | jagMemSpace[offset + 1];
else if ((offset >= 0xF00000) && (offset <= 0xF0FFFE))
return TOMReadWord(offset, who);
else if ((offset >= 0xF10000) && (offset <= 0xF1FFFE))
//extern uint32 * backbuffer;
void JaguarReset(void)
{
+//Need to change this so it uses the single RAM space and load the BIOS
+//into it somewhere...
+//Also, have to change this here and in JaguarReadXX() currently
// Only use the system BIOS if it's available...!
if (vjs.useJaguarBIOS && (biosAvailable & (BIOS_NORMAL | BIOS_STUB1 | BIOS_STUB2)))
- memcpy(jaguarMainRAM, jaguarBootROM, 8);
+// memcpy(jaguarMainRAM, jaguarBootROM, 8);
+// memcpy(jaguarMainRAM, jaguarDevBootROM1, 8);
+ memcpy(jaguarMainRAM, &jagMemSpace[0xE00000], 8);
else
SET32(jaguarMainRAM, 4, jaguarRunAddress);
bool audioEnabled;
uint32 frameSkip;
uint32 renderType;
+ bool allowWritesToROM;
// Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
char jagBootPath[MAX_PATH];
char CDBootPath[MAX_PATH];
char EEPROMPath[MAX_PATH];
+ char alpineROMPath[MAX_PATH];
};
// Render types
HEADERS = \
src/gui/about.h \
+ src/gui/alpinetab.h \
src/gui/app.h \
src/gui/configdialog.h \
src/gui/controllertab.h \
SOURCES = \
src/gui/about.cpp \
+ src/gui/alpinetab.cpp \
src/gui/app.cpp \
src/gui/configdialog.cpp \
src/gui/controllertab.cpp \