From 2d36cde81d75802546a53831f3cf07095278c10a Mon Sep 17 00:00:00 2001 From: spacy51 Date: Sun, 2 Mar 2008 16:11:25 +0000 Subject: [PATCH] Qt: ADDED shared, agb_core and gb_apu files to project file --- project/qmake/vba-m.pro | 127 ++++++++++++++++++- project/vc2008/vba-m.vcproj | 244 ++++++++++++++++++++++++++++++++++++ src/System.h | 3 + src/Util.cpp | 6 + src/agb/GBA-arm.cpp | 2 - src/agb/GBA-thumb.cpp | 2 - src/agb/GBA.cpp | 1 - src/agb/agbprint.cpp | 2 - src/qt/EmuManager.h | 5 + src/qt/emu.cpp | 173 +++++++++++++++++++++++++ src/qt/emu.h | 70 +++++++++++ src/remote.cpp | 1 - 12 files changed, 627 insertions(+), 9 deletions(-) create mode 100644 src/qt/emu.cpp create mode 100644 src/qt/emu.h diff --git a/project/qmake/vba-m.pro b/project/qmake/vba-m.pro index ed8f7d8d..c0a5368e 100644 --- a/project/qmake/vba-m.pro +++ b/project/qmake/vba-m.pro @@ -2,21 +2,39 @@ TEMPLATE = app CONFIG += qt release QT += opengl TARGET = VisualBoyAdvance +DEFINES += BKPT_SUPPORT + # Directory Locations M_DIR_QT = ../../src/qt/ M_DIR_LANG = ../../lang/ +M_DIR_SHARED = ../../src/ +M_DIR_GBAPU = ../../src/dmg/gb_apu/ +M_DIR_AGB = ../../src/agb/ +M_DIR_DMG = ../../src/dmg/ + +# Tweaks +win32-msvc2005 { + DEFINES += _CRT_SECURE_NO_WARNINGS + DEFINES += NO_PNG +} + + +# Resource Files RESOURCES += $${M_DIR_QT}vba-m.qrc win32 { RC_FILE = $${M_DIR_QT}vba-m.rc } -# Language Files + +# Language Files TRANSLATIONS += $${M_DIR_LANG}german.ts TRANSLATIONS += $${M_DIR_LANG}spanish.ts + +# Qt GUI Files PRECOMPILED_HEADER = $${M_DIR_QT}precompile.h HEADERS += $${M_DIR_QT}version.h @@ -37,8 +55,115 @@ SOURCES += $${M_DIR_QT}MainOptions.cpp HEADERS += $${M_DIR_QT}configdialog.h SOURCES += $${M_DIR_QT}configdialog.cpp +HEADERS += $${M_DIR_QT}emu.h +SOURCES += $${M_DIR_QT}emu.cpp + HEADERS += $${M_DIR_QT}EmuManager.h SOURCES += $${M_DIR_QT}EmuManager.cpp HEADERS += $${M_DIR_QT}GraphicsOutput.h SOURCES += $${M_DIR_QT}GraphicsOutput.cpp + + +# Shared Core Files +HEADERS += $${M_DIR_SHARED}System.h + +HEADERS += $${M_DIR_SHARED}Globals.h +SOURCES += $${M_DIR_SHARED}Globals.cpp + +#HEADERS += $${M_DIR_SHARED}armdis.h +#SOURCES += $${M_DIR_SHARED}armdis.cpp + +HEADERS += $${M_DIR_SHARED}bios.h +SOURCES += $${M_DIR_SHARED}bios.cpp + +HEADERS += $${M_DIR_SHARED}Cheats.h +SOURCES += $${M_DIR_SHARED}Cheats.cpp + +#HEADERS += $${M_DIR_SHARED}CheatSearch.h +#SOURCES += $${M_DIR_SHARED}CheatSearch.cpp + +HEADERS += $${M_DIR_SHARED}EEprom.h +SOURCES += $${M_DIR_SHARED}EEprom.cpp + +HEADERS += $${M_DIR_SHARED}Flash.h +SOURCES += $${M_DIR_SHARED}Flash.cpp + +HEADERS += $${M_DIR_SHARED}Sram.h +SOURCES += $${M_DIR_SHARED}Sram.cpp + +HEADERS += $${M_DIR_SHARED}elf.h +SOURCES += $${M_DIR_SHARED}elf.cpp + +HEADERS += $${M_DIR_SHARED}RTC.h +SOURCES += $${M_DIR_SHARED}RTC.cpp + +HEADERS += $${M_DIR_SHARED}Sound.h +SOURCES += $${M_DIR_SHARED}Sound.cpp + +HEADERS += $${M_DIR_SHARED}memgzio.h +SOURCES += $${M_DIR_SHARED}memgzio.c + +HEADERS += $${M_DIR_SHARED}fex.h +SOURCES += $${M_DIR_SHARED}fex_mini.cpp + +HEADERS += $${M_DIR_SHARED}Util.h +SOURCES += $${M_DIR_SHARED}Util.cpp + +SOURCES += $${M_DIR_SHARED}Mode0.cpp +SOURCES += $${M_DIR_SHARED}Mode1.cpp +SOURCES += $${M_DIR_SHARED}Mode2.cpp +SOURCES += $${M_DIR_SHARED}Mode3.cpp +SOURCES += $${M_DIR_SHARED}Mode4.cpp +SOURCES += $${M_DIR_SHARED}Mode5.cpp + +#HEADERS += $${M_DIR_SHARED}NLS.h + +#HEADERS += $${M_DIR_SHARED}Port.h + +#SOURCES += $${M_DIR_SHARED}remote.cpp + + +# GB APU +HEADERS += $${M_DIR_GBAPU}blargg_common.h +HEADERS += $${M_DIR_GBAPU}blargg_config.h +HEADERS += $${M_DIR_GBAPU}blargg_source.h + +HEADERS += $${M_DIR_GBAPU}Blip_Buffer.h +SOURCES += $${M_DIR_GBAPU}Blip_Buffer.cpp + +HEADERS += $${M_DIR_GBAPU}Effects_Buffer.h +SOURCES += $${M_DIR_GBAPU}Effects_Buffer.cpp + +HEADERS += $${M_DIR_GBAPU}Gb_Apu.h +SOURCES += $${M_DIR_GBAPU}Gb_Apu.cpp +SOURCES += $${M_DIR_GBAPU}Gb_Apu_State.cpp + +HEADERS += $${M_DIR_GBAPU}Gb_Oscs.h +SOURCES += $${M_DIR_GBAPU}Gb_Oscs.cpp + +HEADERS += $${M_DIR_GBAPU}Multi_Buffer.h +SOURCES += $${M_DIR_GBAPU}Multi_Buffer.cpp + + +# GBA Core Files +HEADERS += $${M_DIR_AGB}agbprint.h +SOURCES += $${M_DIR_AGB}agbprint.cpp + +HEADERS += $${M_DIR_AGB}GBA.h +SOURCES += $${M_DIR_AGB}GBA.cpp + +#HEADERS += $${M_DIR_AGB}gbafilter.h +#SOURCES += $${M_DIR_AGB}gbafilter.cpp + +HEADERS += $${M_DIR_AGB}GBAGfx.h +SOURCES += $${M_DIR_AGB}GBAGfx.cpp + +#HEADERS += $${M_DIR_AGB}GBALink.h +#SOURCES += $${M_DIR_AGB}GBALink.cpp + +SOURCES += $${M_DIR_AGB}GBA-arm.cpp +SOURCES += $${M_DIR_AGB}GBA-thumb.cpp + +HEADERS += $${M_DIR_AGB}GBAcpu.h +HEADERS += $${M_DIR_AGB}GBAinline.h diff --git a/project/vc2008/vba-m.vcproj b/project/vc2008/vba-m.vcproj index e058280a..d8542ca2 100644 --- a/project/vc2008/vba-m.vcproj +++ b/project/vc2008/vba-m.vcproj @@ -177,6 +177,14 @@ + + + + @@ -187,6 +195,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/System.h b/src/System.h index dee17f7b..1e971e12 100644 --- a/src/System.h +++ b/src/System.h @@ -111,6 +111,9 @@ extern void Sm60FPS_Sleep(); extern void DbgMsg(const char *msg, ...); extern void winlog(const char *,...); +extern void dbgOutput(const char *s, u32 addr); +extern void dbgSignal(int sig,int number); + extern bool systemSoundOn; extern u16 systemColorMap16[0x10000]; extern u32 systemColorMap32[0x10000]; diff --git a/src/Util.cpp b/src/Util.cpp index 245b1daa..cbb5c0fa 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -21,9 +21,11 @@ #include #include +#ifndef NO_PNG extern "C" { #include } +#endif #include "System.h" #include "NLS.h" @@ -58,6 +60,7 @@ static int (ZEXPORT *utilGzCloseFunc)(gzFile) = NULL; bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix) { +#ifndef NO_PNG u8 writeBuffer[512 * 3]; FILE *fp = fopen(fileName,"wb"); @@ -182,6 +185,9 @@ bool utilWritePNGFile(const char *fileName, int w, int h, u8 *pix) fclose(fp); return true; +#else + return false; +#endif } void utilPutDword(u8 *p, u32 value) diff --git a/src/agb/GBA-arm.cpp b/src/agb/GBA-arm.cpp index 711ab63f..dc7915e2 100644 --- a/src/agb/GBA-arm.cpp +++ b/src/agb/GBA-arm.cpp @@ -68,7 +68,6 @@ static INSN_REGPARM void armUnknownInsn(u32 opcode) #ifdef BKPT_SUPPORT static INSN_REGPARM void armBreakpoint(u32 opcode) { - extern void (*dbgSignal)(int,int); reg[15].I -= 4; armNextPC -= 4; dbgSignal(5, (opcode & 0x0f) | ((opcode>>4) & 0xfff0)); @@ -119,7 +118,6 @@ static void count(u32 opcode, int cond_res) #ifdef BKPT_SUPPORT #define CONSOLE_OUTPUT(a,b) do { \ - extern void (*dbgOutput)(char *, u32); \ if ((opcode == 0xe0000000) && (reg[0].I == 0xC0DED00D)) { \ dbgOutput((a), (b)); \ } while (0) diff --git a/src/agb/GBA-thumb.cpp b/src/agb/GBA-thumb.cpp index fcbeebde..161a6aec 100644 --- a/src/agb/GBA-thumb.cpp +++ b/src/agb/GBA-thumb.cpp @@ -62,7 +62,6 @@ static INSN_REGPARM void thumbUnknownInsn(u32 opcode) #ifdef BKPT_SUPPORT static INSN_REGPARM void thumbBreakpoint(u32 opcode) { - extern void (*dbgSignal)(int,int); reg[15].I -= 2; armNextPC -= 2; dbgSignal(5, opcode & 255); @@ -75,7 +74,6 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode) #ifdef BKPT_SUPPORT # define THUMB_CONSOLE_OUTPUT(a,b) do { \ if ((opcode == 0x4000) && (reg[0].I == 0xC0DED00D)) { \ - extern void (*dbgOutput)(const char *, u32); \ dbgOutput((a), (b)); \ } \ } while (0) diff --git a/src/agb/GBA.cpp b/src/agb/GBA.cpp index 20fb31a4..f7c0b31e 100644 --- a/src/agb/GBA.cpp +++ b/src/agb/GBA.cpp @@ -1685,7 +1685,6 @@ void CPUSoftwareInterrupt(int comment) if(armState) comment >>= 16; #ifdef BKPT_SUPPORT if(comment == 0xff) { - extern void (*dbgOutput)(const char *, u32); dbgOutput(NULL, reg[0].I); return; } diff --git a/src/agb/agbprint.cpp b/src/agb/agbprint.cpp index 8b2db30e..e028f665 100644 --- a/src/agb/agbprint.cpp +++ b/src/agb/agbprint.cpp @@ -67,8 +67,6 @@ bool agbPrintIsEnabled() return agbPrintEnabled; } -extern void (*dbgOutput)(const char *, u32); - void agbPrintFlush() { u16 get = debuggerReadHalfWord(0x9fe20fc); diff --git a/src/qt/EmuManager.h b/src/qt/EmuManager.h index 6e9e3e97..d80f8214 100644 --- a/src/qt/EmuManager.h +++ b/src/qt/EmuManager.h @@ -19,8 +19,12 @@ #ifndef EMUMANAGER_H #define EMUMANAGER_H + #include "precompile.h" +#include "emu.h" + + // class to abstract emulation control class EmuManager { @@ -38,4 +42,5 @@ private: unsigned char *romBuffer; }; + #endif // #ifndef EMUMANAGER_H diff --git a/src/qt/emu.cpp b/src/qt/emu.cpp new file mode 100644 index 00000000..fc7b9de0 --- /dev/null +++ b/src/qt/emu.cpp @@ -0,0 +1,173 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// 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 2, 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, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// This file adds all the code required by System.h + + +#include "emu.h" + + +int emulating = 0; +int systemFrameSkip = 0; +int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; +bool systemSoundOn = false; +u32 systemColorMap32[0x10000]; +u16 systemColorMap16[0x10000]; +int systemRedShift = 0; +int systemBlueShift = 0; +int systemGreenShift = 0; +int systemColorDepth = 32; +int systemDebug = 0; +int systemVerbose = 0; + + +bool systemReadJoypads() +{ + // TODO: implement + return false; +} + +u32 systemReadJoypad( int which ) +{ + // TODO: implement + return 0; +} + +void systemUpdateMotionSensor() +{ + // TODO: implement +} + + +int systemGetSensorX() +{ + // TODO: implement + return 0; +} + + +int systemGetSensorY() +{ + // TODO: implement + return 0; +} + + +u32 systemGetClock() +{ + // TODO: implement + return 0; +} + + +void systemMessage( int number, const char *defaultMsg, ... ) +{ + // TODO: implement +} + + +void systemScreenCapture( int captureNumber ) +{ + // TODO: implement +} + + +void systemDrawScreen() +{ + // TODO: implement +} + + +void systemShowSpeed( int speed ) +{ + // TODO: implement +} + + +void system10Frames( int rate ) +{ + // TODO: implement +} + + +void systemFrame() +{ + // TODO: implement +} + + +bool systemPauseOnFrame() +{ + // TODO: implement + return false; +} + + +void dbgOutput( const char *s, u32 addr ) +{ + // TODO: implement +} + + +void dbgSignal( int sig,int number ) +{ + // TODO: implement +} + + +void winlog( const char *msg, ... ) +{ + // TODO: implement +} + + +void systemWriteDataToSoundBuffer() +{ + // TODO: implement +} + +void systemSoundShutdown() +{ + // TODO: implement +} + +void systemSoundPause() +{ + // TODO: implement +} + +void systemSoundResume() +{ + // TODO: implement +} + +void systemSoundReset() +{ + // TODO: implement +} + +bool systemSoundInit() +{ + // TODO: implement + return false; +} + +bool systemCanChangeSoundQuality() +{ + // TODO: implement + return false; +} diff --git a/src/qt/emu.h b/src/qt/emu.h new file mode 100644 index 00000000..a703a1d1 --- /dev/null +++ b/src/qt/emu.h @@ -0,0 +1,70 @@ +// VBA-M, A Nintendo Handheld Console Emulator +// Copyright (C) 2008 VBA-M development team +// +// 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 2, 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, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#ifndef EMU_H +#define EMU_H + + +#include "../System.h" + + +// Global Variables +extern int emulating; +extern int systemFrameSkip; +extern int systemSaveUpdateCounter; +extern bool systemSoundOn; +extern u32 systemColorMap32[0x10000]; +extern u16 systemColorMap16[0x10000]; +extern int systemRedShift; +extern int systemBlueShift; +extern int systemGreenShift; +extern int systemColorDepth; +extern int systemDebug; +extern int systemVerbose; + + +// Global Functions +bool systemReadJoypads(); +u32 systemReadJoypad( int which ); +void systemUpdateMotionSensor(); +int systemGetSensorX(); +int systemGetSensorY(); +u32 systemGetClock(); + +void systemMessage( int number, const char *defaultMsg, ... ); +void dbgOutput( const char *s, u32 addr ); +void dbgSignal( int sig,int number ); +void winlog( const char *msg, ... ); + +bool systemPauseOnFrame(); +void systemScreenCapture( int captureNumber ); +void systemDrawScreen(); +void systemShowSpeed( int speed ); +void system10Frames( int rate ); +void systemFrame(); + +void systemWriteDataToSoundBuffer(); +void systemSoundShutdown(); +void systemSoundPause(); +void systemSoundResume(); +void systemSoundReset(); +bool systemSoundInit(); +bool systemCanChangeSoundQuality(); + + +#endif // #ifndef EMU_H diff --git a/src/remote.cpp b/src/remote.cpp index 54d82c91..1777fd2b 100644 --- a/src/remote.cpp +++ b/src/remote.cpp @@ -48,7 +48,6 @@ extern bool debugger; extern void CPUUpdateCPSR(); #ifdef SDL extern void (*dbgMain)(); -extern void (*dbgSignal)(int,int); extern void debuggerMain(); extern void debuggerSignal(int,int); #endif