Merge win32 branch

This commit is contained in:
Louai Al-Khanji 2008-09-01 12:44:16 +00:00
parent 1220a3d6ad
commit 75f324cfc6
27 changed files with 1351 additions and 221 deletions

407
Makefile.mingw Normal file
View file

@ -0,0 +1,407 @@
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * Mupen64plus - Makefile.mingw *
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
# * Copyright (C) 2008 slougi *
# * *
# * 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., *
# * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# paths
SDL_DIR = C:\SDL-1.2.13
PTHREADS-WIN32_DIR = C:\pthreads-win32
DLFCN-WIN32_DIR = C:\dlfcn-win32-static-r8
GNUWIN32_DIR = C:\GnuWin32
ARCH = 32BITS
CPU = X86
OS = WINDOWS
# set base program pointers and flags
CC = gcc
CXX = g++
LD = g++
RM = del
MV = move
CP = copy
CFLAGS = -pipe -O3 -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -I.
LDFLAGS = -lopengl32 -lglu32
# gnuwin32
CFLAGS += -I${GNUWIN32_DIR}/include -I${GNUWIN32_DIR}/include/freetype2
LDFLAGS += -L${GNUWIN32_DIR}/lib -lfreetype -lz -liconv -lpng
# dlfcn-win
CFLAGS += -I${DLFCN-WIN32_DIR}/include
LDFLAGS += ${DLFCN-WIN32_DIR}/lib/libdl.a
# pthreads-win32
CFLAGS += -I${PTHREADS-WIN32_DIR}/include
LDFLAGS += -L${PTHREADS-WIN32_DIR}/lib -lpthreadGC2
# Qt
QT_H = ${shell qmake -query QT_INSTALL_HEADERS}
QT_L = ${shell qmake -query QT_INSTALL_LIBS}
CFLAGS += -I${QT_H} -I${QT_H}/QtGui -I${QT_H}/QtCore
LDFLAGS += -L${QT_L} -lQtGui4 -lQtCore4
MOC = moc
UIC = uic
# SDL
CFLAGS += -I${SDL_DIR}/include/SDL
LDFLAGS += -L${SDL_DIR}/lib -lSDL
ifeq ($(CPU), X86)
ifeq ($(ARCH), 64BITS)
CFLAGS += -march=athlon64
else
CFLAGS += -march=i686 -mtune=pentium-m -mmmx -msse
ifneq ($(PROFILE), 1)
CFLAGS += -fomit-frame-pointer
endif
endif
# tweak flags for 32-bit build on 64-bit system
ifeq ($(ARCH), 64BITS_32)
CFLAGS += -m32
LDFLAGS += -m32 -m elf_i386
endif
endif
# set options
ifeq ($(DBG), 1)
CFLAGS += -DDBG
endif
ifeq ($(DBG_COMPARE), 1)
CFLAGS += -DCOMPARE_CORE
endif
ifeq ($(DBG_CORE), 1)
CFLAGS += -DCORE_DBG
endif
ifeq ($(DBG_COUNT), 1)
CFLAGS += -DCOUNT_INSTR
endif
ifeq ($(DBG_PROFILE), 1)
CFLAGS += -DPROFILE_R4300
endif
ifeq ($(LIRC), 1)
CFLAGS += -DWITH_LIRC
endif
ifeq ($(GUI), NONE)
CFLAGS += -DNO_GUI
else
ifeq ($(GUI), QT4)
CFLAGS += $(QT_FLAGS) $(GTK_FLAGS)
LDFLAGS += $(QT_LIBS)
ifeq ($(DBG), 1)
CFLAGS += $(GTK_FLAGS)
endif
else
ifeq ($(GUI), GTK2)
CFLAGS += $(GTK_FLAGS)
endif
endif
endif
# list of object files to generate
OBJ_CORE = \
main/main.o \
main/romcache.o \
main/util.o \
main/translate.o \
main/cheat.o \
main/config.o \
main/adler32.o \
main/md5.o \
main/plugin.o \
main/rom.o \
main/savestates.o \
main/zip/ioapi.o \
main/zip/unzip.o \
main/bzip2/bzlib.o \
main/bzip2/crctable.o \
main/bzip2/decompress.o \
main/bzip2/compress.o \
main/bzip2/randtable.o \
main/bzip2/huffman.o \
main/bzip2/blocksort.o \
main/lzma/buffer.o \
main/lzma/io.o \
main/lzma/main.o \
main/7zip/7zAlloc.o \
main/7zip/7zBuffer.o \
main/7zip/7zCrc.o \
main/7zip/7zDecode.o \
main/7zip/7zExtract.o \
main/7zip/7zHeader.o \
main/7zip/7zIn.o \
main/7zip/7zItem.o \
main/7zip/7zMain.o \
main/7zip/LzmaDecode.o \
main/7zip/BranchX86.o \
main/7zip/BranchX86_2.o \
memory/dma.o \
memory/flashram.o \
memory/memory.o \
memory/pif.o \
memory/tlb.o \
r4300/r4300.o \
r4300/bc.o \
r4300/compare_core.o \
r4300/cop0.o \
r4300/cop1.o \
r4300/cop1_d.o \
r4300/cop1_l.o \
r4300/cop1_s.o \
r4300/cop1_w.o \
r4300/exception.o \
r4300/interupt.o \
r4300/profile.o \
r4300/pure_interp.o \
r4300/recomp.o \
r4300/special.o \
r4300/regimm.o \
r4300/tlb.o
# handle dynamic recompiler objects
ifneq ($(NO_ASM), 1)
ifeq ($(CPU), X86)
ifeq ($(ARCH), 64BITS)
DYNAREC = x86_64
else
DYNAREC = x86
endif
endif
OBJ_DYNAREC = \
r4300/$(DYNAREC)/assemble.o \
r4300/$(DYNAREC)/debug.o \
r4300/$(DYNAREC)/gbc.o \
r4300/$(DYNAREC)/gcop0.o \
r4300/$(DYNAREC)/gcop1.o \
r4300/$(DYNAREC)/gcop1_d.o \
r4300/$(DYNAREC)/gcop1_l.o \
r4300/$(DYNAREC)/gcop1_s.o \
r4300/$(DYNAREC)/gcop1_w.o \
r4300/$(DYNAREC)/gr4300.o \
r4300/$(DYNAREC)/gregimm.o \
r4300/$(DYNAREC)/gspecial.o \
r4300/$(DYNAREC)/gtlb.o \
r4300/$(DYNAREC)/regcache.o \
r4300/$(DYNAREC)/rjump.o
else
OBJ_DYNAREC = r4300/empty_dynarec.o
endif
OBJ_LIRC = \
main/lirc.o
OBJ_OPENGL = \
opengl/OGLFT.o \
opengl/osd.o \
opengl/screenshot.o
OBJ_GTK_GUI = \
main/gui_gtk/main_gtk.o \
main/gui_gtk/aboutdialog.o \
main/gui_gtk/cheatdialog.o \
main/gui_gtk/configdialog.o \
main/gui_gtk/rombrowser.o \
main/gui_gtk/romproperties.o
OBJ_QT_GUI = \
main/gui_qt4/main.o \
main/gui_qt4/mainwidget.o \
main/gui_qt4/mainwindow.o \
main/gui_qt4/romdirectorieslistwidget.o \
main/gui_qt4/rommodel.o \
main/gui_qt4/settingsdialog.o \
main/gui_qt4/globals.o
OBJ_QT_MOC = \
main/gui_qt4/mainwidget.moc \
main/gui_qt4/mainwindow.moc \
main/gui_qt4/romdirectorieslistwidget.moc \
main/gui_qt4/settingsdialog.moc \
main/gui_qt4/rommodel.moc
OBJ_QT_HEADERS = \
main/gui_qt4/ui_romdirectorieslistwidget.h \
main/gui_qt4/ui_settingsdialog.h \
main/gui_qt4/ui_mainwindow.h \
main/gui_qt4/ui_mainwidget.h
OBJ_DBG = \
debugger/debugger.o \
debugger/decoder.o \
debugger/memory.o \
debugger/breakpoints.o
OBJ_GTK_DBG_GUI = \
main/gui_gtk/debugger/debugger.o \
main/gui_gtk/debugger/breakpoints.o \
main/gui_gtk/debugger/desasm.o \
main/gui_gtk/debugger/memedit.o \
main/gui_gtk/debugger/varlist.o \
main/gui_gtk/debugger/registers.o \
main/gui_gtk/debugger/regGPR.o \
main/gui_gtk/debugger/regCop0.o \
main/gui_gtk/debugger/regSpecial.o \
main/gui_gtk/debugger/regCop1.o \
main/gui_gtk/debugger/regAI.o \
main/gui_gtk/debugger/regPI.o \
main/gui_gtk/debugger/regRI.o \
main/gui_gtk/debugger/regSI.o \
main/gui_gtk/debugger/regVI.o \
main/gui_gtk/debugger/regTLB.o \
main/gui_gtk/debugger/ui_clist_edit.o \
main/gui_gtk/debugger/ui_disasm_list.o
PLUGINS = plugins/dummyaudio.so \
#plugins/blight_input.so \
plugins/dummyvideo.so \
#plugins/glN64.so \
#plugins/ricevideo.so \
#plugins/glide64.so \
#plugins/jttl_audio.so \
plugins/mupen64_hle_rsp_azimer.so \
plugins/mupen64_input.so
# set primary objects and libraries for all outputs
ALL = mupen64plus
OBJECTS = $(OBJ_CORE) $(OBJ_DYNAREC) $(OBJ_OPENGL)
# add extra objects and libraries for selected options
ifeq ($(DBG), 1)
OBJECTS += $(OBJ_DBG) $(OBJ_GTK_DBG_GUI)
LIBS += -lopcodes -lbfd
endif
ifeq ($(LIRC), 1)
OBJECTS += $(OBJ_LIRC)
LDFLAGS += -llirc_client
endif
ifeq ($(GUI), QT4)
OBJECTS += $(OBJ_QT_GUI)
else
ifneq ($(GUI), NONE)
OBJECTS += $(OBJ_GTK_GUI)
endif
endif
# build targets
targets:
@echo "Mupen64Plus makefile. "
@echo " Targets:"
@echo " all == Build Mupen64Plus and all plugins"
@echo " clean == remove object files"
@echo " rebuild == clean and re-build all"
@echo " install == Install Mupen64Plus and all plugins"
@echo " uninstall == Uninstall Mupen64Plus and all plugins"
@echo " Options:"
@echo " BITS=32 == build 32-bit binaries on 64-bit machine"
@echo " LIRC=1 == enable LIRC support"
@echo " NO_RESAMP=1 == disable libsamplerate support in jttl_audio"
@echo " NO_ASM=1 == build without assembly (no dynamic recompiler or MMX/SSE code)"
@echo " GUI=NONE == build without GUI support"
@echo " GUI=GTK2 == build with GTK2 GUI support (default)"
@echo " GUI=QT4 == build with QT4 GUI support"
@echo " Install Options:"
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local/)"
@echo " SHAREDIR=path == path to install shared data (default: PREFIX/share/mupen64plus/)"
@echo " BINDIR=path == path to install mupen64plus binary (default: PREFIX/bin/)"
@echo " LIBDIR=path == path to install plugin libraries (default: SHAREDIR/plugins/)"
@echo " MANDIR=path == path to install manual files (default: PREFIX/man/man1/)"
@echo " Debugging Options:"
@echo " PROFILE=1 == build gprof instrumentation into binaries for profiling"
@echo " DBGSYM=1 == add debugging symbols to binaries"
@echo " DBG=1 == build graphical debugger"
@echo " DBG_CORE=1 == print debugging info in r4300 core"
@echo " DBG_COUNT=1 == print R4300 instruction count totals (64-bit dynarec only)"
@echo " DBG_COMPARE=1 == enable core-synchronized r4300 debugging"
@echo " DBG_PROFILE=1 == dump profiling data for r4300 dynarec to data file"
# @echo " RELEASE=1 == inhibit SVN info from version strings"
# The RELEASE flag is hidden from view as it should only be used internally. It only affects
# the version strings
clean:
$(RM) /f r4300\*.o r4300\x86\*.o r4300\x86_64\*.o memory\*.o debugger\*.o opengl\*.o
$(RM) /f main\*.o main\zip\*.o main\bzip2\*.o main\lzma\*.o main\7zip\*.o main\gui_gtk\*.o main\gui_gtk\debugger\*.o
$(RM) /f mupen64plus.exe
$(RM) /f main\gui_qt4\settings.cpp main\gui_qt4\settings.h main\gui_qt4\*.moc main\gui_qt4\ui_*.h main\gui_qt4\*.o
all: main/version.h $(ALL)
main/version.h: version.win32.h
${CP} version.win32.h main/version.h
mupen64plus: $(OBJECTS)
$(CXX) $^ $(LDFLAGS) $(LIBS) -o $@
.cpp.o:
$(CXX) -o $@ $(CFLAGS) $(SDL_FLAGS) -c $<
# I have no idea why this is needed, but apparently it is.
main/gui_qt4/settings.o: main/gui_qt4/settings.cpp
$(CXX) -o $@ $(CFLAGS) $(SDL_FLAGS) -c $<
.c.o:
$(CC) -o $@ $(CFLAGS) $(SDL_FLAGS) -c $<
plugins/blight_input.so: FORCE
$(MAKE) -C blight_input all
@$(CP) ./blight_input/blight_input.so ./plugins/blight_input.so
plugins/dummyaudio.so: FORCE
$(MAKE) -C dummy_audio all
@$(CP) ./dummy_audio/dummyaudio.so ./plugins/dummyaudio.so
plugins/dummyvideo.so: FORCE
$(MAKE) -C dummy_video all
@$(CP) ./dummy_video/dummyvideo.so ./plugins/dummyvideo.so
plugins/glN64.so: FORCE
$(MAKE) -C glN64 all
@$(CP) ./glN64/glN64.so ./plugins/glN64.so
plugins/ricevideo.so: FORCE
$(MAKE) -C rice_video all
@$(CP) ./rice_video/ricevideo.so ./plugins/ricevideo.so
plugins/glide64.so: FORCE
$(MAKE) -C glide64 all
@$(CP) ./glide64/glide64.so ./plugins/glide64.so
plugins/jttl_audio.so: FORCE
$(MAKE) -C jttl_audio all
@$(CP) ./jttl_audio/jttl_audio.so ./plugins/jttl_audio.so
plugins/mupen64_hle_rsp_azimer.so: FORCE
$(MAKE) -C rsp_hle all
@$(CP) ./rsp_hle/mupen64_hle_rsp_azimer.so ./plugins/mupen64_hle_rsp_azimer.so
plugins/mupen64_input.so: FORCE
$(MAKE) -C mupen64_input all
@$(CP) ./mupen64_input/mupen64_input.so ./plugins/mupen64_input.so
# QT4 build rules
main/gui_qt4/ui_%.h: main/gui_qt4/%.ui
$(UIC) $< -o $@
main/gui_qt4/%.moc: main/gui_qt4/%.h
$(MOC) -i $< -o $@
$(OBJ_QT_GUI): $(OBJ_QT_MOC) $(OBJ_QT_HEADERS)
# This is used to force the plugin builds
FORCE:

258
dummy_input/Input_1.1.h Normal file
View file

@ -0,0 +1,258 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - Input_1.1.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2002 Zilmar *
* *
* 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., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _CONTR_H_INCLUDED__
#define _CONTR_H_INCLUDED__
#if defined(__cplusplus)
extern "C" {
#endif
/* Note: BOOL, BYTE, WORD, DWORD, TRUE, FALSE are defined in windows.h */
#define PLUGIN_TYPE_CONTROLLER 4
/*** Conteroller plugin's ****/
#define PLUGIN_NONE 1
#define PLUGIN_MEMPAK 2
#define PLUGIN_RUMBLE_PAK 3 // not implemeted for non raw data
#define PLUGIN_TANSFER_PAK 4 // not implemeted for non raw data
#define PLUGIN_RAW 5 // the controller plugin is passed in raw data
/*********************************************************************************
Note about Conteroller plugin's:
the rumble pak needs a function for the force feed back joystick and tranfer pak
probaly needs a function for the plugin to be able to select the GB rom and
eeprom... maybe this should be done by the emu instead of the plugin, but I think
it probaly should be done by the plugin. I will see about adding these functions
in the next spec
**********************************************************************************/
#define EXPORT __declspec(dllexport)
#define CALL _cdecl
#ifndef __PLUGIN_INFO__
#define __PLUGIN_INFO__
/***** Structures *****/
typedef struct {
WORD Version; /* Should be set to 0x0101 */
WORD Type; /* Set to PLUGIN_TYPE_CONTROLLER */
char Name[100]; /* Name of the DLL */
BOOL Reserved1;
BOOL Reserved2;
} PLUGIN_INFO;
#endif //__PLUGIN_INFO__
typedef struct {
BOOL Present;
BOOL RawData;
int Plugin;
} CONTROL;
typedef union {
DWORD Value;
struct {
unsigned R_DPAD : 1;
unsigned L_DPAD : 1;
unsigned D_DPAD : 1;
unsigned U_DPAD : 1;
unsigned START_BUTTON : 1;
unsigned Z_TRIG : 1;
unsigned B_BUTTON : 1;
unsigned A_BUTTON : 1;
unsigned R_CBUTTON : 1;
unsigned L_CBUTTON : 1;
unsigned D_CBUTTON : 1;
unsigned U_CBUTTON : 1;
unsigned R_TRIG : 1;
unsigned L_TRIG : 1;
unsigned Reserved1 : 1;
unsigned Reserved2 : 1;
signed Y_AXIS : 8;
signed X_AXIS : 8;
};
} BUTTONS;
typedef struct {
HWND hMainWindow;
HINSTANCE hinst;
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry, only effects header.
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom)
CONTROL *Controls; // A pointer to an array of 4 controllers .. eg:
// CONTROL Controls[4];
} CONTROL_INFO;
/******************************************************************
Function: CloseDLL
Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise.
input: none
output: none
*******************************************************************/
EXPORT void CALL CloseDLL (void);
/******************************************************************
Function: ControllerCommand
Purpose: To process the raw data that has just been sent to a
specific controller.
input: - Controller Number (0 to 3) and -1 signalling end of
processing the pif ram.
- Pointer of data to be processed.
output: none
note: This function is only needed if the DLL is allowing raw
data, or the plugin is set to raw
the data that is being processed looks like this:
initilize controller: 01 03 00 FF FF FF
read controller: 01 04 01 FF FF FF FF
*******************************************************************/
EXPORT void CALL ControllerCommand ( int Control, BYTE * Command);
/******************************************************************
Function: DllAbout
Purpose: This function is optional function that is provided
to give further information about the DLL.
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllAbout ( HWND hParent );
/******************************************************************
Function: DllConfig
Purpose: This function is optional function that is provided
to allow the user to configure the dll
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllConfig ( HWND hParent );
/******************************************************************
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the dll
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllTest ( HWND hParent );
/******************************************************************
Function: GetDllInfo
Purpose: This function allows the emulator to gather information
about the dll by filling in the PluginInfo structure.
input: a pointer to a PLUGIN_INFO stucture that needs to be
filled by the function. (see def above)
output: none
*******************************************************************/
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo );
/******************************************************************
Function: GetKeys
Purpose: To get the current state of the controllers buttons.
input: - Controller Number (0 to 3)
- A pointer to a BUTTONS structure to be filled with
the controller state.
output: none
*******************************************************************/
EXPORT void CALL GetKeys(int Control, BUTTONS * Keys );
/******************************************************************
Function: InitiateControllers
Purpose: This function initialises how each of the controllers
should be handled.
input: - The handle to the main window.
- A controller structure that needs to be filled for
the emulator to know how to handle each controller.
output: none
*******************************************************************/
EXPORT void CALL InitiateControllers (CONTROL_INFO ControlInfo);
/******************************************************************
Function: ReadController
Purpose: To process the raw data in the pif ram that is about to
be read.
input: - Controller Number (0 to 3) and -1 signalling end of
processing the pif ram.
- Pointer of data to be processed.
output: none
note: This function is only needed if the DLL is allowing raw
data.
*******************************************************************/
EXPORT void CALL ReadController ( int Control, BYTE * Command );
/******************************************************************
Function: RomClosed
Purpose: This function is called when a rom is closed.
input: none
output: none
*******************************************************************/
EXPORT void CALL RomClosed (void);
/******************************************************************
Function: RomOpen
Purpose: This function is called when a rom is open. (from the
emulation thread)
input: none
output: none
*******************************************************************/
EXPORT void CALL RomOpen (void);
/******************************************************************
Function: WM_KeyDown
Purpose: To pass the WM_KeyDown message from the emulator to the
plugin.
input: wParam and lParam of the WM_KEYDOWN message.
output: none
*******************************************************************/
EXPORT void CALL WM_KeyDown( WPARAM wParam, LPARAM lParam );
/******************************************************************
Function: WM_KeyUp
Purpose: To pass the WM_KEYUP message from the emulator to the
plugin.
input: wParam and lParam of the WM_KEYDOWN message.
output: none
*******************************************************************/
EXPORT void CALL WM_KeyUp( WPARAM wParam, LPARAM lParam );
/******************************************************************
NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
ORIGINAL SPEC
Function: SetConfigDir
Purpose: To pass the location where config files should be read/
written to.
input: path to config directory
output: none
*******************************************************************/
EXPORT void CALL SetConfigDir( char *configDir );
#if defined(__cplusplus)
}
#endif
#endif

43
dummy_input/Makefile Normal file
View file

@ -0,0 +1,43 @@
#***************************************************************************
# dummy_input Makefile
# -------------------
# Copyright (C) 2007-2008 Scott Gorman (okaygo)
#***************************************************************************
#***************************************************************************
#* *
#* 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. *
#* *
#***************************************************************************
# include pre-make file with a bunch of definitions
include ../pre.mk
# local CFLAGS, LIBS, and LDFLAGS
CFLAGS += -fpic -DPIC -D__LINUX__ -DX86_ASM
# list of object files to generate
OBJECTS = \
input.o \
# build targets
all: dummyinput.so
clean:
rm -f *.o *.so
# build rules
.cpp.o:
$(CXX) -o $@ $(CFLAGS) $(SDL_FLAGS) $(GTK_FLAGS) -c $<
dummyinput.so: $(OBJECTS)
$(CXX) $^ $(LDFLAGS) $(ASM_LDFLAGS) $(PLUGIN_LDFLAGS) $(SDL_LIBS) $(GTK_LIBS) $(GTHREAD_LIBS) $(LIBGL_LIBS) -o $@
$(STRIP) $@
input.o: input.cpp
$(CXX) $(CFLAGS) $(SDL_FLAGS) -DMAINDEF -c -o $@ $<

66
dummy_input/input.c Normal file
View file

@ -0,0 +1,66 @@
/**
* Mupen64Plus - input.cpp
* Copyright (C) 2008 Scott Gorman (okaygo)
*
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/
*
* This program is free software; you can redistribute it and/
* or modify it under the terms of the GNU General Public Li-
* cence as published by the Free Software Foundation; either
* version 2 of the License, or any later version.
*
* This program is distributed in the hope that it will be use-
* ful, but WITHOUT ANY WARRANTY; without even the implied war-
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
* You should have received a copy of the GNU General Public
* Licence along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
**/
#include <limits.h>
#include <string.h>
#include "input.h"
#include "Input_1.1.h"
char pluginName[] = "No Input";
char configdir[PATH_MAX] = {0};
#ifndef __LINUX__
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
}
return TRUE;
}
#else
void _init( void )
{
}
#endif // !__LINUX__
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo )
{
PluginInfo->Version = 0x0101;
PluginInfo->Type = PLUGIN_TYPE_CONTROLLER;
strcpy( PluginInfo->Name, pluginName );
PluginInfo->Reserved1 = FALSE;
PluginInfo->Reserved2 = FALSE;
}
EXPORT void CALL InitiateControllers (CONTROL_INFO ControlInfo)
{
ControlInfo.Controls[0].Present = TRUE;
}
EXPORT void CALL GetKeys(int Control, BUTTONS * Keys )
{
Keys->Value = 0x0000;
}

37
dummy_input/input.h Normal file
View file

@ -0,0 +1,37 @@
/**
* Mupen64Plus - input.h
* Copyright (C) 2008 Scott Gorman (okaygo)
*
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/
*
* This program is free software; you can redistribute it and/
* or modify it under the terms of the GNU General Public Li-
* cence as published by the Free Software Foundation; either
* version 2 of the License, or any later version.
*
* This program is distributed in the hope that it will be use-
* ful, but WITHOUT ANY WARRANTY; without even the implied war-
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
* You should have received a copy of the GNU General Public
* Licence along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*
**/
#ifndef INPUT_H
#define INPUT_H
#ifndef __LINUX__
#include <windows.h>
#else
# include "../main/winlnxdefs.h"
#endif
extern char pluginName[];
extern char configdir[PATH_MAX];
#endif

View file

@ -0,0 +1,2 @@
gcc -c input.c
gcc -shared -o dummyinput.dll input.c

View file

@ -37,7 +37,7 @@
<string>Resolution:</string>
</property>
<property name="buddy" >
<cstring>kcfg_Resolution</cstring>
<cstring>resolutionCombo</cstring>
</property>
</widget>
</item>
@ -158,6 +158,9 @@
<property name="text" >
<string>Bit Depth:</string>
</property>
<property name="buddy" >
<cstring>bitDepthCombo</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
@ -184,6 +187,9 @@
<property name="text" >
<string>Cache Size:</string>
</property>
<property name="buddy" >
<cstring>cacheSizeSpin</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >

View file

@ -24,6 +24,7 @@
#define __7Z_BUFFER_H
#include <stddef.h>
#include "Types.h"
typedef struct _CSzByteBuffer

View file

@ -23,10 +23,7 @@
#ifndef __BRANCHTYPES_H
#define __BRANCHTYPES_H
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#include <zconf.h>
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED

View file

@ -10,10 +10,7 @@ This file is part of LZMA SDK 4.40 (2006-05-01)
#ifndef __LZMATYPES_H
#define __LZMATYPES_H
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#include <zconf.h>
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED

View file

@ -23,10 +23,7 @@
#ifndef __C_TYPES_H
#define __C_TYPES_H
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#include <zconf.h>
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED

View file

@ -23,7 +23,9 @@ extern "C" {
#include "../main.h"
}
#include <gtk/gtk.h>
#ifndef __WIN32__
# include <gtk/gtk.h>
#endif
#include <QApplication>
#include <QAbstractEventDispatcher>

View file

@ -40,12 +40,20 @@ namespace core {
MainWindow::MainWindow()
: QMainWindow(0)
, m_statusBarLabel(0)
#ifdef __WIN32__
, m_renderWindow(0)
#endif
{
setupUi(this);
setupActions();
m_statusBarLabel = new QLabel;
statusBar()->addPermanentWidget(m_statusBarLabel);
#ifdef __WIN32__
m_renderWindow = new QWidget;
m_renderWindow->installEventFilter(this);
#endif
connect(mainWidget, SIGNAL(itemCountChanged(int)),
this, SLOT(itemCountUpdate(int)));
connect(mainWidget, SIGNAL(romDoubleClicked(QUrl, unsigned int)),
@ -84,6 +92,14 @@ MainWindow::MainWindow()
move(position);
}
MainWindow::~MainWindow()
{
#ifdef __WIN32__
delete m_renderWindow;
m_renderWindow = 0;
#endif
}
void MainWindow::closeEvent(QCloseEvent *event)
{
Q_UNUSED(event);
@ -96,6 +112,17 @@ void MainWindow::closeEvent(QCloseEvent *event)
core::config_put_bool("FilterVisible", actionShowFilter->isChecked());
}
#ifdef __WIN32__
bool MainWindow::eventFilter(QObject *obj, QEvent *ev)
{
if ((obj == m_renderWindow) && (ev->type() == QEvent::Close)) {
emulationStop();
return true;
}
return QMainWindow::eventFilter(obj, ev);
}
#endif
void MainWindow::showInfoMessage(const QString& msg)
{
statusBar()->showMessage(msg);
@ -144,7 +171,7 @@ void MainWindow::romOpen(const QUrl& url, unsigned int archivefile)
{
QString path = url.path();
if (core::open_rom(path.toLocal8Bit(), archivefile) == 0) {
core::startEmulation();
startEmulation();
}
}
@ -170,7 +197,7 @@ void MainWindow::emulationStart()
}
}
else
core::startEmulation();
startEmulation();
}
void MainWindow::emulationPauseContinue()
@ -181,6 +208,9 @@ void MainWindow::emulationPauseContinue()
void MainWindow::emulationStop()
{
core::stopEmulation();
#ifdef __WIN32__
m_renderWindow->hide();
#endif
}
void MainWindow::fullScreenToggle()
@ -190,14 +220,14 @@ void MainWindow::fullScreenToggle()
void MainWindow::saveStateSave()
{
if (core::g_EmulationThread) {
if (core::g_EmulatorRunning) {
core::savestates_job |= SAVESTATE;
}
}
void MainWindow::saveStateSaveAs()
{
if (core::g_EmulationThread) {
if (core::g_EmulatorRunning) {
QString filename = QFileDialog::getSaveFileName(this);
if (!filename.isEmpty()) {
core::savestates_select_filename(filename.toLocal8Bit());
@ -210,14 +240,14 @@ void MainWindow::saveStateSaveAs()
void MainWindow::saveStateLoad()
{
if (core::g_EmulationThread) {
if (core::g_EmulatorRunning) {
core::savestates_job |= LOADSTATE;
}
}
void MainWindow::saveStateLoadFrom()
{
if (core::g_EmulationThread) {
if (core::g_EmulatorRunning) {
QString filename = QFileDialog::getOpenFileName(this);
if (!filename.isEmpty()) {
core::savestates_select_filename(filename.toLocal8Bit());
@ -287,6 +317,17 @@ void MainWindow::customEvent(QEvent* event)
}
}
void MainWindow::startEmulation()
{
#ifdef __WIN32__
m_renderWindow->show();
core::g_MainWindow = reinterpret_cast<core::HWND__*>(m_renderWindow->winId());
core::g_StatusBar = reinterpret_cast<core::HWND__*>(statusBar()->winId());
#endif
core::startEmulation();
}
void MainWindow::setupActions()
{
//File Actions

View file

@ -54,6 +54,7 @@ class MainWindow : public QMainWindow, public Ui_MainWindow
Q_OBJECT
public:
MainWindow();
virtual ~MainWindow();
void showInfoMessage(const QString& msg);
void showAlertMessage(const QString& msg);
@ -85,9 +86,16 @@ class MainWindow : public QMainWindow, public Ui_MainWindow
void closeEvent(QCloseEvent* event);
private:
void startEmulation();
void setupActions();
QList<QAction*> slotActions;
QLabel* m_statusBarLabel;
#ifdef __WIN32__
QWidget* m_renderWindow;
protected:
bool eventFilter(QObject *obj, QEvent *ev);
#endif
};
#endif // MUPEN_KDE4_MAINWINDOW_H

View file

@ -66,6 +66,9 @@ SettingsDialog::SettingsDialog(QWidget* parent)
audioPluginLabel->setPixmap(icon("audio-card.png").pixmap(labelPixmapSize));
graphicsPluginLabel->setPixmap(icon("video-display.png").pixmap(labelPixmapSize));
connect(listWidget, SIGNAL(currentRowChanged(int)),
this, SLOT(pageChanged(int)));
int core = core::config_get_number("Core", CORE_DYNAREC);
switch (core) {
case CORE_DYNAREC:
@ -199,6 +202,12 @@ void SettingsDialog::on_osdEnabledCheck_toggled(bool checked)
core::config_put_bool("OsdEnabled", checked);
}
void SettingsDialog::on_audioPluginCombo_currentIndexChanged(const QString& text)
{
char* filename = core::plugin_filename_by_name(qPrintable(text));
core::config_put_string("Audio Plugin", filename);
}
void SettingsDialog::on_aboutAudioPluginButton_clicked()
{
QString text = audioPluginCombo->currentText();
@ -217,6 +226,12 @@ void SettingsDialog::on_testAudioPluginButton_clicked()
core::plugin_exec_test(qPrintable(text));
}
void SettingsDialog::on_graphicsPluginCombo_currentIndexChanged(const QString& text)
{
char* filename = core::plugin_filename_by_name(qPrintable(text));
core::config_put_string("Gfx Plugin", filename);
}
void SettingsDialog::on_aboutGraphicsPluginButton_clicked()
{
QString text = graphicsPluginCombo->currentText();
@ -235,6 +250,12 @@ void SettingsDialog::on_testGraphicsPluginButton_clicked()
core::plugin_exec_test(qPrintable(text));
}
void SettingsDialog::on_rspPluginCombo_currentIndexChanged(const QString& text)
{
char* filename = core::plugin_filename_by_name(qPrintable(text));
core::config_put_string("RSP Plugin", filename);
}
void SettingsDialog::on_aboutRspPluginButton_clicked()
{
QString text = rspPluginCombo->currentText();
@ -253,6 +274,12 @@ void SettingsDialog::on_testRspPluginButton_clicked()
core::plugin_exec_test(qPrintable(text));
}
void SettingsDialog::on_inputPluginCombo_currentIndexChanged(const QString& text)
{
char* filename = core::plugin_filename_by_name(qPrintable(text));
core::config_put_string("Input Plugin", filename);
}
void SettingsDialog::on_aboutInputPluginButton_clicked()
{
QString text = inputPluginCombo->currentText();

View file

@ -43,15 +43,19 @@ class SettingsDialog : public QDialog, public Ui_SettingsDialog
void on_askBeforeLoadingBadRomCheck_toggled(bool checked);
void on_autoIncrementSaveSlotCheck_toggled(bool checked);
void on_osdEnabledCheck_toggled(bool checked);
void on_audioPluginCombo_currentIndexChanged(const QString& text);
void on_aboutAudioPluginButton_clicked();
void on_configAudioPluginButton_clicked();
void on_testAudioPluginButton_clicked();
void on_inputPluginCombo_currentIndexChanged(const QString& text);
void on_aboutInputPluginButton_clicked();
void on_configInputPluginButton_clicked();
void on_testInputPluginButton_clicked();
void on_rspPluginCombo_currentIndexChanged(const QString& text);
void on_aboutRspPluginButton_clicked();
void on_configRspPluginButton_clicked();
void on_testRspPluginButton_clicked();
void on_graphicsPluginCombo_currentIndexChanged(const QString& text);
void on_aboutGraphicsPluginButton_clicked();
void on_configGraphicsPluginButton_clicked();
void on_testGraphicsPluginButton_clicked();

View file

@ -25,16 +25,20 @@
* gui subdirectories for the gui-specific code.
* if you want to implement an interface, you should look here
*/
#ifndef __WIN32__
# include <ucontext.h> // extra signal types (for portability)
# include <libgen.h> // basename, dirname
#endif
#include <sys/time.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h> // POSIX macros and standard types.
#include <pthread.h> // POSIX thread library
#include <signal.h> // signals
#include <ucontext.h> // extra signal types (for portability)
#include <getopt.h> // getopt_long
#include <libgen.h> // basename, dirname
#include <dirent.h>
#include <png.h> // for writing screenshot PNG files
@ -43,7 +47,6 @@
#include "main.h"
#include "version.h"
#include "winlnxdefs.h"
#include "config.h"
#include "plugin.h"
#include "rom.h"
@ -75,15 +78,21 @@
static void parseCommandLine(int argc, char **argv);
static int SaveRGBBufferToFile(char *filename, unsigned char *buf, int width, int height, int pitch);
static void *emulationThread( void *_arg );
static void sighandler( int signal, siginfo_t *info, void *context ); // signal handler
extern void *rom_cache_system(void *_arg);
#ifdef __WIN32__
static void sighandler( int signal );
#else
static void sighandler( int signal, siginfo_t *info, void *context );
#endif
/** globals **/
int g_Noask = 0; // don't ask to force load on bad dumps
int g_NoaskParam = 0; // was --noask passed at the commandline?
int g_MemHasBeenBSwapped = 0; // store byte-swapped flag so we don't swap twice when re-playing game
pthread_t g_EmulationThread = 0; // core thread handle
pthread_t g_RomCacheThread = 0; // rom cache thread handle
pthread_t g_EmulationThread; // core thread handle
pthread_t g_RomCacheThread; // rom cache thread handle
int g_EmulatorRunning = 0; // need separate boolean to tell if emulator is running, since --nogui doesn't use a thread
int g_OsdEnabled = 1; // On Screen Display enabled?
int g_Fullscreen = 0; // fullscreen enabled?
@ -231,11 +240,21 @@ static int GetVILimit(void)
static unsigned int gettimeofday_msec(void)
{
struct timeval tv;
unsigned int foo;
#if defined(__WIN32__)
FILETIME ft;
unsigned __int64 tmpres = 0;
GetSystemTimeAsFileTime(&ft);
tmpres |= ft.dwHighDateTime;
tmpres <<= 32;
tmpres |= ft.dwLowDateTime;
foo = (((tmpres / 1000000UL) % 1000000) * 1000) + (tmpres % 1000000UL / 1000);
#else
struct timeval tv;
gettimeofday(&tv, NULL);
foo = ((tv.tv_sec % 1000000) * 1000) + (tv.tv_usec / 1000);
#endif
return foo;
}
@ -331,9 +350,13 @@ void startEmulation(void)
// make sure all plugins are specified before running
if(g_GfxPlugin)
{
gfx_plugin = plugin_name_by_filename(g_GfxPlugin);
}
else
{
gfx_plugin = plugin_name_by_filename(config_get_string("Gfx Plugin", ""));
}
if(!gfx_plugin)
{
@ -379,12 +402,11 @@ void startEmulation(void)
{
emulationThread(NULL);
}
else if(!g_EmulationThread)
else if(!g_EmulatorRunning)
{
// spawn emulation thread
if(pthread_create(&g_EmulationThread, NULL, emulationThread, NULL) != 0)
{
g_EmulationThread = 0;
error_message(tr("Couldn't spawn core thread!"));
return;
}
@ -404,7 +426,7 @@ void startEmulation(void)
void stopEmulation(void)
{
if(g_EmulationThread || g_EmulatorRunning)
if(g_EmulatorRunning)
{
#ifndef NO_GUI
g_romcache.rcspause = 0;
@ -414,7 +436,7 @@ void stopEmulation(void)
stop_it();
// wait until emulation thread is done before continuing
if(g_EmulationThread)
if(g_EmulatorRunning)
pthread_join(g_EmulationThread, NULL);
g_EmulatorRunning = 0;
@ -539,7 +561,11 @@ void new_vi(void)
time = (int)(CalculatedTime - CurrentFPSTime);
if (time > 0)
{
#ifdef __WIN32__
Sleep(time);
#else
usleep(time * 1000);
#endif
}
CurrentFPSTime = CurrentFPSTime + time;
}
@ -737,16 +763,23 @@ static int sdl_event_filter( const SDL_Event *event )
*/
static void * emulationThread( void *_arg )
{
#ifndef __WIN32__
struct sigaction sa;
#endif
const char *gfx_plugin = NULL,
*audio_plugin = NULL,
*input_plugin = NULL,
*RSP_plugin = NULL;
struct sigaction sa;
// install signal handler, but only if we're running in GUI mode
// in non-GUI mode, we don't need to catch exceptions (there's no GUI to take down)
if (l_GuiEnabled)
{
#ifdef __WIN32__
signal( SIGSEGV, sighandler );
signal( SIGILL, sighandler );
signal( SIGFPE, sighandler );
#else
memset( &sa, 0, sizeof( struct sigaction ) );
sa.sa_sigaction = sighandler;
sa.sa_flags = SA_SIGINFO;
@ -754,6 +787,7 @@ static void * emulationThread( void *_arg )
sigaction( SIGILL, &sa, NULL );
sigaction( SIGFPE, &sa, NULL );
sigaction( SIGCHLD, &sa, NULL );
#endif
}
g_EmulatorRunning = 1;
@ -876,7 +910,7 @@ static void * emulationThread( void *_arg )
free_memory();
// clean up
g_EmulationThread = 0;
g_EmulatorRunning = 0;
SDL_Quit();
@ -895,6 +929,12 @@ static void * emulationThread( void *_arg )
/*********************************************************************************************************
* signal handler
*/
#ifdef __WIN32__
static void sighandler(int signal)
{
printf( "Signal number %d caught\n", signal );
}
#else
static void sighandler(int signal, siginfo_t *info, void *context)
{
if( info->si_pid == g_EmulationThread )
@ -965,6 +1005,7 @@ static void sighandler(int signal, siginfo_t *info, void *context)
exit( EXIT_FAILURE );
}
}
#endif /* __WIN32__ */
static void printUsage(const char *progname)
{
@ -991,7 +1032,7 @@ static void printUsage(const char *progname)
" --debugger : start with debugger enabled\n"
#endif
" -h, --help : see this help message\n"
"\n", basename(str));
"\n", str);
free(str);
@ -1182,7 +1223,6 @@ void parseCommandLine(int argc, char **argv)
// This allows creation of a mupen64plus_nogui symlink to mupen64plus instead of passing --nogui
// for backwards compatability with old mupen64_nogui program name.
str = strdup(argv[0]);
basename(str);
if(strstr(str, "_nogui") != NULL)
{
l_GuiEnabled = FALSE;
@ -1198,6 +1238,11 @@ void parseCommandLine(int argc, char **argv)
*/
static void setPaths(void)
{
#ifdef __WIN32__
strncpy(l_ConfigDir, "./", PATH_MAX);
strncpy(l_InstallDir, "./", PATH_MAX);
return;
#else
char buf[PATH_MAX], buf2[PATH_MAX];
// if the config dir was not specified at the commandline, look for ~/.mupen64plus dir
@ -1335,7 +1380,7 @@ static void setPaths(void)
snprintf(chDefaultDir, PATH_MAX, "%sscreenshots/", l_ConfigDir);
SetScreenshotDir(chDefaultDir);
}
#endif /* __WIN32__ */
}
/*********************************************************************************************************
@ -1451,7 +1496,6 @@ int main(int argc, char *argv[])
g_romcache.rcstask = RCS_INIT;
if(pthread_create(&g_RomCacheThread, &tattr, rom_cache_system, &tattr)!=0)
{
g_RomCacheThread = 0;
error_message(tr("Couldn't spawn rom cache thread!"));
}
else
@ -1519,3 +1563,40 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
}
#ifdef __WIN32__
static const char* programName = "mupen64plus.exe";
int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParamarg, int cmdShow)
{
list_t arguments = NULL;
list_node_t* node = NULL;
int i = 0;
char* arg = NULL;
char* wrk = NULL;
char** argv = NULL;
g_ProgramInstance = instance;
wrk = malloc(strlen(programName) + 1);
strcpy(wrk, programName);
list_append(&arguments, wrk);
for (arg = strtok(cmdParamarg, " ");
arg != NULL;
arg = strtok(NULL, " "))
{
wrk = malloc(strlen(arg) + 1);
strcpy(wrk, arg);
list_append(&arguments, arg);
}
argv = malloc(list_length(arguments) + 1 * sizeof(char*));
list_foreach(arguments, node)
{
argv[i++] = node->data;
}
return main(i, argv);
}
#endif

View file

@ -31,6 +31,7 @@ extern int g_MemHasBeenBSwapped;
extern int g_TakeScreenshot;
extern int g_OsdEnabled;
extern int g_Fullscreen;
extern int g_EmulatorRunning;
extern pthread_t g_EmulationThread;
extern pthread_t g_RomCacheThread;
extern char *g_GfxPlugin;

View file

@ -35,7 +35,6 @@
#include <unistd.h>
#include <limits.h>
#include "winlnxdefs.h"
#include "plugin.h"
#include "main.h"
#include "util.h"
@ -48,10 +47,10 @@ CONTROL Controls[4];
static char l_PluginDir[PATH_MAX] = {0};
static GFX_INFO gfx_info;
static AUDIO_INFO audio_info;
static CONTROL_INFO control_info;
static RSP_INFO rsp_info;
GFX_INFO gfx_info;
AUDIO_INFO audio_info;
CONTROL_INFO control_info;
RSP_INFO rsp_info;
void (*getDllInfo)(PLUGIN_INFO *PluginInfo);
void (*dllConfig)(HWND hParent);
@ -63,6 +62,7 @@ static void dummy_void() {}
static BOOL dummy_initiateGFX(GFX_INFO Gfx_Info) { return TRUE; }
static BOOL dummy_initiateAudio(AUDIO_INFO Audio_Info) { return TRUE; }
static void dummy_initiateControllers(CONTROL_INFO Control_Info) {}
static void dummy_old_initiateControllers(HWND hMainWindow, CONTROL Controls[4]) {}
static void dummy_aiDacrateChanged(int SystemType) {}
static DWORD dummy_aiReadLength() { return 0; }
static void dummy_setSpeedFactor(int percent) {}
@ -114,6 +114,7 @@ const char * (*volumeGetString)() = dummy_volumeGetString;
void (*closeDLL_input)() = dummy_void;
void (*controllerCommand)(int Control, BYTE * Command) = dummy_controllerCommand;
void (*getKeys)(int Control, BUTTONS *Keys) = dummy_getKeys;
void (*old_initiateControllers)(HWND hMainWindow, CONTROL Controls[4]) = dummy_old_initiateControllers;
void (*initiateControllers)(CONTROL_INFO ControlInfo) = dummy_initiateControllers;
void (*readController)(int Control, BYTE *Command) = dummy_readController;
void (*romClosed_input)() = dummy_void;
@ -133,6 +134,10 @@ void (*fBGetFrameBufferInfo)(void *p) = dummy_fBGetFrameBufferInfo;
list_t g_PluginList = NULL;
HINSTANCE g_ProgramInstance = 0;
HWND g_MainWindow = 0;
HWND g_StatusBar = 0;
void plugin_delete_list(void)
{
list_node_t *node;
@ -165,6 +170,9 @@ int plugin_scan_file(const char *file_name, WORD plugin_type)
char *bname = NULL;
char filepath[PATH_MAX];
#ifdef __WIN32__
snprintf(filepath, PATH_MAX, "%s%s", l_PluginDir, file_name);
#else
if(strstr(file_name, "/"))
realpath(file_name, filepath);
else
@ -178,6 +186,7 @@ int plugin_scan_file(const char *file_name, WORD plugin_type)
snprintf(filepath, PATH_MAX, "%s%s", l_PluginDir, bname);
filepath[PATH_MAX-1] = '\0';
}
#endif
handle = dlopen(filepath, RTLD_NOW);
if(handle)
@ -233,6 +242,11 @@ void plugin_scan_directory(const char *plugindir)
{
DIR *dir;
struct dirent *entry;
#ifdef __WIN32__
const char* suffix = ".dll";
#else
const char* suffix = ".so";
#endif
// open the plugins directory and if it's valid, copy it to the static l_PluginDir char array
dir = opendir(plugindir);
@ -251,7 +265,7 @@ void plugin_scan_directory(const char *plugindir)
// look for any shared libraries in this folder, and scan them
while((entry = readdir(dir)) != NULL)
{
if (strcmp(entry->d_name + strlen(entry->d_name) - 3, ".so") != 0)
if (strcmp(entry->d_name + strlen(entry->d_name) - strlen(suffix), suffix) != 0)
continue;
plugin_scan_file(entry->d_name, 0);
@ -311,15 +325,23 @@ char *plugin_name_by_filename(const char *filename)
list_node_t *node;
char real_filename1[PATH_MAX], real_filename2[PATH_MAX];
#ifdef __WIN32__
strncpy(real_filename1, filename, PATH_MAX);
#else
if (!realpath(filename, real_filename1))
strcpy(real_filename1, filename);
#endif
list_foreach(g_PluginList, node)
{
p = (plugin *)node->data;
#ifdef __WIN32__
strncpy(real_filename2, p->file_name, PATH_MAX);
#else
if (!realpath(p->file_name, real_filename2))
strcpy(real_filename2, p->file_name);
#endif
if (!strcmp(real_filename1, real_filename2))
return p->plugin_name;
@ -338,6 +360,21 @@ void plugin_exec_config(const char *name)
if(p && p->handle)
{
switch (p->type)
{
case PLUGIN_TYPE_CONTROLLER:
plugin_load_input_plugin(name);
break;
case PLUGIN_TYPE_RSP:
plugin_load_rsp_plugin(name);
break;
case PLUGIN_TYPE_GFX:
plugin_load_gfx_plugin(name);
break;
case PLUGIN_TYPE_AUDIO:
plugin_load_audio_plugin(name);
break;
}
dllConfig = dlsym(p->handle, "DllConfig");
if(dllConfig)
dllConfig(0);
@ -373,26 +410,227 @@ void plugin_load_plugins(const char *gfx_name,
const char *input_name,
const char *RSP_name)
{
int i;
plugin *p;
void *handle_gfx = NULL,
*handle_audio = NULL,
*handle_input = NULL,
*handle_RSP = NULL;
plugin_load_gfx_plugin(gfx_name);
plugin_load_audio_plugin(audio_name);
plugin_load_input_plugin(input_name);
plugin_load_rsp_plugin(RSP_name);
}
p = plugin_get_by_name(gfx_name);
if(p) handle_gfx = p->handle;
void plugin_load_rsp_plugin(const char* RSP_name)
{
plugin *p;
void *handle_RSP = NULL;
p = plugin_get_by_name(RSP_name);
if(p) handle_RSP = p->handle;
p = plugin_get_by_name(audio_name);
if(p) handle_audio = p->handle;
if (handle_RSP)
{
closeDLL_RSP = dlsym(handle_RSP, "CloseDLL");
doRspCycles = dlsym(handle_RSP, "DoRspCycles");
initiateRSP = dlsym(handle_RSP, "InitiateRSP");
romClosed_RSP = dlsym(handle_RSP, "RomClosed");
if (closeDLL_RSP == NULL) closeDLL_RSP = dummy_void;
if (doRspCycles == NULL) doRspCycles = dummy_doRspCycles;
if (initiateRSP == NULL) initiateRSP = dummy_initiateRSP;
if (romClosed_RSP == NULL) romClosed_RSP = dummy_void;
rsp_info.MemoryBswaped = TRUE;
rsp_info.RDRAM = (BYTE*)rdram;
rsp_info.DMEM = (BYTE*)SP_DMEM;
rsp_info.IMEM = (BYTE*)SP_IMEM;
rsp_info.MI_INTR_REG = &MI_register.mi_intr_reg;
rsp_info.SP_MEM_ADDR_REG = &sp_register.sp_mem_addr_reg;
rsp_info.SP_DRAM_ADDR_REG = &sp_register.sp_dram_addr_reg;
rsp_info.SP_RD_LEN_REG = &sp_register.sp_rd_len_reg;
rsp_info.SP_WR_LEN_REG = &sp_register.sp_wr_len_reg;
rsp_info.SP_STATUS_REG = &sp_register.sp_status_reg;
rsp_info.SP_DMA_FULL_REG = &sp_register.sp_dma_full_reg;
rsp_info.SP_DMA_BUSY_REG = &sp_register.sp_dma_busy_reg;
rsp_info.SP_PC_REG = &rsp_register.rsp_pc;
rsp_info.SP_SEMAPHORE_REG = &sp_register.sp_semaphore_reg;
rsp_info.DPC_START_REG = &dpc_register.dpc_start;
rsp_info.DPC_END_REG = &dpc_register.dpc_end;
rsp_info.DPC_CURRENT_REG = &dpc_register.dpc_current;
rsp_info.DPC_STATUS_REG = &dpc_register.dpc_status;
rsp_info.DPC_CLOCK_REG = &dpc_register.dpc_clock;
rsp_info.DPC_BUFBUSY_REG = &dpc_register.dpc_bufbusy;
rsp_info.DPC_PIPEBUSY_REG = &dpc_register.dpc_pipebusy;
rsp_info.DPC_TMEM_REG = &dpc_register.dpc_tmem;
rsp_info.CheckInterrupts = sucre;
rsp_info.ProcessDlistList = processDList;
rsp_info.ProcessAlistList = processAList;
rsp_info.ProcessRdpList = processRDPList;
rsp_info.ShowCFB = showCFB;
#ifdef __WIN32__
rsp_info.hInst = g_ProgramInstance;
#endif
initiateRSP(rsp_info,(DWORD*) NULL);
}
else
{
closeDLL_RSP = dummy_void;
doRspCycles = dummy_doRspCycles;
initiateRSP = dummy_initiateRSP;
romClosed_RSP = dummy_void;
}
}
void plugin_load_input_plugin(const char* input_name)
{
int i;
plugin *p;
void *handle_input = NULL;
PLUGIN_INFO input_pluginInfo;
p = plugin_get_by_name(input_name);
if(p) handle_input = p->handle;
p = plugin_get_by_name(RSP_name);
if(p) handle_RSP = p->handle;
if (handle_input)
{
getDllInfo = dlsym(handle_input, "GetDllInfo");
getDllInfo(&input_pluginInfo);
closeDLL_input = dlsym(handle_input, "CloseDLL");
controllerCommand = dlsym(handle_input, "ControllerCommand");
getKeys = dlsym(handle_input, "GetKeys");
initiateControllers = dlsym(handle_input, "InitiateControllers");
old_initiateControllers = dlsym(handle_input, "InitiateControllers");
readController = dlsym(handle_input, "ReadController");
romClosed_input = dlsym(handle_input, "RomClosed");
romOpen_input = dlsym(handle_input, "RomOpen");
keyDown = dlsym(handle_input, "WM_KeyDown");
keyUp = dlsym(handle_input, "WM_KeyUp");
if (closeDLL_input == NULL) closeDLL_input = dummy_void;
if (controllerCommand == NULL) controllerCommand = dummy_controllerCommand;
if (getKeys == NULL) getKeys = dummy_getKeys;
if (initiateControllers == NULL) initiateControllers = dummy_initiateControllers;
if (readController == NULL) readController = dummy_readController;
if (romClosed_input == NULL) romClosed_input = dummy_void;
if (romOpen_input == NULL) romOpen_input = dummy_void;
if (keyDown == NULL) keyDown = dummy_keyDown;
if (keyUp == NULL) keyUp = dummy_keyUp;
control_info.MemoryBswaped = TRUE;
control_info.HEADER = rom;
control_info.Controls = Controls;
#ifdef __WIN32__
control_info.hMainWindow = g_MainWindow;
control_info.hinst = g_ProgramInstance;
#endif
for (i=0; i<4; i++)
{
Controls[i].Present = FALSE;
Controls[i].RawData = FALSE;
Controls[i].Plugin = PLUGIN_NONE;
}
if (input_pluginInfo.Version == 0x0101)
{
initiateControllers(control_info);
}
else
{
old_initiateControllers(g_MainWindow, Controls);
}
}
else
{
closeDLL_input = dummy_void;
controllerCommand = dummy_controllerCommand;
getKeys = dummy_getKeys;
initiateControllers = dummy_initiateControllers;
readController = dummy_readController;
romClosed_input = dummy_void;
romOpen_input = dummy_void;
keyDown = dummy_keyDown;
keyUp = dummy_keyUp;
}
}
if (handle_gfx)
void plugin_load_audio_plugin(const char* audio_name)
{
plugin *p;
void *handle_audio = NULL;
p = plugin_get_by_name(audio_name);
if(p) handle_audio = p->handle;
if (handle_audio)
{
closeDLL_audio = dlsym(handle_audio, "CloseDLL");
aiDacrateChanged = dlsym(handle_audio, "AiDacrateChanged");
aiLenChanged = dlsym(handle_audio, "AiLenChanged");
aiReadLength = dlsym(handle_audio, "AiReadLength");
//aiUpdate = dlsym(handle_audio, "AiUpdate");
initiateAudio = dlsym(handle_audio, "InitiateAudio");
processAList = dlsym(handle_audio, "ProcessAList");
romClosed_audio = dlsym(handle_audio, "RomClosed");
romOpen_audio = dlsym(handle_audio, "RomOpen");
setSpeedFactor = dlsym(handle_audio, "SetSpeedFactor");
volumeUp = dlsym(handle_audio, "VolumeUp");
volumeDown = dlsym(handle_audio, "VolumeDown");
volumeMute = dlsym(handle_audio, "VolumeMute");
volumeGetString = dlsym(handle_audio, "VolumeGetString");
if (aiDacrateChanged == NULL) aiDacrateChanged = dummy_aiDacrateChanged;
if (aiLenChanged == NULL) aiLenChanged = dummy_void;
if (aiReadLength == NULL) aiReadLength = dummy_aiReadLength;
//if (aiUpdate == NULL) aiUpdate = dummy_aiUpdate;
if (closeDLL_audio == NULL) closeDLL_audio = dummy_void;
if (initiateAudio == NULL) initiateAudio = dummy_initiateAudio;
if (processAList == NULL) processAList = dummy_void;
if (romClosed_audio == NULL) romClosed_audio = dummy_void;
if (romOpen_audio == NULL) romOpen_audio = dummy_void;
if (setSpeedFactor == NULL) setSpeedFactor = dummy_setSpeedFactor;
if (volumeUp == NULL) volumeUp = dummy_void;
if (volumeDown == NULL) volumeDown = dummy_void;
if (volumeMute == NULL) volumeMute = dummy_void;
if (volumeGetString == NULL) volumeGetString = dummy_volumeGetString;
audio_info.MemoryBswaped = TRUE;
audio_info.HEADER = rom;
audio_info.RDRAM = (BYTE*)rdram;
audio_info.DMEM = (BYTE*)SP_DMEM;
audio_info.IMEM = (BYTE*)SP_IMEM;
audio_info.MI_INTR_REG = &(MI_register.mi_intr_reg);
audio_info.AI_DRAM_ADDR_REG = &(ai_register.ai_dram_addr);
audio_info.AI_LEN_REG = &(ai_register.ai_len);
audio_info.AI_CONTROL_REG = &(ai_register.ai_control);
audio_info.AI_STATUS_REG = &dummy;
audio_info.AI_DACRATE_REG = &(ai_register.ai_dacrate);
audio_info.AI_BITRATE_REG = &(ai_register.ai_bitrate);
audio_info.CheckInterrupts = sucre;
#ifdef __WIN32__
audio_info.hwnd = g_MainWindow;
audio_info.hinst = g_ProgramInstance;
#endif
initiateAudio(audio_info);
}
else
{
aiDacrateChanged = dummy_aiDacrateChanged;
aiLenChanged = dummy_void;
aiReadLength = dummy_aiReadLength;
//aiUpdate = dummy_aiUpdate;
closeDLL_audio = dummy_void;
initiateAudio = dummy_initiateAudio;
processAList = dummy_void;
romClosed_audio = dummy_void;
romOpen_audio = dummy_void;
setSpeedFactor = dummy_setSpeedFactor;
}
}
void plugin_load_gfx_plugin(const char* gfx_name)
{
plugin *p;
void *handle_gfx = NULL;
p = plugin_get_by_name(gfx_name);
if(p) handle_gfx = p->handle;
if (handle_gfx)
{
changeWindow = dlsym(handle_gfx, "ChangeWindow");
closeDLL_gfx = dlsym(handle_gfx, "CloseDLL");
@ -459,6 +697,10 @@ void plugin_load_plugins(const char *gfx_name,
gfx_info.VI_X_SCALE_REG = &(vi_register.vi_x_scale);
gfx_info.VI_Y_SCALE_REG = &(vi_register.vi_y_scale);
gfx_info.CheckInterrupts = sucre;
#ifdef __WIN32__
gfx_info.hWnd = g_MainWindow;
gfx_info.hStatusBar = g_StatusBar;
#endif
initiateGFX(gfx_info);
}
else
@ -478,160 +720,4 @@ void plugin_load_plugins(const char *gfx_name,
captureScreen = dummy_void;
setRenderingCallback = dummy_void;
}
if (handle_audio)
{
closeDLL_audio = dlsym(handle_audio, "CloseDLL");
aiDacrateChanged = dlsym(handle_audio, "AiDacrateChanged");
aiLenChanged = dlsym(handle_audio, "AiLenChanged");
aiReadLength = dlsym(handle_audio, "AiReadLength");
//aiUpdate = dlsym(handle_audio, "AiUpdate");
initiateAudio = dlsym(handle_audio, "InitiateAudio");
processAList = dlsym(handle_audio, "ProcessAList");
romClosed_audio = dlsym(handle_audio, "RomClosed");
romOpen_audio = dlsym(handle_audio, "RomOpen");
setSpeedFactor = dlsym(handle_audio, "SetSpeedFactor");
volumeUp = dlsym(handle_audio, "VolumeUp");
volumeDown = dlsym(handle_audio, "VolumeDown");
volumeMute = dlsym(handle_audio, "VolumeMute");
volumeGetString = dlsym(handle_audio, "VolumeGetString");
if (aiDacrateChanged == NULL) aiDacrateChanged = dummy_aiDacrateChanged;
if (aiLenChanged == NULL) aiLenChanged = dummy_void;
if (aiReadLength == NULL) aiReadLength = dummy_aiReadLength;
//if (aiUpdate == NULL) aiUpdate = dummy_aiUpdate;
if (closeDLL_audio == NULL) closeDLL_audio = dummy_void;
if (initiateAudio == NULL) initiateAudio = dummy_initiateAudio;
if (processAList == NULL) processAList = dummy_void;
if (romClosed_audio == NULL) romClosed_audio = dummy_void;
if (romOpen_audio == NULL) romOpen_audio = dummy_void;
if (setSpeedFactor == NULL) setSpeedFactor = dummy_setSpeedFactor;
if (volumeUp == NULL) volumeUp = dummy_void;
if (volumeDown == NULL) volumeDown = dummy_void;
if (volumeMute == NULL) volumeMute = dummy_void;
if (volumeGetString == NULL) volumeGetString = dummy_volumeGetString;
audio_info.MemoryBswaped = TRUE;
audio_info.HEADER = rom;
audio_info.RDRAM = (BYTE*)rdram;
audio_info.DMEM = (BYTE*)SP_DMEM;
audio_info.IMEM = (BYTE*)SP_IMEM;
audio_info.MI_INTR_REG = &(MI_register.mi_intr_reg);
audio_info.AI_DRAM_ADDR_REG = &(ai_register.ai_dram_addr);
audio_info.AI_LEN_REG = &(ai_register.ai_len);
audio_info.AI_CONTROL_REG = &(ai_register.ai_control);
audio_info.AI_STATUS_REG = &dummy;
audio_info.AI_DACRATE_REG = &(ai_register.ai_dacrate);
audio_info.AI_BITRATE_REG = &(ai_register.ai_bitrate);
audio_info.CheckInterrupts = sucre;
initiateAudio(audio_info);
}
else
{
aiDacrateChanged = dummy_aiDacrateChanged;
aiLenChanged = dummy_void;
aiReadLength = dummy_aiReadLength;
//aiUpdate = dummy_aiUpdate;
closeDLL_audio = dummy_void;
initiateAudio = dummy_initiateAudio;
processAList = dummy_void;
romClosed_audio = dummy_void;
romOpen_audio = dummy_void;
setSpeedFactor = dummy_setSpeedFactor;
}
if (handle_input)
{
closeDLL_input = dlsym(handle_input, "CloseDLL");
controllerCommand = dlsym(handle_input, "ControllerCommand");
getKeys = dlsym(handle_input, "GetKeys");
initiateControllers = dlsym(handle_input, "InitiateControllers");
readController = dlsym(handle_input, "ReadController");
romClosed_input = dlsym(handle_input, "RomClosed");
romOpen_input = dlsym(handle_input, "RomOpen");
keyDown = dlsym(handle_input, "WM_KeyDown");
keyUp = dlsym(handle_input, "WM_KeyUp");
if (closeDLL_input == NULL) closeDLL_input = dummy_void;
if (controllerCommand == NULL) controllerCommand = dummy_controllerCommand;
if (getKeys == NULL) getKeys = dummy_getKeys;
if (initiateControllers == NULL) initiateControllers = dummy_initiateControllers;
if (readController == NULL) readController = dummy_readController;
if (romClosed_input == NULL) romClosed_input = dummy_void;
if (romOpen_input == NULL) romOpen_input = dummy_void;
if (keyDown == NULL) keyDown = dummy_keyDown;
if (keyUp == NULL) keyUp = dummy_keyUp;
control_info.MemoryBswaped = TRUE;
control_info.HEADER = rom;
control_info.Controls = Controls;
for (i=0; i<4; i++)
{
Controls[i].Present = FALSE;
Controls[i].RawData = FALSE;
Controls[i].Plugin = PLUGIN_NONE;
}
initiateControllers(control_info);
}
else
{
closeDLL_input = dummy_void;
controllerCommand = dummy_controllerCommand;
getKeys = dummy_getKeys;
initiateControllers = dummy_initiateControllers;
readController = dummy_readController;
romClosed_input = dummy_void;
romOpen_input = dummy_void;
keyDown = dummy_keyDown;
keyUp = dummy_keyUp;
}
if (handle_RSP)
{
closeDLL_RSP = dlsym(handle_RSP, "CloseDLL");
doRspCycles = dlsym(handle_RSP, "DoRspCycles");
initiateRSP = dlsym(handle_RSP, "InitiateRSP");
romClosed_RSP = dlsym(handle_RSP, "RomClosed");
if (closeDLL_RSP == NULL) closeDLL_RSP = dummy_void;
if (doRspCycles == NULL) doRspCycles = dummy_doRspCycles;
if (initiateRSP == NULL) initiateRSP = dummy_initiateRSP;
if (romClosed_RSP == NULL) romClosed_RSP = dummy_void;
rsp_info.MemoryBswaped = TRUE;
rsp_info.RDRAM = (BYTE*)rdram;
rsp_info.DMEM = (BYTE*)SP_DMEM;
rsp_info.IMEM = (BYTE*)SP_IMEM;
rsp_info.MI_INTR_REG = &MI_register.mi_intr_reg;
rsp_info.SP_MEM_ADDR_REG = &sp_register.sp_mem_addr_reg;
rsp_info.SP_DRAM_ADDR_REG = &sp_register.sp_dram_addr_reg;
rsp_info.SP_RD_LEN_REG = &sp_register.sp_rd_len_reg;
rsp_info.SP_WR_LEN_REG = &sp_register.sp_wr_len_reg;
rsp_info.SP_STATUS_REG = &sp_register.sp_status_reg;
rsp_info.SP_DMA_FULL_REG = &sp_register.sp_dma_full_reg;
rsp_info.SP_DMA_BUSY_REG = &sp_register.sp_dma_busy_reg;
rsp_info.SP_PC_REG = &rsp_register.rsp_pc;
rsp_info.SP_SEMAPHORE_REG = &sp_register.sp_semaphore_reg;
rsp_info.DPC_START_REG = &dpc_register.dpc_start;
rsp_info.DPC_END_REG = &dpc_register.dpc_end;
rsp_info.DPC_CURRENT_REG = &dpc_register.dpc_current;
rsp_info.DPC_STATUS_REG = &dpc_register.dpc_status;
rsp_info.DPC_CLOCK_REG = &dpc_register.dpc_clock;
rsp_info.DPC_BUFBUSY_REG = &dpc_register.dpc_bufbusy;
rsp_info.DPC_PIPEBUSY_REG = &dpc_register.dpc_pipebusy;
rsp_info.DPC_TMEM_REG = &dpc_register.dpc_tmem;
rsp_info.CheckInterrupts = sucre;
rsp_info.ProcessDlistList = processDList;
rsp_info.ProcessAlistList = processAList;
rsp_info.ProcessRdpList = processRDPList;
rsp_info.ShowCFB = showCFB;
initiateRSP(rsp_info,(DWORD*)&i);
}
else
{
closeDLL_RSP = dummy_void;
doRspCycles = dummy_doRspCycles;
initiateRSP = dummy_initiateRSP;
romClosed_RSP = dummy_void;
}
}

View file

@ -60,6 +60,11 @@ void plugin_exec_config(const char *name);
void plugin_exec_test(const char *name);
void plugin_exec_about(const char *name);
void plugin_load_gfx_plugin(const char* gfx_name);
void plugin_load_audio_plugin(const char* audio_name);
void plugin_load_input_plugin(const char* input_name);
void plugin_load_rsp_plugin(const char* RSP_name);
/* Plugin types */
#define PLUGIN_TYPE_RSP 1
#define PLUGIN_TYPE_GFX 2
@ -283,6 +288,7 @@ extern const char * (*volumeGetString)();
extern void (*closeDLL_input)();
extern void (*controllerCommand)(int Control, BYTE * Command);
extern void (*getKeys)(int Control, BUTTONS *Keys);
extern void (*old_initiateControllers)(HWND hMainWindow, CONTROL Controls[4]);
extern void (*initiateControllers)(CONTROL_INFO ControlInfo);
extern void (*readController)(int Control, BYTE *Command);
extern void (*romClosed_input)();
@ -310,4 +316,8 @@ extern void (*fBRead)(DWORD addr);
extern void (*fBWrite)(DWORD addr, DWORD size);
extern void (*fBGetFrameBufferInfo)(void *p);
extern HINSTANCE g_ProgramInstance;
extern HWND g_MainWindow;
extern HWND g_StatusBar;
#endif

View file

@ -459,7 +459,7 @@ static int ask_hack(void)
int open_rom(const char* filename, unsigned int archivefile)
{
if(g_EmulationThread)
if(g_EmulatorRunning)
{
#ifndef NO_GUI
if(!g_Noask)
@ -617,7 +617,7 @@ int open_rom(const char* filename, unsigned int archivefile)
int close_rom(void)
{
if(g_EmulationThread)
if(g_EmulatorRunning)
{
#ifndef NO_GUI
if(!g_Noask)

View file

@ -26,6 +26,7 @@
#include <zlib.h>
#include "winlnxdefs.h"
#include "romcache.h"
#include "config.h"
#include "rom.h"
@ -333,12 +334,16 @@ static void scan_dir(const char *directoryname)
snprintf(filename, PATH_MAX-1, "%s%s", directoryname, directoryentry->d_name);
filename[PATH_MAX-1] = '\0';
#ifdef __WIN32__
strncpy(fullpath, filename, PATH_MAX-1);
#else
//Use real path (maybe it's a link)
if(realpath(filename,fullpath))
{
strncpy(filename,fullpath,PATH_MAX-1);
filename[PATH_MAX-1] = '\0';
}
#endif
//If we can't get information, move to next file.
if(stat(fullpath,&filestatus)==-1)

View file

@ -22,6 +22,12 @@
#ifndef WINLNXDEFS_H
#define WINLNXDEFS_H
#ifdef __WIN32__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <winbase.h>
# define sleep(x) Sleep(x*1000)
#else
typedef unsigned int BOOL;
typedef unsigned int DWORD;
typedef unsigned short WORD;
@ -52,4 +58,5 @@ typedef void* LPVOID;
#define TRUE 1
#endif
#endif
#endif // __WIN32__
#endif // WINLNXDEFS_H

View file

@ -24,7 +24,12 @@
#include "r4300.h"
#include "../memory/memory.h"
#ifndef __WIN32__
#include "../main/winlnxdefs.h"
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include "../main/plugin.h"
#include "../r4300/recomph.h"
@ -166,7 +171,7 @@ void compare_core()
fwrite(reg, 32, sizeof(long long int), f);
fwrite(reg_cop0, 32, sizeof(int), f);
fwrite(reg_cop1_fgr_64, 32, sizeof(long long int), f);
//fwrite(&rdram[0x31280/4], 1, sizeof(int), f);
/*fwrite(&FCR31, 4, 1, f);*/
/*fwrite(&rdram[0x31280/4], 1, sizeof(int), f);
fwrite(&FCR31, 4, 1, f);*/
}
}

View file

@ -22,6 +22,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define _POSIX_C_SOURCE 199309
#include <time.h>
#include <time.h>
#ifndef __WIN32__

View file

@ -51,9 +51,15 @@ void dyna_jump()
*return_address = (unsigned long) (actual->code + PC->local_addr);
}
static long save_ebp = 0;
static long save_esp = 0;
static long save_eip = 0;
#ifdef __GNUC__
# define ASM_NAME(name) asm(name)
#else
# define ASM_NAME(name)
#endif
static long save_ebp ASM_NAME("save_ebp") = 0;
static long save_esp ASM_NAME("save_esp") = 0;
static long save_eip ASM_NAME("save_eip") = 0;
void dyna_start(void (*code)())
{
@ -62,7 +68,7 @@ void dyna_start(void (*code)())
/* then call the code(), which should theoretically never return. */
/* When dyna_stop() sets the *return_address to the saved EIP, the emulator thread will come back here. */
/* It will jump to label 2, restore the base and stack pointers, and exit this function */
#ifdef _WIN32
#if defined(_WIN32) && !defined(__GNUC__)
__asm
{
mov _save_ebp, ebp

34
version.win32.h Normal file
View file

@ -0,0 +1,34 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus - version.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2008 Richard42 DarkJeztr Tillin9 *
* *
* 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., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Version macros automatically replaced by Makefiles. */
#ifndef __VERSION_H__
#define __VERSION_H__
#define MUPEN_NAME "Mupen64Plus"
#define MUPEN_VERSION "win-devel"
#define PLUGIN_VERSION "win-devel"
#endif /* __VERSION_H__ */