Remove some unused files

This commit is contained in:
twinaphex 2021-10-05 12:16:13 +02:00
parent a421cbbe68
commit e5be965b0b
634 changed files with 72 additions and 13278 deletions

View File

@ -3,29 +3,29 @@ DEPS_DIR := $(CORE_DIR)/deps
COREDEFINES := -D__LIBRETRO__ -DSINGLE_THREADED -DVIDEO_COLOR_TYPE_RGB565 -DZ80_CUSTOM_CONFIGURATION -DNO_FRAMEBUFFER
INCFLAGS := -I$(CORE_DIR) \
-I$(LIBRETRO_COMM_DIR)/include \
-I$(CORE_DIR)/Src/Arch \
-I$(CORE_DIR)/Src/Bios \
-I$(CORE_DIR)/Src/Board \
-I$(CORE_DIR)/Src/BuildInfo \
-I$(CORE_DIR)/Src/Common \
-I$(CORE_DIR)/Src/Debugger \
-I$(CORE_DIR)/Src/Emulator \
-I$(CORE_DIR)/Src/IoDevice \
-I$(CORE_DIR)/Src/Language \
-I$(CORE_DIR)/Src/Media \
-I$(CORE_DIR)/Src/Memory \
-I$(CORE_DIR)/Src/Resources \
-I$(CORE_DIR)/Src/SoundChips \
-I$(CORE_DIR)/Src/TinyXML \
-I$(CORE_DIR)/Src/Unzip \
-I$(CORE_DIR)/Src/Utils \
-I$(CORE_DIR)/Src/VideoChips \
-I$(CORE_DIR)/Src/VideoRender \
-I$(CORE_DIR)/Src/Z80 \
-I$(CORE_DIR)/Src/Input \
-I$(CORE_DIR)/Src/Libretro \
-I$(DEPS_DIR)/zlib
-I$(LIBRETRO_COMM_DIR)/include \
-I$(CORE_DIR)/Src/Arch \
-I$(CORE_DIR)/Src/Bios \
-I$(CORE_DIR)/Src/Board \
-I$(CORE_DIR)/Src/BuildInfo \
-I$(CORE_DIR)/Src/Common \
-I$(CORE_DIR)/Src/Debugger \
-I$(CORE_DIR)/Src/Emulator \
-I$(CORE_DIR)/Src/IoDevice \
-I$(CORE_DIR)/Src/Language \
-I$(CORE_DIR)/Src/Media \
-I$(CORE_DIR)/Src/Memory \
-I$(CORE_DIR)/Src/Resources \
-I$(CORE_DIR)/Src/SoundChips \
-I$(CORE_DIR)/Src/TinyXML \
-I$(CORE_DIR)/Src/Unzip \
-I$(CORE_DIR)/Src/Utils \
-I$(CORE_DIR)/Src/VideoChips \
-I$(CORE_DIR)/Src/VideoRender \
-I$(CORE_DIR)/Src/Z80 \
-I$(CORE_DIR)/Src/Input \
-I$(CORE_DIR)/Src/Libretro \
-I$(DEPS_DIR)/zlib
ifneq (,$(findstring msvc2003,$(platform)))
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
@ -33,47 +33,32 @@ endif
SOURCES_C := $(CORE_DIR)/libretro.c \
$(CORE_DIR)/Src/Libretro/Dialog.c \
$(CORE_DIR)/Src/Libretro/Event.c \
$(CORE_DIR)/Src/Libretro/File.c \
$(CORE_DIR)/Src/Libretro/Glob.c \
$(CORE_DIR)/Src/Libretro/Input.c \
$(CORE_DIR)/Src/Libretro/Menu.c \
$(CORE_DIR)/Src/Libretro/Midi.c \
$(CORE_DIR)/Src/Libretro/Notifications.c \
$(CORE_DIR)/Src/Libretro/Printer.c \
$(CORE_DIR)/Src/Libretro/Sound.c \
$(CORE_DIR)/Src/Libretro/Timer.c \
$(CORE_DIR)/Src/Libretro/Uart.c \
$(CORE_DIR)/Src/Libretro/VideoIn.c \
$(CORE_DIR)/Src/Libretro/Eth.c \
$(CORE_DIR)/Src/Libretro/Cdrom.c \
$(CORE_DIR)/Src/Libretro/Mouse.c \
$(CORE_DIR)/Src/Libretro/Emulator.c \
$(CORE_DIR)/Src/Common/ArrayList.c \
$(CORE_DIR)/Src/Common/DebugMemory.c \
$(CORE_DIR)/Src/Bios/Patch.c \
$(CORE_DIR)/Src/Unzip/unzip.c \
$(CORE_DIR)/Src/Unzip/ioapi.c \
$(CORE_DIR)/Src/Unzip/zip.c
$(CORE_DIR)/Src/Libretro/Dialog.c \
$(CORE_DIR)/Src/Libretro/Event.c \
$(CORE_DIR)/Src/Libretro/File.c \
$(CORE_DIR)/Src/Libretro/Glob.c \
$(CORE_DIR)/Src/Libretro/Input.c \
$(CORE_DIR)/Src/Libretro/Menu.c \
$(CORE_DIR)/Src/Libretro/Midi.c \
$(CORE_DIR)/Src/Libretro/Notifications.c \
$(CORE_DIR)/Src/Libretro/Printer.c \
$(CORE_DIR)/Src/Libretro/Sound.c \
$(CORE_DIR)/Src/Libretro/Timer.c \
$(CORE_DIR)/Src/Libretro/Uart.c \
$(CORE_DIR)/Src/Libretro/VideoIn.c \
$(CORE_DIR)/Src/Libretro/Eth.c \
$(CORE_DIR)/Src/Libretro/Cdrom.c \
$(CORE_DIR)/Src/Libretro/Mouse.c \
$(CORE_DIR)/Src/Libretro/Emulator.c \
$(CORE_DIR)/Src/Common/ArrayList.c \
$(CORE_DIR)/Src/Common/DebugMemory.c \
$(CORE_DIR)/Src/Bios/Patch.c \
$(CORE_DIR)/Src/Unzip/unzip.c \
$(CORE_DIR)/Src/Unzip/ioapi.c \
$(CORE_DIR)/Src/Unzip/zip.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/adler32.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/compress.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/crc32.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/gzio.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/uncompr.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/deflate.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/trees.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/zutil.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/inflate.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/infback.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/inftrees.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/inffast.c
#SOURCES_C += $(CORE_DIR)/Src/Unzip/iowin32.c
SOURCES_C += $(CORE_DIR)/Src/Memory/AtmelPerom.c \
$(CORE_DIR)/Src/Memory/AmdFlash.c
SOURCES_C += $(CORE_DIR)/Src/Memory/AtmelPerom.c \
$(CORE_DIR)/Src/Memory/AmdFlash.c
SOURCES_C += $(CORE_DIR)/Src/Memory/DeviceManager.c
SOURCES_C += $(CORE_DIR)/Src/Memory/IoPort.c
@ -203,11 +188,6 @@ SOURCES_C += $(CORE_DIR)/Src/VideoChips/VDP.c
SOURCES_C += $(CORE_DIR)/Src/VideoChips/V9938.c
SOURCES_C += $(CORE_DIR)/Src/VideoChips/VideoManager.c
#SOURCES_C += $(CORE_DIR)/Src/VideoRender/hq2x.c
#SOURCES_C += $(CORE_DIR)/Src/VideoRender/hq3x.c
#SOURCES_C += $(CORE_DIR)/Src/VideoRender/Scalebit.c
#SOURCES_C += $(CORE_DIR)/Src/VideoRender/VideoRender.c
SOURCES_C += $(CORE_DIR)/Src/Z80/R800.c
SOURCES_C += $(CORE_DIR)/Src/Z80/R800SaveState.c
@ -270,8 +250,6 @@ SOURCES_C += $(CORE_DIR)/Src/SoundChips/MsxPsg.c
SOURCES_C += $(CORE_DIR)/Src/Emulator/Actions.c
SOURCES_C += $(CORE_DIR)/Src/Emulator/AppConfig.c
SOURCES_C += $(CORE_DIR)/Src/Emulator/CommandLine.c
#SOURCES_C += $(CORE_DIR)/Src/Emulator/Emulator.c
#SOURCES_C += $(CORE_DIR)/Src/Emulator/Keyboard.c
SOURCES_C += $(CORE_DIR)/Src/Emulator/FileHistory.c
SOURCES_C += $(CORE_DIR)/Src/Emulator/LaunchFile.c
@ -313,37 +291,37 @@ SOURCES_C += $(CORE_DIR)/Src/Input/SviJoyIo.c
SOURCES_C += $(CORE_DIR)/Src/Input/SviJoystick.c
SOURCES_CXX := $(CORE_DIR)/Src/SoundChips/Moonsound.cpp \
$(CORE_DIR)/Src/Memory/romMapperNoWind.cpp \
$(CORE_DIR)/Src/TinyXML/tinystr.cpp \
$(CORE_DIR)/Src/TinyXML/tinyxml.cpp \
$(CORE_DIR)/Src/TinyXML/tinyxmlerror.cpp \
$(CORE_DIR)/Src/TinyXML/tinyxmlparser.cpp \
$(CORE_DIR)/Src/Media/MediaDb.cpp \
$(CORE_DIR)/Src/Media/Sha1.cpp \
$(CORE_DIR)/Src/IoDevice/GameReader.cpp \
$(CORE_DIR)/Src/SoundChips/OpenMsxYM2413.cpp \
$(CORE_DIR)/Src/SoundChips/OpenMsxYM2413_2.cpp \
$(CORE_DIR)/Src/SoundChips/OpenMsxYMF262.cpp \
$(CORE_DIR)/Src/SoundChips/OpenMsxYMF278.cpp \
$(CORE_DIR)/Src/SoundChips/YM2413.cpp
$(CORE_DIR)/Src/Memory/romMapperNoWind.cpp \
$(CORE_DIR)/Src/TinyXML/tinystr.cpp \
$(CORE_DIR)/Src/TinyXML/tinyxml.cpp \
$(CORE_DIR)/Src/TinyXML/tinyxmlerror.cpp \
$(CORE_DIR)/Src/TinyXML/tinyxmlparser.cpp \
$(CORE_DIR)/Src/Media/MediaDb.cpp \
$(CORE_DIR)/Src/Media/Sha1.cpp \
$(CORE_DIR)/Src/IoDevice/GameReader.cpp \
$(CORE_DIR)/Src/SoundChips/OpenMsxYM2413.cpp \
$(CORE_DIR)/Src/SoundChips/OpenMsxYM2413_2.cpp \
$(CORE_DIR)/Src/SoundChips/OpenMsxYMF262.cpp \
$(CORE_DIR)/Src/SoundChips/OpenMsxYMF278.cpp \
$(CORE_DIR)/Src/SoundChips/YM2413.cpp
#SOURCES_CXX += $(CORE_DIR)/Src/IoDevice/msxgr.cpp
ifneq ($(STATIC_LINKING), 1)
SOURCES_C += $(LIBRETRO_COMM_DIR)/file/retro_dirent.c \
$(LIBRETRO_COMM_DIR)/compat/compat_snprintf.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c
$(LIBRETRO_COMM_DIR)/compat/compat_snprintf.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c
#include zlib
SOURCES_C += $(DEPS_DIR)/zlib/adler32.c \
$(DEPS_DIR)/zlib/compress.c \
$(DEPS_DIR)/zlib/crc32.c \
$(DEPS_DIR)/zlib/deflate.c \
$(DEPS_DIR)/zlib/inffast.c \
$(DEPS_DIR)/zlib/inflate.c \
$(DEPS_DIR)/zlib/inftrees.c \
$(DEPS_DIR)/zlib/trees.c \
$(DEPS_DIR)/zlib/uncompr.c \
$(DEPS_DIR)/zlib/zutil.c
$(DEPS_DIR)/zlib/compress.c \
$(DEPS_DIR)/zlib/crc32.c \
$(DEPS_DIR)/zlib/deflate.c \
$(DEPS_DIR)/zlib/inffast.c \
$(DEPS_DIR)/zlib/inflate.c \
$(DEPS_DIR)/zlib/inftrees.c \
$(DEPS_DIR)/zlib/trees.c \
$(DEPS_DIR)/zlib/uncompr.c \
$(DEPS_DIR)/zlib/zutil.c
endif
ifeq ($(HAVE_COMPAT), 1)

0
Src/Arch/ArchBitmap.h Executable file → Normal file
View File

0
Src/Arch/ArchControls.h Executable file → Normal file
View File

0
Src/Arch/ArchDialog.h Executable file → Normal file
View File

0
Src/Arch/ArchEth.h Executable file → Normal file
View File

0
Src/Arch/ArchEvent.h Executable file → Normal file
View File

0
Src/Arch/ArchFile.h Executable file → Normal file
View File

0
Src/Arch/ArchGlob.h Executable file → Normal file
View File

0
Src/Arch/ArchInput.h Executable file → Normal file
View File

0
Src/Arch/ArchKeyStorage.h Executable file → Normal file
View File

0
Src/Arch/ArchMenu.h Executable file → Normal file
View File

0
Src/Arch/ArchMidi.h Executable file → Normal file
View File

0
Src/Arch/ArchNotifications.h Executable file → Normal file
View File

0
Src/Arch/ArchSound.h Executable file → Normal file
View File

0
Src/Arch/ArchText.h Executable file → Normal file
View File

0
Src/Arch/ArchThread.h Executable file → Normal file
View File

0
Src/Arch/ArchTimer.h Executable file → Normal file
View File

0
Src/Arch/ArchVideoIn.h Executable file → Normal file
View File

0
Src/Bios/Patch.c Executable file → Normal file
View File

0
Src/Board/Adam.c Executable file → Normal file
View File

0
Src/Board/Adam.h Executable file → Normal file
View File

0
Src/Board/Board.c Executable file → Normal file
View File

0
Src/Board/Board.h Executable file → Normal file
View File

0
Src/Board/Coleco.c Executable file → Normal file
View File

0
Src/Board/Coleco.h Executable file → Normal file
View File

0
Src/Board/MSX.c Executable file → Normal file
View File

0
Src/Board/MSX.h Executable file → Normal file
View File

0
Src/Board/Machine.c Executable file → Normal file
View File

0
Src/Board/Machine.h Executable file → Normal file
View File

0
Src/Board/SG1000.c Executable file → Normal file
View File

0
Src/Board/SG1000.h Executable file → Normal file
View File

0
Src/Board/SVI.c Executable file → Normal file
View File

0
Src/Board/SVI.h Executable file → Normal file
View File

0
Src/BuildInfo/build_info.txt Executable file → Normal file
View File

0
Src/BuildInfo/build_number.h Executable file → Normal file
View File

0
Src/BuildInfo/version.h Executable file → Normal file
View File

0
Src/Common/DebugMemory.c Executable file → Normal file
View File

0
Src/Common/MsxTypes.h Executable file → Normal file
View File

0
Src/Debugger/DebugDeviceManager.c Executable file → Normal file
View File

0
Src/Debugger/DebugDeviceManager.h Executable file → Normal file
View File

0
Src/Debugger/Debugger.c Executable file → Normal file
View File

0
Src/Debugger/Debugger.h Executable file → Normal file
View File

0
Src/Emulator/Actions.c Executable file → Normal file
View File

0
Src/Emulator/Actions.h Executable file → Normal file
View File

0
Src/Emulator/AppConfig.c Executable file → Normal file
View File

0
Src/Emulator/AppConfig.h Executable file → Normal file
View File

View File

@ -1,561 +0,0 @@
/*****************************************************************************
** $Source: /cvsroot/bluemsx/blueMSX/Src/Emulator/CommandLine.c,v $
**
** $Revision: 1.35 $
**
** $Date: 2008/08/31 06:13:13 $
**
** More info: http://www.bluemsx.com
**
** Copyright (C) 2003-2006 Daniel Vik
**
** 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 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, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
******************************************************************************
*/
#include "CommandLine.h"
#include "TokenExtract.h"
#include "IsFileExtension.h"
#include "MediaDb.h"
#include "ziphelper.h"
#include "Machine.h"
#include "Casette.h"
#include "Disk.h"
#include "FileHistory.h"
#include "LaunchFile.h"
#include "Emulator.h"
#include "StrcmpNoCase.h"
#include "AppConfig.h"
#include <stdlib.h>
#include <string.h>
static RomType romNameToType(char* name) {
RomType romType = ROM_UNKNOWN;
if (name == NULL) {
return ROM_UNKNOWN;
}
romType = mediaDbStringToType(name);
if (romType == ROM_UNKNOWN) {
romType = atoi(name);
if (romType < ROM_STANDARD || romType > ROM_MAXROMID) {
romType = ROM_UNKNOWN;
}
}
return romType;
}
static int isRomFileType(char* filename, char* inZip) {
inZip[0] = 0;
if (isFileExtension(filename, ".zip")) {
int count;
char* fileList;
fileList = zipGetFileList(filename, ".rom", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".ri", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".mx1", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".mx2", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".sms", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".col", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".sg", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".sc", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
return 0;
}
return isFileExtension(filename, ".rom") ||
isFileExtension(filename, ".ri") ||
isFileExtension(filename, ".mx1") ||
isFileExtension(filename, ".mx2") ||
isFileExtension(filename, ".sms") ||
isFileExtension(filename, ".col") ||
isFileExtension(filename, ".sg") ||
isFileExtension(filename, ".sc");
}
static int isDskFileType(char* filename, char* inZip) {
inZip[0] = 0;
if (isFileExtension(filename, ".zip")) {
int count;
char* fileList;
fileList = zipGetFileList(filename, ".dsk", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".di1", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".di2", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".360", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".720", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
fileList = zipGetFileList(filename, ".sf7", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
return 0;
}
return isFileExtension(filename, ".dsk") ||
isFileExtension(filename, ".di1") ||
isFileExtension(filename, ".di2") ||
isFileExtension(filename, ".360") ||
isFileExtension(filename, ".720") ||
isFileExtension(filename, ".Sf7");
}
static int isCasFileType(char* filename, char* inZip) {
inZip[0] = 0;
if (isFileExtension(filename, ".zip")) {
int count;
char* fileList;
fileList = zipGetFileList(filename, ".cas", &count);
if (fileList) {
strcpy(inZip, fileList);
free(fileList);
return 1;
}
return 0;
}
return isFileExtension(filename, ".cas");
}
static int checkArg(const char* arg, const char* value) {
if (arg[0] != '/' && arg[0] != '-') {
return 0;
}
return strcmpnocase(arg + 1, value) == 0;
}
int emuCheckResetArgument(char* cmdLine) {
int i;
char* argument;
for (i = 0; (argument = extractToken(cmdLine, i)) != NULL; i++) {
if (checkArg(argument, "reset")) {
return 1;
}
if (checkArg(argument, "resetregs")) {
return 2;
}
}
return 0;
}
char* emuCheckThemeArgument(char* cmdLine){
static char themeName[PROP_MAXPATH];
int i;
char* argument;
themeName[0] = 0;
for (i = 0; (argument = extractToken(cmdLine, i)) != NULL; i++) {
if (checkArg(argument, "theme")) {
argument = extractToken(cmdLine, i + 1);
if (argument != NULL) {
strcat(themeName, argument);
}
return themeName;
}
}
return NULL;
}
void emuCheckFullscreenArgument(Properties* properties, char* cmdLine){
int i;
char* argument;
if (NULL == extractToken(cmdLine, 0)) {
return;
}
// properties->video.windowSize = P_VIDEO_SIZEX2;
for (i = 0; (argument = extractToken(cmdLine, i)) != NULL; i++) {
if (checkArg(argument, "fullscreen")) {
properties->video.windowSize = P_VIDEO_SIZEFULLSCREEN;
}
}
}
static int emuStartWithArguments(Properties* properties, char* commandLine, char *gamedir) {
int i;
char cmdLine[512] = "";
char* argument;
char rom1[512] = "";
char rom2[512] = "";
char rom1zip[256] = "";
char rom2zip[256] = "";
RomType romType1 = ROM_UNKNOWN;
RomType romType2 = ROM_UNKNOWN;
char machineName[64] = "";
char diskA[512] = "";
char diskB[512] = "";
char diskAzip[256] = "";
char diskBzip[256] = "";
char ide1p[256] = "";
char ide1s[256] = "";
char cas[512] = "";
char caszip[256] = "";
int fullscreen = 0;
#ifdef WII
int startEmu = 1; // always start
#else
int startEmu = 0;
#endif
if (commandLine[0] != '/' && commandLine[1] == ':') {
char* ptr;
strcat(cmdLine, "\"");
strcat(cmdLine, commandLine);
ptr = cmdLine + strlen(commandLine);
while (ptr > cmdLine && *ptr == ' ') {
*ptr-- = '\0';
}
strcat(cmdLine, "\"");
}
else {
strcat(cmdLine, commandLine);
}
// If one argument, assume it is a rom or disk to run
if (!extractToken(cmdLine, 1)) {
argument = extractToken(cmdLine, 0);
if (argument && *argument != '/') {
if (*argument == '\"') argument++;
if (*argument) {
int i;
for (i = 0; i < PROP_MAX_CARTS; i++) {
properties->media.carts[i].fileName[0] = 0;
properties->media.carts[i].fileNameInZip[0] = 0;
properties->media.carts[i].type = ROM_UNKNOWN;
updateExtendedRomName(i, properties->media.carts[i].fileName, properties->media.carts[i].fileNameInZip);
}
for (i = 0; i < PROP_MAX_DISKS; i++) {
properties->media.disks[i].fileName[0] = 0;
properties->media.disks[i].fileNameInZip[0] = 0;
updateExtendedDiskName(i, properties->media.disks[i].fileName, properties->media.disks[i].fileNameInZip);
}
return tryLaunchUnknownFile(properties, argument, 1);
}
return 0;
}
}
// If more than one argument, check arguments,
// set configuration and then run
for (i = 0; (argument = extractToken(cmdLine, i)) != NULL; i++) {
if (checkArg(argument, "rom1")) {
argument = extractTokenEx(cmdLine, ++i, gamedir);
if (argument == NULL || !isRomFileType(argument, rom1zip)) return 0; // Invaid argument
strcpy(rom1, argument);
startEmu = 1;
}
if (checkArg(argument, "rom1zip")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0;
strcpy(rom1zip, argument);
}
if (checkArg(argument, "romtype1")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0; // Invaid argument
romType1 = romNameToType(argument);
startEmu = 1;
}
if (checkArg(argument, "rom2")) {
argument = extractTokenEx(cmdLine, ++i, gamedir);
if (argument == NULL || !isRomFileType(argument, rom2zip)) return 0; // Invaid argument
strcpy(rom2, argument);
startEmu = 1;
}
if (checkArg(argument, "rom2zip")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0;
strcpy(rom2zip, argument);
}
if (checkArg(argument, "romtype2")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0; // Invaid argument
romType2 = romNameToType(argument);
startEmu = 1;
}
if (checkArg(argument, "diskA")) {
argument = extractTokenEx(cmdLine, ++i, gamedir);
if (argument == NULL || !isDskFileType(argument, diskAzip)) return 0; // Invaid argument
strcpy(diskA, argument);
startEmu = 1;
}
if (checkArg(argument, "diskAzip")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0;
strcpy(diskAzip, argument);
}
if (checkArg(argument, "diskB")) {
argument = extractTokenEx(cmdLine, ++i, gamedir);
if (argument == NULL || !isDskFileType(argument, diskBzip)) return 0; // Invaid argument
strcpy(diskB, argument);
startEmu = 1;
}
if (checkArg(argument, "diskBzip")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0;
strcpy(diskBzip, argument);
}
if (checkArg(argument, "cas")) {
argument = extractTokenEx(cmdLine, ++i, gamedir);
if (argument == NULL || !isCasFileType(argument, caszip)) return 0; // Invaid argument
strcpy(cas, argument);
startEmu = 1;
}
if (checkArg(argument, "ide1primary")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0; // Invaid argument
strcpy(ide1p, argument);
startEmu = 1;
}
if (checkArg(argument, "ide1secondary")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0; // Invaid argument
strcpy(ide1s, argument);
startEmu = 1;
}
if (checkArg(argument, "caszip")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0;
strcpy(caszip, argument);
}
if (checkArg(argument, "machine")) {
argument = extractToken(cmdLine, ++i);
if (argument == NULL) return 0; // Invaid argument
strcpy(machineName, argument);
if (!machineIsValid(machineName, 1)) return 0;
startEmu = 1;
}
if (checkArg(argument, "fullscreen")) {
fullscreen = 1;
}
}
if (!startEmu) {
return 1;
}
for (i = 0; i < PROP_MAX_CARTS; i++) {
properties->media.carts[i].fileName[0] = 0;
properties->media.carts[i].fileNameInZip[0] = 0;
properties->media.carts[i].type = ROM_UNKNOWN;
updateExtendedRomName(i, properties->media.carts[i].fileName, properties->media.carts[i].fileNameInZip);
}
for (i = 0; i < PROP_MAX_DISKS; i++) {
properties->media.disks[i].fileName[0] = 0;
properties->media.disks[i].fileNameInZip[0] = 0;
updateExtendedDiskName(i, properties->media.disks[i].fileName, properties->media.disks[i].fileNameInZip);
}
for (i = 0; i < PROP_MAX_TAPES; i++) {
properties->media.tapes[i].fileName[0] = 0;
properties->media.tapes[i].fileNameInZip[0] = 0;
updateExtendedCasName(i, properties->media.tapes[i].fileName, properties->media.tapes[i].fileNameInZip);
}
if (!strlen(rom1)) {
switch (romType1) {
case ROM_SCC: strcat(rom1, CARTNAME_SCC); romType1 = ROM_SCC; break;
case ROM_SCCPLUS: strcat(rom1, CARTNAME_SCCPLUS); romType1 = ROM_SCCPLUS; break;
case ROM_SNATCHER: strcat(rom1, CARTNAME_SNATCHER); break;
case ROM_SDSNATCHER: strcat(rom1, CARTNAME_SDSNATCHER); break;
case ROM_SCCMIRRORED: strcat(rom1, CARTNAME_SCCMIRRORED); break;
case ROM_SCCEXTENDED: strcat(rom1, CARTNAME_SCCEXPANDED); break;
case ROM_FMPAC: strcat(rom1, CARTNAME_FMPAC); break;
case ROM_PAC: strcat(rom1, CARTNAME_PAC); break;
case ROM_GAMEREADER: strcat(rom1, CARTNAME_GAMEREADER); break;
case ROM_SUNRISEIDE: strcat(rom1, CARTNAME_SUNRISEIDE); break;
case ROM_NOWIND: strcat(rom1, CARTNAME_NOWINDDOS1); break;
case ROM_BEERIDE: strcat(rom1, CARTNAME_BEERIDE); break;
case ROM_GIDE: strcat(rom1, CARTNAME_GIDE); break;
case ROM_GOUDASCSI: strcat(rom1, CARTNAME_GOUDASCSI); break;
case ROM_NMS1210: strcat(rom1, CARTNAME_NMS1210); break;
case ROM_SONYHBI55: strcat(rom1, CARTNAME_SONYHBI55); break;
}
}
if (!strlen(rom2)) {
switch (romType2) {
case ROM_SCC: strcat(rom2, CARTNAME_SCC); romType2 = ROM_SCC; break;
case ROM_SCCPLUS: strcat(rom2, CARTNAME_SCCPLUS); romType2 = ROM_SCCPLUS; break;
case ROM_SNATCHER: strcat(rom2, CARTNAME_SNATCHER); break;
case ROM_SDSNATCHER: strcat(rom2, CARTNAME_SDSNATCHER); break;
case ROM_SCCMIRRORED: strcat(rom2, CARTNAME_SCCMIRRORED); break;
case ROM_SCCEXTENDED: strcat(rom2, CARTNAME_SCCEXPANDED); break;
case ROM_FMPAC: strcat(rom2, CARTNAME_FMPAC); break;
case ROM_PAC: strcat(rom2, CARTNAME_PAC); break;
case ROM_GAMEREADER: strcat(rom2, CARTNAME_GAMEREADER); break;
case ROM_SUNRISEIDE: strcat(rom2, CARTNAME_SUNRISEIDE); break;
case ROM_NOWIND: strcat(rom2, CARTNAME_NOWINDDOS1); break;
case ROM_BEERIDE: strcat(rom2, CARTNAME_BEERIDE); break;
case ROM_GIDE: strcat(rom2, CARTNAME_GIDE); break;
case ROM_GOUDASCSI: strcat(rom2, CARTNAME_GOUDASCSI); break;
case ROM_NMS1210: strcat(rom2, CARTNAME_NMS1210); break;
case ROM_SONYHBI55: strcat(rom2, CARTNAME_SONYHBI55); break;
}
}
if (properties->cassette.rewindAfterInsert) tapeRewindNextInsert();
if (strlen(rom1) && !insertCartridge(properties, 0, rom1, *rom1zip ? rom1zip : NULL, romType1, -1)) return 0;
if (strlen(rom2) && !insertCartridge(properties, 1, rom2, *rom2zip ? rom2zip : NULL, romType2, -1)) return 0;
if (strlen(diskA) && !insertDiskette(properties, 0, diskA, *diskAzip ? diskAzip : NULL, -1)) return 0;
if (strlen(diskB) && !insertDiskette(properties, 1, diskB, *diskBzip ? diskBzip : NULL, -1)) return 0;
if (strlen(ide1p) && !insertDiskette(properties, diskGetHdDriveId(0, 0), ide1p, NULL, -1)) return 0;
if (strlen(ide1s) && !insertDiskette(properties, diskGetHdDriveId(0, 1), ide1s, NULL, -1)) return 0;
if (strlen(cas) && !insertCassette(properties, 0, cas, *caszip ? caszip : NULL, -1)) return 0;
if (strlen(machineName)) strcpy(properties->emulation.machineName, machineName);
#ifdef WII
else strcpy(properties->emulation.machineName, "MSX2 - No Moonsound"); /* If not specified, use MSX2 without moonsound as default */
#endif
emulatorStop();
emulatorStart(NULL);
return 1;
}
int emuTryStartWithArguments(Properties* properties, char* cmdLine, char *gamedir) {
if (cmdLine == NULL || *cmdLine == 0) {
if (appConfigGetInt("autostart", 0) != 0) {
emulatorStop();
emulatorStart(properties->filehistory.quicksave);
}
return 0;
}
if (*cmdLine) {
int success;
if (0 == strncmp(cmdLine, "/onearg ", 8)) {
char args[2048];
char* ptr;
sprintf(args, "\"%s", cmdLine + 8);
ptr = args + strlen(args);
while(*--ptr == ' ') {
*ptr = 0;
}
strcat(args, "\"");
success = emuStartWithArguments(properties, args, gamedir);
}
else {
success = emuStartWithArguments(properties, cmdLine, gamedir);
}
if (!success) {
return -1;
}
}
return 1;
}

39
Src/Emulator/CommandLine.h Executable file → Normal file
View File

@ -1,39 +0,0 @@
/*****************************************************************************
** $Source: /cvsroot/bluemsx/blueMSX/Src/Emulator/CommandLine.h,v $
**
** $Revision: 1.7 $
**
** $Date: 2008/03/30 18:38:40 $
**
** More info: http://www.bluemsx.com
**
** Copyright (C) 2003-2006 Daniel Vik
**
** 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 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, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
******************************************************************************
*/
#ifndef COMMAND_LINE_H
#define COMMAND_LINE_H
#include "Properties.h"
int emuCheckResetArgument(char* szLine);
char* emuCheckThemeArgument(char* szLine);
void emuCheckFullscreenArgument(Properties* properties, char* szLine);
int emuTryStartWithArguments(Properties* properties, char* cmdLine, char *gamedir);
#endif

View File

@ -1,941 +0,0 @@
/*****************************************************************************
** $Source: /cygdrive/d/Private/_SVNROOT/bluemsx/blueMSX/Src/Emulator/Emulator.c,v $
**
** $Revision: 1.67 $
**
** $Date: 2009-07-18 14:35:59 $
**
** More info: http://www.bluemsx.com
**
** Copyright (C) 2003-2006 Daniel Vik
**
** 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 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, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
******************************************************************************
*/
#include "Emulator.h"
#include "MsxTypes.h"
#include "Debugger.h"
#include "Board.h"
#include "FileHistory.h"
#include "Switches.h"
#include "Led.h"
#include "Machine.h"
#include "InputEvent.h"
#include "ArchThread.h"
#include "ArchEvent.h"
#include "ArchTimer.h"
#include "ArchSound.h"
#include "ArchMidi.h"
#include "JoystickPort.h"
#include "ArchInput.h"
#include "ArchDialog.h"
#include "ArchNotifications.h"
#include <math.h>
#include <string.h>
static int WaitForSync(int maxSpeed, int breakpointHit);
static void* emuThread;
#ifndef WII
static void* emuSyncEvent;
#endif
static void* emuStartEvent;
#ifndef WII
static void* emuTimer;
#endif
static int emuExitFlag;
static UInt32 emuSysTime = 0;
static UInt32 emuFrequency = 3579545;
int emuMaxSpeed = 0;
int emuPlayReverse = 0;
int emuMaxEmuSpeed = 0; // Max speed issued by emulation
static char emuStateName[512];
static volatile int emuSuspendFlag;
static volatile EmuState emuState = EMU_STOPPED;
static volatile int emuSingleStep = 0;
static Properties* properties;
static Mixer* mixer;
static BoardDeviceInfo deviceInfo;
static Machine* machine;
static int lastScreenMode;
static int emuFrameskipCounter = 0;
static UInt32 emuTimeIdle = 0;
static UInt32 emuTimeTotal = 1;
static UInt32 emuTimeOverflow = 0;
static UInt32 emuUsageCurrent = 0;
static UInt32 emuCpuSpeed = 0;
static UInt32 emuCpuUsage = 0;
static int enableSynchronousUpdate = 1;
#if 0
#define LOG_SIZE (10 * 1000000)
UInt32 logentry[LOG_SIZE];
int logindex;
int logwrapped;
void dolog(int slot, int sslot, int wr, UInt16 addr, UInt8 val)
{
logentry[logindex++] = (slot << 26) | (sslot << 24) | ((UInt32)val << 16) | addr | (wr ? (1 << 31) : 0);
if (logindex == LOG_SIZE) {
logindex = 0;
logwrapped++;
}
}
void clearlog()
{
logwrapped = 0;
logindex = 0;
}
void savelog()
{
int totalSize = LOG_SIZE;
int lastPct = -1;
int cnt = 0;
FILE * f = fopen("bluemsxlog.txt", "w+");
int i = 0;
if (logwrapped == 0 && logindex == 0) {
return;
}
if (logwrapped) {
i = logindex;
}
else {
totalSize = logindex;
}
printf("Saving log for slot 1\n");
do {
UInt32 v = logentry[i];
int newPct = ++cnt * 100 / totalSize;
char rw = (v >> 31) ? 'W' : 'R';
if (newPct != lastPct) {
printf("\r%d%%",newPct);
lastPct = newPct;
}
fprintf(f, "%c(%d:%d) %.4x: %.2x\n", rw, (v>>26)&3, (v>>24)&3,v & 0xffff, (v >> 16) & 0xff);
if (++i == LOG_SIZE) {
i = 0;
}
} while (i != logindex);
printf("\n");
fclose(f);
}
#else
#define clearlog()
#define savelog()
#endif
static void emuCalcCpuUsage() {
static UInt32 oldSysTime = 0;
static UInt32 oldAverage = 0;
static UInt32 cnt = 0;
UInt32 newSysTime;
UInt32 emuTimeAverage;
if (emuTimeTotal < 10) {
return;
}
newSysTime = archGetSystemUpTime(1000);
emuTimeAverage = 100 * (emuTimeTotal - emuTimeIdle) / (emuTimeTotal / 10);
emuTimeOverflow = emuTimeAverage > 940;
if ((cnt++ & 0x1f) == 0) {
UInt32 usageAverage = emuUsageCurrent * 100 / (newSysTime - oldSysTime) * emuFrequency / 3579545;
if (usageAverage > 98 && usageAverage < 102) {
usageAverage = 100;
}
if (usageAverage >= 10000) {
usageAverage = 0;
}
emuCpuSpeed = usageAverage;
emuCpuUsage = emuTimeAverage;
}
oldSysTime = newSysTime;
emuUsageCurrent = 0;
emuTimeIdle = 0;
emuTimeTotal = 1;
}
static int emuUseSynchronousUpdate()
{
if (properties->emulation.syncMethod == P_EMU_SYNCIGNORE) {
return properties->emulation.syncMethod;
}
if (properties->emulation.speed == 50 &&
enableSynchronousUpdate &&
emulatorGetMaxSpeed() == 0)
{
return properties->emulation.syncMethod;
}
return P_EMU_SYNCAUTO;
}
UInt32 emulatorGetCpuSpeed() {
return emuCpuSpeed;
}
UInt32 emulatorGetCpuUsage() {
return emuCpuUsage;
}
void emuEnableSynchronousUpdate(int enable)
{
enableSynchronousUpdate = enable;
}
void emulatorInit(Properties* theProperties, Mixer* theMixer)
{
properties = theProperties;
mixer = theMixer;
}
void emulatorExit()
{
properties = NULL;
mixer = NULL;
}
EmuState emulatorGetState() {
return emuState;
}
void emulatorSetState(EmuState state) {
if (state == EMU_RUNNING) {
archSoundResume();
archMidiEnable(1);
}
else {
archSoundSuspend();
archMidiEnable(0);
}
if (state == EMU_STEP) {
state = EMU_RUNNING;
emuSingleStep = 1;
}
if (state == EMU_STEP_BACK) {
EmuState oldState = state;
state = EMU_RUNNING;
if (!boardRewindOne()) {
state = oldState;
}
}
emuState = state;
}
int emulatorGetSyncPeriod() {
#ifdef NO_HIRES_TIMERS
return 10;
#else
return properties->emulation.syncMethod == P_EMU_SYNCAUTO ||
properties->emulation.syncMethod == P_EMU_SYNCNONE ? 2 : 1;
#endif
}
#ifndef WII
static int timerCallback(void* timer) {
if (properties == NULL) {
return 1;
}
else {
static UInt32 frameCount = 0;
static UInt32 oldSysTime = 0;
static UInt32 refreshRate = 50;
UInt32 framePeriod = (properties->video.frameSkip + 1) * 1000;
UInt32 syncPeriod = emulatorGetSyncPeriod();
UInt32 sysTime = archGetSystemUpTime(1000);
UInt32 diffTime = sysTime - oldSysTime;
int syncMethod = emuUseSynchronousUpdate();
if (diffTime == 0) {
return 0;
}
oldSysTime = sysTime;
// Update display
frameCount += refreshRate * diffTime;
if (frameCount >= framePeriod) {
frameCount %= framePeriod;
if (emuState == EMU_RUNNING) {
refreshRate = boardGetRefreshRate();
if (syncMethod == P_EMU_SYNCAUTO || syncMethod == P_EMU_SYNCNONE) {
archUpdateEmuDisplay(0);
}
}
}
if (syncMethod == P_EMU_SYNCTOVBLANKASYNC) {
archUpdateEmuDisplay(syncMethod);
}
// Update emulation
archEventSet(emuSyncEvent);
}
return 1;
}
int timerCallback_global(void* timer) {
timerCallback(timer);
}
#endif
static void getDeviceInfo(BoardDeviceInfo* deviceInfo)
{
int i;
for (i = 0; i < PROP_MAX_CARTS; i++) {
strcpy(properties->media.carts[i].fileName, deviceInfo->carts[i].name);
strcpy(properties->media.carts[i].fileNameInZip, deviceInfo->carts[i].inZipName);
// Don't save rom type
// properties->media.carts[i].type = deviceInfo->carts[i].type;
updateExtendedRomName(i, properties->media.carts[i].fileName, properties->media.carts[i].fileNameInZip);
}
for (i = 0; i < PROP_MAX_DISKS; i++) {
strcpy(properties->media.disks[i].fileName, deviceInfo->disks[i].name);
strcpy(properties->media.disks[i].fileNameInZip, deviceInfo->disks[i].inZipName);
updateExtendedDiskName(i, properties->media.disks[i].fileName, properties->media.disks[i].fileNameInZip);
}
for (i = 0; i < PROP_MAX_TAPES; i++) {
strcpy(properties->media.tapes[i].fileName, deviceInfo->tapes[i].name);
strcpy(properties->media.tapes[i].fileNameInZip, deviceInfo->tapes[i].inZipName);
updateExtendedCasName(i, properties->media.tapes[i].fileName, properties->media.tapes[i].fileNameInZip);
}
properties->emulation.vdpSyncMode = deviceInfo->video.vdpSyncMode;
}
static void setDeviceInfo(BoardDeviceInfo* deviceInfo)
{
int i;
for (i = 0; i < PROP_MAX_CARTS; i++) {
deviceInfo->carts[i].inserted = strlen(properties->media.carts[i].fileName);
deviceInfo->carts[i].type = properties->media.carts[i].type;
strcpy(deviceInfo->carts[i].name, properties->media.carts[i].fileName);
strcpy(deviceInfo->carts[i].inZipName, properties->media.carts[i].fileNameInZip);
}
for (i = 0; i < PROP_MAX_DISKS; i++) {
deviceInfo->disks[i].inserted = strlen(properties->media.disks[i].fileName);
strcpy(deviceInfo->disks[i].name, properties->media.disks[i].fileName);
strcpy(deviceInfo->disks[i].inZipName, properties->media.disks[i].fileNameInZip);
}
for (i = 0; i < PROP_MAX_TAPES; i++) {
deviceInfo->tapes[i].inserted = strlen(properties->media.tapes[i].fileName);
strcpy(deviceInfo->tapes[i].name, properties->media.tapes[i].fileName);
strcpy(deviceInfo->tapes[i].inZipName, properties->media.tapes[i].fileNameInZip);
}
deviceInfo->video.vdpSyncMode = properties->emulation.vdpSyncMode;
}
static int emulationStartFailure = 0;
static void emulatorPauseCb(void)
{
emulatorSetState(EMU_PAUSED);
debuggerNotifyEmulatorPause();
}
static void emulatorThread() {
int frequency;
int success = 0;
int reversePeriod = 0;
int reverseBufferCnt = 0;
emulatorSetFrequency(properties->emulation.speed, &frequency);
switchSetFront(properties->emulation.frontSwitch);
switchSetPause(properties->emulation.pauseSwitch);
switchSetAudio(properties->emulation.audioSwitch);
if (properties->emulation.reverseEnable && properties->emulation.reverseMaxTime > 0) {
reversePeriod = 50;
reverseBufferCnt = properties->emulation.reverseMaxTime * 1000 / reversePeriod;
}
success = boardRun(machine,
&deviceInfo,
mixer,
*emuStateName ? emuStateName : NULL,
frequency,
reversePeriod,
reverseBufferCnt,
WaitForSync);
ledSetAll(0);
emuState = EMU_STOPPED;
#ifndef WII
archTimerDestroy(emuTimer);
#endif
if (!success) {
emulationStartFailure = 1;
}
archEventSet(emuStartEvent);
}
//extern int xxxx;
void emulatorStart(const char* stateName) {
dbgEnable();
archEmulationStartNotification();
//xxxx = 0;
emulatorResume();
emuExitFlag = 0;
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MOONSOUND, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_YAMAHA_SFG, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MSXAUDIO, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MSXMUSIC, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_SCC, 1);
properties->emulation.pauseSwitch = 0;
switchSetPause(properties->emulation.pauseSwitch);
machine = machineCreate(properties->emulation.machineName);
if (machine == NULL) {
archShowStartEmuFailDialog();
archEmulationStopNotification();
emuState = EMU_STOPPED;
archEmulationStartFailure();
return;
}
boardSetMachine(machine);
#ifndef NO_TIMERS
#ifndef WII
emuSyncEvent = archEventCreate(0);
#endif
emuStartEvent = archEventCreate(0);
#ifndef WII
emuTimer = archCreateTimer(emulatorGetSyncPeriod(), timerCallback);
#endif
#endif
setDeviceInfo(&deviceInfo);
inputEventReset();
archSoundResume();
archMidiEnable(1);
emuState = EMU_PAUSED;
emulationStartFailure = 0;
strcpy(emuStateName, stateName ? stateName : "");
clearlog();
#ifdef SINGLE_THREADED
emuState = EMU_RUNNING;
emulatorThread();
if (emulationStartFailure) {
archEmulationStopNotification();
emuState = EMU_STOPPED;
archEmulationStartFailure();
}
#else
emuThread = archThreadCreate(emulatorThread, THREAD_PRIO_HIGH);
archEventWait(emuStartEvent, 3000);
if (emulationStartFailure) {
archEmulationStopNotification();
emuState = EMU_STOPPED;
archEmulationStartFailure();
}
if (emuState != EMU_STOPPED) {
getDeviceInfo(&deviceInfo);
boardSetYm2413Oversampling(properties->sound.chip.ym2413Oversampling);
boardSetY8950Oversampling(properties->sound.chip.y8950Oversampling);
boardSetMoonsoundOversampling(properties->sound.chip.moonsoundOversampling);
strcpy(properties->emulation.machineName, machine->name);
debuggerNotifyEmulatorStart();
emuState = EMU_RUNNING;
}
#endif
}
void emulatorStop() {
if (emuState == EMU_STOPPED) {
return;
}
debuggerNotifyEmulatorStop();
emuState = EMU_STOPPED;
do {
archThreadSleep(10);
} while (!emuSuspendFlag);
emuExitFlag = 1;
#ifndef WII
archEventSet(emuSyncEvent);
#endif
archSoundSuspend();
archThreadJoin(emuThread, 3000);
archMidiEnable(0);
machineDestroy(machine);
archThreadDestroy(emuThread);
#ifndef WII
archEventDestroy(emuSyncEvent);
#endif
archEventDestroy(emuStartEvent);
// Reset active indicators in mixer
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MOONSOUND, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_YAMAHA_SFG, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MSXAUDIO, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MSXMUSIC, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_SCC, 1);
archEmulationStopNotification();
dbgDisable();
dbgPrint();
savelog();
}
void emulatorSetFrequency(int logFrequency, int* frequency) {
emuFrequency = (int)(3579545 * pow(2.0, (logFrequency - 50) / 15.0515));
if (frequency != NULL) {
*frequency = emuFrequency;
}
boardSetFrequency(emuFrequency);
}
void emulatorSuspend() {
if (emuState == EMU_RUNNING) {
emuState = EMU_SUSPENDED;
do {
archThreadSleep(10);
} while (!emuSuspendFlag);
archSoundSuspend();
archMidiEnable(0);
}
}
void emulatorResume() {
if (emuState == EMU_SUSPENDED) {
emuSysTime = 0;
archSoundResume();
archMidiEnable(1);
emuState = EMU_RUNNING;
archUpdateEmuDisplay(0);
}
}
int emulatorGetCurrentScreenMode()
{
return lastScreenMode;
}
void emulatorRestart() {
Machine* machine = machineCreate(properties->emulation.machineName);
emulatorStop();
if (machine != NULL) {
boardSetMachine(machine);
machineDestroy(machine);
}
}
void emulatorRestartSound() {
emulatorSuspend();
archSoundDestroy();
archSoundCreate(mixer, 44100, properties->sound.bufSize, properties->sound.stereo ? 2 : 1);
emulatorResume();
}
int emulatorGetCpuOverflow() {
int overflow = emuTimeOverflow;
emuTimeOverflow = 0;
return overflow;
}
void emulatorSetMaxSpeed(int enable) {
emuMaxSpeed = enable;
}
int emulatorGetMaxSpeed() {
return emuMaxSpeed;
}
void emulatorPlayReverse(int enable)
{
if (enable) {
archSoundSuspend();
}
else {
archSoundResume();
}
emuPlayReverse = enable;
}
int emulatorGetPlayReverse()
{
return emuPlayReverse;
}
void emulatorResetMixer() {
// Reset active indicators in mixer
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MOONSOUND, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_YAMAHA_SFG, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MSXAUDIO, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MSXMUSIC, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_SCC, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_PCM, 1);
mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_IO, 1);
}
int emulatorSyncScreen()
{
int rv = 0;
emuFrameskipCounter--;
if (emuFrameskipCounter < 0) {
rv = archUpdateEmuDisplay(properties->emulation.syncMethod);
if (rv) {
emuFrameskipCounter = properties->video.frameSkip;
}
}
return rv;
}
void RefreshScreen(int screenMode) {
lastScreenMode = screenMode;
if (emuUseSynchronousUpdate() == P_EMU_SYNCFRAMES && emuState == EMU_RUNNING) {
emulatorSyncScreen();
}
}
#ifndef NO_TIMERS
#ifdef WII
static int WaitForSync(int maxSpeed, int breakpointHit)
{
UInt32 diffTime;
emuMaxEmuSpeed = maxSpeed;
emuSuspendFlag = 1;
archPollInput();
if (emuState != EMU_RUNNING) {
archEventSet(emuStartEvent);
archThreadSleep(100);
emuSuspendFlag = 0;
return emuExitFlag ? -1 : 0;
}
emuSuspendFlag = 0;
if (emuSingleStep) {
diffTime = 0;
}else{
diffTime = 20;
}
if (emuMaxSpeed || emuMaxEmuSpeed) {
diffTime *= 10;
}
return emuExitFlag ? -1 : diffTime;
}
#else
int WaitReverse()
{
boardEnableSnapshots(0);
for (;;) {
UInt32 sysTime = archGetSystemUpTime(1000);
UInt32 diffTime = sysTime - emuSysTime;
if (diffTime >= 50) {
emuSysTime = sysTime;
break;
}
archEventWait(emuSyncEvent, -1);
}
boardRewind();
return -60;
}
static int WaitForSync(int maxSpeed, int breakpointHit) {
UInt32 li1;
UInt32 li2;
static UInt32 tmp = 0;
static UInt32 cnt = 0;
UInt32 sysTime;
UInt32 diffTime;
UInt32 syncPeriod;
static int overflowCount = 0;
static UInt32 kbdPollCnt = 0;
if (emuPlayReverse && properties->emulation.reverseEnable) {
return WaitReverse();
}
boardEnableSnapshots(1);
emuMaxEmuSpeed = maxSpeed;
syncPeriod = emulatorGetSyncPeriod();
li1 = archGetHiresTimer();
emuSuspendFlag = 1;
if (emuSingleStep) {
debuggerNotifyEmulatorPause();
emuSingleStep = 0;
emuState = EMU_PAUSED;
archSoundSuspend();
archMidiEnable(0);
}
if (breakpointHit) {
debuggerNotifyEmulatorPause();
emuState = EMU_PAUSED;
archSoundSuspend();
archMidiEnable(0);
}
if (emuState != EMU_RUNNING) {
archEventSet(emuStartEvent);
emuSysTime = 0;
}
#ifdef SINGLE_THREADED
emuExitFlag |= archPollEvent();
#endif
if (((++kbdPollCnt & 0x03) >> 1) == 0) {
archPollInput();
}
if (emuUseSynchronousUpdate() == P_EMU_SYNCTOVBLANK) {
overflowCount += emulatorSyncScreen() ? 0 : 1;
while ((!emuExitFlag && emuState != EMU_RUNNING) || overflowCount > 0) {
archEventWait(emuSyncEvent, -1);
#ifdef NO_TIMERS
while (timerCallback(NULL) == 0) emuExitFlag |= archPollEvent();
#endif
overflowCount--;
}
}
else {
do {
#ifdef NO_TIMERS
while (timerCallback(NULL) == 0) emuExitFlag |= archPollEvent();
#endif
archEventWait(emuSyncEvent, -1);
if (((emuMaxSpeed || emuMaxEmuSpeed) && !emuExitFlag) || overflowCount > 0) {
#ifdef NO_TIMERS
while (timerCallback(NULL) == 0) emuExitFlag |= archPollEvent();
#endif
archEventWait(emuSyncEvent, -1);
}
overflowCount = 0;
} while (!emuExitFlag && emuState != EMU_RUNNING);
}
emuSuspendFlag = 0;
li2 = archGetHiresTimer();
emuTimeIdle += li2 - li1;
emuTimeTotal += li2 - tmp;
tmp = li2;
sysTime = archGetSystemUpTime(1000);
diffTime = sysTime - emuSysTime;
emuSysTime = sysTime;
if (emuSingleStep) {
diffTime = 0;
}
if ((++cnt & 0x0f) == 0) {
emuCalcCpuUsage(NULL);
}
overflowCount = emulatorGetCpuOverflow() ? 1 : 0;
#ifdef NO_HIRES_TIMERS
if (diffTime > 50U) {
overflowCount = 1;
diffTime = 0;
}
#else
if (diffTime > 100U) {
overflowCount = 1;
diffTime = 0;
}
#endif
if (emuMaxSpeed || emuMaxEmuSpeed) {
diffTime *= 10;
if (diffTime > 20 * syncPeriod) {
diffTime = 20 * syncPeriod;
}
}
emuUsageCurrent += diffTime;
return emuExitFlag ? -99 : diffTime;
}
#endif
#else
#ifdef WIN32
#include <windows.h>
UInt32 getHiresTimer() {
static LONGLONG hfFrequency = 0;
LARGE_INTEGER li;
if (!hfFrequency) {
if (QueryPerformanceFrequency(&li)) {
hfFrequency = li.QuadPart;
}
else {
return 0;
}
}
QueryPerformanceCounter(&li);
return (DWORD)(li.QuadPart * 1000000 / hfFrequency);
}
#else
#define getHiresTimer archGetHiresTimer
#endif
#if 1
extern void switch_to_main_thread(void);
static int WaitForSync(int maxSpeed, int breakpointHit) {
static float time_fraction = 0.0;
if (time_fraction > 1.0)
time_fraction -= 1.0;
switch_to_main_thread();
time_fraction += (1000.0 / 60.0) - 16.0;
return 16 + time_fraction;
}
#else
static UInt32 busy, total, oldTime;
static int WaitForSync(int maxSpeed, int breakpointHit) {
emuSuspendFlag = 1;
busy += getHiresTimer() - oldTime;
emuExitFlag |= archPollEvent();
archPollInput();
do {
for (;;) {
UInt32 sysTime = archGetSystemUpTime(1000);
UInt32 diffTime = sysTime - emuSysTime;
emuExitFlag |= archPollEvent();
if (diffTime < 10) {
continue;
}
emuSysTime += 10;
if (diffTime > 30) {
emuSysTime = sysTime;
}
break;
}
} while (!emuExitFlag && emuState != EMU_RUNNING);
emuSuspendFlag = 0;
total += getHiresTimer() - oldTime;
oldTime = getHiresTimer();
#if 0
if (total >= 1000000) {
UInt32 pct = 10000 * busy / total;
printf("CPU Usage = %d.%d%%\n", pct / 100, pct % 100);
total = 0;
busy = 0;
}
#endif
return emuExitFlag ? -1 : 10;
}
#endif
#endif // #ifndef NO_TIMERS

0
Src/Emulator/Emulator.h Executable file → Normal file
View File

0
Src/Emulator/FileHistory.c Executable file → Normal file
View File

0
Src/Emulator/FileHistory.h Executable file → Normal file
View File

0
Src/Emulator/Keyboard.c Executable file → Normal file
View File

0
Src/Emulator/Keyboard.h Executable file → Normal file
View File

0
Src/Emulator/LaunchFile.c Executable file → Normal file
View File

0
Src/Emulator/LaunchFile.h Executable file → Normal file
View File

0
Src/Emulator/Properties.c Executable file → Normal file
View File

0
Src/Emulator/Properties.h Executable file → Normal file
View File

0
Src/Input/CoinDevice.c Executable file → Normal file
View File

0
Src/Input/CoinDevice.h Executable file → Normal file
View File

0
Src/Input/ColecoJoystick.c Executable file → Normal file
View File

0
Src/Input/ColecoJoystick.h Executable file → Normal file
View File

0
Src/Input/ColecoJoystickDevice.h Executable file → Normal file
View File

0
Src/Input/InputEvent.c Executable file → Normal file
View File

0
Src/Input/InputEvent.h Executable file → Normal file
View File

0
Src/Input/JoystickPort.c Executable file → Normal file
View File

0
Src/Input/JoystickPort.h Executable file → Normal file
View File

0
Src/Input/MagicKeyDongle.c Executable file → Normal file
View File

0
Src/Input/MagicKeyDongle.h Executable file → Normal file
View File

0
Src/Input/MsxArkanoidPad.c Executable file → Normal file
View File

0
Src/Input/MsxArkanoidPad.h Executable file → Normal file
View File

0
Src/Input/MsxAsciiLaser.c Executable file → Normal file
View File

0
Src/Input/MsxAsciiLaser.h Executable file → Normal file
View File

0
Src/Input/MsxGunstick.c Executable file → Normal file
View File

0
Src/Input/MsxGunstick.h Executable file → Normal file
View File

0
Src/Input/MsxJoystick.c Executable file → Normal file
View File

0
Src/Input/MsxJoystick.h Executable file → Normal file
View File

0
Src/Input/MsxJoystickDevice.h Executable file → Normal file
View File

0
Src/Input/MsxMouse.c Executable file → Normal file
View File

0
Src/Input/MsxMouse.h Executable file → Normal file
View File

0
Src/Input/MsxTetrisDongle.c Executable file → Normal file
View File

0
Src/Input/MsxTetrisDongle.h Executable file → Normal file
View File

0
Src/Input/Sg1000JoyIo.c Executable file → Normal file
View File

0
Src/Input/Sg1000JoyIo.h Executable file → Normal file
View File

0
Src/Input/Sg1000Joystick.c Executable file → Normal file
View File

0
Src/Input/Sg1000Joystick.h Executable file → Normal file
View File

0
Src/Input/Sg1000JoystickDevice.h Executable file → Normal file
View File

0
Src/Input/SviJoyIo.c Executable file → Normal file
View File

0
Src/Input/SviJoyIo.h Executable file → Normal file
View File

0
Src/Input/SviJoystick.c Executable file → Normal file
View File

0
Src/Input/SviJoystick.h Executable file → Normal file
View File

0
Src/Input/SviJoystickDevice.h Executable file → Normal file
View File

0
Src/IoDevice/Casette.c Executable file → Normal file
View File

0
Src/IoDevice/Casette.h Executable file → Normal file
View File

0
Src/IoDevice/DirAsDisk.c Executable file → Normal file
View File

0
Src/IoDevice/DirAsDisk.h Executable file → Normal file
View File

0
Src/IoDevice/Disk.c Executable file → Normal file
View File

0
Src/IoDevice/Disk.h Executable file → Normal file
View File

0
Src/IoDevice/DiskUtil.h Executable file → Normal file
View File

0
Src/IoDevice/FdcAudio.c Executable file → Normal file
View File

Some files were not shown because too many files have changed in this diff Show More