set svn:eol-style=native for **.h

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1438 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
bushing 2008-12-08 04:46:09 +00:00
parent e6fe5ec42f
commit 30c883bcfc
334 changed files with 30407 additions and 30407 deletions

View File

@ -1,33 +1,33 @@
/*==================================================================== /*====================================================================
filename: opcodes.h filename: opcodes.h
project: GameCube DSP Tool (gcdsp) project: GameCube DSP Tool (gcdsp)
created: 2005.03.04 created: 2005.03.04
mail: duddie@walla.com mail: duddie@walla.com
Copyright (c) 2005 Duddie Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/ ====================================================================*/
#ifndef _GDSP_EXT_OP_H #ifndef _GDSP_EXT_OP_H
#define _GDSP_EXT_OP_H #define _GDSP_EXT_OP_H
void dsp_op_ext_ops_pro(uint16 _Opcode); void dsp_op_ext_ops_pro(uint16 _Opcode);
void dsp_op_ext_ops_epi(uint16 _Opcode); void dsp_op_ext_ops_epi(uint16 _Opcode);
#endif #endif

View File

@ -1,48 +1,48 @@
/*==================================================================== /*====================================================================
filename: gdsp_opcodes.h filename: gdsp_opcodes.h
project: GCemu project: GCemu
created: 2004-6-18 created: 2004-6-18
mail: duddie@walla.com mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax Copyright (c) 2005 Duddie & Tratax
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/ ====================================================================*/
#ifndef _GDSP_OPCODES_H #ifndef _GDSP_OPCODES_H
#define _GDSP_OPCODES_H #define _GDSP_OPCODES_H
void dsp_op0(uint16 opc); void dsp_op0(uint16 opc);
void dsp_op1(uint16 opc); void dsp_op1(uint16 opc);
void dsp_op2(uint16 opc); void dsp_op2(uint16 opc);
void dsp_op3(uint16 opc); void dsp_op3(uint16 opc);
void dsp_op4(uint16 opc); void dsp_op4(uint16 opc);
void dsp_op5(uint16 opc); void dsp_op5(uint16 opc);
void dsp_op6(uint16 opc); void dsp_op6(uint16 opc);
void dsp_op7(uint16 opc); void dsp_op7(uint16 opc);
void dsp_op8(uint16 opc); void dsp_op8(uint16 opc);
void dsp_op9(uint16 opc); void dsp_op9(uint16 opc);
void dsp_opab(uint16 opc); void dsp_opab(uint16 opc);
void dsp_opcd(uint16 opc); void dsp_opcd(uint16 opc);
void dsp_ope(uint16 opc); void dsp_ope(uint16 opc);
void dsp_opf(uint16 opc); void dsp_opf(uint16 opc);
#define R_SR 0x13 #define R_SR 0x13
#define FLAG_ENABLE_INTERUPT 11 #define FLAG_ENABLE_INTERUPT 11
#endif #endif

View File

@ -1,23 +1,23 @@
// stdafx.h : include file for standard system include files, // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but // or project specific include files that are used frequently, but
// are changed infrequently // are changed infrequently
// //
#pragma once #pragma once
namespace OutBuffer namespace OutBuffer
{ {
void Init(); void Init();
void Add(const char* _fmt, ...); void Add(const char* _fmt, ...);
void AddCode(const char* _fmt, ...); void AddCode(const char* _fmt, ...);
const char* GetRegName(uint16 reg); const char* GetRegName(uint16 reg);
const char* GetMemName(uint16 addr); const char* GetMemName(uint16 addr);
} }
// TODO: reference additional headers your program requires here // TODO: reference additional headers your program requires here

View File

@ -1,234 +1,234 @@
/*==================================================================== /*====================================================================
filename: opcodes.h filename: opcodes.h
project: GameCube DSP Tool (gcdsp) project: GameCube DSP Tool (gcdsp)
created: 2005.03.04 created: 2005.03.04
mail: duddie@walla.com mail: duddie@walla.com
Copyright (c) 2005 Duddie Copyright (c) 2005 Duddie
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/ ====================================================================*/
#ifndef _GDSP_OPCODES_HELPER_H #ifndef _GDSP_OPCODES_HELPER_H
#define _GDSP_OPCODES_HELPER_H #define _GDSP_OPCODES_HELPER_H
#include "Globals.h" #include "Globals.h"
#include "gdsp_opcodes.h" #include "gdsp_opcodes.h"
#include "gdsp_memory.h" #include "gdsp_memory.h"
#include "gdsp_interpreter.h" #include "gdsp_interpreter.h"
#include "gdsp_registers.h" #include "gdsp_registers.h"
#include "gdsp_ext_op.h" #include "gdsp_ext_op.h"
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// //
// --- SR // --- SR
// //
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
inline void dsp_SR_set_flag(uint8 flag) inline void dsp_SR_set_flag(uint8 flag)
{ {
g_dsp.r[R_SR] |= (1 << flag); g_dsp.r[R_SR] |= (1 << flag);
} }
inline bool dsp_SR_is_flag_set(uint8 flag) inline bool dsp_SR_is_flag_set(uint8 flag)
{ {
return((g_dsp.r[R_SR] & (1 << flag)) > 0); return((g_dsp.r[R_SR] & (1 << flag)) > 0);
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// //
// --- reg // --- reg
// //
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
inline uint16 dsp_op_read_reg(uint8 reg) inline uint16 dsp_op_read_reg(uint8 reg)
{ {
uint16 val; uint16 val;
switch (reg & 0x1f) switch (reg & 0x1f)
{ {
case 0x0c: case 0x0c:
case 0x0d: case 0x0d:
case 0x0e: case 0x0e:
case 0x0f: case 0x0f:
val = dsp_reg_load_stack(reg - 0x0c); val = dsp_reg_load_stack(reg - 0x0c);
break; break;
default: default:
val = g_dsp.r[reg]; val = g_dsp.r[reg];
break; break;
} }
return(val); return(val);
} }
inline void dsp_op_write_reg(uint8 reg, uint16 val) inline void dsp_op_write_reg(uint8 reg, uint16 val)
{ {
switch (reg & 0x1f) switch (reg & 0x1f)
{ {
case 0x0c: case 0x0c:
case 0x0d: case 0x0d:
case 0x0e: case 0x0e:
case 0x0f: case 0x0f:
dsp_reg_store_stack(reg - 0x0c, val); dsp_reg_store_stack(reg - 0x0c, val);
break; break;
default: default:
g_dsp.r[reg] = val; g_dsp.r[reg] = val;
break; break;
} }
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// //
// --- prod // --- prod
// //
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_prod() inline sint64 dsp_get_long_prod()
{ {
sint64 val; sint64 val;
sint64 low_prod; sint64 low_prod;
val = (sint8)g_dsp.r[0x16]; val = (sint8)g_dsp.r[0x16];
val <<= 32; val <<= 32;
low_prod = g_dsp.r[0x15]; low_prod = g_dsp.r[0x15];
low_prod += g_dsp.r[0x17]; low_prod += g_dsp.r[0x17];
low_prod <<= 16; low_prod <<= 16;
low_prod |= g_dsp.r[0x14]; low_prod |= g_dsp.r[0x14];
val += low_prod; val += low_prod;
return(val); return(val);
} }
inline void dsp_set_long_prod(sint64 val) inline void dsp_set_long_prod(sint64 val)
{ {
g_dsp.r[0x14] = (uint16)val; g_dsp.r[0x14] = (uint16)val;
val >>= 16; val >>= 16;
g_dsp.r[0x15] = (uint16)val; g_dsp.r[0x15] = (uint16)val;
val >>= 16; val >>= 16;
g_dsp.r[0x16] = (uint16)val; g_dsp.r[0x16] = (uint16)val;
g_dsp.r[0x17] = 0; g_dsp.r[0x17] = 0;
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// //
// --- acc // --- acc
// //
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_acc(uint8 reg) inline sint64 dsp_get_long_acc(uint8 reg)
{ {
_dbg_assert_(reg < 2); _dbg_assert_(reg < 2);
sint64 val; sint64 val;
sint64 low_acc; sint64 low_acc;
val = (sint8)g_dsp.r[0x10 + reg]; val = (sint8)g_dsp.r[0x10 + reg];
val <<= 32; val <<= 32;
low_acc = g_dsp.r[0x1e + reg]; low_acc = g_dsp.r[0x1e + reg];
low_acc <<= 16; low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + reg]; low_acc |= g_dsp.r[0x1c + reg];
val |= low_acc; val |= low_acc;
return(val); return(val);
} }
inline uint64 dsp_get_ulong_acc(uint8 reg) inline uint64 dsp_get_ulong_acc(uint8 reg)
{ {
_dbg_assert_(reg < 2); _dbg_assert_(reg < 2);
uint64 val; uint64 val;
uint64 low_acc; uint64 low_acc;
val = (uint8)g_dsp.r[0x10 + reg]; val = (uint8)g_dsp.r[0x10 + reg];
val <<= 32; val <<= 32;
low_acc = g_dsp.r[0x1e + reg]; low_acc = g_dsp.r[0x1e + reg];
low_acc <<= 16; low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + reg]; low_acc |= g_dsp.r[0x1c + reg];
val |= low_acc; val |= low_acc;
return(val); return(val);
} }
inline void dsp_set_long_acc(uint8 _reg, sint64 val) inline void dsp_set_long_acc(uint8 _reg, sint64 val)
{ {
_dbg_assert_(_reg < 2); _dbg_assert_(_reg < 2);
g_dsp.r[0x1c + _reg] = (uint16)val; g_dsp.r[0x1c + _reg] = (uint16)val;
val >>= 16; val >>= 16;
g_dsp.r[0x1e + _reg] = (uint16)val; g_dsp.r[0x1e + _reg] = (uint16)val;
val >>= 16; val >>= 16;
g_dsp.r[0x10 + _reg] = (uint16)val; g_dsp.r[0x10 + _reg] = (uint16)val;
} }
inline sint16 dsp_get_acc_l(uint8 _reg) inline sint16 dsp_get_acc_l(uint8 _reg)
{ {
_dbg_assert_(_reg < 2); _dbg_assert_(_reg < 2);
return(g_dsp.r[0x1c + _reg]); return(g_dsp.r[0x1c + _reg]);
} }
inline sint16 dsp_get_acc_m(uint8 _reg) inline sint16 dsp_get_acc_m(uint8 _reg)
{ {
_dbg_assert_(_reg < 2); _dbg_assert_(_reg < 2);
return(g_dsp.r[0x1e + _reg]); return(g_dsp.r[0x1e + _reg]);
} }
inline sint16 dsp_get_acc_h(uint8 _reg) inline sint16 dsp_get_acc_h(uint8 _reg)
{ {
_dbg_assert_(_reg < 2); _dbg_assert_(_reg < 2);
return(g_dsp.r[0x10 + _reg]); return(g_dsp.r[0x10 + _reg]);
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// //
// --- acx // --- acx
// //
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_acx(uint8 _reg) inline sint64 dsp_get_long_acx(uint8 _reg)
{ {
_dbg_assert_(_reg < 2); _dbg_assert_(_reg < 2);
sint64 val = (sint16)g_dsp.r[0x1a + _reg]; sint64 val = (sint16)g_dsp.r[0x1a + _reg];
val <<= 16; val <<= 16;
sint64 low_acc = g_dsp.r[0x18 + _reg]; sint64 low_acc = g_dsp.r[0x18 + _reg];
val |= low_acc; val |= low_acc;
return(val); return(val);
} }
inline sint16 dsp_get_ax_l(uint8 _reg) inline sint16 dsp_get_ax_l(uint8 _reg)
{ {
_dbg_assert_(_reg < 2); _dbg_assert_(_reg < 2);
return(g_dsp.r[0x18 + _reg]); return(g_dsp.r[0x18 + _reg]);
} }
inline sint16 dsp_get_ax_h(uint8 _reg) inline sint16 dsp_get_ax_h(uint8 _reg)
{ {
_dbg_assert_(_reg < 2); _dbg_assert_(_reg < 2);
return(g_dsp.r[0x1a + _reg]); return(g_dsp.r[0x1a + _reg]);
} }
#endif #endif

View File

@ -1,39 +1,39 @@
// stdafx.h : include file for standard system include files, // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but // or project specific include files that are used frequently, but
// are changed infrequently // are changed infrequently
// //
#pragma once #pragma once
#include "targetver.h" #include "targetver.h"
#include <stdio.h> #include <stdio.h>
#include <tchar.h> #include <tchar.h>
typedef unsigned char uint8; typedef unsigned char uint8;
typedef unsigned short uint16; typedef unsigned short uint16;
typedef unsigned int uint32; typedef unsigned int uint32;
typedef unsigned long long uint64; typedef unsigned long long uint64;
typedef unsigned int uint; typedef unsigned int uint;
typedef signed char sint8; typedef signed char sint8;
typedef signed short sint16; typedef signed short sint16;
typedef signed int sint32; typedef signed int sint32;
typedef signed long long sint64; typedef signed long long sint64;
extern uint16 FetchOpcode(); extern uint16 FetchOpcode();
extern void ErrorLog(const char* _fmt, ...); extern void ErrorLog(const char* _fmt, ...);
inline uint16 swap16(uint16 x) inline uint16 swap16(uint16 x)
{ {
return((x >> 8) | (x << 8)); return((x >> 8) | (x << 8));
} }
#include "OutBuffer.h" #include "OutBuffer.h"
// TODO: reference additional headers your program requires here // TODO: reference additional headers your program requires here

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
// The following macros define the minimum required platform. The minimum required platform // The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and // your application. The macros work by enabling all features available on platform versions up to and
// including the version specified. // including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below. // Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms. // Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif #endif

View File

@ -1,122 +1,122 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _JIT_ABI_H #ifndef _JIT_ABI_H
#define _JIT_ABI_H #define _JIT_ABI_H
#include "x64Emitter.h" #include "x64Emitter.h"
// x86/x64 ABI:s, and helpers to help follow them when JIT-ing code. // x86/x64 ABI:s, and helpers to help follow them when JIT-ing code.
// All convensions return values in EAX (+ possibly EDX). // All convensions return values in EAX (+ possibly EDX).
// Linux 32-bit, Windows 32-bit (cdecl, System V): // Linux 32-bit, Windows 32-bit (cdecl, System V):
// * Caller pushes left to right // * Caller pushes left to right
// * Caller fixes stack after call // * Caller fixes stack after call
// * function subtract from stack for local storage only. // * function subtract from stack for local storage only.
// Scratch: EAX ECX EDX // Scratch: EAX ECX EDX
// Callee-save: EBX ESI EDI EBP // Callee-save: EBX ESI EDI EBP
// Parameters: - // Parameters: -
// Windows 64-bit // Windows 64-bit
// * 4-reg "fastcall" variant, very new-skool stack handling // * 4-reg "fastcall" variant, very new-skool stack handling
// * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself calls_ // * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself calls_
// * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space. // * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space.
// Scratch: RAX RCX RDX R8 R9 R10 R11 // Scratch: RAX RCX RDX R8 R9 R10 R11
// Callee-save: RBX RSI RDI RBP R12 R13 R14 R15 // Callee-save: RBX RSI RDI RBP R12 R13 R14 R15
// Parameters: RCX RDX R8 R9, further MOV-ed // Parameters: RCX RDX R8 R9, further MOV-ed
// Linux 64-bit // Linux 64-bit
// * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed) // * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed)
// Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11 // Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11
// Callee-save: RBX RBP R12 R13 R14 R15 // Callee-save: RBX RBP R12 R13 R14 R15
// Parameters: RDI RSI RDX RCX R8 R9 // Parameters: RDI RSI RDX RCX R8 R9
#ifdef _M_IX86 #ifdef _M_IX86
// 32 bit calling convention, shared by all // 32 bit calling convention, shared by all
// 32-bit don't pass parameters in regs, but these are convenient to have anyway when we have to // 32-bit don't pass parameters in regs, but these are convenient to have anyway when we have to
// choose regs to put stuff in. // choose regs to put stuff in.
#define ABI_PARAM1 RCX #define ABI_PARAM1 RCX
#define ABI_PARAM2 RDX #define ABI_PARAM2 RDX
// There are no ABI_PARAM* here, since args are pushed. // There are no ABI_PARAM* here, since args are pushed.
// === 32-bit bog standard cdecl, shared between linux and windows ============================ // === 32-bit bog standard cdecl, shared between linux and windows ============================
// MacOSX 32-bit is same as System V with a few exceptions that we probably don't care much about. // MacOSX 32-bit is same as System V with a few exceptions that we probably don't care much about.
#else #else
// 64 bit calling convention // 64 bit calling convention
#ifdef _WIN32 #ifdef _WIN32
// === 64-bit Windows - the really exotic calling convention ================================== // === 64-bit Windows - the really exotic calling convention ==================================
#define ABI_PARAM1 RCX #define ABI_PARAM1 RCX
#define ABI_PARAM2 RDX #define ABI_PARAM2 RDX
#define ABI_PARAM3 R8 #define ABI_PARAM3 R8
#define ABI_PARAM4 R9 #define ABI_PARAM4 R9
#else #else
// === 64-bit Unix (hopefully MacOSX too) ===================================================== // === 64-bit Unix (hopefully MacOSX too) =====================================================
#define ABI_PARAM1 RDI #define ABI_PARAM1 RDI
#define ABI_PARAM2 RSI #define ABI_PARAM2 RSI
#define ABI_PARAM3 RDX #define ABI_PARAM3 RDX
#define ABI_PARAM4 RCX #define ABI_PARAM4 RCX
#define ABI_PARAM5 R8 #define ABI_PARAM5 R8
#define ABI_PARAM6 R9 #define ABI_PARAM6 R9
#endif #endif
#endif #endif
// Utility functions // Utility functions
// These only support u32 parameters, but that's enough for a lot of uses. // These only support u32 parameters, but that's enough for a lot of uses.
// These will destroy the 1 or 2 first "parameter regs". // These will destroy the 1 or 2 first "parameter regs".
void ABI_CallFunctionC(void *func, u32 param1); void ABI_CallFunctionC(void *func, u32 param1);
void ABI_CallFunctionCC(void *func, u32 param1, u32 param2); void ABI_CallFunctionCC(void *func, u32 param1, u32 param2);
void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2); void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2);
// Pass a register as a paremeter. // Pass a register as a paremeter.
void ABI_CallFunctionR(void *func, Gen::X64Reg reg1); void ABI_CallFunctionR(void *func, Gen::X64Reg reg1);
void ABI_CallFunctionRR(void *func, Gen::X64Reg reg1, Gen::X64Reg reg2); void ABI_CallFunctionRR(void *func, Gen::X64Reg reg1, Gen::X64Reg reg2);
// A function that doesn't have any control over what it will do to regs, // A function that doesn't have any control over what it will do to regs,
// such as the dispatcher, should be surrounded by these. // such as the dispatcher, should be surrounded by these.
void ABI_PushAllCalleeSavedRegsAndAdjustStack(); void ABI_PushAllCalleeSavedRegsAndAdjustStack();
void ABI_PopAllCalleeSavedRegsAndAdjustStack(); void ABI_PopAllCalleeSavedRegsAndAdjustStack();
// A function that doesn't know anything about it's surroundings, should // A function that doesn't know anything about it's surroundings, should
// be surrounded by these to establish a safe environment, where it can roam free. // be surrounded by these to establish a safe environment, where it can roam free.
// An example is a backpatch injected function. // An example is a backpatch injected function.
void ABI_PushAllCallerSavedRegsAndAdjustStack(); void ABI_PushAllCallerSavedRegsAndAdjustStack();
void ABI_PopAllCallerSavedRegsAndAdjustStack(); void ABI_PopAllCallerSavedRegsAndAdjustStack();
unsigned int ABI_GetAlignedFrameSize(unsigned int frameSize); unsigned int ABI_GetAlignedFrameSize(unsigned int frameSize);
void ABI_AlignStack(unsigned int frameSize); void ABI_AlignStack(unsigned int frameSize);
void ABI_RestoreStack(unsigned int frameSize); void ABI_RestoreStack(unsigned int frameSize);
// Sets up a __cdecl function. // Sets up a __cdecl function.
// Only x64 really needs the parameter. // Only x64 really needs the parameter.
void ABI_EmitPrologue(int maxCallParams); void ABI_EmitPrologue(int maxCallParams);
void ABI_EmitEpilogue(int maxCallParams); void ABI_EmitEpilogue(int maxCallParams);
#ifdef _M_IX86 #ifdef _M_IX86
inline int ABI_GetNumXMMRegs() { return 8; } inline int ABI_GetNumXMMRegs() { return 8; }
#else #else
inline int ABI_GetNumXMMRegs() { return 16; } inline int ABI_GetNumXMMRegs() { return 16; }
#endif #endif
#endif // _JIT_ABI_H #endif // _JIT_ABI_H

View File

@ -1,66 +1,66 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _CPUDETECT_H #ifndef _CPUDETECT_H
#define _CPUDETECT_H #define _CPUDETECT_H
#include <string>
enum CPUVendor
{
VENDOR_INTEL = 0,
VENDOR_AMD = 1,
VENDOR_OTHER = 2,
};
struct CPUInfo
{
CPUVendor vendor;
char cpu_string[0x21];
char brand_string[0x41];
bool OS64bit;
bool CPU64bit;
bool Mode64bit;
bool hyper_threaded;
int num_cores;
bool bSSE;
bool bSSE2;
bool bSSE3;
bool bSSSE3;
bool bPOPCNT;
bool bSSE4_1;
bool bSSE4_2;
bool bLZCNT;
bool bSSE4A;
bool bLAHFSAHF64;
bool bLongMode;
void Detect();
std::string Summarize();
};
extern CPUInfo cpu_info;
inline void DetectCPU() {cpu_info.Detect();}
#endif
#include <string>
enum CPUVendor
{
VENDOR_INTEL = 0,
VENDOR_AMD = 1,
VENDOR_OTHER = 2,
};
struct CPUInfo
{
CPUVendor vendor;
char cpu_string[0x21];
char brand_string[0x41];
bool OS64bit;
bool CPU64bit;
bool Mode64bit;
bool hyper_threaded;
int num_cores;
bool bSSE;
bool bSSE2;
bool bSSE3;
bool bSSSE3;
bool bPOPCNT;
bool bSSE4_1;
bool bSSE4_2;
bool bLZCNT;
bool bSSE4A;
bool bLAHFSAHF64;
bool bLongMode;
void Detect();
std::string Summarize();
};
extern CPUInfo cpu_info;
inline void DetectCPU() {cpu_info.Detect();}
#endif

View File

@ -1,236 +1,236 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _POINTERWRAP_H #ifndef _POINTERWRAP_H
#define _POINTERWRAP_H #define _POINTERWRAP_H
// Extremely simple serialization framework. // Extremely simple serialization framework.
// (mis)-features: // (mis)-features:
// + Super fast // + Super fast
// + Very simple // + Very simple
// + Same code is used for serialization and deserializaition (in most cases) // + Same code is used for serialization and deserializaition (in most cases)
// - Zero backwards/forwards compatibility // - Zero backwards/forwards compatibility
// - Serialization code for anything complex has to be manually written. // - Serialization code for anything complex has to be manually written.
#include <stdio.h> #include <stdio.h>
#include <map> #include <map>
#include <vector> #include <vector>
#include <string> #include <string>
#include "Common.h" #include "Common.h"
template <class T> template <class T>
struct LinkedListItem : public T struct LinkedListItem : public T
{ {
LinkedListItem<T> *next; LinkedListItem<T> *next;
}; };
class PointerWrap class PointerWrap
{ {
public: public:
enum Mode // also defined in pluginspecs.h. Didn't want to couple them. enum Mode // also defined in pluginspecs.h. Didn't want to couple them.
{ {
MODE_READ = 1, MODE_READ = 1,
MODE_WRITE, MODE_WRITE,
MODE_MEASURE, MODE_MEASURE,
}; };
u8 **ptr; u8 **ptr;
Mode mode; Mode mode;
public: public:
PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {} PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {}
PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_) {} PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_) {}
void SetMode(Mode mode_) {mode = mode_;} void SetMode(Mode mode_) {mode = mode_;}
Mode GetMode() const {return mode;} Mode GetMode() const {return mode;}
u8 **GetPPtr() {return ptr;} u8 **GetPPtr() {return ptr;}
void DoVoid(void *data, int size) void DoVoid(void *data, int size)
{ {
switch (mode) switch (mode)
{ {
case MODE_READ: memcpy(data, *ptr, size); break; case MODE_READ: memcpy(data, *ptr, size); break;
case MODE_WRITE: memcpy(*ptr, data, size); break; case MODE_WRITE: memcpy(*ptr, data, size); break;
case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything
default: break; // throw an error? default: break; // throw an error?
} }
(*ptr) += size; (*ptr) += size;
} }
// Store maps to file. Very useful. // Store maps to file. Very useful.
template<class T> template<class T>
void Do(std::map<unsigned int, T> &x) { void Do(std::map<unsigned int, T> &x) {
// TODO // TODO
PanicAlert("Do(map<>) does not yet work."); PanicAlert("Do(map<>) does not yet work.");
} }
// Store vectors. // Store vectors.
template<class T> template<class T>
void Do(std::vector<T> &x) { void Do(std::vector<T> &x) {
// TODO // TODO
PanicAlert("Do(vector<>) does not yet work."); PanicAlert("Do(vector<>) does not yet work.");
} }
// Store strings. // Store strings.
void Do(std::string &x) void Do(std::string &x)
{ {
int stringLen = (int)x.length() + 1; int stringLen = (int)x.length() + 1;
Do(stringLen); Do(stringLen);
switch (mode) switch (mode)
{ {
case MODE_READ: x = (char*)*ptr; break; case MODE_READ: x = (char*)*ptr; break;
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
case MODE_MEASURE: break; case MODE_MEASURE: break;
} }
(*ptr) += stringLen; (*ptr) += stringLen;
} }
void DoBuffer(u8** pBuffer, u32& _Size) void DoBuffer(u8** pBuffer, u32& _Size)
{ {
Do(_Size); Do(_Size);
if (_Size > 0) if (_Size > 0)
{ {
switch (mode) switch (mode)
{ {
case MODE_READ: *pBuffer = new u8[_Size]; memcpy(*pBuffer, *ptr, _Size); break; case MODE_READ: *pBuffer = new u8[_Size]; memcpy(*pBuffer, *ptr, _Size); break;
case MODE_WRITE: memcpy(*ptr, *pBuffer, _Size); break; case MODE_WRITE: memcpy(*ptr, *pBuffer, _Size); break;
case MODE_MEASURE: break; case MODE_MEASURE: break;
} }
} }
else else
{ {
*pBuffer = NULL; *pBuffer = NULL;
} }
(*ptr) += _Size; (*ptr) += _Size;
} }
template<class T> template<class T>
void DoArray(T *x, int count) { void DoArray(T *x, int count) {
DoVoid((void *)x, sizeof(T) * count); DoVoid((void *)x, sizeof(T) * count);
} }
template<class T> template<class T>
void Do(T &x) { void Do(T &x) {
DoVoid((void *)&x, sizeof(x)); DoVoid((void *)&x, sizeof(x));
} }
template<class T> template<class T>
void DoLinkedList(LinkedListItem<T> **list_start) { void DoLinkedList(LinkedListItem<T> **list_start) {
// TODO // TODO
PanicAlert("Do(vector<>) does not yet work."); PanicAlert("Do(vector<>) does not yet work.");
} }
}; };
class CChunkFileReader class CChunkFileReader
{ {
public: public:
template<class T> template<class T>
static bool Load(const std::string& _rFilename, int _Revision, T& _class) static bool Load(const std::string& _rFilename, int _Revision, T& _class)
{ {
FILE* pFile = fopen(_rFilename.c_str(), "rb"); FILE* pFile = fopen(_rFilename.c_str(), "rb");
if (pFile) if (pFile)
{ {
// get size // get size
fseek(pFile, 0, SEEK_END); fseek(pFile, 0, SEEK_END);
size_t FileSize = ftell(pFile); size_t FileSize = ftell(pFile);
fseek(pFile, 0, SEEK_SET); fseek(pFile, 0, SEEK_SET);
if (FileSize < sizeof(SChunkHeader)) if (FileSize < sizeof(SChunkHeader))
{ {
fclose(pFile); fclose(pFile);
return false; return false;
} }
// read the header // read the header
SChunkHeader Header; SChunkHeader Header;
fread(&Header, sizeof(SChunkHeader), 1, pFile); fread(&Header, sizeof(SChunkHeader), 1, pFile);
if (Header.Revision != _Revision) if (Header.Revision != _Revision)
{ {
fclose(pFile); fclose(pFile);
return false; return false;
} }
// get size // get size
int sz = FileSize - sizeof(SChunkHeader); int sz = FileSize - sizeof(SChunkHeader);
if (Header.ExpectedSize != sz) if (Header.ExpectedSize != sz)
{ {
fclose(pFile); fclose(pFile);
return false; return false;
} }
// read the state // read the state
u8* buffer = new u8[sz]; u8* buffer = new u8[sz];
fread(buffer, 1, sz, pFile); fread(buffer, 1, sz, pFile);
fclose(pFile); fclose(pFile);
u8 *ptr = buffer; u8 *ptr = buffer;
PointerWrap p(&ptr, PointerWrap::MODE_READ); PointerWrap p(&ptr, PointerWrap::MODE_READ);
_class.DoState(p); _class.DoState(p);
delete [] buffer; delete [] buffer;
return true; return true;
} }
return false; return false;
} }
template<class T> template<class T>
static bool Save(const std::string& _rFilename, int _Revision, T& _class) static bool Save(const std::string& _rFilename, int _Revision, T& _class)
{ {
FILE* pFile = fopen(_rFilename.c_str(), "wb"); FILE* pFile = fopen(_rFilename.c_str(), "wb");
if (pFile) if (pFile)
{ {
u8 *ptr = 0; u8 *ptr = 0;
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
_class.DoState(p); _class.DoState(p);
size_t sz = (size_t)ptr; size_t sz = (size_t)ptr;
u8 *buffer = new u8[sz]; u8 *buffer = new u8[sz];
ptr = buffer; ptr = buffer;
p.SetMode(PointerWrap::MODE_WRITE); p.SetMode(PointerWrap::MODE_WRITE);
_class.DoState(p); _class.DoState(p);
SChunkHeader Header; SChunkHeader Header;
Header.Compress = 0; Header.Compress = 0;
Header.Revision = _Revision; Header.Revision = _Revision;
Header.ExpectedSize = sz; Header.ExpectedSize = sz;
fwrite(&Header, sizeof(SChunkHeader), 1, pFile); fwrite(&Header, sizeof(SChunkHeader), 1, pFile);
fwrite(buffer, sz, 1, pFile); fwrite(buffer, sz, 1, pFile);
fclose(pFile); fclose(pFile);
return true; return true;
} }
return false; return false;
} }
private: private:
struct SChunkHeader struct SChunkHeader
{ {
int Revision; int Revision;
int Compress; int Compress;
int ExpectedSize; int ExpectedSize;
}; };
}; };
#endif // _POINTERWRAP_H #endif // _POINTERWRAP_H

View File

@ -1,306 +1,306 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _COMMON_H #ifndef _COMMON_H
#define _COMMON_H #define _COMMON_H
#define _CRTDBG_MAP_ALLOC #define _CRTDBG_MAP_ALLOC
#define _CRTDBG_MAP_ALLOC_NEW #define _CRTDBG_MAP_ALLOC_NEW
#ifdef OSX64 #ifdef OSX64
#define MAP_32BIT 0 #define MAP_32BIT 0
#endif #endif
#define CHECK_HEAP_INTEGRITY() #define CHECK_HEAP_INTEGRITY()
#ifdef _WIN32 #ifdef _WIN32
#ifdef _DEBUG #ifdef _DEBUG
#include <crtdbg.h> #include <crtdbg.h>
#undef CHECK_HEAP_INTEGRITY #undef CHECK_HEAP_INTEGRITY
#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");} #define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");}
#endif #endif
#include "../../../PluginSpecs/CommonTypes.h" #include "../../../PluginSpecs/CommonTypes.h"
#define HAVE_WIIUSE 1 #define HAVE_WIIUSE 1
#define HAVE_WX 1 #define HAVE_WX 1
#else #else
#include "CommonTypes.h" #include "CommonTypes.h"
#include "Config.h" #include "Config.h"
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "Paths.h" #include "Paths.h"
// Function Cross-Compatibility // Function Cross-Compatibility
#ifdef _WIN32 #ifdef _WIN32
#define strcasecmp _stricmp #define strcasecmp _stricmp
#define unlink _unlink #define unlink _unlink
#else #else
#define _stricmp strcasecmp #define _stricmp strcasecmp
#define _unlink unlink #define _unlink unlink
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
// By default, MS' stdio implementation does not support 64-bit offsets. // By default, MS' stdio implementation does not support 64-bit offsets.
// This little hack fixes that, keeping the code portable to linux where fseek and fread // This little hack fixes that, keeping the code portable to linux where fseek and fread
// do support 64-bit offsets in modern distributions. // do support 64-bit offsets in modern distributions.
#define fseek _fseeki64 #define fseek _fseeki64
#define ftell _ftelli64 #define ftell _ftelli64
#define atoll _atoi64 #define atoll _atoi64
#define POSIX 0 #define POSIX 0
#define NOMINMAX #define NOMINMAX
#if _M_IX86 #if _M_IX86
#define Crash() {__asm int 3} #define Crash() {__asm int 3}
#else #else
#if _MSC_VER > 1000 #if _MSC_VER > 1000
extern "C" { extern "C" {
__declspec(dllimport) void __stdcall DebugBreak(void); __declspec(dllimport) void __stdcall DebugBreak(void);
} }
#define Crash() {DebugBreak();} #define Crash() {DebugBreak();}
#else #else
#error fixme #error fixme
#endif #endif
#endif #endif
#elif __GNUC__ #elif __GNUC__
#define POSIX 1 #define POSIX 1
#define MAX_PATH 260 #define MAX_PATH 260
#define stricmp strcasecmp #define stricmp strcasecmp
#define Crash() {asm ("int $3");} #define Crash() {asm ("int $3");}
#ifdef _LP64 #ifdef _LP64
#define _M_X64 1 #define _M_X64 1
#else #else
#define _M_IX86 1 #define _M_IX86 1
#endif #endif
#endif #endif
// Alignment // Alignment
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define GC_ALIGNED16(x) __declspec(align(16)) x #define GC_ALIGNED16(x) __declspec(align(16)) x
#define GC_ALIGNED32(x) __declspec(align(32)) x #define GC_ALIGNED32(x) __declspec(align(32)) x
#define GC_ALIGNED64(x) __declspec(align(64)) x #define GC_ALIGNED64(x) __declspec(align(64)) x
#define GC_ALIGNED16_DECL(x) __declspec(align(16)) x #define GC_ALIGNED16_DECL(x) __declspec(align(16)) x
#define GC_ALIGNED64_DECL(x) __declspec(align(64)) x #define GC_ALIGNED64_DECL(x) __declspec(align(64)) x
#else #else
#define GC_ALIGNED16(x) __attribute((aligned(16))) x #define GC_ALIGNED16(x) __attribute((aligned(16))) x
#define GC_ALIGNED32(x) __attribute((aligned(16))) x #define GC_ALIGNED32(x) __attribute((aligned(16))) x
#define GC_ALIGNED64(x) __attribute((aligned(64))) x #define GC_ALIGNED64(x) __attribute((aligned(64))) x
#define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x #define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x
#define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x #define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x
#endif #endif
// Various Windows compatibility // Various Windows compatibility
#if !defined(_WIN32) #if !defined(_WIN32)
inline u32 _rotl(u32 x, int shift) { inline u32 _rotl(u32 x, int shift) {
return (x << shift) | (x >> (32 - shift)); return (x << shift) | (x >> (32 - shift));
} }
inline u32 _rotr(u32 x, int shift) { inline u32 _rotr(u32 x, int shift) {
return (x >> shift) | (x << (32 - shift)); return (x >> shift) | (x << (32 - shift));
} }
#define LONG int #define LONG int
#ifdef __LINUX__ #ifdef __LINUX__
typedef union _LARGE_INTEGER typedef union _LARGE_INTEGER
{ {
long long QuadPart; long long QuadPart;
} LARGE_INTEGER; } LARGE_INTEGER;
#endif #endif
#ifndef __forceinline #ifndef __forceinline
#define __forceinline inline #define __forceinline inline
#endif #endif
#endif #endif
#if defined (_M_IX86) && defined (_WIN32) #if defined (_M_IX86) && defined (_WIN32)
#define HWCALL __cdecl #define HWCALL __cdecl
#else #else
#define HWCALL #define HWCALL
#endif #endif
#undef min #undef min
#undef max #undef max
template<class T> template<class T>
inline T min(const T& a, const T& b) {return a > b ? b : a;} inline T min(const T& a, const T& b) {return a > b ? b : a;}
template<class T> template<class T>
inline T max(const T& a, const T& b) {return a > b ? a : b;} inline T max(const T& a, const T& b) {return a > b ? a : b;}
// Byte ordering // Byte ordering
namespace Common namespace Common
{ {
inline u8 swap8(u8 _data) {return(_data);} inline u8 swap8(u8 _data) {return(_data);}
#ifdef _WIN32 #ifdef _WIN32
inline u16 swap16(u16 _data) {return(_byteswap_ushort(_data));} inline u16 swap16(u16 _data) {return(_byteswap_ushort(_data));}
inline u32 swap32(u32 _data) {return(_byteswap_ulong(_data));} inline u32 swap32(u32 _data) {return(_byteswap_ulong(_data));}
inline u64 swap64(u64 _data) {return(_byteswap_uint64(_data));} inline u64 swap64(u64 _data) {return(_byteswap_uint64(_data));}
#elif __linux__ #elif __linux__
} }
#include <byteswap.h> #include <byteswap.h>
namespace Common namespace Common
{ {
inline u16 swap16(u16 _data) {return(bswap_16(_data));} inline u16 swap16(u16 _data) {return(bswap_16(_data));}
inline u32 swap32(u32 _data) {return(bswap_32(_data));} inline u32 swap32(u32 _data) {return(bswap_32(_data));}
inline u64 swap64(u64 _data) {return(bswap_64(_data));} inline u64 swap64(u64 _data) {return(bswap_64(_data));}
#else #else
inline u16 swap16(u16 data) {return((data >> 8) | (data << 8));} inline u16 swap16(u16 data) {return((data >> 8) | (data << 8));}
inline u32 swap32(u32 data) {return((swap16(data) << 16) | swap16(data >> 16));} inline u32 swap32(u32 data) {return((swap16(data) << 16) | swap16(data >> 16));}
inline u64 swap64(u64 data) {return(((u64)swap32(data) << 32) | swap32(data >> 32));} inline u64 swap64(u64 data) {return(((u64)swap32(data) << 32) | swap32(data >> 32));}
#endif #endif
} // end of namespace Common } // end of namespace Common
// Utility functions // Utility functions
void PanicAlert(const char* text, ...); void PanicAlert(const char* text, ...);
bool PanicYesNo(const char* text, ...); bool PanicYesNo(const char* text, ...);
bool AskYesNo(const char* text, ...); bool AskYesNo(const char* text, ...);
extern void __Log(int logNumber, const char* text, ...); extern void __Log(int logNumber, const char* text, ...);
extern void __Logv(int log, int v, const char *format, ...); extern void __Logv(int log, int v, const char *format, ...);
// dummy class // dummy class
class LogTypes class LogTypes
{ {
public: public:
enum LOG_TYPE enum LOG_TYPE
{ {
MASTER_LOG, MASTER_LOG,
BOOT, BOOT,
PIXELENGINE, PIXELENGINE,
COMMANDPROCESSOR, COMMANDPROCESSOR,
VIDEOINTERFACE, VIDEOINTERFACE,
SERIALINTERFACE, SERIALINTERFACE,
PERIPHERALINTERFACE, PERIPHERALINTERFACE,
MEMMAP, MEMMAP,
DSPINTERFACE, DSPINTERFACE,
STREAMINGINTERFACE, STREAMINGINTERFACE,
DVDINTERFACE, DVDINTERFACE,
GPFIFO, GPFIFO,
EXPANSIONINTERFACE, EXPANSIONINTERFACE,
AUDIO_INTERFACE, AUDIO_INTERFACE,
GEKKO, GEKKO,
HLE, HLE,
DSPHLE, DSPHLE,
VIDEO, VIDEO,
AUDIO, AUDIO,
DYNA_REC, DYNA_REC,
CONSOLE, CONSOLE,
OSREPORT, OSREPORT,
WII_IOB, WII_IOB,
WII_IPC, WII_IPC,
WII_IPC_HLE, WII_IPC_HLE,
WII_IPC_DVD, WII_IPC_DVD,
WII_IPC_ES, WII_IPC_ES,
WII_IPC_FILEIO, WII_IPC_FILEIO,
WII_IPC_SD, WII_IPC_SD,
WII_IPC_NET, WII_IPC_NET,
WII_IPC_WIIMOTE, WII_IPC_WIIMOTE,
ACTIONREPLAY, ACTIONREPLAY,
NUMBER_OF_LOGS NUMBER_OF_LOGS
}; };
}; };
typedef bool (*PanicAlertHandler)(const char* text, bool yes_no); typedef bool (*PanicAlertHandler)(const char* text, bool yes_no);
void RegisterPanicAlertHandler(PanicAlertHandler handler); void RegisterPanicAlertHandler(PanicAlertHandler handler);
void Host_UpdateLogDisplay(); void Host_UpdateLogDisplay();
// Logging macros // Logging macros
#ifdef LOGGING #ifdef LOGGING
#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__); #define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__);
#define LOGV(t,v, ...) __Logv(LogTypes::t, v, __VA_ARGS__); #define LOGV(t,v, ...) __Logv(LogTypes::t, v, __VA_ARGS__);
#define _dbg_assert_(_t_, _a_) \ #define _dbg_assert_(_t_, _a_) \
if (!(_a_)){\ if (!(_a_)){\
LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
__LINE__, __FILE__, __TIME__); \ __LINE__, __FILE__, __TIME__); \
if (!PanicYesNo("*** Assertion (see log)***\n")){Crash();} \ if (!PanicYesNo("*** Assertion (see log)***\n")){Crash();} \
} }
#define _dbg_assert_msg_(_t_, _a_, ...)\ #define _dbg_assert_msg_(_t_, _a_, ...)\
if (!(_a_)){\ if (!(_a_)){\
LOG(_t_, __VA_ARGS__); \ LOG(_t_, __VA_ARGS__); \
if (!PanicYesNo(__VA_ARGS__)){Crash();} \ if (!PanicYesNo(__VA_ARGS__)){Crash();} \
} }
#define _dbg_update_() Host_UpdateLogDisplay(); #define _dbg_update_() Host_UpdateLogDisplay();
#else #else
#define LOG(_t_, ...) #define LOG(_t_, ...)
#define LOGV(_t_,_v_, ...) #define LOGV(_t_,_v_, ...)
#define _dbg_clear_() #define _dbg_clear_()
#ifndef _dbg_assert_ #ifndef _dbg_assert_
#define _dbg_assert_(_t_, _a_) ; #define _dbg_assert_(_t_, _a_) ;
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ; #define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ;
#endif #endif
#define _dbg_update_() ; #define _dbg_update_() ;
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) #define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
#define _assert_msg_(_t_, _a_, _fmt_, ...)\ #define _assert_msg_(_t_, _a_, _fmt_, ...)\
if (!(_a_)){\ if (!(_a_)){\
if (!PanicYesNo(_fmt_, __VA_ARGS__)){Crash();} \ if (!PanicYesNo(_fmt_, __VA_ARGS__)){Crash();} \
} }
#else #else
#define _assert_(a) #define _assert_(a)
#define _assert_msg_(...) #define _assert_msg_(...)
#endif #endif
// compile time asserts // compile time asserts
namespace namespace
{ {
// it is very risky to mix _SECURE_SCL=0 and _SECURE_SCL=1 compiled libraries // it is very risky to mix _SECURE_SCL=0 and _SECURE_SCL=1 compiled libraries
// it is possible that you overwrite memory if you do it // it is possible that you overwrite memory if you do it
#ifdef _WIN32 #ifdef _WIN32
#ifndef _SECURE_SCL #ifndef _SECURE_SCL
#error Please define _SECURE_SCL=0 in the project settings #error Please define _SECURE_SCL=0 in the project settings
#else #else
template <bool> struct CompileTimeAssert; template <bool> struct CompileTimeAssert;
template<> struct CompileTimeAssert<true> {}; template<> struct CompileTimeAssert<true> {};
CompileTimeAssert<_SECURE_SCL==0> x; CompileTimeAssert<_SECURE_SCL==0> x;
#endif #endif
#endif #endif
} }
#endif // #ifndef _COMMON_H #endif // #ifndef _COMMON_H

View File

@ -1,28 +1,28 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DRIVEUTIL_H #ifndef _DRIVEUTIL_H
#define _DRIVEUTIL_H #define _DRIVEUTIL_H
#include <string> #include <string>
#include <vector> #include <vector>
// Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner. // Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner.
void GetAllRemovableDrives(std::vector<std::string> *drives); void GetAllRemovableDrives(std::vector<std::string> *drives);
#endif #endif

View File

@ -1,47 +1,47 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DYNAMICLIBRARY_H #ifndef _DYNAMICLIBRARY_H
#define _DYNAMICLIBRARY_H #define _DYNAMICLIBRARY_H
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
#include <string> #include <string>
class DynamicLibrary class DynamicLibrary
{ {
public: public:
DynamicLibrary(); DynamicLibrary();
int Load(const char* filename); int Load(const char* filename);
void Unload(); void Unload();
void* Get(const char* funcname) const; void* Get(const char* funcname) const;
bool IsLoaded() const {return(library != 0);} bool IsLoaded() const {return(library != 0);}
private: private:
std::string library_file; std::string library_file;
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE library; HINSTANCE library;
#else #else
void* library; void* library;
#endif #endif
}; };
#endif #endif

View File

@ -1,56 +1,56 @@
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
// //
// Written by Zoltan Csizmadia, zoltan_csizmadia@yahoo.com // Written by Zoltan Csizmadia, zoltan_csizmadia@yahoo.com
// For companies(Austin,TX): If you would like to get my resume, send an email. // For companies(Austin,TX): If you would like to get my resume, send an email.
// //
// The source is free, but if you want to use it, mention my name and e-mail address // The source is free, but if you want to use it, mention my name and e-mail address
// //
// History: // History:
// 1.0 Initial version Zoltan Csizmadia // 1.0 Initial version Zoltan Csizmadia
// 1.1 WhineCube version Masken // 1.1 WhineCube version Masken
// 1.2 Dolphin version Masken // 1.2 Dolphin version Masken
// //
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
// //
// ExtendedTrace.h // ExtendedTrace.h
// //
#ifndef EXTENDEDTRACE_H_INCLUDED #ifndef EXTENDEDTRACE_H_INCLUDED
#define EXTENDEDTRACE_H_INCLUDED #define EXTENDEDTRACE_H_INCLUDED
#if defined(WIN32) #if defined(WIN32)
#include <windows.h> #include <windows.h>
#include <tchar.h> #include <tchar.h>
#include <string> #include <string>
#pragma comment( lib, "imagehlp.lib" ) #pragma comment( lib, "imagehlp.lib" )
#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath ) #define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath )
#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo() #define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
#define STACKTRACE(file) StackTrace( GetCurrentThread(), _T(""), file) #define STACKTRACE(file) StackTrace( GetCurrentThread(), _T(""), file)
#define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), _T(""), file, eip, esp, ebp) #define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), _T(""), file, eip, esp, ebp)
//class File; //class File;
BOOL InitSymInfo( PCSTR ); BOOL InitSymInfo( PCSTR );
BOOL UninitSymInfo(); BOOL UninitSymInfo();
void StackTrace( HANDLE, LPCTSTR, FILE *file); void StackTrace( HANDLE, LPCTSTR, FILE *file);
void StackTrace( HANDLE, LPCTSTR, FILE *file, DWORD eip, DWORD esp, DWORD ebp); void StackTrace( HANDLE, LPCTSTR, FILE *file, DWORD eip, DWORD esp, DWORD ebp);
//functions by Masken //functions by Masken
void etfprintf(FILE *file, const char *format, ...); void etfprintf(FILE *file, const char *format, ...);
void etfprint(FILE *file, const std::string &text); void etfprint(FILE *file, const std::string &text);
#define UEFBUFSIZE 2048 #define UEFBUFSIZE 2048
extern char g_uefbuf[UEFBUFSIZE]; extern char g_uefbuf[UEFBUFSIZE];
#else //not WIN32 #else //not WIN32
#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0) #define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0)
#define EXTENDEDTRACEUNINITIALIZE() ((void)0) #define EXTENDEDTRACEUNINITIALIZE() ((void)0)
#define STACKTRACE(file) ((void)0) #define STACKTRACE(file) ((void)0)
#define STACKTRACE2(file, eip, esp, ebp) ((void)0) #define STACKTRACE2(file, eip, esp, ebp) ((void)0)
#endif //WIN32 #endif //WIN32
#endif //EXTENDEDTRACE_H_INCLUDED #endif //EXTENDEDTRACE_H_INCLUDED

View File

@ -1,44 +1,44 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef __FILESEARCH_H_ #ifndef __FILESEARCH_H_
#define __FILESEARCH_H_ #define __FILESEARCH_H_
#include <string> #include <string>
#include <vector> #include <vector>
class CFileSearch class CFileSearch
{ {
public: public:
typedef std::vector<std::string>XStringVector; typedef std::vector<std::string>XStringVector;
CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories); CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories);
const XStringVector& GetFileNames() const; const XStringVector& GetFileNames() const;
private: private:
void FindFiles(const std::string& _searchString, const std::string& _strPath); void FindFiles(const std::string& _searchString, const std::string& _strPath);
XStringVector m_FileNames; XStringVector m_FileNames;
}; };
#endif #endif

View File

@ -1,60 +1,60 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FILEUTIL_H #ifndef _FILEUTIL_H
#define _FILEUTIL_H #define _FILEUTIL_H
#include <string> #include <string>
#include <vector> #include <vector>
#include "Common.h" #include "Common.h"
namespace File namespace File
{ {
struct FSTEntry struct FSTEntry
{ {
bool isDirectory; bool isDirectory;
u32 size; // file length or number of entries from children u32 size; // file length or number of entries from children
std::string physicalName; // name on disk std::string physicalName; // name on disk
std::string virtualName; // name in FST names table std::string virtualName; // name in FST names table
std::vector<FSTEntry> children; std::vector<FSTEntry> children;
}; };
std::string SanitizePath(const char *filename); std::string SanitizePath(const char *filename);
bool Exists(const char *filename); bool Exists(const char *filename);
void Launch(const char *filename); void Launch(const char *filename);
void Explore(const char *path); void Explore(const char *path);
bool IsDirectory(const char *filename); bool IsDirectory(const char *filename);
bool CreateDir(const char *filename); bool CreateDir(const char *filename);
bool CreateDirectoryStructure(const std::string& _rFullPath); bool CreateDirectoryStructure(const std::string& _rFullPath);
bool Delete(const char *filename); bool Delete(const char *filename);
bool DeleteDir(const char *filename); bool DeleteDir(const char *filename);
bool Rename(const char *srcFilename, const char *destFilename); bool Rename(const char *srcFilename, const char *destFilename);
bool Copy(const char *srcFilename, const char *destFilename); bool Copy(const char *srcFilename, const char *destFilename);
u64 GetSize(const char *filename); u64 GetSize(const char *filename);
std::string GetUserDirectory(); std::string GetUserDirectory();
bool CreateEmptyFile(const char *filename); bool CreateEmptyFile(const char *filename);
u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry); u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry);
bool DeleteDirRecursively(const std::string& _Directory); bool DeleteDirRecursively(const std::string& _Directory);
void GetCurrentDirectory(std::string& _rDirectory); void GetCurrentDirectory(std::string& _rDirectory);
} // namespace } // namespace
#endif #endif

View File

@ -1,81 +1,81 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FIXED_SIZE_QUEUE_H #ifndef _FIXED_SIZE_QUEUE_H
#define _FIXED_SIZE_QUEUE_H #define _FIXED_SIZE_QUEUE_H
// STL-look-a-like interface, but name is mixed case to distinguish it clearly from the // STL-look-a-like interface, but name is mixed case to distinguish it clearly from the
// real STL classes. // real STL classes.
// Not fully featured, no safety checking yet. Add features as needed. // Not fully featured, no safety checking yet. Add features as needed.
// TODO: "inline" storage? // TODO: "inline" storage?
template <class T, int N> template <class T, int N>
class FixedSizeQueue class FixedSizeQueue
{ {
T *storage; T *storage;
int head; int head;
int tail; int tail;
int count; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future. int count; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future.
// Make copy constructor private for now. // Make copy constructor private for now.
FixedSizeQueue(FixedSizeQueue &other) { } FixedSizeQueue(FixedSizeQueue &other) { }
public: public:
FixedSizeQueue() FixedSizeQueue()
{ {
head = 0; head = 0;
tail = 0; tail = 0;
storage = new T[N]; storage = new T[N];
} }
~FixedSizeQueue() ~FixedSizeQueue()
{ {
delete [] storage; delete [] storage;
} }
void push(T t) { void push(T t) {
storage[tail] = t; storage[tail] = t;
tail++; tail++;
if (tail == N) if (tail == N)
tail = 0; tail = 0;
count++; count++;
} }
void pop() { void pop() {
head++; head++;
if (head == N) if (head == N)
head = 0; head = 0;
count--; count--;
} }
T pop_front() { T pop_front() {
const T &temp = storage[head]; const T &temp = storage[head];
pop(); pop();
return temp; return temp;
} }
T &front() { return storage[head]; } T &front() { return storage[head]; }
const T &front() const { return storage[head]; } const T &front() const { return storage[head]; }
size_t size() const { size_t size() const {
return count; return count;
} }
}; };
#endif // _FIXED_SIZE_QUEUE_H #endif // _FIXED_SIZE_QUEUE_H

View File

@ -1,28 +1,28 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _HASH_H #ifndef _HASH_H
#define _HASH_H #define _HASH_H
#include "Common.h" #include "Common.h"
u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0. u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower
u32 HashFNV(const u8* ptr, int length); // Another fast and decent hash u32 HashFNV(const u8* ptr, int length); // Another fast and decent hash
u32 HashEctor(const u8* ptr, int length); // JUNK. DO NOT USE FOR NEW THINGS u32 HashEctor(const u8* ptr, int length); // JUNK. DO NOT USE FOR NEW THINGS
#endif #endif

View File

@ -1,88 +1,88 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _INIFILE_H #ifndef _INIFILE_H
#define _INIFILE_H #define _INIFILE_H
#include <string> #include <string>
#include <vector> #include <vector>
#include "StringUtil.h" #include "StringUtil.h"
class Section class Section
{ {
public: public:
Section(); Section();
Section(const std::string& _name); Section(const std::string& _name);
Section(const Section& other); Section(const Section& other);
std::vector<std::string>lines; std::vector<std::string>lines;
std::string name; std::string name;
std::string comment; std::string comment;
bool operator<(const Section& other) const bool operator<(const Section& other) const
{ {
return(name < other.name); return(name < other.name);
} }
}; };
class IniFile class IniFile
{ {
public: public:
IniFile(); IniFile();
~IniFile(); ~IniFile();
bool Load(const char* filename); bool Load(const char* filename);
bool Save(const char* filename); bool Save(const char* filename);
void Set(const char* sectionName, const char* key, const char* newValue); void Set(const char* sectionName, const char* key, const char* newValue);
void Set(const char* sectionName, const char* key, int newValue); void Set(const char* sectionName, const char* key, int newValue);
void Set(const char* sectionName, const char* key, u32 newValue); void Set(const char* sectionName, const char* key, u32 newValue);
void Set(const char* sectionName, const char* key, bool newValue); void Set(const char* sectionName, const char* key, bool newValue);
void Set(const char* sectionName, const char* key, const std::string& newValue) {Set(sectionName, key, newValue.c_str());} void Set(const char* sectionName, const char* key, const std::string& newValue) {Set(sectionName, key, newValue.c_str());}
void Set(const char* sectionName, const char* key, const std::vector<std::string>& newValues); void Set(const char* sectionName, const char* key, const std::vector<std::string>& newValues);
void SetLines(const char* sectionName, const std::vector<std::string> &lines); void SetLines(const char* sectionName, const std::vector<std::string> &lines);
// getter should be const // getter should be const
bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = ""); bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = "");
bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0); bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0);
bool Get(const char* sectionName, const char* key, u32* value, u32 defaultValue = 0); bool Get(const char* sectionName, const char* key, u32* value, u32 defaultValue = 0);
bool Get(const char* sectionName, const char* key, bool* value, bool defaultValue = false); bool Get(const char* sectionName, const char* key, bool* value, bool defaultValue = false);
bool Get(const char* sectionName, const char* key, std::vector<std::string>& values); bool Get(const char* sectionName, const char* key, std::vector<std::string>& values);
bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const; bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const;
bool GetLines(const char* sectionName, std::vector<std::string>& lines) const; bool GetLines(const char* sectionName, std::vector<std::string>& lines) const;
bool DeleteKey(const char* sectionName, const char* key); bool DeleteKey(const char* sectionName, const char* key);
bool DeleteSection(const char* sectionName); bool DeleteSection(const char* sectionName);
void SortSections(); void SortSections();
void ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut, std::string* commentOut) const; void ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut, std::string* commentOut) const;
std::string* GetLine(Section* section, const char* key, std::string* valueOut, std::string* commentOut); std::string* GetLine(Section* section, const char* key, std::string* valueOut, std::string* commentOut);
private: private:
std::vector<Section>sections; std::vector<Section>sections;
const Section* GetSection(const char* section) const; const Section* GetSection(const char* section) const;
Section* GetSection(const char* section); Section* GetSection(const char* section);
Section* GetOrCreateSection(const char* section); Section* GetOrCreateSection(const char* section);
std::string* GetLine(const char* section, const char* key); std::string* GetLine(const char* section, const char* key);
void CreateSection(const char* section); void CreateSection(const char* section);
}; };
#endif #endif

View File

@ -1,51 +1,51 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Handles giant memory mapped files // Handles giant memory mapped files
// Through some trickery, allows lock on byte boundaries // Through some trickery, allows lock on byte boundaries
// instead of allocation granularity boundaries // instead of allocation granularity boundaries
// for ease of use // for ease of use
// //
#ifndef _MAPPED_FILE_H #ifndef _MAPPED_FILE_H
#define _MAPPED_FILE_H #define _MAPPED_FILE_H
// #pragma warning (disable: 4786) // #pragma warning (disable: 4786)
#include <map> #include <map>
namespace Common namespace Common
{ {
class IMappedFile class IMappedFile
{ {
public: public:
virtual ~IMappedFile() {} virtual ~IMappedFile() {}
virtual bool Open(const char* _szFilename) = 0; virtual bool Open(const char* _szFilename) = 0;
virtual bool IsOpen(void) = 0; virtual bool IsOpen(void) = 0;
virtual void Close(void) = 0; virtual void Close(void) = 0;
virtual u64 GetSize(void) = 0; virtual u64 GetSize(void) = 0;
virtual u8* Lock(u64 _offset, u64 _size) = 0; virtual u8* Lock(u64 _offset, u64 _size) = 0;
virtual void Unlock(u8* ptr) = 0; virtual void Unlock(u8* ptr) = 0;
static IMappedFile* CreateMappedFileDEPRECATED(); static IMappedFile* CreateMappedFileDEPRECATED();
}; };
} // end of namespace DiscIO } // end of namespace DiscIO
#endif #endif

View File

@ -1,35 +1,35 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _MATH_UTIL_H #ifndef _MATH_UTIL_H
#define _MATH_UTIL_H #define _MATH_UTIL_H
#include <xmmintrin.h> #include <xmmintrin.h>
/* /*
There are two different flavors of float to int conversion: There are two different flavors of float to int conversion:
_mm_cvtps_epi32() and _mm_cvttps_epi32(). The first rounds _mm_cvtps_epi32() and _mm_cvttps_epi32(). The first rounds
according to the MXCSR rounding bits. The second one always according to the MXCSR rounding bits. The second one always
uses round towards zero. uses round towards zero.
*/ */
void SaveSSEState(); void SaveSSEState();
void LoadSSEState(); void LoadSSEState();
void LoadDefaultSSEState(); void LoadDefaultSSEState();
#endif #endif

View File

@ -1,52 +1,52 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _MEMARENA_H #ifndef _MEMARENA_H
#define _MEMARENA_H #define _MEMARENA_H
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
#include "Common.h" #include "Common.h"
// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it. // This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
// Multiple views can mirror the same section of the block, which makes it very convient for emulating // Multiple views can mirror the same section of the block, which makes it very convient for emulating
// memory mirrors. // memory mirrors.
// Pass ensure_low_mem = true to CreateView if you want arbitrarily positioned views to end up in the low 2GB. // Pass ensure_low_mem = true to CreateView if you want arbitrarily positioned views to end up in the low 2GB.
class MemArena class MemArena
{ {
public: public:
void GrabLowMemSpace(size_t size); void GrabLowMemSpace(size_t size);
void ReleaseSpace(); void ReleaseSpace();
void* CreateView(s64 offset, size_t size, bool ensure_low_mem = false); void* CreateView(s64 offset, size_t size, bool ensure_low_mem = false);
void* CreateViewAt(s64 offset, size_t size, void* base); void* CreateViewAt(s64 offset, size_t size, void* base);
void ReleaseView(void* view, size_t size); void ReleaseView(void* view, size_t size);
// This only finds 1 GB in 32-bit // This only finds 1 GB in 32-bit
static u8* Find4GBBase(); static u8* Find4GBBase();
private: private:
#ifdef _WIN32 #ifdef _WIN32
HANDLE hMemoryMapping; HANDLE hMemoryMapping;
#else #else
int fd; int fd;
#endif #endif
}; };
#endif #endif

View File

@ -1,31 +1,31 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _MEMORYUTIL_H #ifndef _MEMORYUTIL_H
#define _MEMORYUTIL_H #define _MEMORYUTIL_H
void* AllocateExecutableMemory(int size, bool low = true); void* AllocateExecutableMemory(int size, bool low = true);
void* AllocateMemoryPages(int size); void* AllocateMemoryPages(int size);
void FreeMemoryPages(void* ptr, int size); void FreeMemoryPages(void* ptr, int size);
void WriteProtectMemory(void* ptr, int size, bool executable = false); void WriteProtectMemory(void* ptr, int size, bool executable = false);
void UnWriteProtectMemory(void* ptr, int size, bool allowExecute); void UnWriteProtectMemory(void* ptr, int size, bool allowExecute);
inline int GetPageSize() {return(4096);} inline int GetPageSize() {return(4096);}
#endif #endif

View File

@ -1,51 +1,51 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PLUGIN_H #ifndef _PLUGIN_H
#define _PLUGIN_H #define _PLUGIN_H
#include "Common.h" #include "Common.h"
#include "../../../PluginSpecs/PluginSpecs.h" #include "../../../PluginSpecs/PluginSpecs.h"
#include "DynamicLibrary.h" #include "DynamicLibrary.h"
namespace Common namespace Common
{ {
class CPlugin class CPlugin
{ {
public: public:
static void Release(void); static void Release(void);
static bool Load(const char* _szName); static bool Load(const char* _szName);
static bool GetInfo(PLUGIN_INFO& _pluginInfo); static bool GetInfo(PLUGIN_INFO& _pluginInfo);
static void Config(HWND _hwnd); static void Config(HWND _hwnd);
static void About(HWND _hwnd); static void About(HWND _hwnd);
static void Debug(HWND _hwnd, bool Show); static void Debug(HWND _hwnd, bool Show);
private: private:
static DynamicLibrary m_hInstLib; static DynamicLibrary m_hInstLib;
static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo); static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo);
static void (__cdecl * m_DllConfig)(HWND _hParent); static void (__cdecl * m_DllConfig)(HWND _hParent);
static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show); static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show);
}; };
} // end of namespace Common } // end of namespace Common
#endif #endif

View File

@ -1,77 +1,77 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _STRINGUTIL_H #ifndef _STRINGUTIL_H
#define _STRINGUTIL_H #define _STRINGUTIL_H
#include <stdarg.h> #include <stdarg.h>
#include <vector> #include <vector>
#include <string> #include <string>
#include "Common.h" #include "Common.h"
std::string StringFromFormat(const char* format, ...); std::string StringFromFormat(const char* format, ...);
void ToStringFromFormat(std::string* out, const char* format, ...); void ToStringFromFormat(std::string* out, const char* format, ...);
// Expensive! // Expensive!
void StringFromFormatV(std::string* out, const char* format, va_list args); void StringFromFormatV(std::string* out, const char* format, va_list args);
// Cheap! // Cheap!
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args); bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
template<size_t Count> template<size_t Count>
inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...) inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
CharArrayFromFormatV(out, Count, format, args); CharArrayFromFormatV(out, Count, format, args);
va_end(args); va_end(args);
} }
std::string StripSpaces(const std::string &s); std::string StripSpaces(const std::string &s);
std::string StripQuotes(const std::string &s); std::string StripQuotes(const std::string &s);
std::string StripNewline(const std::string &s); std::string StripNewline(const std::string &s);
std::string ThS(int a, bool b = true); // thousand separator std::string ThS(int a, bool b = true); // thousand separator
std::string StringFromInt(int value); std::string StringFromInt(int value);
std::string StringFromBool(bool value); std::string StringFromBool(bool value);
bool TryParseInt(const char* str, int* outVal); bool TryParseInt(const char* str, int* outVal);
bool TryParseBool(const char* str, bool* output); bool TryParseBool(const char* str, bool* output);
bool TryParseUInt(const std::string& str, u32* output); bool TryParseUInt(const std::string& str, u32* output);
// TODO: kill this // TODO: kill this
bool AsciiToHex(const char* _szValue, u32& result); bool AsciiToHex(const char* _szValue, u32& result);
void SplitString(const std::string& str, const std::string& delim, std::vector<std::string>& output); void SplitString(const std::string& str, const std::string& delim, std::vector<std::string>& output);
int ChooseStringFrom(const char* str, const char* * items); int ChooseStringFrom(const char* str, const char* * items);
// filehelper // filehelper
bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension); bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename); void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename);
#endif #endif

View File

@ -1,100 +1,100 @@
// Stupidly simple automated testing framework // Stupidly simple automated testing framework
// by ector // by ector
// licence: Public Domain // licence: Public Domain
// If TESTING_ENABLE is true, all tests across the project will run before main(). // If TESTING_ENABLE is true, all tests across the project will run before main().
// If it's false, all tests will be destroyed by the linker, hopefully. // If it's false, all tests will be destroyed by the linker, hopefully.
// Unfortunately, MSVC:s library linker seems to kill off unreferenced objects, even if the // Unfortunately, MSVC:s library linker seems to kill off unreferenced objects, even if the
// initialization has side effects. This makes this framework not work properly :( // initialization has side effects. This makes this framework not work properly :(
// TODO(ector): Find solution. // TODO(ector): Find solution.
// TODO(ector): make sure tests are destroyed and that things compile without TESTING_ENABLE :P // TODO(ector): make sure tests are destroyed and that things compile without TESTING_ENABLE :P
#define TESTING_ENABLE #define TESTING_ENABLE
#ifndef _TEST_FRAMEWORK_H #ifndef _TEST_FRAMEWORK_H
#define _TEST_FRAMEWORK_H #define _TEST_FRAMEWORK_H
#include "Common.h" #include "Common.h"
#include <stdio.h> #include <stdio.h>
#ifdef TESTING_ENABLE #ifdef TESTING_ENABLE
namespace __test namespace __test
{ {
extern int numTests; extern int numTests;
extern int numTestsFailed; extern int numTestsFailed;
} }
struct TestRunnah struct TestRunnah
{ {
const char* filename; const char* filename;
const char* function; const char* function;
TestRunnah(const char* _filename, const char* _function) TestRunnah(const char* _filename, const char* _function)
: filename(_filename), function(_function) {} : filename(_filename), function(_function) {}
bool AssertTrue(bool value, int line) bool AssertTrue(bool value, int line)
{ {
if (!value) if (!value)
{ {
char string[256]; char string[256];
sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed"); sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed");
PanicAlert("Test Results: %s", string); PanicAlert("Test Results: %s", string);
TestFailed(); TestFailed();
return(false); return(false);
} }
return(true); return(true);
} }
template<class T> template<class T>
bool AssertEqual(T a, T b, int line) bool AssertEqual(T a, T b, int line)
{ {
if (!(a == b)) if (!(a == b))
{ {
// TODO(ector) : better output // TODO(ector) : better output
char string[256]; char string[256];
sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed"); sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed");
PanicAlert("Test Results: %s", string); PanicAlert("Test Results: %s", string);
TestFailed(); TestFailed();
return(false); return(false);
} }
} }
void TestFailed() void TestFailed()
{ {
__test::numTestsFailed++; __test::numTestsFailed++;
} }
}; };
#define TEST(a) \ #define TEST(a) \
void TEST_ ## a(TestRunnah * __tr); \ void TEST_ ## a(TestRunnah * __tr); \
struct DUMMY_ ## a \ struct DUMMY_ ## a \
: public TestRunnah { \ : public TestRunnah { \
DUMMY_ ## a() \ DUMMY_ ## a() \
: TestRunnah(__FILE__, # a) {\ : TestRunnah(__FILE__, # a) {\
TEST_ ## a(this); __test::numTests++;} }; \ TEST_ ## a(this); __test::numTests++;} }; \
DUMMY_ ## a ddummy_ ## a; \ DUMMY_ ## a ddummy_ ## a; \
void TEST_ ## a(TestRunnah * __tr) void TEST_ ## a(TestRunnah * __tr)
#else // TESTING_ENABLE #else // TESTING_ENABLE
#define TEST(a) \ #define TEST(a) \
void TEST_ ## a(TestRunnah * __tr) \ void TEST_ ## a(TestRunnah * __tr) \
#endif #endif
#define CHECK(a) if (!__tr->AssertTrue(a, __LINE__)){return;} #define CHECK(a) if (!__tr->AssertTrue(a, __LINE__)){return;}
#define CHECK_EQ(a, b) if (!__tr->AssertEqual(a, b, __LINE__)){return;} #define CHECK_EQ(a, b) if (!__tr->AssertEqual(a, b, __LINE__)){return;}
int GetNumTests(); int GetNumTests();
int GetNumTestsFailed(); int GetNumTestsFailed();
#endif #endif

View File

@ -1,117 +1,117 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _THREAD_H #ifndef _THREAD_H
#define _THREAD_H #define _THREAD_H
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else #else
#include <pthread.h> #include <pthread.h>
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define THREAD_RETURN DWORD WINAPI #define THREAD_RETURN DWORD WINAPI
#else #else
#define THREAD_RETURN void* #define THREAD_RETURN void*
#endif #endif
#include "Common.h" #include "Common.h"
namespace Common namespace Common
{ {
class CriticalSection class CriticalSection
{ {
#ifdef _WIN32 #ifdef _WIN32
CRITICAL_SECTION section; CRITICAL_SECTION section;
#elif __GNUC__ #elif __GNUC__
pthread_mutex_t mutex; pthread_mutex_t mutex;
#endif #endif
public: public:
CriticalSection(int spincount = 1000); CriticalSection(int spincount = 1000);
~CriticalSection(); ~CriticalSection();
void Enter(); void Enter();
bool TryEnter(); bool TryEnter();
void Leave(); void Leave();
}; };
#ifdef _WIN32 #ifdef _WIN32
typedef DWORD (WINAPI * ThreadFunc)(void* arg); typedef DWORD (WINAPI * ThreadFunc)(void* arg);
#elif __GNUC__ #elif __GNUC__
typedef void* (*ThreadFunc)(void* arg); typedef void* (*ThreadFunc)(void* arg);
#endif #endif
class Thread class Thread
{ {
public: public:
Thread(ThreadFunc entry, void* arg); Thread(ThreadFunc entry, void* arg);
~Thread(); ~Thread();
void WaitForDeath(); void WaitForDeath();
void SetAffinity(int mask); void SetAffinity(int mask);
static void SetCurrentThreadAffinity(int mask); static void SetCurrentThreadAffinity(int mask);
private: private:
#ifdef _WIN32 #ifdef _WIN32
HANDLE m_hThread; HANDLE m_hThread;
DWORD m_threadId; DWORD m_threadId;
#elif __GNUC__ #elif __GNUC__
pthread_t thread_id; pthread_t thread_id;
#endif #endif
}; };
class Event class Event
{ {
public: public:
Event(); Event();
void Init(); void Init();
void Shutdown(); void Shutdown();
void Set(); void Set();
void Wait(); void Wait();
private: private:
#ifdef _WIN32 #ifdef _WIN32
HANDLE m_hEvent; HANDLE m_hEvent;
#elif __GNUC__ #elif __GNUC__
bool is_set_; bool is_set_;
pthread_cond_t event_; pthread_cond_t event_;
pthread_mutex_t mutex_; pthread_mutex_t mutex_;
#endif #endif
}; };
void SleepCurrentThread(int ms); void SleepCurrentThread(int ms);
void SetCurrentThreadName(const char *name); void SetCurrentThreadName(const char *name);
LONG SyncInterlockedExchangeAdd(LONG *Dest, LONG Val); LONG SyncInterlockedExchangeAdd(LONG *Dest, LONG Val);
LONG SyncInterlockedExchange(LONG *Dest, LONG Val); LONG SyncInterlockedExchange(LONG *Dest, LONG Val);
LONG SyncInterlockedIncrement(LONG *Dest); LONG SyncInterlockedIncrement(LONG *Dest);
} // end of namespace Common } // end of namespace Common
#endif #endif

View File

@ -1,39 +1,39 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _THUNK_H #ifndef _THUNK_H
#define _THUNK_H #define _THUNK_H
// This simple class creates a wrapper around a C/C++ function that saves all fp state // This simple class creates a wrapper around a C/C++ function that saves all fp state
// before entering it, and restores it upon exit. This is required to be able to selectively // before entering it, and restores it upon exit. This is required to be able to selectively
// call functions from generated code, without inflicting the performance hit and increase // call functions from generated code, without inflicting the performance hit and increase
// of complexity that it means to protect the generated code from this problem. // of complexity that it means to protect the generated code from this problem.
// This process is called thunking. // This process is called thunking.
// There will only ever be one level of thunking on the stack, plus, // There will only ever be one level of thunking on the stack, plus,
// we don't want to pollute the stack, so we store away regs somewhere global. // we don't want to pollute the stack, so we store away regs somewhere global.
// NOT THREAD SAFE. This may only be used from the CPU thread. // NOT THREAD SAFE. This may only be used from the CPU thread.
// Any other thread using this stuff will be FATAL. // Any other thread using this stuff will be FATAL.
void Thunk_Init(); void Thunk_Init();
void Thunk_Reset(); void Thunk_Reset();
void Thunk_Shutdown(); void Thunk_Shutdown();
void *ProtectFunction(void *function, int num_params); void *ProtectFunction(void *function, int num_params);
#endif #endif

View File

@ -1,49 +1,49 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _TIMER_H #ifndef _TIMER_H
#define _TIMER_H #define _TIMER_H
#include "Common.h" #include "Common.h"
namespace Common namespace Common
{ {
class Timer class Timer
{ {
public: public:
Timer(); Timer();
void Update(); void Update();
// Always in milliseconds, regardless of alternative internal representation // Always in milliseconds, regardless of alternative internal representation
s64 GetTimeDifference(void); s64 GetTimeDifference(void);
static void IncreaseResolution(); static void IncreaseResolution();
static void RestoreResolution(); static void RestoreResolution();
static u64 GetTimeSinceJan1970(); static u64 GetTimeSinceJan1970();
public: public:
u64 m_LastTime; u64 m_LastTime;
u64 m_frequency; u64 m_frequency;
}; };
} // end of namespace Common } // end of namespace Common
#endif #endif

View File

@ -1,55 +1,55 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// WaveFileWriter // WaveFileWriter
// Simple utility class to make it easy to write long 16-bit stereo // Simple utility class to make it easy to write long 16-bit stereo
// audio streams to disk. // audio streams to disk.
// Use Start() to start recording to a file, and AddStereoSamples to add wave data. // Use Start() to start recording to a file, and AddStereoSamples to add wave data.
// The float variant will convert from -1.0-1.0 range and clamp. // The float variant will convert from -1.0-1.0 range and clamp.
// Alternatively, AddSamplesBE for big endian wave data. // Alternatively, AddSamplesBE for big endian wave data.
// If Stop is not called when it destructs, the destructor will call Stop(). // If Stop is not called when it destructs, the destructor will call Stop().
#ifndef _WAVEFILE_H #ifndef _WAVEFILE_H
#define _WAVEFILE_H #define _WAVEFILE_H
#include <stdio.h> #include <stdio.h>
class WaveFileWriter class WaveFileWriter
{ {
FILE *file; FILE *file;
bool skip_silence; bool skip_silence;
u32 audio_size; u32 audio_size;
short *conv_buffer; short *conv_buffer;
void Write(u32 value); void Write(u32 value);
void Write4(const char *ptr); void Write4(const char *ptr);
public: public:
WaveFileWriter(); WaveFileWriter();
~WaveFileWriter(); ~WaveFileWriter();
bool Start(const char *filename); bool Start(const char *filename);
void Stop(); void Stop();
void SetSkipSilence(bool skip) { skip_silence = skip; } void SetSkipSilence(bool skip) { skip_silence = skip; }
void AddStereoSamples(const short *sample_data, int count); void AddStereoSamples(const short *sample_data, int count);
void AddStereoSamplesBE(const short *sample_data, int count); // big endian void AddStereoSamplesBE(const short *sample_data, int count); // big endian
u32 GetAudioSize() { return audio_size; } u32 GetAudioSize() { return audio_size; }
}; };
#endif // _WAVEFILE_H #endif // _WAVEFILE_H

View File

@ -1,35 +1,35 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#pragma once #pragma once
#ifndef _WIN32_WINNT #ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x501 #define _WIN32_WINNT 0x501
#endif #endif
#ifndef _WIN32_IE #ifndef _WIN32_IE
#define _WIN32_IE 0x0500 // Default value is 0x0400 #define _WIN32_IE 0x0500 // Default value is 0x0400
#endif #endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1 #define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_NONSTDC_NO_DEPRECATE 1 #define _CRT_NONSTDC_NO_DEPRECATE 1
#include <windows.h> #include <windows.h>
#include <tchar.h> #include <tchar.h>
#include <vector> #include <vector>

View File

@ -1,2 +1,2 @@
#define SVN_REV $WCREV$ #define SVN_REV $WCREV$
#define SVN_REV_STR "$WCREV$" #define SVN_REV_STR "$WCREV$"

View File

@ -1,56 +1,56 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _X64ANALYZER_H #ifndef _X64ANALYZER_H
#define _X64ANALYZER_H #define _X64ANALYZER_H
#include "Common.h" #include "Common.h"
struct InstructionInfo struct InstructionInfo
{ {
int operandSize; //8, 16, 32, 64 int operandSize; //8, 16, 32, 64
int instructionSize; int instructionSize;
int regOperandReg; int regOperandReg;
int otherReg; int otherReg;
int scaledReg; int scaledReg;
bool zeroExtend; bool zeroExtend;
bool signExtend; bool signExtend;
bool hasImmediate; bool hasImmediate;
bool isMemoryWrite; bool isMemoryWrite;
u64 immediate; u64 immediate;
s32 displacement; s32 displacement;
}; };
struct ModRM struct ModRM
{ {
int mod, reg, rm; int mod, reg, rm;
ModRM(u8 modRM, u8 rex) ModRM(u8 modRM, u8 rex)
{ {
mod = modRM >> 6; mod = modRM >> 6;
reg = ((modRM >> 3) & 7) | ((rex & 4)?8:0); reg = ((modRM >> 3) & 7) | ((rex & 4)?8:0);
rm = modRM & 7; rm = modRM & 7;
} }
}; };
enum AccessType{ enum AccessType{
OP_ACCESS_READ = 0, OP_ACCESS_READ = 0,
OP_ACCESS_WRITE = 1 OP_ACCESS_WRITE = 1
}; };
bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int accessType); bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int accessType);
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,36 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _ARDECRYPT_H_ #ifndef _ARDECRYPT_H_
#define _ARDECRYPT_H_ #define _ARDECRYPT_H_
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#include "Common.h" #include "Common.h"
#include "ActionReplay.h" #include "ActionReplay.h"
extern int total; extern int total;
extern const char *filter; extern const char *filter;
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops); void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops);
#endif //_ARDECRYPT_H_ #endif //_ARDECRYPT_H_

View File

@ -1,42 +1,42 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _ACTIONREPLAY_H_ #ifndef _ACTIONREPLAY_H_
#define _ACTIONREPLAY_H_ #define _ACTIONREPLAY_H_
#include "IniFile.h" #include "IniFile.h"
struct AREntry { struct AREntry {
u32 cmd_addr; u32 cmd_addr;
u32 value; u32 value;
}; };
struct ARCode { struct ARCode {
std::string name; std::string name;
std::vector<AREntry> ops; std::vector<AREntry> ops;
bool active; bool active;
}; };
void ActionReplayRunAllActive(); void ActionReplayRunAllActive();
bool RunActionReplayCode(const ARCode &arcode); bool RunActionReplayCode(const ARCode &arcode);
void LoadActionReplayCodes(IniFile &ini); void LoadActionReplayCodes(IniFile &ini);
size_t ActionReplay_GetCodeListSize(); size_t ActionReplay_GetCodeListSize();
ARCode ActionReplay_GetARCode(size_t index); ARCode ActionReplay_GetARCode(size_t index);
void ActionReplay_SetARCode_IsActive(bool active, size_t index); void ActionReplay_SetARCode_IsActive(bool active, size_t index);
void ActionReplay_UpdateActiveList(); void ActionReplay_UpdateActiveList();
#endif //_ACTIONREPLAY_H_ #endif //_ACTIONREPLAY_H_

View File

@ -1,60 +1,60 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _BOOT_H #ifndef _BOOT_H
#define _BOOT_H #define _BOOT_H
#include <string> #include <string>
#include "Common.h" #include "Common.h"
#include "../CoreParameter.h" #include "../CoreParameter.h"
class CBoot class CBoot
{ {
public: public:
enum TBootFileType enum TBootFileType
{ {
BOOT_ERROR, BOOT_ERROR,
BOOT_DOL, BOOT_DOL,
BOOT_ELF, BOOT_ELF,
BOOT_ISO, BOOT_ISO,
BOOT_BIOS BOOT_BIOS
}; };
static bool BootUp(const SCoreStartupParameter& _StartupPara); static bool BootUp(const SCoreStartupParameter& _StartupPara);
static bool IsElfWii(const char *filename); static bool IsElfWii(const char *filename);
static std::string GenerateMapFilename(); static std::string GenerateMapFilename();
private: private:
enum { BIOS_SIZE = 2*1024*1024 }; enum { BIOS_SIZE = 2*1024*1024 };
static void RunFunction(u32 _iAddr, bool _bUseDebugger); static void RunFunction(u32 _iAddr, bool _bUseDebugger);
static void UpdateDebugger_MapLoaded(const char* _gameID = NULL); static void UpdateDebugger_MapLoaded(const char* _gameID = NULL);
static bool LoadMapFromFilename(const std::string& _rFilename, const char* _gameID = NULL); static bool LoadMapFromFilename(const std::string& _rFilename, const char* _gameID = NULL);
static bool Boot_ELF(const char *filename); static bool Boot_ELF(const char *filename);
static void EmulatedBIOS(bool _bDebug); static void EmulatedBIOS(bool _bDebug);
static bool EmulatedBIOS_Wii(bool _bDebug); static bool EmulatedBIOS_Wii(bool _bDebug);
static bool Load_BIOS(const std::string& _rBiosFilename); static bool Load_BIOS(const std::string& _rBiosFilename);
static void Load_FST(bool _bIsWii); static void Load_FST(bool _bIsWii);
}; };
#endif #endif

View File

@ -1,55 +1,55 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _BOOT_DOL_H #ifndef _BOOT_DOL_H
#define _BOOT_DOL_H #define _BOOT_DOL_H
#include "Common.h" #include "Common.h"
class CDolLoader class CDolLoader
{ {
public: public:
CDolLoader(const char* _szFilename); CDolLoader(const char* _szFilename);
u32 GetEntryPoint(); u32 GetEntryPoint();
private: private:
enum enum
{ {
DOL_NUM_TEXT = 7, DOL_NUM_TEXT = 7,
DOL_NUM_DATA = 11 DOL_NUM_DATA = 11
}; };
struct SDolHeader struct SDolHeader
{ {
u32 textOffset[DOL_NUM_TEXT]; u32 textOffset[DOL_NUM_TEXT];
u32 dataOffset[DOL_NUM_DATA]; u32 dataOffset[DOL_NUM_DATA];
u32 textAddress[DOL_NUM_TEXT]; u32 textAddress[DOL_NUM_TEXT];
u32 dataAddress[DOL_NUM_DATA]; u32 dataAddress[DOL_NUM_DATA];
u32 textSize[DOL_NUM_TEXT]; u32 textSize[DOL_NUM_TEXT];
u32 dataSize[DOL_NUM_DATA]; u32 dataSize[DOL_NUM_DATA];
u32 bssAddress; u32 bssAddress;
u32 bssSize; u32 bssSize;
u32 entryPoint; u32 entryPoint;
u32 padd[7]; u32 padd[7];
}; };
SDolHeader m_dolheader; SDolHeader m_dolheader;
bool m_bInit; bool m_bInit;
}; };
#endif #endif

View File

@ -1,18 +1,18 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#pragma once #pragma once

View File

@ -1,89 +1,89 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _ELFREADER_H #ifndef _ELFREADER_H
#define _ELFREADER_H #define _ELFREADER_H
#include "ElfTypes.h" #include "ElfTypes.h"
enum KnownElfTypes enum KnownElfTypes
{ {
KNOWNELF_PSP = 0, KNOWNELF_PSP = 0,
KNOWNELF_DS = 1, KNOWNELF_DS = 1,
KNOWNELF_GBA = 2, KNOWNELF_GBA = 2,
KNOWNELF_GC = 3, KNOWNELF_GC = 3,
}; };
typedef int SectionID; typedef int SectionID;
class ElfReader class ElfReader
{ {
char *base; char *base;
u32 *base32; u32 *base32;
Elf32_Ehdr *header; Elf32_Ehdr *header;
Elf32_Phdr *segments; Elf32_Phdr *segments;
Elf32_Shdr *sections; Elf32_Shdr *sections;
u32 *sectionOffsets; u32 *sectionOffsets;
u32 *sectionAddrs; u32 *sectionAddrs;
bool bRelocate; bool bRelocate;
u32 entryPoint; u32 entryPoint;
public: public:
ElfReader(void *ptr); ElfReader(void *ptr);
~ElfReader() { } ~ElfReader() { }
u32 Read32(int off) const { return base32[off>>2]; } u32 Read32(int off) const { return base32[off>>2]; }
// Quick accessors // Quick accessors
ElfType GetType() const { return (ElfType)(header->e_type); } ElfType GetType() const { return (ElfType)(header->e_type); }
ElfMachine GetMachine() const { return (ElfMachine)(header->e_machine); } ElfMachine GetMachine() const { return (ElfMachine)(header->e_machine); }
u32 GetEntryPoint() const { return entryPoint; } u32 GetEntryPoint() const { return entryPoint; }
u32 GetFlags() const { return (u32)(header->e_flags); } u32 GetFlags() const { return (u32)(header->e_flags); }
int GetNumSegments() const { return (int)(header->e_phnum); } int GetNumSegments() const { return (int)(header->e_phnum); }
int GetNumSections() const { return (int)(header->e_shnum); } int GetNumSections() const { return (int)(header->e_shnum); }
const u8 *GetPtr(int offset) const { return (u8*)base + offset; } const u8 *GetPtr(int offset) const { return (u8*)base + offset; }
const char *GetSectionName(int section) const; const char *GetSectionName(int section) const;
const u8 *GetSectionDataPtr(int section) const const u8 *GetSectionDataPtr(int section) const
{ {
if (section < 0 || section >= header->e_shnum) if (section < 0 || section >= header->e_shnum)
return 0; return 0;
if (sections[section].sh_type != SHT_NOBITS) if (sections[section].sh_type != SHT_NOBITS)
return GetPtr(sections[section].sh_offset); return GetPtr(sections[section].sh_offset);
else else
return 0; return 0;
} }
const u8 *GetSegmentPtr(int segment) const u8 *GetSegmentPtr(int segment)
{ {
return GetPtr(segments[segment].p_offset); return GetPtr(segments[segment].p_offset);
} }
u32 GetSectionAddr(SectionID section) const { return sectionAddrs[section]; } u32 GetSectionAddr(SectionID section) const { return sectionAddrs[section]; }
int GetSectionSize(SectionID section) const { return sections[section].sh_size; } int GetSectionSize(SectionID section) const { return sections[section].sh_size; }
SectionID GetSectionByName(const char *name, int firstSection = 0) const; //-1 for not found SectionID GetSectionByName(const char *name, int firstSection = 0) const; //-1 for not found
bool DidRelocate() { bool DidRelocate() {
return bRelocate; return bRelocate;
} }
// More indepth stuff:) // More indepth stuff:)
bool LoadInto(u32 vaddr); bool LoadInto(u32 vaddr);
bool LoadSymbols(); bool LoadSymbols();
}; };
#endif #endif

View File

@ -1,281 +1,281 @@
#ifndef _ELFTYPES_H #ifndef _ELFTYPES_H
#define _ELFTYPES_H #define _ELFTYPES_H
// ELF Header Constants // ELF Header Constants
// File type // File type
enum ElfType enum ElfType
{ {
ET_NONE =0, ET_NONE =0,
ET_REL =1, ET_REL =1,
ET_EXEC =2, ET_EXEC =2,
ET_DYN =3, ET_DYN =3,
ET_CORE =4, ET_CORE =4,
ET_LOPROC =0xFF00, ET_LOPROC =0xFF00,
ET_HIPROC =0xFFFF, ET_HIPROC =0xFFFF,
}; };
// Machine/Architecture // Machine/Architecture
enum ElfMachine enum ElfMachine
{ {
EM_NONE =0, EM_NONE =0,
EM_M32 =1, EM_M32 =1,
EM_SPARC =2, EM_SPARC =2,
EM_386 =3, EM_386 =3,
EM_68K =4, EM_68K =4,
EM_88K =5, EM_88K =5,
EM_860 =7, EM_860 =7,
EM_MIPS =8 EM_MIPS =8
}; };
// File version // File version
#define EV_NONE 0 #define EV_NONE 0
#define EV_CURRENT 1 #define EV_CURRENT 1
// Identification index // Identification index
#define EI_MAG0 0 #define EI_MAG0 0
#define EI_MAG1 1 #define EI_MAG1 1
#define EI_MAG2 2 #define EI_MAG2 2
#define EI_MAG3 3 #define EI_MAG3 3
#define EI_CLASS 4 #define EI_CLASS 4
#define EI_DATA 5 #define EI_DATA 5
#define EI_VERSION 6 #define EI_VERSION 6
#define EI_PAD 7 #define EI_PAD 7
#define EI_NIDENT 16 #define EI_NIDENT 16
// Magic number // Magic number
#define ELFMAG0 0x7F #define ELFMAG0 0x7F
#define ELFMAG1 'E' #define ELFMAG1 'E'
#define ELFMAG2 'L' #define ELFMAG2 'L'
#define ELFMAG3 'F' #define ELFMAG3 'F'
// File class // File class
#define ELFCLASSNONE 0 #define ELFCLASSNONE 0
#define ELFCLASS32 1 #define ELFCLASS32 1
#define ELFCLASS64 2 #define ELFCLASS64 2
// Encoding // Encoding
#define ELFDATANONE 0 #define ELFDATANONE 0
#define ELFDATA2LSB 1 #define ELFDATA2LSB 1
#define ELFDATA2MSB 2 #define ELFDATA2MSB 2
///////////////////// /////////////////////
// Sections constants // Sections constants
// Section indexes // Section indexes
#define SHN_UNDEF 0 #define SHN_UNDEF 0
#define SHN_LORESERVE 0xFF00 #define SHN_LORESERVE 0xFF00
#define SHN_LOPROC 0xFF00 #define SHN_LOPROC 0xFF00
#define SHN_HIPROC 0xFF1F #define SHN_HIPROC 0xFF1F
#define SHN_ABS 0xFFF1 #define SHN_ABS 0xFFF1
#define SHN_COMMON 0xFFF2 #define SHN_COMMON 0xFFF2
#define SHN_HIRESERVE 0xFFFF #define SHN_HIRESERVE 0xFFFF
// Section types // Section types
#define SHT_NULL 0 #define SHT_NULL 0
#define SHT_PROGBITS 1 #define SHT_PROGBITS 1
#define SHT_SYMTAB 2 #define SHT_SYMTAB 2
#define SHT_STRTAB 3 #define SHT_STRTAB 3
#define SHT_RELA 4 #define SHT_RELA 4
#define SHT_HASH 5 #define SHT_HASH 5
#define SHT_DYNAMIC 6 #define SHT_DYNAMIC 6
#define SHT_NOTE 7 #define SHT_NOTE 7
#define SHT_NOBITS 8 #define SHT_NOBITS 8
#define SHT_REL 9 #define SHT_REL 9
#define SHT_SHLIB 10 #define SHT_SHLIB 10
#define SHT_DYNSYM 11 #define SHT_DYNSYM 11
#define SHT_LOPROC 0x70000000 #define SHT_LOPROC 0x70000000
#define SHT_HIPROC 0x7FFFFFFF #define SHT_HIPROC 0x7FFFFFFF
#define SHT_LOUSER 0x80000000 #define SHT_LOUSER 0x80000000
#define SHT_HIUSER 0xFFFFFFFF #define SHT_HIUSER 0xFFFFFFFF
// Custom section types // Custom section types
#define SHT_PSPREL 0x700000a0 #define SHT_PSPREL 0x700000a0
// Section flags // Section flags
enum ElfSectionFlags enum ElfSectionFlags
{ {
SHF_WRITE =0x1, SHF_WRITE =0x1,
SHF_ALLOC =0x2, SHF_ALLOC =0x2,
SHF_EXECINSTR =0x4, SHF_EXECINSTR =0x4,
SHF_MASKPROC =0xF0000000, SHF_MASKPROC =0xF0000000,
}; };
// Symbol binding // Symbol binding
#define STB_LOCAL 0 #define STB_LOCAL 0
#define STB_GLOBAL 1 #define STB_GLOBAL 1
#define STB_WEAK 2 #define STB_WEAK 2
#define STB_LOPROC 13 #define STB_LOPROC 13
#define STB_HIPROC 15 #define STB_HIPROC 15
// Symbol types // Symbol types
#define STT_NOTYPE 0 #define STT_NOTYPE 0
#define STT_OBJECT 1 #define STT_OBJECT 1
#define STT_FUNC 2 #define STT_FUNC 2
#define STT_SECTION 3 #define STT_SECTION 3
#define STT_FILE 4 #define STT_FILE 4
#define STT_LOPROC 13 #define STT_LOPROC 13
#define STT_HIPROC 15 #define STT_HIPROC 15
// Undefined name // Undefined name
#define STN_UNDEF 0 #define STN_UNDEF 0
// Relocation types // Relocation types
#define R_386_NONE 0 #define R_386_NONE 0
#define R_386_32 1 #define R_386_32 1
#define R_386_PC32 2 #define R_386_PC32 2
#define R_386_GOT32 3 #define R_386_GOT32 3
#define R_386_PLT32 4 #define R_386_PLT32 4
#define R_386_COPY 5 #define R_386_COPY 5
#define R_386_GLOB_DAT 6 #define R_386_GLOB_DAT 6
#define R_386_JMP_SLOT 7 #define R_386_JMP_SLOT 7
#define R_386_RELATIVE 8 #define R_386_RELATIVE 8
#define R_386_GOTOFF 9 #define R_386_GOTOFF 9
#define R_386_GOTPC 10 #define R_386_GOTPC 10
// Segment types // Segment types
#define PT_NULL 0 #define PT_NULL 0
#define PT_LOAD 1 #define PT_LOAD 1
#define PT_DYNAMIC 2 #define PT_DYNAMIC 2
#define PT_INTERP 3 #define PT_INTERP 3
#define PT_NOTE 4 #define PT_NOTE 4
#define PT_SHLIB 5 #define PT_SHLIB 5
#define PT_PHDR 6 #define PT_PHDR 6
#define PT_LOPROC 0x70000000 #define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7FFFFFFF #define PT_HIPROC 0x7FFFFFFF
// Segment flags // Segment flags
#define PF_X 1 #define PF_X 1
#define PF_W 2 #define PF_W 2
#define PF_R 4 #define PF_R 4
// Dynamic Array Tags // Dynamic Array Tags
#define DT_NULL 0 #define DT_NULL 0
#define DT_NEEDED 1 #define DT_NEEDED 1
#define DT_PLTRELSZ 2 #define DT_PLTRELSZ 2
#define DT_PLTGOT 3 #define DT_PLTGOT 3
#define DT_HASH 4 #define DT_HASH 4
#define DT_STRTAB 5 #define DT_STRTAB 5
#define DT_SYMTAB 6 #define DT_SYMTAB 6
#define DT_RELA 7 #define DT_RELA 7
#define DT_RELASZ 8 #define DT_RELASZ 8
#define DT_RELAENT 9 #define DT_RELAENT 9
#define DT_STRSZ 10 #define DT_STRSZ 10
#define DT_SYMENT 11 #define DT_SYMENT 11
#define DT_INIT 12 #define DT_INIT 12
#define DT_FINI 13 #define DT_FINI 13
#define DT_SONAME 14 #define DT_SONAME 14
#define DT_RPATH 15 #define DT_RPATH 15
#define DT_SYMBOLIC 16 #define DT_SYMBOLIC 16
#define DT_REL 17 #define DT_REL 17
#define DT_RELSZ 18 #define DT_RELSZ 18
#define DT_RELENT 19 #define DT_RELENT 19
#define DT_PLTREL 20 #define DT_PLTREL 20
#define DT_DEBUG 21 #define DT_DEBUG 21
#define DT_TEXTREL 22 #define DT_TEXTREL 22
#define DT_JMPREL 23 #define DT_JMPREL 23
#define DT_LOPROC 0x70000000 #define DT_LOPROC 0x70000000
#define DT_HIPROC 0x7FFFFFFF #define DT_HIPROC 0x7FFFFFFF
typedef unsigned int Elf32_Addr; typedef unsigned int Elf32_Addr;
typedef unsigned short Elf32_Half; typedef unsigned short Elf32_Half;
typedef unsigned int Elf32_Off; typedef unsigned int Elf32_Off;
typedef signed int Elf32_Sword; typedef signed int Elf32_Sword;
typedef unsigned int Elf32_Word; typedef unsigned int Elf32_Word;
// ELF file header // ELF file header
struct Elf32_Ehdr struct Elf32_Ehdr
{ {
unsigned char e_ident[EI_NIDENT]; unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type; Elf32_Half e_type;
Elf32_Half e_machine; Elf32_Half e_machine;
Elf32_Word e_version; Elf32_Word e_version;
Elf32_Addr e_entry; Elf32_Addr e_entry;
Elf32_Off e_phoff; Elf32_Off e_phoff;
Elf32_Off e_shoff; Elf32_Off e_shoff;
Elf32_Word e_flags; Elf32_Word e_flags;
Elf32_Half e_ehsize; Elf32_Half e_ehsize;
Elf32_Half e_phentsize; Elf32_Half e_phentsize;
Elf32_Half e_phnum; Elf32_Half e_phnum;
Elf32_Half e_shentsize; Elf32_Half e_shentsize;
Elf32_Half e_shnum; Elf32_Half e_shnum;
Elf32_Half e_shstrndx; Elf32_Half e_shstrndx;
}; };
// Section header // Section header
struct Elf32_Shdr struct Elf32_Shdr
{ {
Elf32_Word sh_name; Elf32_Word sh_name;
Elf32_Word sh_type; Elf32_Word sh_type;
Elf32_Word sh_flags; Elf32_Word sh_flags;
Elf32_Addr sh_addr; Elf32_Addr sh_addr;
Elf32_Off sh_offset; Elf32_Off sh_offset;
Elf32_Word sh_size; Elf32_Word sh_size;
Elf32_Word sh_link; Elf32_Word sh_link;
Elf32_Word sh_info; Elf32_Word sh_info;
Elf32_Word sh_addralign; Elf32_Word sh_addralign;
Elf32_Word sh_entsize; Elf32_Word sh_entsize;
}; };
// Segment header // Segment header
struct Elf32_Phdr struct Elf32_Phdr
{ {
Elf32_Word p_type; Elf32_Word p_type;
Elf32_Off p_offset; Elf32_Off p_offset;
Elf32_Addr p_vaddr; Elf32_Addr p_vaddr;
Elf32_Addr p_paddr; Elf32_Addr p_paddr;
Elf32_Word p_filesz; Elf32_Word p_filesz;
Elf32_Word p_memsz; Elf32_Word p_memsz;
Elf32_Word p_flags; Elf32_Word p_flags;
Elf32_Word p_align; Elf32_Word p_align;
}; };
// Symbol table entry // Symbol table entry
struct Elf32_Sym struct Elf32_Sym
{ {
Elf32_Word st_name; Elf32_Word st_name;
Elf32_Addr st_value; Elf32_Addr st_value;
Elf32_Word st_size; Elf32_Word st_size;
unsigned char st_info; unsigned char st_info;
unsigned char st_other; unsigned char st_other;
Elf32_Half st_shndx; Elf32_Half st_shndx;
}; };
#define ELF32_ST_BIND(i) ((i)>>4) #define ELF32_ST_BIND(i) ((i)>>4)
#define ELF32_ST_TYPE(i) ((i)&0xf) #define ELF32_ST_TYPE(i) ((i)&0xf)
#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) #define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
// Relocation entries // Relocation entries
struct Elf32_Rel struct Elf32_Rel
{ {
Elf32_Addr r_offset; Elf32_Addr r_offset;
Elf32_Word r_info; Elf32_Word r_info;
}; };
struct Elf32_Rela struct Elf32_Rela
{ {
Elf32_Addr r_offset; Elf32_Addr r_offset;
Elf32_Word r_info; Elf32_Word r_info;
Elf32_Sword r_addend; Elf32_Sword r_addend;
}; };
#define ELF32_R_SYM(i) ((i)>>8) #define ELF32_R_SYM(i) ((i)>>8)
#define ELF32_R_TYPE(i) ((unsigned char)(i)) #define ELF32_R_TYPE(i) ((unsigned char)(i))
#define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t)) #define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t))
struct Elf32_Dyn struct Elf32_Dyn
{ {
Elf32_Sword d_tag; Elf32_Sword d_tag;
union union
{ {
Elf32_Word d_val; Elf32_Word d_val;
Elf32_Addr d_ptr; Elf32_Addr d_ptr;
} d_un; } d_un;
}; };
#endif #endif

View File

@ -1,27 +1,27 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Simple debugging console currently residing in the Logging window. Not used much. // Simple debugging console currently residing in the Logging window. Not used much.
#ifndef _CONSOLE_H #ifndef _CONSOLE_H
#define _CONSOLE_H #define _CONSOLE_H
void Console_Submit(const char *cmd); void Console_Submit(const char *cmd);
#endif #endif

View File

@ -1,75 +1,75 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Core // Core
// The external interface to the emulator core. Plus some extras. // The external interface to the emulator core. Plus some extras.
// This is another part of the emu that needs cleaning - Core.cpp really has // This is another part of the emu that needs cleaning - Core.cpp really has
// too much random junk inside. // too much random junk inside.
#ifndef _CORE_H #ifndef _CORE_H
#define _CORE_H #define _CORE_H
#include <vector> #include <vector>
#include <string> #include <string>
#include "Common.h" #include "Common.h"
#include "CoreParameter.h" #include "CoreParameter.h"
namespace Core namespace Core
{ {
enum EState enum EState
{ {
CORE_UNINITIALIZED, CORE_UNINITIALIZED,
CORE_PAUSE, CORE_PAUSE,
CORE_RUN, CORE_RUN,
}; };
// Init core // Init core
bool Init(const SCoreStartupParameter _CoreParameter); bool Init(const SCoreStartupParameter _CoreParameter);
void Stop(); void Stop();
bool SetState(EState _State); bool SetState(EState _State);
EState GetState(); EState GetState();
// Save/Load state // Save/Load state
void SaveState(); void SaveState();
void LoadState(); void LoadState();
// get core parameters // get core parameters
extern SCoreStartupParameter g_CoreStartupParameter; //uck extern SCoreStartupParameter g_CoreStartupParameter; //uck
const SCoreStartupParameter& GetStartupParameter(); const SCoreStartupParameter& GetStartupParameter();
// make a screen shot // make a screen shot
bool MakeScreenshot(const std::string& _rFilename); bool MakeScreenshot(const std::string& _rFilename);
void* GetWindowHandle(); void* GetWindowHandle();
extern bool bReadTrace; extern bool bReadTrace;
extern bool bWriteTrace; extern bool bWriteTrace;
void StartTrace(bool write); void StartTrace(bool write);
void DisplayMessage(const std::string &message, int time_in_ms); // This displays messages in a user-visible way. void DisplayMessage(const std::string &message, int time_in_ms); // This displays messages in a user-visible way.
void DisplayMessage(const char *message, int time_in_ms); // This displays messages in a user-visible way. void DisplayMessage(const char *message, int time_in_ms); // This displays messages in a user-visible way.
int SyncTrace(); int SyncTrace();
void SetBlockStart(u32 addr); void SetBlockStart(u32 addr);
void StopTrace(); void StopTrace();
} // namespace } // namespace
#endif #endif

View File

@ -1,108 +1,108 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _COREPARAMETER_H #ifndef _COREPARAMETER_H
#define _COREPARAMETER_H #define _COREPARAMETER_H
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
#include <string> #include <string>
struct SCoreStartupParameter struct SCoreStartupParameter
{ {
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE hInstance; HINSTANCE hInstance;
#endif #endif
// windows/GUI related // windows/GUI related
void* hMainWindow; void* hMainWindow;
// flags // flags
bool bEnableDebugging; bool bAutomaticStart; bool bEnableDebugging; bool bAutomaticStart;
bool bUseJIT; bool bUseJIT;
bool bJITUnlimitedCache, bJITOff; // JIT bool bJITUnlimitedCache, bJITOff; // JIT
bool bJITLoadStoreOff, bJITLoadStorelXzOff, bJITLoadStorelwzOff, bJITLoadStorelbzxOff; bool bJITLoadStoreOff, bJITLoadStorelXzOff, bJITLoadStorelwzOff, bJITLoadStorelbzxOff;
bool bJITLoadStoreFloatingOff; bool bJITLoadStoreFloatingOff;
bool bJITLoadStorePairedOff; bool bJITLoadStorePairedOff;
bool bJITFloatingPointOff; bool bJITFloatingPointOff;
bool bJITIntegerOff; bool bJITIntegerOff;
bool bJITPairedOff; bool bJITPairedOff;
bool bJITSystemRegistersOff; bool bJITSystemRegistersOff;
bool bUseDualCore; bool bUseDualCore;
bool bSkipIdle; bool bSkipIdle;
bool bNTSC; bool bNTSC;
bool bHLEBios; bool bHLEBios;
bool bUseFastMem; bool bUseFastMem;
bool bLockThreads; bool bLockThreads;
bool bOptimizeQuantizers; bool bOptimizeQuantizers;
bool bEnableCheats; bool bEnableCheats;
bool bEnableIsoCache; bool bEnableIsoCache;
bool bRunCompareServer; bool bRunCompareServer;
bool bRunCompareClient; bool bRunCompareClient;
int SelectedLanguage; int SelectedLanguage;
bool bWii; bool bWii;
enum EBootBios enum EBootBios
{ {
BOOT_DEFAULT, BOOT_DEFAULT,
BOOT_BIOS_JAP, BOOT_BIOS_JAP,
BOOT_BIOS_USA, BOOT_BIOS_USA,
BOOT_BIOS_EUR, BOOT_BIOS_EUR,
}; };
enum EBootType enum EBootType
{ {
BOOT_ISO, BOOT_ISO,
BOOT_ELF, BOOT_ELF,
BOOT_DOL, BOOT_DOL,
BOOT_BIOS BOOT_BIOS
}; };
EBootType m_BootType; EBootType m_BootType;
// files // files
std::string m_strVideoPlugin; std::string m_strVideoPlugin;
std::string m_strPadPlugin; std::string m_strPadPlugin;
std::string m_strDSPPlugin; std::string m_strDSPPlugin;
std::string m_strWiimotePlugin; std::string m_strWiimotePlugin;
std::string m_strFilename; std::string m_strFilename;
std::string m_strBios; std::string m_strBios;
std::string m_strMemoryCardA; std::string m_strMemoryCardA;
std::string m_strMemoryCardB; std::string m_strMemoryCardB;
std::string m_strSRAM; std::string m_strSRAM;
std::string m_strDefaultGCM; std::string m_strDefaultGCM;
std::string m_strDVDRoot; std::string m_strDVDRoot;
std::string m_strUniqueID; std::string m_strUniqueID;
std::string m_strName; std::string m_strName;
// //
SCoreStartupParameter(); SCoreStartupParameter();
void LoadDefaults(); void LoadDefaults();
bool AutoSetup(EBootBios _BootBios); bool AutoSetup(EBootBios _BootBios);
const std::string &GetUniqueID() const { return m_strUniqueID; } const std::string &GetUniqueID() const { return m_strUniqueID; }
}; };
#endif #endif

View File

@ -1,85 +1,85 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _CORETIMING_H #ifndef _CORETIMING_H
#define _CORETIMING_H #define _CORETIMING_H
// This is a system to schedule events into the emulated machine's future. Time is measured // This is a system to schedule events into the emulated machine's future. Time is measured
// in main CPU clock cycles. // in main CPU clock cycles.
// To schedule an event, you first have to register its type. This is where you pass in the // To schedule an event, you first have to register its type. This is where you pass in the
// callback. You then schedule events using the type id you get back. // callback. You then schedule events using the type id you get back.
// See HW/SystemTimers.cpp for the main part of Dolphin's usage of this scheduler. // See HW/SystemTimers.cpp for the main part of Dolphin's usage of this scheduler.
// The int cyclesLate that the callbacks get is how many cycles late it was. // The int cyclesLate that the callbacks get is how many cycles late it was.
// So to schedule a new event on a regular basis: // So to schedule a new event on a regular basis:
// inside callback: // inside callback:
// ScheduleEvent(periodInCycles - cyclesLate, callback, "whatever") // ScheduleEvent(periodInCycles - cyclesLate, callback, "whatever")
#include "Common.h" #include "Common.h"
#include <string> #include <string>
#include "ChunkFile.h" #include "ChunkFile.h"
namespace CoreTiming namespace CoreTiming
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
typedef void (*TimedCallback)(u64 userdata, int cyclesLate); typedef void (*TimedCallback)(u64 userdata, int cyclesLate);
u64 GetTicks(); u64 GetTicks();
u64 GetIdleTicks(); u64 GetIdleTicks();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
// Returns the event_type identifier. // Returns the event_type identifier.
int RegisterEvent(const char *name, TimedCallback callback); int RegisterEvent(const char *name, TimedCallback callback);
void UnregisterAllEvents(); void UnregisterAllEvents();
// userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from disk, // userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from disk,
// when we implement state saves. // when we implement state saves.
void ScheduleEvent(int cyclesIntoFuture, int event_type, u64 userdata=0); void ScheduleEvent(int cyclesIntoFuture, int event_type, u64 userdata=0);
void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata=0); void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata=0);
// We only permit one event of each type in the queue at a time. // We only permit one event of each type in the queue at a time.
void RemoveEvent(int event_type); void RemoveEvent(int event_type);
bool IsScheduled(int event_type); bool IsScheduled(int event_type);
void Advance(); void Advance();
// Pretend that the main CPU has executed enough cycles to reach the next event. // Pretend that the main CPU has executed enough cycles to reach the next event.
void Idle(); void Idle();
// Clear all pending events. This should ONLY be done on exit or state load. // Clear all pending events. This should ONLY be done on exit or state load.
void ClearPendingEvents(); void ClearPendingEvents();
void LogPendingEvents(); void LogPendingEvents();
void SetMaximumSlice(int maximumSliceLength); void SetMaximumSlice(int maximumSliceLength);
void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted)); void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted));
std::string GetScheduledEventsSummary(); std::string GetScheduledEventsSummary();
extern int downcount; extern int downcount;
extern int slicelength; extern int slicelength;
}; // end of namespace }; // end of namespace
#endif #endif

View File

@ -1,32 +1,32 @@
#ifndef _DEBUGINTERFACE_H #ifndef _DEBUGINTERFACE_H
#define _DEBUGINTERFACE_H #define _DEBUGINTERFACE_H
#include <string> #include <string>
class DebugInterface class DebugInterface
{ {
protected: protected:
virtual ~DebugInterface() {} virtual ~DebugInterface() {}
public: public:
virtual const char *disasm(unsigned int /*address*/) {return "NODEBUGGER";} virtual const char *disasm(unsigned int /*address*/) {return "NODEBUGGER";}
virtual const char *getRawMemoryString(unsigned int /*address*/){return "NODEBUGGER";} virtual const char *getRawMemoryString(unsigned int /*address*/){return "NODEBUGGER";}
virtual int getInstructionSize(int /*instruction*/) {return 1;} virtual int getInstructionSize(int /*instruction*/) {return 1;}
virtual bool isAlive() {return true;} virtual bool isAlive() {return true;}
virtual bool isBreakpoint(unsigned int /*address*/) {return false;} virtual bool isBreakpoint(unsigned int /*address*/) {return false;}
virtual void setBreakpoint(unsigned int /*address*/){} virtual void setBreakpoint(unsigned int /*address*/){}
virtual void clearBreakpoint(unsigned int /*address*/){} virtual void clearBreakpoint(unsigned int /*address*/){}
virtual void clearAllBreakpoints() {} virtual void clearAllBreakpoints() {}
virtual void toggleBreakpoint(unsigned int /*address*/){} virtual void toggleBreakpoint(unsigned int /*address*/){}
virtual unsigned int readMemory(unsigned int /*address*/){return 0;} virtual unsigned int readMemory(unsigned int /*address*/){return 0;}
virtual unsigned int readInstruction(unsigned int /*address*/){return 0;} virtual unsigned int readInstruction(unsigned int /*address*/){return 0;}
virtual unsigned int getPC() {return 0;} virtual unsigned int getPC() {return 0;}
virtual void setPC(unsigned int /*address*/) {} virtual void setPC(unsigned int /*address*/) {}
virtual void step() {} virtual void step() {}
virtual void runToBreakpoint() {} virtual void runToBreakpoint() {}
virtual void insertBLR(unsigned int /*address*/) {} virtual void insertBLR(unsigned int /*address*/) {}
virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;} virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;}
virtual std::string getDescription(unsigned int /*address*/) = 0; virtual std::string getDescription(unsigned int /*address*/) = 0;
}; };
#endif #endif

View File

@ -1,100 +1,100 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DEBUGGER_BREAKPOINTS_H #ifndef _DEBUGGER_BREAKPOINTS_H
#define _DEBUGGER_BREAKPOINTS_H #define _DEBUGGER_BREAKPOINTS_H
#include <vector> #include <vector>
#include <string> #include <string>
#include "Common.h" #include "Common.h"
struct TBreakPoint struct TBreakPoint
{ {
u32 iAddress; u32 iAddress;
bool bOn; bool bOn;
bool bTemporary; bool bTemporary;
}; };
struct TMemCheck struct TMemCheck
{ {
TMemCheck(); TMemCheck();
u32 StartAddress; u32 StartAddress;
u32 EndAddress; u32 EndAddress;
bool bRange; bool bRange;
bool OnRead; bool OnRead;
bool OnWrite; bool OnWrite;
bool Log; bool Log;
bool Break; bool Break;
u32 numHits; u32 numHits;
void Action(u32 _iValue, u32 addr, bool write, int size, u32 pc); void Action(u32 _iValue, u32 addr, bool write, int size, u32 pc);
}; };
class CBreakPoints class CBreakPoints
{ {
public: public:
typedef std::vector<TBreakPoint> TBreakPoints; typedef std::vector<TBreakPoint> TBreakPoints;
typedef std::vector<TMemCheck> TMemChecks; typedef std::vector<TMemCheck> TMemChecks;
static const TBreakPoints& GetBreakPoints() { return m_BreakPoints; } static const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
static const TMemChecks& GetMemChecks() { return m_MemChecks; } static const TMemChecks& GetMemChecks() { return m_MemChecks; }
// is address breakpoint // is address breakpoint
static bool IsAddressBreakPoint(u32 _iAddress); static bool IsAddressBreakPoint(u32 _iAddress);
//memory breakpoint //memory breakpoint
static TMemCheck *GetMemCheck(u32 address); static TMemCheck *GetMemCheck(u32 address);
// is break on count // is break on count
static void SetBreakCount(u32 count) { m_iBreakOnCount = count; } static void SetBreakCount(u32 count) { m_iBreakOnCount = count; }
static u32 GetBreakCount() { return m_iBreakOnCount; } static u32 GetBreakCount() { return m_iBreakOnCount; }
static bool IsTempBreakPoint(u32 _iAddress); static bool IsTempBreakPoint(u32 _iAddress);
// AddBreakPoint // AddBreakPoint
static void AddBreakPoint(u32 _iAddress, bool temp=false); static void AddBreakPoint(u32 _iAddress, bool temp=false);
// Remove Breakpoint // Remove Breakpoint
static void RemoveBreakPoint(u32 _iAddress); static void RemoveBreakPoint(u32 _iAddress);
static void AddMemoryCheck(const TMemCheck& _rMemoryCheck); static void AddMemoryCheck(const TMemCheck& _rMemoryCheck);
static void ClearAllBreakPoints(); static void ClearAllBreakPoints();
static void UpdateBreakPointView(); static void UpdateBreakPointView();
static void AddAutoBreakpoints(); static void AddAutoBreakpoints();
static void DeleteElementByAddress(u32 _Address); static void DeleteElementByAddress(u32 _Address);
private: private:
static TBreakPoints m_BreakPoints; static TBreakPoints m_BreakPoints;
static TMemChecks m_MemChecks; static TMemChecks m_MemChecks;
static u32 m_iBreakOnCount; static u32 m_iBreakOnCount;
}; };
#endif #endif

View File

@ -1,43 +1,43 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DEBUGGER_SYMBOLMAP_H #ifndef _DEBUGGER_SYMBOLMAP_H
#define _DEBUGGER_SYMBOLMAP_H #define _DEBUGGER_SYMBOLMAP_H
#include <vector> #include <vector>
#include <string> #include <string>
#include "Common.h" #include "Common.h"
namespace Debugger namespace Debugger
{ {
struct CallstackEntry struct CallstackEntry
{ {
std::string Name; std::string Name;
u32 vAddress; u32 vAddress;
}; };
bool GetCallstack(std::vector<CallstackEntry> &output); bool GetCallstack(std::vector<CallstackEntry> &output);
void PrintCallstack(); void PrintCallstack();
void PrintCallstack(LogTypes::LOG_TYPE _Log); void PrintCallstack(LogTypes::LOG_TYPE _Log);
void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title); void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title);
} // end of namespace Debugger } // end of namespace Debugger
#endif #endif

View File

@ -1,52 +1,52 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// uncompress the dumps from costis GC-Debugger tool // uncompress the dumps from costis GC-Debugger tool
// //
// //
#ifndef _DUMP_H #ifndef _DUMP_H
#define _DUMP_H #define _DUMP_H
#include "Common.h" #include "Common.h"
class CDump class CDump
{ {
public: public:
CDump(const char* _szFilename); CDump(const char* _szFilename);
~CDump(); ~CDump();
int GetNumberOfSteps(); int GetNumberOfSteps();
u32 GetGPR(int _step, int _gpr); u32 GetGPR(int _step, int _gpr);
u32 GetPC(int _step); u32 GetPC(int _step);
private: private:
enum enum
{ {
OFFSET_GPR = 0x4, OFFSET_GPR = 0x4,
OFFSET_PC = 0x194, OFFSET_PC = 0x194,
STRUCTUR_SIZE = 0x2BC STRUCTUR_SIZE = 0x2BC
}; };
u8 *m_pData; u8 *m_pData;
bool m_bInit; bool m_bInit;
size_t m_size; size_t m_size;
u32 Read32(u32 _pos); u32 Read32(u32 _pos);
}; };
#endif #endif

View File

@ -1,109 +1,109 @@
#ifndef GCELF_H #ifndef GCELF_H
#define GCELF_H #define GCELF_H
// ELF File Types // ELF File Types
#define ET_NONE 0 // No file type #define ET_NONE 0 // No file type
#define ET_REL 1 // Relocatable file #define ET_REL 1 // Relocatable file
#define ET_EXEC 2 // Executable file #define ET_EXEC 2 // Executable file
#define ET_DYN 3 // Shared object file #define ET_DYN 3 // Shared object file
#define ET_CORE 4 // Core file #define ET_CORE 4 // Core file
#define ET_LOPROC 0xFF00 // Processor specific #define ET_LOPROC 0xFF00 // Processor specific
#define ET_HIPROC 0xFFFF // Processor specific #define ET_HIPROC 0xFFFF // Processor specific
// ELF Machine Types // ELF Machine Types
#define EM_NONE 0 // No machine #define EM_NONE 0 // No machine
#define EM_M32 1 // AT&T WE 32100 #define EM_M32 1 // AT&T WE 32100
#define EM_SPARC 2 // SPARC #define EM_SPARC 2 // SPARC
#define EM_386 3 // Intel Architecture #define EM_386 3 // Intel Architecture
#define EM_68K 4 // Motorola 68000 #define EM_68K 4 // Motorola 68000
#define EM_88K 5 // Motorola 88000 #define EM_88K 5 // Motorola 88000
#define EM_860 6 // Intel 80860 #define EM_860 6 // Intel 80860
#define EM_MIPS 7 // MIPS RS3000 Big-Endian #define EM_MIPS 7 // MIPS RS3000 Big-Endian
#define EM_MIPS_RS4_BE 8 // MIPS RS4000 Big-Endian #define EM_MIPS_RS4_BE 8 // MIPS RS4000 Big-Endian
#define EM_ARM 40 // ARM/Thumb Architecture #define EM_ARM 40 // ARM/Thumb Architecture
// ELF Version Types // ELF Version Types
#define EV_NONE 0 // Invalid version #define EV_NONE 0 // Invalid version
#define EV_CURRENT 1 // Current version #define EV_CURRENT 1 // Current version
// ELF Section Header Types // ELF Section Header Types
#define SHT_NULL 0 #define SHT_NULL 0
#define SHT_PROGBITS 1 #define SHT_PROGBITS 1
#define SHT_SYMTAB 2 #define SHT_SYMTAB 2
#define SHT_STRTAB 3 #define SHT_STRTAB 3
#define SHT_RELA 4 #define SHT_RELA 4
#define SHT_HASH 5 #define SHT_HASH 5
#define SHT_DYNAMIC 6 #define SHT_DYNAMIC 6
#define SHT_NOTE 7 #define SHT_NOTE 7
#define SHT_NOBITS 8 #define SHT_NOBITS 8
#define SHT_REL 9 #define SHT_REL 9
#define SHT_SHLIB 10 #define SHT_SHLIB 10
#define SHT_DYNSYM 11 #define SHT_DYNSYM 11
typedef struct typedef struct
{ {
unsigned char ID[4]; unsigned char ID[4];
unsigned char clazz; unsigned char clazz;
unsigned char data; unsigned char data;
unsigned char version; unsigned char version;
unsigned char pad[9]; unsigned char pad[9];
unsigned short e_type; // ELF file type unsigned short e_type; // ELF file type
unsigned short e_machine; // ELF target machine unsigned short e_machine; // ELF target machine
unsigned int e_version; // ELF file version number unsigned int e_version; // ELF file version number
unsigned int e_entry; unsigned int e_entry;
unsigned int e_phoff; unsigned int e_phoff;
unsigned int e_shoff; unsigned int e_shoff;
unsigned int e_flags; unsigned int e_flags;
unsigned short e_ehsize; unsigned short e_ehsize;
unsigned short e_phentsize; unsigned short e_phentsize;
unsigned short e_phnum; unsigned short e_phnum;
unsigned short e_shentsize; unsigned short e_shentsize;
unsigned short e_shnum; unsigned short e_shnum;
unsigned short e_shtrndx; unsigned short e_shtrndx;
} ELF_Header; } ELF_Header;
typedef struct { typedef struct {
unsigned int type; unsigned int type;
unsigned int offset; unsigned int offset;
unsigned int vaddr; unsigned int vaddr;
unsigned int paddr; unsigned int paddr;
unsigned int filesz; unsigned int filesz;
unsigned int memsz; unsigned int memsz;
unsigned int flags; unsigned int flags;
unsigned int align; unsigned int align;
} Program_Header; } Program_Header;
typedef struct typedef struct
{ {
unsigned int name; unsigned int name;
unsigned int type; unsigned int type;
unsigned int flags; unsigned int flags;
unsigned int addr; unsigned int addr;
unsigned int offset; unsigned int offset;
unsigned int size; unsigned int size;
unsigned int link; unsigned int link;
unsigned int info; unsigned int info;
unsigned int addralign; unsigned int addralign;
unsigned int entsize; unsigned int entsize;
} Section_Header; } Section_Header;
typedef struct { typedef struct {
unsigned int name; unsigned int name;
unsigned int value; unsigned int value;
unsigned int size; unsigned int size;
unsigned char info; unsigned char info;
unsigned char other; unsigned char other;
unsigned short shndx; unsigned short shndx;
} Symbol_Header; } Symbol_Header;
typedef struct { typedef struct {
unsigned int offset; unsigned int offset;
unsigned int info; unsigned int info;
signed int addend; signed int addend;
} Rela_Header; } Rela_Header;
const char ELFID[4] = {0x7F, 'E', 'L', 'F'}; const char ELFID[4] = {0x7F, 'E', 'L', 'F'};
#endif #endif

View File

@ -1,34 +1,34 @@
#ifndef _PPCDEBUGINTERFACE_H #ifndef _PPCDEBUGINTERFACE_H
#define _PPCDEBUGINTERFACE_H #define _PPCDEBUGINTERFACE_H
#include <string> #include <string>
#include "DebugInterface.h" #include "DebugInterface.h"
//wrapper between disasm control and Dolphin debugger //wrapper between disasm control and Dolphin debugger
class PPCDebugInterface : public DebugInterface class PPCDebugInterface : public DebugInterface
{ {
public: public:
PPCDebugInterface(){} PPCDebugInterface(){}
virtual const char *disasm(unsigned int address); virtual const char *disasm(unsigned int address);
virtual const char *getRawMemoryString(unsigned int address); virtual const char *getRawMemoryString(unsigned int address);
virtual int getInstructionSize(int instruction) {return 4;} virtual int getInstructionSize(int instruction) {return 4;}
virtual bool isAlive(); virtual bool isAlive();
virtual bool isBreakpoint(unsigned int address); virtual bool isBreakpoint(unsigned int address);
virtual void setBreakpoint(unsigned int address); virtual void setBreakpoint(unsigned int address);
virtual void clearBreakpoint(unsigned int address); virtual void clearBreakpoint(unsigned int address);
virtual void clearAllBreakpoints(); virtual void clearAllBreakpoints();
virtual void toggleBreakpoint(unsigned int address); virtual void toggleBreakpoint(unsigned int address);
virtual unsigned int readMemory(unsigned int address); virtual unsigned int readMemory(unsigned int address);
virtual unsigned int readInstruction(unsigned int address); virtual unsigned int readInstruction(unsigned int address);
virtual unsigned int getPC(); virtual unsigned int getPC();
virtual void setPC(unsigned int address); virtual void setPC(unsigned int address);
virtual void step() {} virtual void step() {}
virtual void runToBreakpoint(); virtual void runToBreakpoint();
virtual void insertBLR(unsigned int address); virtual void insertBLR(unsigned int address);
virtual int getColor(unsigned int address); virtual int getColor(unsigned int address);
virtual std::string getDescription(unsigned int address); virtual std::string getDescription(unsigned int address);
}; };
#endif #endif

View File

@ -1,120 +1,120 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N /////////////////////////////////////////////////////////////////////////// // M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include "Common.h" #include "Common.h"
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
// C L A S S///////////////////////////////////////////////////////////////////////////////////////// // C L A S S/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
class CDolLoader class CDolLoader
{ {
public: public:
CDolLoader(const char* _szFilename) : CDolLoader(const char* _szFilename) :
m_bInit(false) m_bInit(false)
{ {
// try to open file // try to open file
FILE* pStream = NULL; FILE* pStream = NULL;
fopen_s(&pStream, _szFilename, "rb"); fopen_s(&pStream, _szFilename, "rb");
if (pStream) if (pStream)
{ {
fread(&m_dolheader, 1, sizeof(SDolHeader), pStream); fread(&m_dolheader, 1, sizeof(SDolHeader), pStream);
// swap memory // swap memory
u32* p = (u32*)&m_dolheader; u32* p = (u32*)&m_dolheader;
for (int i=0; i<(sizeof(SDolHeader)>>2); i++) for (int i=0; i<(sizeof(SDolHeader)>>2); i++)
p[i] = Common::swap32(p[i]); p[i] = Common::swap32(p[i]);
// load all text (code) sections // load all text (code) sections
for(int i=0; i<DOL_NUM_TEXT; i++) for(int i=0; i<DOL_NUM_TEXT; i++)
{ {
if(m_dolheader.textOffset[i] != 0) if(m_dolheader.textOffset[i] != 0)
{ {
u8* pTemp = new u8[m_dolheader.textSize[i]]; u8* pTemp = new u8[m_dolheader.textSize[i]];
fseek(pStream, m_dolheader.textOffset[i], SEEK_SET); fseek(pStream, m_dolheader.textOffset[i], SEEK_SET);
fread(pTemp, 1, m_dolheader.textSize[i], pStream); fread(pTemp, 1, m_dolheader.textSize[i], pStream);
for (size_t num=0; num<m_dolheader.textSize[i]; num++) for (size_t num=0; num<m_dolheader.textSize[i]; num++)
CMemory::Write_U8(pTemp[num], m_dolheader.textAddress[i] + num); CMemory::Write_U8(pTemp[num], m_dolheader.textAddress[i] + num);
delete [] pTemp; delete [] pTemp;
} }
} }
// load all data sections // load all data sections
for(int i=0; i<DOL_NUM_DATA; i++) for(int i=0; i<DOL_NUM_DATA; i++)
{ {
if(m_dolheader.dataOffset[i] != 0) if(m_dolheader.dataOffset[i] != 0)
{ {
u8* pTemp = new u8[m_dolheader.dataSize[i]]; u8* pTemp = new u8[m_dolheader.dataSize[i]];
fseek(pStream, m_dolheader.dataOffset[i], SEEK_SET); fseek(pStream, m_dolheader.dataOffset[i], SEEK_SET);
fread(pTemp, 1, m_dolheader.dataSize[i], pStream); fread(pTemp, 1, m_dolheader.dataSize[i], pStream);
for (size_t num=0; num<m_dolheader.dataSize[i]; num++) for (size_t num=0; num<m_dolheader.dataSize[i]; num++)
CMemory::Write_U8(pTemp[num], m_dolheader.dataAddress[i] + num); CMemory::Write_U8(pTemp[num], m_dolheader.dataAddress[i] + num);
delete [] pTemp; delete [] pTemp;
} }
} }
fclose(pStream); fclose(pStream);
m_bInit = true; m_bInit = true;
} }
} }
_u32 GetEntryPoint(void) _u32 GetEntryPoint(void)
{ {
return m_dolheader.entryPoint; return m_dolheader.entryPoint;
} }
private: private:
enum enum
{ {
DOL_NUM_TEXT = 7, DOL_NUM_TEXT = 7,
DOL_NUM_DATA = 11 DOL_NUM_DATA = 11
}; };
struct SDolHeader struct SDolHeader
{ {
_u32 textOffset[DOL_NUM_TEXT]; _u32 textOffset[DOL_NUM_TEXT];
_u32 dataOffset[DOL_NUM_DATA]; _u32 dataOffset[DOL_NUM_DATA];
_u32 textAddress[DOL_NUM_TEXT]; _u32 textAddress[DOL_NUM_TEXT];
_u32 dataAddress[DOL_NUM_DATA]; _u32 dataAddress[DOL_NUM_DATA];
_u32 textSize[DOL_NUM_TEXT]; _u32 textSize[DOL_NUM_TEXT];
_u32 dataSize[DOL_NUM_DATA]; _u32 dataSize[DOL_NUM_DATA];
_u32 bssAddress; _u32 bssAddress;
_u32 bssSize; _u32 bssSize;
_u32 entryPoint; _u32 entryPoint;
_u32 padd[7]; _u32 padd[7];
}; };
SDolHeader m_dolheader; SDolHeader m_dolheader;
bool m_bInit; bool m_bInit;
}; };

View File

@ -1,31 +1,31 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _HLE_H #ifndef _HLE_H
#define _HLE_H #define _HLE_H
#include "Common.h" #include "Common.h"
namespace HLE namespace HLE
{ {
void PatchFunctions(); void PatchFunctions();
void Patch(u32 pc, const char *func_name); void Patch(u32 pc, const char *func_name);
void Execute(u32 _CurrentPC, u32 _Instruction); void Execute(u32 _CurrentPC, u32 _Instruction);
} }
#endif #endif

View File

@ -1,38 +1,38 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef HLE_MISC_H #ifndef HLE_MISC_H
#define HLE_MISC_H #define HLE_MISC_H
namespace HLE_Misc namespace HLE_Misc
{ {
void Pass(); void Pass();
void PanicAlert(); void PanicAlert();
void UnimplementedFunction(); void UnimplementedFunction();
void UnimplementedFunctionTrue(); void UnimplementedFunctionTrue();
void UnimplementedFunctionFalse(); void UnimplementedFunctionFalse();
void GXPeekZ(); void GXPeekZ();
void GXPeekARGB(); void GXPeekARGB();
void SMB_EvilVecCosine(); void SMB_EvilVecCosine();
void SMB_EvilNormalize(); void SMB_EvilNormalize();
void SMB_sqrt_internal(); void SMB_sqrt_internal();
void SMB_rsqrt_internal(); void SMB_rsqrt_internal();
void SMB_atan2(); void SMB_atan2();
void SMB_evil_vec_setlength(); void SMB_evil_vec_setlength();
} }
#endif #endif

View File

@ -1,31 +1,31 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef HLE_OS_H #ifndef HLE_OS_H
#define HLE_OS_H #define HLE_OS_H
#include "Common.h" #include "Common.h"
namespace HLE_OS namespace HLE_OS
{ {
void HLE_vprintf(); void HLE_vprintf();
void HLE_printf(); void HLE_printf();
void HLE_OSReport(); void HLE_OSReport();
void HLE_OSPanic(); void HLE_OSPanic();
} }
#endif #endif

View File

@ -1,48 +1,48 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// See CPP file for comments. // See CPP file for comments.
#ifndef _AUDIOINTERFACE_H #ifndef _AUDIOINTERFACE_H
#define _AUDIOINTERFACE_H #define _AUDIOINTERFACE_H
#include "CommonTypes.h" #include "CommonTypes.h"
class PointerWrap; class PointerWrap;
namespace AudioInterface namespace AudioInterface
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void Update(); void Update();
// Calls by DSP plugin // Calls by DSP plugin
u32 Callback_GetStreaming(short* _pDestBuffer, u32 _numSamples); u32 Callback_GetStreaming(short* _pDestBuffer, u32 _numSamples);
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress); void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
// Get the audio rates (48000 or 32000 only) // Get the audio rates (48000 or 32000 only)
u32 GetAISampleRate(); u32 GetAISampleRate();
u32 GetDSPSampleRate(); u32 GetDSPSampleRate();
} // namespace } // namespace
#endif #endif

View File

@ -1,60 +1,60 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _CPU_H #ifndef _CPU_H
#define _CPU_H #define _CPU_H
#include "Common.h" #include "Common.h"
namespace Common { namespace Common {
class Event; class Event;
} }
class CCPU class CCPU
{ {
public: public:
// init // init
static void Init(); static void Init();
// shutdown // shutdown
static void Shutdown(); static void Shutdown();
// starts the CPU // starts the CPU
static void Run(); static void Run();
// causes shutdown // causes shutdown
static void Stop(); static void Stop();
// Reset // Reset
static void Reset(); static void Reset();
// StepOpcode (Steps one Opcode) // StepOpcode (Steps one Opcode)
static void StepOpcode(Common::Event *event = 0); static void StepOpcode(Common::Event *event = 0);
// one step only // one step only
static void SingleStep(); static void SingleStep();
// Enable or Disable Stepping // Enable or Disable Stepping
static void EnableStepping(const bool _bStepping); static void EnableStepping(const bool _bStepping);
// is stepping ? // is stepping ?
static bool IsStepping(); static bool IsStepping();
// break // break
static void Break(); static void Break();
}; };
#endif #endif

View File

@ -1,50 +1,50 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Sets up and maintains interprocess communication to make it possible // Sets up and maintains interprocess communication to make it possible
// to easily compare any two cpu cores by running two instances of DolphinHLE and // to easily compare any two cpu cores by running two instances of DolphinHLE and
// comparing them to each other. // comparing them to each other.
// //
#ifndef _CPUCOMPARE_H #ifndef _CPUCOMPARE_H
#define _CPUCOMPARE_H #define _CPUCOMPARE_H
#include "Common.h" #include "Common.h"
namespace CPUCompare namespace CPUCompare
{ {
// start the server // start the server
void StartServer(); void StartServer();
// connect as client // connect as client
void ConnectAsClient(); void ConnectAsClient();
// stop // stop
void Stop(); void Stop();
// sync // sync
int Sync(); int Sync();
// IsEnabled // IsEnabled
bool IsEnabled(); bool IsEnabled();
// IsServer // IsServer
bool IsServer(); bool IsServer();
void SetBlockStart(u32 addr); void SetBlockStart(u32 addr);
} }
#endif #endif

View File

@ -1,89 +1,89 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _COMMANDPROCESSOR_H #ifndef _COMMANDPROCESSOR_H
#define _COMMANDPROCESSOR_H #define _COMMANDPROCESSOR_H
#include "Common.h" #include "Common.h"
#include "pluginspecs_video.h" #include "pluginspecs_video.h"
class PointerWrap; class PointerWrap;
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
extern bool MT; extern bool MT;
namespace CommandProcessor namespace CommandProcessor
{ {
// internal hardware addresses // internal hardware addresses
enum enum
{ {
STATUS_REGISTER = 0x00, STATUS_REGISTER = 0x00,
CTRL_REGISTER = 0x02, CTRL_REGISTER = 0x02,
CLEAR_REGISTER = 0x04, CLEAR_REGISTER = 0x04,
FIFO_TOKEN_REGISTER = 0x0E, FIFO_TOKEN_REGISTER = 0x0E,
FIFO_BOUNDING_BOX_LEFT = 0x10, FIFO_BOUNDING_BOX_LEFT = 0x10,
FIFO_BOUNDING_BOX_RIGHT = 0x12, FIFO_BOUNDING_BOX_RIGHT = 0x12,
FIFO_BOUNDING_BOX_TOP = 0x14, FIFO_BOUNDING_BOX_TOP = 0x14,
FIFO_BOUNDING_BOX_BOTTOM = 0x16, FIFO_BOUNDING_BOX_BOTTOM = 0x16,
FIFO_BASE_LO = 0x20, FIFO_BASE_LO = 0x20,
FIFO_BASE_HI = 0x22, FIFO_BASE_HI = 0x22,
FIFO_END_LO = 0x24, FIFO_END_LO = 0x24,
FIFO_END_HI = 0x26, FIFO_END_HI = 0x26,
FIFO_HI_WATERMARK_LO = 0x28, FIFO_HI_WATERMARK_LO = 0x28,
FIFO_HI_WATERMARK_HI = 0x2a, FIFO_HI_WATERMARK_HI = 0x2a,
FIFO_LO_WATERMARK_LO = 0x2c, FIFO_LO_WATERMARK_LO = 0x2c,
FIFO_LO_WATERMARK_HI = 0x2e, FIFO_LO_WATERMARK_HI = 0x2e,
FIFO_RW_DISTANCE_LO = 0x30, FIFO_RW_DISTANCE_LO = 0x30,
FIFO_RW_DISTANCE_HI = 0x32, FIFO_RW_DISTANCE_HI = 0x32,
FIFO_WRITE_POINTER_LO = 0x34, FIFO_WRITE_POINTER_LO = 0x34,
FIFO_WRITE_POINTER_HI = 0x36, FIFO_WRITE_POINTER_HI = 0x36,
FIFO_READ_POINTER_LO = 0x38, FIFO_READ_POINTER_LO = 0x38,
FIFO_READ_POINTER_HI = 0x3A, FIFO_READ_POINTER_HI = 0x3A,
FIFO_BP_LO = 0x3C, FIFO_BP_LO = 0x3C,
FIFO_BP_HI = 0x3E FIFO_BP_HI = 0x3E
}; };
extern SCPFifoStruct fifo; extern SCPFifoStruct fifo;
// Init // Init
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
// Read // Read
void HWCALL Read16(u16& _rReturnValue, const u32 _Address); void HWCALL Read16(u16& _rReturnValue, const u32 _Address);
void HWCALL Write16(const u16 _Data, const u32 _Address); void HWCALL Write16(const u16 _Data, const u32 _Address);
void HWCALL Read32(u32& _rReturnValue, const u32 _Address); void HWCALL Read32(u32& _rReturnValue, const u32 _Address);
void HWCALL Write32(const u32 _Data, const u32 _Address); void HWCALL Write32(const u32 _Data, const u32 _Address);
// for CGPFIFO // for CGPFIFO
void CatchUpGPU(); void CatchUpGPU();
void GatherPipeBursted(); void GatherPipeBursted();
void UpdateInterrupts(); void UpdateInterrupts();
void UpdateInterruptsFromVideoPlugin(); void UpdateInterruptsFromVideoPlugin();
bool AllowIdleSkipping(); bool AllowIdleSkipping();
// for DC GP watchdog hack // for DC GP watchdog hack
void IncrementGPWDToken(); void IncrementGPWDToken();
void WaitForFrameFinish(); void WaitForFrameFinish();
} // end of namespace CommandProcessor } // end of namespace CommandProcessor
#endif #endif

View File

@ -1,60 +1,60 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSPINTERFACE_H #ifndef _DSPINTERFACE_H
#define _DSPINTERFACE_H #define _DSPINTERFACE_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace DSP namespace DSP
{ {
enum DSPInterruptType enum DSPInterruptType
{ {
INT_DSP = 0, INT_DSP = 0,
INT_ARAM = 1, INT_ARAM = 1,
INT_AID = 2 INT_AID = 2
}; };
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void GenerateDSPInterrupt(DSPInterruptType _DSPInterruptType, bool _bSet = true); void GenerateDSPInterrupt(DSPInterruptType _DSPInterruptType, bool _bSet = true);
void GenerateDSPInterruptFromPlugin(DSPInterruptType _DSPInterruptType, bool _bSet = true); void GenerateDSPInterruptFromPlugin(DSPInterruptType _DSPInterruptType, bool _bSet = true);
// Read32 // Read32
void HWCALL Read16(u16& _uReturnValue, const u32 _uAddress); void HWCALL Read16(u16& _uReturnValue, const u32 _uAddress);
void HWCALL Read32(u32& _uReturnValue, const u32 _uAddress); void HWCALL Read32(u32& _uReturnValue, const u32 _uAddress);
// Write // Write
void HWCALL Write16(const u16 _uValue, const u32 _uAddress); void HWCALL Write16(const u16 _uValue, const u32 _uAddress);
void HWCALL Write32(const u32 _uValue, const u32 _uAddress); void HWCALL Write32(const u32 _uValue, const u32 _uAddress);
// Audio/DSP Plugin Helper // Audio/DSP Plugin Helper
u8 ReadARAM(const u32 _uAddress); u8 ReadARAM(const u32 _uAddress);
// Debugger Helper // Debugger Helper
u8* GetARAMPtr(); u8* GetARAMPtr();
void UpdateAudioDMA(); void UpdateAudioDMA();
}// end of namespace DSP }// end of namespace DSP
#endif #endif

View File

@ -1,50 +1,50 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DVDINTERFACE_H #ifndef _DVDINTERFACE_H
#define _DVDINTERFACE_H #define _DVDINTERFACE_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace DVDInterface namespace DVDInterface
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void SetDiscInside(bool _DiscInside); void SetDiscInside(bool _DiscInside);
// Lid Functions // Lid Functions
void SetLidOpen(bool open); void SetLidOpen(bool open);
bool IsLidOpen(); bool IsLidOpen();
// DVD Access Functions // DVD Access Functions
bool DVDRead(u32 _iDVDOffset, u32 _iRamAddress, u32 _iLength); bool DVDRead(u32 _iDVDOffset, u32 _iRamAddress, u32 _iLength);
bool DVDReadADPCM(u8* _pDestBuffer, u32 _iNumSamples); bool DVDReadADPCM(u8* _pDestBuffer, u32 _iNumSamples);
// Read32 // Read32
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
// Write32 // Write32
void HWCALL Write32(const u32 _iValue, const u32 _iAddress); void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
} // end of namespace DVDInterface } // end of namespace DVDInterface
#endif #endif

View File

@ -1,39 +1,39 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EXIINTERFACE_H #ifndef _EXIINTERFACE_H
#define _EXIINTERFACE_H #define _EXIINTERFACE_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace ExpansionInterface namespace ExpansionInterface
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void Update(); void Update();
void UpdateInterrupts(); void UpdateInterrupts();
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress); void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
} // end of namespace ExpansionInterface } // end of namespace ExpansionInterface
#endif #endif

View File

@ -1,113 +1,113 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EXICHANNEL_H #ifndef _EXICHANNEL_H
#define _EXICHANNEL_H #define _EXICHANNEL_H
#include "Common.h" #include "Common.h"
#include "EXI_Device.h" #include "EXI_Device.h"
class CEXIChannel class CEXIChannel
{ {
private: private:
enum enum
{ {
EXI_STATUS = 0, EXI_STATUS = 0,
EXI_DMAADDR = 1, EXI_DMAADDR = 1,
EXI_DMALENGTH = 2, EXI_DMALENGTH = 2,
EXI_DMACONTROL = 3, EXI_DMACONTROL = 3,
EXI_IMMDATA = 4 EXI_IMMDATA = 4
}; };
// EXI Status Register // EXI Status Register
union UEXI_STATUS union UEXI_STATUS
{ {
u32 hex; u32 hex;
struct struct
{ {
unsigned EXIINTMASK : 1; // 31 unsigned EXIINTMASK : 1; // 31
unsigned EXIINT : 1; //30 unsigned EXIINT : 1; //30
unsigned TCINTMASK : 1; //29 unsigned TCINTMASK : 1; //29
unsigned TCINT : 1; //28 unsigned TCINT : 1; //28
unsigned CLK : 3; //27 unsigned CLK : 3; //27
unsigned CHIP_SELECT : 3; //24 unsigned CHIP_SELECT : 3; //24
unsigned EXTINTMASK : 1; //21 unsigned EXTINTMASK : 1; //21
unsigned EXTINT : 1; //20 unsigned EXTINT : 1; //20
unsigned EXT : 1; // External Insertion Status (1: External EXI device present) //19 unsigned EXT : 1; // External Insertion Status (1: External EXI device present) //19
unsigned ROMDIS : 1; // ROM Disable //18 unsigned ROMDIS : 1; // ROM Disable //18
unsigned :18; unsigned :18;
}; };
UEXI_STATUS() {hex = 0;} UEXI_STATUS() {hex = 0;}
UEXI_STATUS(u32 _hex) {hex = _hex;} UEXI_STATUS(u32 _hex) {hex = _hex;}
}; };
// EXI Control Register // EXI Control Register
union UEXI_CONTROL union UEXI_CONTROL
{ {
u32 hex; u32 hex;
struct struct
{ {
unsigned TSTART : 1; unsigned TSTART : 1;
unsigned DMA : 1; unsigned DMA : 1;
unsigned RW : 2; unsigned RW : 2;
unsigned TLEN : 2; unsigned TLEN : 2;
unsigned :26; unsigned :26;
}; };
}; };
// STATE_TO_SAVE // STATE_TO_SAVE
UEXI_STATUS m_Status; UEXI_STATUS m_Status;
UEXI_CONTROL m_Control; UEXI_CONTROL m_Control;
u32 m_DMAMemoryAddress; u32 m_DMAMemoryAddress;
u32 m_DMALength; u32 m_DMALength;
u32 m_ImmData; u32 m_ImmData;
// get device // get device
IEXIDevice* GetDevice(u8 _CHIP_SELECT); IEXIDevice* GetDevice(u8 _CHIP_SELECT);
// Devices // Devices
enum enum
{ {
NUM_DEVICES = 3 NUM_DEVICES = 3
}; };
IEXIDevice* m_pDevices[NUM_DEVICES]; IEXIDevice* m_pDevices[NUM_DEVICES];
public: public:
// channelId for debugging // channelId for debugging
u32 m_ChannelId; u32 m_ChannelId;
CEXIChannel(); CEXIChannel();
~CEXIChannel(); ~CEXIChannel();
void AddDevice(const TEXIDevices _device, const unsigned int _iSlot); void AddDevice(const TEXIDevices _device, const unsigned int _iSlot);
// Remove all devices // Remove all devices
void RemoveDevices(); void RemoveDevices();
void Read32(u32& _uReturnValue, const u32 _iRegister); void Read32(u32& _uReturnValue, const u32 _iRegister);
void Write32(const u32 _iValue, const u32 _iRegister); void Write32(const u32 _iValue, const u32 _iRegister);
void Update(); void Update();
bool IsCausingInterrupt(); bool IsCausingInterrupt();
void UpdateInterrupts(); void UpdateInterrupts();
}; };
#endif #endif

View File

@ -1,64 +1,64 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EXIDEVICE_H #ifndef _EXIDEVICE_H
#define _EXIDEVICE_H #define _EXIDEVICE_H
#include "Common.h" #include "Common.h"
class IEXIDevice class IEXIDevice
{ {
private: private:
// byte transfer function for this device // byte transfer function for this device
virtual void TransferByte(u8& _byte) {}; virtual void TransferByte(u8& _byte) {};
public: public:
// immediate copy functions // immediate copy functions
virtual void ImmWrite(u32 _uData, u32 _uSize); virtual void ImmWrite(u32 _uData, u32 _uSize);
virtual u32 ImmRead(u32 _uSize); virtual u32 ImmRead(u32 _uSize);
// dma copy functions // dma copy functions
virtual void DMAWrite(u32 _uAddr, u32 _uSize); virtual void DMAWrite(u32 _uAddr, u32 _uSize);
virtual void DMARead (u32 _uAddr, u32 _uSize); virtual void DMARead (u32 _uAddr, u32 _uSize);
virtual bool IsPresent(); virtual bool IsPresent();
virtual void SetCS(int _iCS); virtual void SetCS(int _iCS);
// update // update
virtual void Update(); virtual void Update();
// is generating interrupt ? // is generating interrupt ?
virtual bool IsInterruptSet(); virtual bool IsInterruptSet();
virtual ~IEXIDevice() {}; virtual ~IEXIDevice() {};
}; };
enum TEXIDevices enum TEXIDevices
{ {
EXIDEVICE_DUMMY, EXIDEVICE_DUMMY,
EXIDEVICE_MEMORYCARD_A, EXIDEVICE_MEMORYCARD_A,
EXIDEVICE_MEMORYCARD_B, EXIDEVICE_MEMORYCARD_B,
EXIDEVICE_IPL, EXIDEVICE_IPL,
EXIDEVICE_AD16, EXIDEVICE_AD16,
EXIDEVICE_MIC, EXIDEVICE_MIC,
EXIDEVICE_ETH, EXIDEVICE_ETH,
}; };
extern IEXIDevice* EXIDevice_Create(TEXIDevices _EXIDevice); extern IEXIDevice* EXIDevice_Create(TEXIDevices _EXIDevice);
#endif #endif

View File

@ -1,51 +1,51 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EXIDEVICE_AD16_H #ifndef _EXIDEVICE_AD16_H
#define _EXIDEVICE_AD16_H #define _EXIDEVICE_AD16_H
class CEXIAD16 : public IEXIDevice class CEXIAD16 : public IEXIDevice
{ {
public: public:
CEXIAD16(); CEXIAD16();
virtual void SetCS(int _iCS); virtual void SetCS(int _iCS);
virtual bool IsPresent(); virtual bool IsPresent();
private: private:
enum enum
{ {
init = 0x00, init = 0x00,
write = 0xa0, write = 0xa0,
read = 0xa2 read = 0xa2
}; };
union UAD16Reg union UAD16Reg
{ {
u32 U32; u32 U32;
u32 U8[4]; u32 U8[4];
}; };
// STATE_TO_SAVE // STATE_TO_SAVE
u32 m_uPosition; u32 m_uPosition;
u32 m_uCommand; u32 m_uCommand;
UAD16Reg m_uAD16Register; UAD16Reg m_uAD16Register;
virtual void TransferByte(u8& _uByte); virtual void TransferByte(u8& _uByte);
}; };
#endif #endif

View File

@ -1,62 +1,62 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EXIDEVICE_IPL_H #ifndef _EXIDEVICE_IPL_H
#define _EXIDEVICE_IPL_H #define _EXIDEVICE_IPL_H
#include "EXI_Device.h" #include "EXI_Device.h"
class CEXIIPL : public IEXIDevice class CEXIIPL : public IEXIDevice
{ {
public: public:
CEXIIPL(); CEXIIPL();
virtual ~CEXIIPL(); virtual ~CEXIIPL();
virtual void SetCS(int _iCS); virtual void SetCS(int _iCS);
bool IsPresent(); bool IsPresent();
static u32 GetGCTime(); static u32 GetGCTime();
private: private:
enum enum
{ {
ROM_SIZE = 1024*1024*2, ROM_SIZE = 1024*1024*2,
ROM_MASK = (ROM_SIZE - 1) ROM_MASK = (ROM_SIZE - 1)
}; };
//! IPL //! IPL
u8* m_pIPL; u8* m_pIPL;
// STATE_TO_SAVE // STATE_TO_SAVE
//! RealTimeClock //! RealTimeClock
u8 m_RTC[4]; u8 m_RTC[4];
//! SRam //! SRam
u8 m_SRAM[64]; u8 m_SRAM[64];
//! Helper //! Helper
u32 m_uPosition; u32 m_uPosition;
u32 m_uAddress; u32 m_uAddress;
u32 m_uRWOffset; u32 m_uRWOffset;
char m_szBuffer[256]; char m_szBuffer[256];
int m_count; int m_count;
virtual void TransferByte(u8 &_uByte); virtual void TransferByte(u8 &_uByte);
}; };
#endif #endif

View File

@ -1,85 +1,85 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EXI_DEVICEMEMORYCARD_H #ifndef _EXI_DEVICEMEMORYCARD_H
#define _EXI_DEVICEMEMORYCARD_H #define _EXI_DEVICEMEMORYCARD_H
class CEXIMemoryCard : public IEXIDevice class CEXIMemoryCard : public IEXIDevice
{ {
public: public:
CEXIMemoryCard(const std::string& _rName, const std::string& _rFilename, int card_index); CEXIMemoryCard(const std::string& _rName, const std::string& _rFilename, int card_index);
virtual ~CEXIMemoryCard(); virtual ~CEXIMemoryCard();
void SetCS(int cs); void SetCS(int cs);
void Update(); void Update();
bool IsInterruptSet(); bool IsInterruptSet();
bool IsPresent(); bool IsPresent();
inline const std::string &GetFileName() const { return m_strFilename; }; inline const std::string &GetFileName() const { return m_strFilename; };
private: private:
// This is scheduled whenever a page write is issued. The this pointer is passed // This is scheduled whenever a page write is issued. The this pointer is passed
// through the userdata parameter, so that it can then call Flush on the right card. // through the userdata parameter, so that it can then call Flush on the right card.
static void FlushCallback(u64 userdata, int cyclesLate); static void FlushCallback(u64 userdata, int cyclesLate);
// Flushes the memory card contents to disk. // Flushes the memory card contents to disk.
void Flush(bool exiting = false); void Flush(bool exiting = false);
enum enum
{ {
cmdNintendoID = 0x00, cmdNintendoID = 0x00,
cmdReadArray = 0x52, cmdReadArray = 0x52,
cmdArrayToBuffer = 0x53, cmdArrayToBuffer = 0x53,
cmdSetInterrupt = 0x81, cmdSetInterrupt = 0x81,
cmdWriteBuffer = 0x82, cmdWriteBuffer = 0x82,
cmdReadStatus = 0x83, cmdReadStatus = 0x83,
cmdReadID = 0x85, cmdReadID = 0x85,
cmdReadErrorBuffer = 0x86, cmdReadErrorBuffer = 0x86,
cmdWakeUp = 0x87, cmdWakeUp = 0x87,
cmdSleep = 0x88, cmdSleep = 0x88,
cmdClearStatus = 0x89, cmdClearStatus = 0x89,
cmdSectorErase = 0xF1, cmdSectorErase = 0xF1,
cmdPageProgram = 0xF2, cmdPageProgram = 0xF2,
cmdExtraByteProgram = 0xF3, cmdExtraByteProgram = 0xF3,
cmdChipErase = 0xF4, cmdChipErase = 0xF4,
}; };
std::string m_strFilename; std::string m_strFilename;
int card_index; int card_index;
int et_this_card; int et_this_card;
//! memory card state //! memory card state
// STATE_TO_SAVE // STATE_TO_SAVE
int interruptSwitch; int interruptSwitch;
bool m_bInterruptSet; bool m_bInterruptSet;
int command; int command;
int status; int status;
u32 m_uPosition; u32 m_uPosition;
u8 programming_buffer[128]; u8 programming_buffer[128];
u32 formatDelay; u32 formatDelay;
//! memory card parameters //! memory card parameters
unsigned int nintendo_card_id, card_id; unsigned int nintendo_card_id, card_id;
unsigned int address; unsigned int address;
int memory_card_size; //! in bytes, must be power of 2. int memory_card_size; //! in bytes, must be power of 2.
u8 *memory_card_content; u8 *memory_card_content;
protected: protected:
virtual void TransferByte(u8 &byte); virtual void TransferByte(u8 &byte);
}; };
#endif #endif

View File

@ -1,61 +1,61 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _GPFIFO_H #ifndef _GPFIFO_H
#define _GPFIFO_H #define _GPFIFO_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace GPFifo namespace GPFifo
{ {
enum enum
{ {
GATHER_PIPE_SIZE = 32 GATHER_PIPE_SIZE = 32
}; };
extern u8 m_gatherPipe[GATHER_PIPE_SIZE*16]; //more room, for the fastmodes extern u8 m_gatherPipe[GATHER_PIPE_SIZE*16]; //more room, for the fastmodes
// pipe counter // pipe counter
extern u32 m_gatherPipeCount; extern u32 m_gatherPipeCount;
// Init // Init
void Init(); void Init();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
// ResetGatherPipe // ResetGatherPipe
void ResetGatherPipe(); void ResetGatherPipe();
void CheckGatherPipe(); void CheckGatherPipe();
bool IsEmpty(); bool IsEmpty();
// Write // Write
void HWCALL Write8(const u8 _iValue, const u32 _iAddress); void HWCALL Write8(const u8 _iValue, const u32 _iAddress);
void HWCALL Write16(const u16 _iValue, const u32 _iAddress); void HWCALL Write16(const u16 _iValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress); void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
// These expect pre-byteswapped values // These expect pre-byteswapped values
// Also there's an upper limit of about 512 per batch // Also there's an upper limit of about 512 per batch
// Most likely these should be inlined into JIT instead // Most likely these should be inlined into JIT instead
void HWCALL FastWrite8(const u8 _iValue); void HWCALL FastWrite8(const u8 _iValue);
void HWCALL FastWrite16(const u16 _iValue); void HWCALL FastWrite16(const u16 _iValue);
void HWCALL FastWrite32(const u32 _iValue); void HWCALL FastWrite32(const u32 _iValue);
}; };
#endif #endif

View File

@ -1,31 +1,31 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _HW_H #ifndef _HW_H
#define _HW_H #define _HW_H
#include "Common.h" #include "Common.h"
#include "ChunkFile.h" #include "ChunkFile.h"
namespace HW namespace HW
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
} }
#endif #endif

View File

@ -1,136 +1,136 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _MEMMAP_H #ifndef _MEMMAP_H
#define _MEMMAP_H #define _MEMMAP_H
#include <string> #include <string>
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
typedef void (HWCALL *writeFn8 )(const u8, const u32); typedef void (HWCALL *writeFn8 )(const u8, const u32);
typedef void (HWCALL *writeFn16)(const u16,const u32); typedef void (HWCALL *writeFn16)(const u16,const u32);
typedef void (HWCALL *writeFn32)(const u32,const u32); typedef void (HWCALL *writeFn32)(const u32,const u32);
typedef void (HWCALL *writeFn64)(const u64,const u32); typedef void (HWCALL *writeFn64)(const u64,const u32);
typedef void (HWCALL *readFn8 )(u8&, const u32); typedef void (HWCALL *readFn8 )(u8&, const u32);
typedef void (HWCALL *readFn16)(u16&, const u32); typedef void (HWCALL *readFn16)(u16&, const u32);
typedef void (HWCALL *readFn32)(u32&, const u32); typedef void (HWCALL *readFn32)(u32&, const u32);
typedef void (HWCALL *readFn64)(u64&, const u32); typedef void (HWCALL *readFn64)(u64&, const u32);
namespace Memory namespace Memory
{ {
// base is a pointer to the base of the memory map. Yes, some MMU tricks are used to set up // base is a pointer to the base of the memory map. Yes, some MMU tricks are used to set up
// a full GC or Wii memory map in process memory. // a full GC or Wii memory map in process memory.
// on 32-bit, you have to mask your offsets with 0x3FFFFFFF. This means that some things are mirrored, // on 32-bit, you have to mask your offsets with 0x3FFFFFFF. This means that some things are mirrored,
// but eh... it works. // but eh... it works.
extern u8 *base; extern u8 *base;
extern u8* m_pRAM; extern u8* m_pRAM;
extern u8* m_pL1Cache; extern u8* m_pL1Cache;
// the size should be 24mb only, but the RAM_MASK wouldn't work anymore // the size should be 24mb only, but the RAM_MASK wouldn't work anymore
enum enum
{ {
RAM_SIZE = 0x2000000, RAM_SIZE = 0x2000000,
RAM_MASK = 0x1FFFFFF, RAM_MASK = 0x1FFFFFF,
FAKEVMEM_SIZE = 0x2000000, FAKEVMEM_SIZE = 0x2000000,
FAKEVMEM_MASK = 0x1FFFFFF, FAKEVMEM_MASK = 0x1FFFFFF,
REALRAM_SIZE = 0x1800000, REALRAM_SIZE = 0x1800000,
L1_CACHE_SIZE = 0x40000, L1_CACHE_SIZE = 0x40000,
L1_CACHE_MASK = 0x3FFFF, L1_CACHE_MASK = 0x3FFFF,
EFB_SIZE = 0x200000, EFB_SIZE = 0x200000,
EFB_MASK = 0x1FFFFF, EFB_MASK = 0x1FFFFF,
IO_SIZE = 0x10000, IO_SIZE = 0x10000,
EXRAM_SIZE = 0x4000000, EXRAM_SIZE = 0x4000000,
EXRAM_MASK = 0x3FFFFFF, EXRAM_MASK = 0x3FFFFFF,
#ifdef _M_IX86 #ifdef _M_IX86
MEMVIEW32_MASK = 0x3FFFFFFF, MEMVIEW32_MASK = 0x3FFFFFFF,
#endif #endif
}; };
bool IsInitialized(); bool IsInitialized();
bool Init(); bool Init();
bool Shutdown(); bool Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void Clear(); void Clear();
bool AreMemoryBreakpointsActivated(); bool AreMemoryBreakpointsActivated();
//ONLY for use by GUI //ONLY for use by GUI
u8 ReadUnchecked_U8(const u32 _Address); u8 ReadUnchecked_U8(const u32 _Address);
u32 ReadUnchecked_U32(const u32 _Address); u32 ReadUnchecked_U32(const u32 _Address);
void WriteUnchecked_U8(const u8 _Data, const u32 _Address); void WriteUnchecked_U8(const u8 _Data, const u32 _Address);
void WriteUnchecked_U32(const u32 _Data, const u32 _Address); void WriteUnchecked_U32(const u32 _Data, const u32 _Address);
void InitHWMemFuncs(); void InitHWMemFuncs();
void InitHWMemFuncsWii(); void InitHWMemFuncsWii();
u32 Read_Instruction(const u32 _Address); u32 Read_Instruction(const u32 _Address);
bool IsRAMAddress(const u32 addr, bool allow_locked_cache = false); bool IsRAMAddress(const u32 addr, bool allow_locked_cache = false);
writeFn32 GetHWWriteFun32(const u32 _Address); writeFn32 GetHWWriteFun32(const u32 _Address);
inline u8* GetCachePtr() {return m_pL1Cache;} inline u8* GetCachePtr() {return m_pL1Cache;}
inline u8* GetMainRAMPtr() {return m_pRAM;} inline u8* GetMainRAMPtr() {return m_pRAM;}
inline u32 ReadFast32(const u32 _Address) inline u32 ReadFast32(const u32 _Address)
{ {
#ifdef _M_IX86 #ifdef _M_IX86
return Common::swap32(*(u32 *)(base + (_Address & MEMVIEW32_MASK))); //ReadUnchecked_U32(_Address); return Common::swap32(*(u32 *)(base + (_Address & MEMVIEW32_MASK))); //ReadUnchecked_U32(_Address);
#elif defined(_M_X64) #elif defined(_M_X64)
return Common::swap32(*(u32 *)(base + _Address)); return Common::swap32(*(u32 *)(base + _Address));
#endif #endif
} }
u32 Read_Opcode(const u32 _Address); u32 Read_Opcode(const u32 _Address);
//For use by emulator //For use by emulator
u8 Read_U8(const u32 _Address); u8 Read_U8(const u32 _Address);
u16 Read_U16(const u32 _Address); u16 Read_U16(const u32 _Address);
u32 Read_U32(const u32 _Address); u32 Read_U32(const u32 _Address);
u64 Read_U64(const u32 _Address); u64 Read_U64(const u32 _Address);
void Write_U8(const u8 _Data, const u32 _Address); void Write_U8(const u8 _Data, const u32 _Address);
void Write_U16(const u16 _Data, const u32 _Address); void Write_U16(const u16 _Data, const u32 _Address);
void Write_U32(const u32 _Data, const u32 _Address); void Write_U32(const u32 _Data, const u32 _Address);
void Write_U64(const u64 _Data, const u32 _Address); void Write_U64(const u64 _Data, const u32 _Address);
void WriteHW_U32(const u32 _Data, const u32 _Address); void WriteHW_U32(const u32 _Data, const u32 _Address);
void GetString(std::string& _string, const u32 _Address); void GetString(std::string& _string, const u32 _Address);
void WriteBigEData(const u8 *_pData, const u32 _Address, const u32 size); void WriteBigEData(const u8 *_pData, const u32 _Address, const u32 size);
void ReadBigEData(u8 *_pDest, const u32 _Address, const u32 size); void ReadBigEData(u8 *_pDest, const u32 _Address, const u32 size);
u8* GetPointer(const u32 _Address); u8* GetPointer(const u32 _Address);
void DMA_LCToMemory(const u32 _iMemAddr, const u32 _iCacheAddr, const u32 _iNumBlocks); void DMA_LCToMemory(const u32 _iMemAddr, const u32 _iCacheAddr, const u32 _iNumBlocks);
void DMA_MemoryToLC(const u32 _iCacheAddr, const u32 _iMemAddr, const u32 _iNumBlocks); void DMA_MemoryToLC(const u32 _iCacheAddr, const u32 _iMemAddr, const u32 _iNumBlocks);
void Memset(const u32 _Address, const u8 _Data, const u32 _iLength); void Memset(const u32 _Address, const u8 _Data, const u32 _iLength);
void SDRUpdated(); void SDRUpdated();
enum XCheckTLBFlag enum XCheckTLBFlag
{ {
FLAG_NO_EXCEPTION, FLAG_NO_EXCEPTION,
FLAG_READ, FLAG_READ,
FLAG_WRITE, FLAG_WRITE,
FLAG_OPCODE, FLAG_OPCODE,
}; };
u32 CheckDTLB(u32 _Address, XCheckTLBFlag _Flag); u32 CheckDTLB(u32 _Address, XCheckTLBFlag _Flag);
extern u32 pagetable_base; extern u32 pagetable_base;
extern u32 pagetable_hashmask; extern u32 pagetable_hashmask;
}; };
#endif #endif

View File

@ -1,34 +1,34 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _MEMORYINTERFACE_H #ifndef _MEMORYINTERFACE_H
#define _MEMORYINTERFACE_H #define _MEMORYINTERFACE_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace MemoryInterface namespace MemoryInterface
{ {
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void HWCALL Read16(u16& _uReturnValue, const u32 _iAddress); void HWCALL Read16(u16& _uReturnValue, const u32 _iAddress);
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress); void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
void HWCALL Write16(const u16 _iValue, const u32 _iAddress); void HWCALL Write16(const u16 _iValue, const u32 _iAddress);
} // end of namespace MemoryInterface } // end of namespace MemoryInterface
#endif #endif

View File

@ -1,116 +1,116 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PERIPHERALINTERFACE_H #ifndef _PERIPHERALINTERFACE_H
#define _PERIPHERALINTERFACE_H #define _PERIPHERALINTERFACE_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
// //
// PERIPHERALINTERFACE // PERIPHERALINTERFACE
// Handles communication with cpu services like the write gatherer used for fifos, and interrupts // Handles communication with cpu services like the write gatherer used for fifos, and interrupts
// //
class CPeripheralInterface class CPeripheralInterface
{ {
friend class CRegisters; friend class CRegisters;
public: public:
enum InterruptCause enum InterruptCause
{ {
INT_CAUSE_ERROR = 0x1, // ? INT_CAUSE_ERROR = 0x1, // ?
INT_CAUSE_RSW = 0x2, // Reset Switch INT_CAUSE_RSW = 0x2, // Reset Switch
INT_CAUSE_DI = 0x4, // DVD interrupt INT_CAUSE_DI = 0x4, // DVD interrupt
INT_CAUSE_SI = 0x8, // Serial interface INT_CAUSE_SI = 0x8, // Serial interface
INT_CAUSE_EXI = 0x10, // Expansion interface INT_CAUSE_EXI = 0x10, // Expansion interface
INT_CAUSE_AUDIO = 0x20, // Audio Interface Streaming INT_CAUSE_AUDIO = 0x20, // Audio Interface Streaming
INT_CAUSE_DSP = 0x40, // DSP interface INT_CAUSE_DSP = 0x40, // DSP interface
INT_CAUSE_MEMORY = 0x80, // Memory interface INT_CAUSE_MEMORY = 0x80, // Memory interface
INT_CAUSE_VI = 0x100, // Video interface INT_CAUSE_VI = 0x100, // Video interface
INT_CAUSE_PE_TOKEN = 0x200, // GP Token INT_CAUSE_PE_TOKEN = 0x200, // GP Token
INT_CAUSE_PE_FINISH = 0x400, // GP Finished INT_CAUSE_PE_FINISH = 0x400, // GP Finished
INT_CAUSE_CP = 0x800, // Command Fifo INT_CAUSE_CP = 0x800, // Command Fifo
INT_CAUSE_DEBUG = 0x1000, // ? INT_CAUSE_DEBUG = 0x1000, // ?
INT_CAUSE_HSP = 0x2000, // High Speed Port INT_CAUSE_HSP = 0x2000, // High Speed Port
INT_CAUSE_WII_IPC = 0x4000, // Wii IPC INT_CAUSE_WII_IPC = 0x4000, // Wii IPC
INT_CAUSE_RST_BUTTON = 0x10000 // ResetButtonState (1 = unpressed, 0 = pressed) INT_CAUSE_RST_BUTTON = 0x10000 // ResetButtonState (1 = unpressed, 0 = pressed)
}; };
private: private:
// internal hardware addresses // internal hardware addresses
enum enum
{ {
PI_INTERRUPT_CAUSE = 0x000, PI_INTERRUPT_CAUSE = 0x000,
PI_INTERRUPT_MASK = 0x004, PI_INTERRUPT_MASK = 0x004,
PI_FIFO_BASE = 0x00C, PI_FIFO_BASE = 0x00C,
PI_FIFO_END = 0x010, PI_FIFO_END = 0x010,
PI_FIFO_WPTR = 0x014, PI_FIFO_WPTR = 0x014,
PI_FIFO_RESET = 0x018, // ??? - GXAbortFrameWrites to it PI_FIFO_RESET = 0x018, // ??? - GXAbortFrameWrites to it
PI_RESET_CODE = 0x024, PI_RESET_CODE = 0x024,
PI_MB_REV = 0x02C, PI_MB_REV = 0x02C,
}; };
//This must always be byteswapped :( (UNUSED ATM) //This must always be byteswapped :( (UNUSED ATM)
struct PIRegMem struct PIRegMem
{ {
u32 rInterruptCause; //00 u32 rInterruptCause; //00
u32 rInterruptMask; //04 u32 rInterruptMask; //04
u32 unused0; //08 u32 unused0; //08
u32 FifoBase; //0C u32 FifoBase; //0C
u32 FifoEnd; //10 u32 FifoEnd; //10
u32 FifoWptr; //14 u32 FifoWptr; //14
u32 FifoReset; //18 u32 FifoReset; //18
u32 unused1; //1C u32 unused1; //1C
u32 unused2; //20 u32 unused2; //20
u32 ResetCode; //24 u32 ResetCode; //24
u32 unused3; //28 u32 unused3; //28
u32 MBRev; //2C u32 MBRev; //2C
}; };
static volatile u32 m_InterruptMask; static volatile u32 m_InterruptMask;
static volatile u32 m_InterruptCause; static volatile u32 m_InterruptCause;
static void UpdateException(); static void UpdateException();
// Debug_GetInterruptName // Debug_GetInterruptName
static const char* Debug_GetInterruptName(InterruptCause _causemask); static const char* Debug_GetInterruptName(InterruptCause _causemask);
public: public:
static u32 Fifo_CPUBase; static u32 Fifo_CPUBase;
static u32 Fifo_CPUEnd; static u32 Fifo_CPUEnd;
static u32 Fifo_CPUWritePointer; static u32 Fifo_CPUWritePointer;
static void Init(); static void Init();
static void DoState(PointerWrap &p); static void DoState(PointerWrap &p);
static void SetInterrupt(InterruptCause _causemask, bool _bSet=true); static void SetInterrupt(InterruptCause _causemask, bool _bSet=true);
// Read32 // Read32
static void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); static void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
// Write32 // Write32
static void HWCALL Write32(const u32 _iValue, const u32 _iAddress); static void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
// SetResetButton (you have to release the button again to make a reset) // SetResetButton (you have to release the button again to make a reset)
static void SetResetButton(bool _bSet); static void SetResetButton(bool _bSet);
}; };
#endif #endif

View File

@ -1,43 +1,43 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PIXELENGINE_H #ifndef _PIXELENGINE_H
#define _PIXELENGINE_H #define _PIXELENGINE_H
#include "CommonTypes.h" #include "CommonTypes.h"
class PointerWrap; class PointerWrap;
namespace PixelEngine namespace PixelEngine
{ {
void Init(); void Init();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
// Read // Read
void HWCALL Read16(u16& _uReturnValue, const u32 _iAddress); void HWCALL Read16(u16& _uReturnValue, const u32 _iAddress);
// Write // Write
void HWCALL Write16(const u16 _iValue, const u32 _iAddress); void HWCALL Write16(const u16 _iValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress); void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
// gfx plugin support // gfx plugin support
void SetToken(const u16 _token, const int _bSetTokenAcknowledge); void SetToken(const u16 _token, const int _bSetTokenAcknowledge);
void SetFinish(void); void SetFinish(void);
bool AllowIdleSkipping(); bool AllowIdleSkipping();
} // end of namespace PixelEngine } // end of namespace PixelEngine
#endif #endif

View File

@ -1,39 +1,39 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _SERIALINTERFACE_H #ifndef _SERIALINTERFACE_H
#define _SERIALINTERFACE_H #define _SERIALINTERFACE_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace SerialInterface namespace SerialInterface
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void UpdateDevices(); void UpdateDevices();
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress); void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
}; // end of namespace SerialInterface }; // end of namespace SerialInterface
#endif #endif

View File

@ -1,139 +1,139 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _SERIALINTERFACE_DEVICES_H #ifndef _SERIALINTERFACE_DEVICES_H
#define _SERIALINTERFACE_DEVICES_H #define _SERIALINTERFACE_DEVICES_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
class ISIDevice class ISIDevice
{ {
protected: protected:
int m_iDeviceNumber; int m_iDeviceNumber;
public: public:
// constructor // constructor
ISIDevice(int _iDeviceNumber) : ISIDevice(int _iDeviceNumber) :
m_iDeviceNumber(_iDeviceNumber) m_iDeviceNumber(_iDeviceNumber)
{ } { }
virtual ~ISIDevice() { } virtual ~ISIDevice() { }
// run the SI Buffer // run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength); virtual int RunBuffer(u8* _pBuffer, int _iLength);
// return true on new data // return true on new data
virtual bool GetData(u32& _Hi, u32& _Low) = 0; virtual bool GetData(u32& _Hi, u32& _Low) = 0;
// send a command directly (no detour per buffer) // send a command directly (no detour per buffer)
virtual void SendCommand(u32 _Cmd) = 0; virtual void SendCommand(u32 _Cmd) = 0;
}; };
// ===================================================================================================== // =====================================================================================================
// standard gamecube controller // standard gamecube controller
// ===================================================================================================== // =====================================================================================================
class CSIDevice_GCController : public ISIDevice class CSIDevice_GCController : public ISIDevice
{ {
private: private:
// commands // commands
enum EBufferCommands enum EBufferCommands
{ {
CMD_INVALID = 0xFFFFFFFF, CMD_INVALID = 0xFFFFFFFF,
CMD_RESET = 0x00, CMD_RESET = 0x00,
CMD_ORIGIN = 0x41, CMD_ORIGIN = 0x41,
CMD_RECALIBRATE = 0x42, CMD_RECALIBRATE = 0x42,
}; };
struct SOrigin struct SOrigin
{ {
u8 uCommand; u8 uCommand;
u8 unk_1; u8 unk_1;
u8 uOriginStickX; u8 uOriginStickX;
u8 uOriginStickY; u8 uOriginStickY;
u8 uSubStickStickX; // ??? u8 uSubStickStickX; // ???
u8 uSubStickStickY; // ??? u8 uSubStickStickY; // ???
u8 uTrigger_L; // ??? u8 uTrigger_L; // ???
u8 uTrigger_R; // ??? u8 uTrigger_R; // ???
u8 unk_4; u8 unk_4;
u8 unk_5; u8 unk_5;
u8 unk_6; u8 unk_6;
u8 unk_7; u8 unk_7;
}; };
enum EDirectCommands enum EDirectCommands
{ {
CMD_RUMBLE = 0x40 CMD_RUMBLE = 0x40
}; };
union UCommand union UCommand
{ {
u32 Hex; u32 Hex;
struct struct
{ {
unsigned Parameter1 : 8; unsigned Parameter1 : 8;
unsigned Parameter2 : 8; unsigned Parameter2 : 8;
unsigned Command : 8; unsigned Command : 8;
unsigned : 8; unsigned : 8;
}; };
UCommand() {Hex = 0;} UCommand() {Hex = 0;}
UCommand(u32 _iValue) {Hex = _iValue;} UCommand(u32 _iValue) {Hex = _iValue;}
}; };
SOrigin m_origin; SOrigin m_origin;
int DeviceNum; int DeviceNum;
public: public:
// constructor // constructor
CSIDevice_GCController(int _iDeviceNumber); CSIDevice_GCController(int _iDeviceNumber);
// run the SI Buffer // run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength); virtual int RunBuffer(u8* _pBuffer, int _iLength);
// return true on new data // return true on new data
virtual bool GetData(u32& _Hi, u32& _Low); virtual bool GetData(u32& _Hi, u32& _Low);
// send a command directly // send a command directly
virtual void SendCommand(u32 _Cmd); virtual void SendCommand(u32 _Cmd);
}; };
// ===================================================================================================== // =====================================================================================================
// dummy - no device attached // dummy - no device attached
// ===================================================================================================== // =====================================================================================================
class CSIDevice_Dummy : public ISIDevice class CSIDevice_Dummy : public ISIDevice
{ {
public: public:
// constructor // constructor
CSIDevice_Dummy(int _iDeviceNumber); CSIDevice_Dummy(int _iDeviceNumber);
// run the SI Buffer // run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength); virtual int RunBuffer(u8* _pBuffer, int _iLength);
// return true on new data // return true on new data
virtual bool GetData(u32& _Hi, u32& _Low); virtual bool GetData(u32& _Hi, u32& _Low);
// send a command directly // send a command directly
virtual void SendCommand(u32 _Cmd); virtual void SendCommand(u32 _Cmd);
}; };
#endif #endif

View File

@ -1,35 +1,35 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _SYSTEMTIMERS_H #ifndef _SYSTEMTIMERS_H
#define _SYSTEMTIMERS_H #define _SYSTEMTIMERS_H
#include "Common.h" #include "Common.h"
namespace SystemTimers namespace SystemTimers
{ {
u32 GetTicksPerSecond(); u32 GetTicksPerSecond();
void Init(); void Init();
void Shutdown(); void Shutdown();
// Notify timing system that somebody wrote to the decrementer // Notify timing system that somebody wrote to the decrementer
void DecrementerSet(); void DecrementerSet();
} }
#endif #endif

View File

@ -1,65 +1,65 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _VIDEOINTERFACE_H #ifndef _VIDEOINTERFACE_H
#define _VIDEOINTERFACE_H #define _VIDEOINTERFACE_H
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace VideoInterface namespace VideoInterface
{ {
enum VIInterruptType enum VIInterruptType
{ {
INT_PRERETRACE = 0, INT_PRERETRACE = 0,
INT_POSTRETRACE = 1, INT_POSTRETRACE = 1,
INT_REG_2, INT_REG_2,
INT_REG_3, INT_REG_3,
}; };
void Init(); void Init();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void HWCALL Read16(u16& _uReturnValue, const u32 _uAddress); void HWCALL Read16(u16& _uReturnValue, const u32 _uAddress);
void HWCALL Read32(u32& _uReturnValue, const u32 _uAddress); void HWCALL Read32(u32& _uReturnValue, const u32 _uAddress);
void HWCALL Write16(const u16 _uValue, const u32 _uAddress); void HWCALL Write16(const u16 _uValue, const u32 _uAddress);
void HWCALL Write32(const u32 _uValue, const u32 _uAddress); void HWCALL Write32(const u32 _uValue, const u32 _uAddress);
void GenerateVIInterrupt(VIInterruptType _VIInterrupt); void GenerateVIInterrupt(VIInterruptType _VIInterrupt);
// returns a pointer to the current visible framebuffer // returns a pointer to the current visible framebuffer
u8* GetFrameBufferPointer(); u8* GetFrameBufferPointer();
// pre init // pre init
void PreInit(bool _bNTSC); void PreInit(bool _bNTSC);
// VI Unknown Regs // VI Unknown Regs
extern u8 m_UVIUnknownRegs[0x1000]; extern u8 m_UVIUnknownRegs[0x1000];
// ?????? // ??????
void Update(); void Update();
// UpdateInterrupts: check if we have to generate a new VI Interrupt // UpdateInterrupts: check if we have to generate a new VI Interrupt
void UpdateInterrupts(); void UpdateInterrupts();
// ?????? // ??????
void UpdateTiming(); void UpdateTiming();
}; };
#endif #endif

View File

@ -1,45 +1,45 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IOBRIDGE_H_ #ifndef _WII_IOBRIDGE_H_
#define _WII_IOBRIDGE_H_ #define _WII_IOBRIDGE_H_
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace WII_IOBridge namespace WII_IOBridge
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void Update(); void Update();
void HWCALL Read8(u8& _rReturnValue, const u32 _Address); void HWCALL Read8(u8& _rReturnValue, const u32 _Address);
void HWCALL Read16(u16& _rReturnValue, const u32 _Address); void HWCALL Read16(u16& _rReturnValue, const u32 _Address);
void HWCALL Read32(u32& _rReturnValue, const u32 _Address); void HWCALL Read32(u32& _rReturnValue, const u32 _Address);
void HWCALL Read64(u64& _rReturnValue, const u32 _Address); void HWCALL Read64(u64& _rReturnValue, const u32 _Address);
void HWCALL Write8(const u8 _Value, const u32 _Address); void HWCALL Write8(const u8 _Value, const u32 _Address);
void HWCALL Write16(const u16 _Value, const u32 _Address); void HWCALL Write16(const u16 _Value, const u32 _Address);
void HWCALL Write32(const u32 _Value, const u32 _Address); void HWCALL Write32(const u32 _Value, const u32 _Address);
void HWCALL Write64(const u64 _Value, const u32 _Address); void HWCALL Write64(const u64 _Value, const u32 _Address);
} // end of namespace AudioInterface } // end of namespace AudioInterface
#endif #endif

View File

@ -1,42 +1,42 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_H_ #ifndef _WII_IPC_H_
#define _WII_IPC_H_ #define _WII_IPC_H_
#include "Common.h" #include "Common.h"
class PointerWrap; class PointerWrap;
namespace WII_IPCInterface namespace WII_IPCInterface
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void Update(); void Update();
bool IsReady(); bool IsReady();
void GenerateReply(u32 _AnswerAddress); void GenerateReply(u32 _AnswerAddress);
void GenerateAck(u32 _AnswerAddress); void GenerateAck(u32 _AnswerAddress);
void HWCALL Read32(u32& _rReturnValue, const u32 _Address); void HWCALL Read32(u32& _rReturnValue, const u32 _Address);
void HWCALL Write32(const u32 _Value, const u32 _Address); void HWCALL Write32(const u32 _Value, const u32 _Address);
} // end of namespace AudioInterface } // end of namespace AudioInterface
#endif #endif

View File

@ -1,56 +1,56 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _HOST_H #ifndef _HOST_H
#define _HOST_H #define _HOST_H
// Host - defines an interface for the emulator core to communicate back to the // Host - defines an interface for the emulator core to communicate back to the
// OS-specific layer // OS-specific layer
// The emulator core is abstracted from the OS using 2 interfaces: // The emulator core is abstracted from the OS using 2 interfaces:
// Common and Host. // Common and Host.
// Common simply provides OS-neutral implementations of things like threads, mutexes, // Common simply provides OS-neutral implementations of things like threads, mutexes,
// INI file manipulation, memory mapping, etc. // INI file manipulation, memory mapping, etc.
// Host is an abstract interface for communicating things back to the host. The emulator // Host is an abstract interface for communicating things back to the host. The emulator
// core is treated as a library, not as a main program, because it is far easier to // core is treated as a library, not as a main program, because it is far easier to
// write GUI interfaces that control things than to squash GUI into some model that wasn't // write GUI interfaces that control things than to squash GUI into some model that wasn't
// designed for it. // designed for it.
// The host can be just a command line app that opens a window, or a full blown debugger // The host can be just a command line app that opens a window, or a full blown debugger
// interface. // interface.
void Host_BootingStarted(); void Host_BootingStarted();
void Host_BootingEnded(); void Host_BootingEnded();
void Host_UpdateMainFrame(); void Host_UpdateMainFrame();
void Host_UpdateDisasmDialog(); void Host_UpdateDisasmDialog();
void Host_UpdateLogDisplay(); void Host_UpdateLogDisplay();
void Host_UpdateMemoryView(); void Host_UpdateMemoryView();
void Host_NotifyMapLoaded(); void Host_NotifyMapLoaded();
void Host_UpdateBreakPointView(); void Host_UpdateBreakPointView();
void Host_SetDebugMode(bool enable); void Host_SetDebugMode(bool enable);
void Host_SetWaitCursor(bool enable); void Host_SetWaitCursor(bool enable);
void Host_UpdateStatusBar(const char* _pText); void Host_UpdateStatusBar(const char* _pText);
void Host_SysMessage(const char *fmt, ...); void Host_SysMessage(const char *fmt, ...);
void Host_SetWiiMoteConnectionState(int _State); void Host_SetWiiMoteConnectionState(int _State);
#endif #endif

View File

@ -1,50 +1,50 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_H_ #ifndef _WII_IPC_HLE_H_
#define _WII_IPC_HLE_H_ #define _WII_IPC_HLE_H_
namespace WII_IPC_HLE_Interface namespace WII_IPC_HLE_Interface
{ {
// Init // Init
void Init(); void Init();
// Shutdown // Shutdown
void Shutdown(); void Shutdown();
// Update // Update
void Update(); void Update();
// Acknowledge command // Acknowledge command
bool AckCommand(u32 _Address); bool AckCommand(u32 _Address);
enum ECommandType enum ECommandType
{ {
COMMAND_OPEN_DEVICE = 1, COMMAND_OPEN_DEVICE = 1,
COMMAND_CLOSE_DEVICE = 2, COMMAND_CLOSE_DEVICE = 2,
COMMAND_READ = 3, COMMAND_READ = 3,
COMMAND_WRITE = 4, COMMAND_WRITE = 4,
COMMAND_SEEK = 5, COMMAND_SEEK = 5,
COMMAND_IOCTL = 6, COMMAND_IOCTL = 6,
COMMAND_IOCTLV = 7, COMMAND_IOCTLV = 7,
}; };
} // end of namespace AudioInterface } // end of namespace AudioInterface
#endif #endif

View File

@ -1,200 +1,200 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_DEVICE_H_ #ifndef _WII_IPC_HLE_DEVICE_H_
#define _WII_IPC_HLE_DEVICE_H_ #define _WII_IPC_HLE_DEVICE_H_
#include <string> #include <string>
#include <queue> #include <queue>
#include "../HW/Memmap.h" #include "../HW/Memmap.h"
#include "../HW/CPU.h" #include "../HW/CPU.h"
class IWII_IPC_HLE_Device class IWII_IPC_HLE_Device
{ {
public: public:
IWII_IPC_HLE_Device(u32 _DeviceID, const std::string& _rName) : IWII_IPC_HLE_Device(u32 _DeviceID, const std::string& _rName) :
m_Name(_rName), m_Name(_rName),
m_DeviceID(_DeviceID) m_DeviceID(_DeviceID)
{} {}
virtual ~IWII_IPC_HLE_Device() virtual ~IWII_IPC_HLE_Device()
{} {}
const std::string& GetDeviceName() const { return m_Name; } const std::string& GetDeviceName() const { return m_Name; }
u32 GetDeviceID() const { return m_DeviceID; } u32 GetDeviceID() const { return m_DeviceID; }
virtual bool Open(u32 _CommandAddress, u32 _Mode) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Open()", m_Name.c_str()); return true; } virtual bool Open(u32 _CommandAddress, u32 _Mode) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Open()", m_Name.c_str()); return true; }
virtual bool Close(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Close()", m_Name.c_str()); return true; } virtual bool Close(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Close()", m_Name.c_str()); return true; }
virtual bool Seek(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Seek()", m_Name.c_str()); return true; } virtual bool Seek(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Seek()", m_Name.c_str()); return true; }
virtual bool Read(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Read()", m_Name.c_str()); return true; } virtual bool Read(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Read()", m_Name.c_str()); return true; }
virtual bool Write(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Write()", m_Name.c_str()); return true; } virtual bool Write(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Write()", m_Name.c_str()); return true; }
virtual bool IOCtl(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run IOCtl()", m_Name.c_str()); return true; } virtual bool IOCtl(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run IOCtl()", m_Name.c_str()); return true; }
virtual bool IOCtlV(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run IOCtlV()", m_Name.c_str()); return true; } virtual bool IOCtlV(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run IOCtlV()", m_Name.c_str()); return true; }
virtual u32 Update() { return 0; } virtual u32 Update() { return 0; }
virtual bool ReturnFileHandle() { return false; } virtual bool ReturnFileHandle() { return false; }
private: private:
// STATE_TO_SAVE // STATE_TO_SAVE
std::string m_Name; std::string m_Name;
u32 m_DeviceID; u32 m_DeviceID;
protected: protected:
// =================================================== // ===================================================
/* A struct for IOS ioctlv calls */ /* A struct for IOS ioctlv calls */
// ---------------- // ----------------
struct SIOCtlVBuffer struct SIOCtlVBuffer
{ {
SIOCtlVBuffer(u32 _Address) SIOCtlVBuffer(u32 _Address)
: m_Address(_Address) : m_Address(_Address)
{ {
/* These are the Ioctlv parameters in the IOS communication. The BufferVector /* These are the Ioctlv parameters in the IOS communication. The BufferVector
is a memory address offset at where the in and out buffer addresses are is a memory address offset at where the in and out buffer addresses are
stored. */ stored. */
Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0 Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0
NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1 NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1
NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2 NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2
BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3 BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3
// The start of the out buffer // The start of the out buffer
u32 BufferVectorOffset = BufferVector; u32 BufferVectorOffset = BufferVector;
//if(Parameter = 0x1d) PanicAlert("%i: %i", Parameter, NumberInBuffer); //if(Parameter = 0x1d) PanicAlert("%i: %i", Parameter, NumberInBuffer);
// Write the address and size for all in messages // Write the address and size for all in messages
for (u32 i = 0; i < NumberInBuffer; i++) for (u32 i = 0; i < NumberInBuffer; i++)
{ {
SBuffer Buffer; SBuffer Buffer;
Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); Buffer.m_Address = Memory::Read_U32(BufferVectorOffset);
/* Restore cached address, mauled by emulatee's ioctl functions. Why? /* Restore cached address, mauled by emulatee's ioctl functions. Why?
What is the purpose of this? After we have read the values, why would What is the purpose of this? After we have read the values, why would
anyone ned it */ anyone ned it */
//Memory::Write_U32(Buffer.m_Address | 0x80000000, BufferVectorOffset); //Memory::Write_U32(Buffer.m_Address | 0x80000000, BufferVectorOffset);
BufferVectorOffset += 4; BufferVectorOffset += 4;
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
BufferVectorOffset += 4; BufferVectorOffset += 4;
LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer in%i: 0x%08x, 0x%x", LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer in%i: 0x%08x, 0x%x",
i, Buffer.m_Address, Buffer.m_Size); i, Buffer.m_Address, Buffer.m_Size);
InBuffer.push_back(Buffer); InBuffer.push_back(Buffer);
} }
// Write the address and size for all out or in-out messages // Write the address and size for all out or in-out messages
for (u32 i = 0; i < NumberPayloadBuffer; i++) for (u32 i = 0; i < NumberPayloadBuffer; i++)
{ {
SBuffer Buffer; SBuffer Buffer;
Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); Buffer.m_Address = Memory::Read_U32(BufferVectorOffset);
//Memory::Write_U32(Buffer.m_Address | 0x80000000, BufferVectorOffset); //Memory::Write_U32(Buffer.m_Address | 0x80000000, BufferVectorOffset);
BufferVectorOffset += 4; BufferVectorOffset += 4;
Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); Buffer.m_Size = Memory::Read_U32(BufferVectorOffset);
BufferVectorOffset += 4; BufferVectorOffset += 4;
LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer io%i: 0x%08x, 0x%x", LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer io%i: 0x%08x, 0x%x",
i, Buffer.m_Address, Buffer.m_Size); i, Buffer.m_Address, Buffer.m_Size);
PayloadBuffer.push_back(Buffer); PayloadBuffer.push_back(Buffer);
} }
} }
// STATE_TO_SAVE // STATE_TO_SAVE
const u32 m_Address; const u32 m_Address;
u32 Parameter; u32 Parameter;
u32 NumberInBuffer; u32 NumberInBuffer;
u32 NumberPayloadBuffer; u32 NumberPayloadBuffer;
u32 BufferVector; u32 BufferVector;
u32 BufferSize; u32 BufferSize;
struct SBuffer { u32 m_Address, m_Size; }; struct SBuffer { u32 m_Address, m_Size; };
std::vector<SBuffer> InBuffer; std::vector<SBuffer> InBuffer;
std::vector<SBuffer> PayloadBuffer; std::vector<SBuffer> PayloadBuffer;
}; };
// =================================================== // ===================================================
/* Write out the IPC struct from _CommandAddress to _NumberOfCommands numbers /* Write out the IPC struct from _CommandAddress to _NumberOfCommands numbers
of 4 byte commands. */ of 4 byte commands. */
// ---------------- // ----------------
void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8, void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8,
int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0) int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0)
{ {
// Because I have to use __Logv here I add this #if // Because I have to use __Logv here I add this #if
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
__Logv(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str()); __Logv(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str());
for (u32 i = 0; i < _NumberOfCommands; i++) for (u32 i = 0; i < _NumberOfCommands; i++)
{ {
__Logv(LogType, Verbosity, " Command%02i: 0x%08x", i, __Logv(LogType, Verbosity, " Command%02i: 0x%08x", i,
Memory::Read_U32(_CommandAddress + i*4)); Memory::Read_U32(_CommandAddress + i*4));
} }
#endif #endif
} }
void DumpAsync( u32 BufferVector, u32 _CommandAddress, u32 NumberInBuffer, u32 NumberOutBuffer ) void DumpAsync( u32 BufferVector, u32 _CommandAddress, u32 NumberInBuffer, u32 NumberOutBuffer )
{ {
LOGV(WII_IPC_HLE, 1, "======= DumpAsync ======"); LOGV(WII_IPC_HLE, 1, "======= DumpAsync ======");
// write return value // write return value
u32 BufferOffset = BufferVector; u32 BufferOffset = BufferVector;
Memory::Write_U32(1, _CommandAddress + 0x4); Memory::Write_U32(1, _CommandAddress + 0x4);
for (u32 i=0; i<NumberInBuffer; i++) for (u32 i=0; i<NumberInBuffer; i++)
{ {
u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4; u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4; u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
LOGV(WII_IPC_HLE, 1, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i); LOGV(WII_IPC_HLE, 1, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i);
std::string Temp; std::string Temp;
for (u32 j=0; j<InBufferSize; j++) for (u32 j=0; j<InBufferSize; j++)
{ {
char Buffer[128]; char Buffer[128];
sprintf(Buffer, "%02x ", Memory::Read_U8(InBuffer+j)); sprintf(Buffer, "%02x ", Memory::Read_U8(InBuffer+j));
Temp.append(Buffer); Temp.append(Buffer);
} }
LOGV(WII_IPC_HLE, 1, " Buffer: %s", Temp.c_str()); LOGV(WII_IPC_HLE, 1, " Buffer: %s", Temp.c_str());
} }
for (u32 i = 0; i < NumberOutBuffer; i++) for (u32 i = 0; i < NumberOutBuffer; i++)
{ {
#ifdef LOGGING #ifdef LOGGING
u32 OutBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4; u32 OutBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
u32 OutBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4; u32 OutBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
#endif #endif
Memory::Write_U32(1, _CommandAddress + 0x4); Memory::Write_U32(1, _CommandAddress + 0x4);
LOGV(WII_IPC_HLE, 1, "%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i); LOGV(WII_IPC_HLE, 1, "%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i);
LOGV(WII_IPC_HLE, 1, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize); LOGV(WII_IPC_HLE, 1, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize);
#ifdef LOGGING #ifdef LOGGING
DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, 1); DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, 1);
#endif #endif
} }
} }
}; };
#endif #endif

View File

@ -1,48 +1,48 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_DEVICE_DI_H_ #ifndef _WII_IPC_HLE_DEVICE_DI_H_
#define _WII_IPC_HLE_DEVICE_DI_H_ #define _WII_IPC_HLE_DEVICE_DI_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
namespace DiscIO namespace DiscIO
{ {
class IVolume; class IVolume;
class IFileSystem; class IFileSystem;
} }
class CWII_IPC_HLE_Device_di : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_di : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName); CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_di(); virtual ~CWII_IPC_HLE_Device_di();
bool Open(u32 _CommandAddress, u32 _Mode); bool Open(u32 _CommandAddress, u32 _Mode);
bool IOCtl(u32 _CommandAddress); bool IOCtl(u32 _CommandAddress);
bool IOCtlV(u32 _CommandAddress); bool IOCtlV(u32 _CommandAddress);
private: private:
u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize); u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize);
DiscIO::IVolume* m_pVolume; DiscIO::IVolume* m_pVolume;
DiscIO::IFileSystem* m_pFileSystem; DiscIO::IFileSystem* m_pFileSystem;
}; };
#endif #endif

View File

@ -1,42 +1,42 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_DEVICE_ERROR_H_ #ifndef _WII_IPC_HLE_DEVICE_ERROR_H_
#define _WII_IPC_HLE_DEVICE_ERROR_H_ #define _WII_IPC_HLE_DEVICE_ERROR_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
class CWII_IPC_HLE_Device_Error : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_Error : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_Error(u32 _DeviceID, const std::string& _rDeviceName ) : CWII_IPC_HLE_Device_Error(u32 _DeviceID, const std::string& _rDeviceName ) :
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{} {}
virtual ~CWII_IPC_HLE_Device_Error() virtual ~CWII_IPC_HLE_Device_Error()
{} {}
virtual bool Open(u32 _CommandAddress, u32 _Mode) virtual bool Open(u32 _CommandAddress, u32 _Mode)
{ {
PanicAlert("CWII_IPC_HLE_Device_Error"); PanicAlert("CWII_IPC_HLE_Device_Error");
Memory::Write_U32(GetDeviceID(), _CommandAddress+4); Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
return true; return true;
} }
}; };
#endif #endif

View File

@ -1,74 +1,74 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_DEVICE_FILEIO_H_ #ifndef _WII_IPC_HLE_DEVICE_FILEIO_H_
#define _WII_IPC_HLE_DEVICE_FILEIO_H_ #define _WII_IPC_HLE_DEVICE_FILEIO_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std::string& _rDeviceName); CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_FileIO(); virtual ~CWII_IPC_HLE_Device_FileIO();
bool Close(u32 _CommandAddress); bool Close(u32 _CommandAddress);
bool Open(u32 _CommandAddress, u32 _Mode); bool Open(u32 _CommandAddress, u32 _Mode);
bool Seek(u32 _CommandAddress); bool Seek(u32 _CommandAddress);
bool Read(u32 _CommandAddress); bool Read(u32 _CommandAddress);
bool Write(u32 _CommandAddress); bool Write(u32 _CommandAddress);
bool IOCtl(u32 _CommandAddress); bool IOCtl(u32 _CommandAddress);
bool ReturnFileHandle(); bool ReturnFileHandle();
private: private:
enum enum
{ {
ISFS_FUNCNULL = 0, ISFS_FUNCNULL = 0,
ISFS_FUNCGETSTAT = 1, ISFS_FUNCGETSTAT = 1,
ISFS_FUNCREADDIR = 2, ISFS_FUNCREADDIR = 2,
ISFS_FUNCGETATTR = 3, ISFS_FUNCGETATTR = 3,
ISFS_FUNCGETUSAGE = 4, ISFS_FUNCGETUSAGE = 4,
}; };
enum enum
{ {
ISFS_IOCTL_FORMAT = 1, ISFS_IOCTL_FORMAT = 1,
ISFS_IOCTL_GETSTATS = 2, ISFS_IOCTL_GETSTATS = 2,
ISFS_IOCTL_CREATEDIR = 3, ISFS_IOCTL_CREATEDIR = 3,
ISFS_IOCTL_READDIR = 4, ISFS_IOCTL_READDIR = 4,
ISFS_IOCTL_SETATTR = 5, ISFS_IOCTL_SETATTR = 5,
ISFS_IOCTL_GETATTR = 6, ISFS_IOCTL_GETATTR = 6,
ISFS_IOCTL_DELETE = 7, ISFS_IOCTL_DELETE = 7,
ISFS_IOCTL_RENAME = 8, ISFS_IOCTL_RENAME = 8,
ISFS_IOCTL_CREATEFILE = 9, ISFS_IOCTL_CREATEFILE = 9,
ISFS_IOCTL_SETFILEVERCTRL = 10, ISFS_IOCTL_SETFILEVERCTRL = 10,
ISFS_IOCTL_GETFILESTATS = 11, ISFS_IOCTL_GETFILESTATS = 11,
ISFS_IOCTL_GETUSAGE = 12, ISFS_IOCTL_GETUSAGE = 12,
ISFS_IOCTL_SHUTDOWN = 13, ISFS_IOCTL_SHUTDOWN = 13,
}; };
FILE* m_pFileHandle; FILE* m_pFileHandle;
u64 m_FileLength; u64 m_FileLength;
std::string m_Filename; std::string m_Filename;
}; };
#endif #endif

View File

@ -1,227 +1,227 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// ======================================================= // =======================================================
// File description // File description
// ------------- // -------------
/* Here we handle /dev/es requests. We have cases for these functions, the exact /* Here we handle /dev/es requests. We have cases for these functions, the exact
DevKitPro name is en parenthesis: DevKitPro name is en parenthesis:
0x20 GetTitleID (ES_GetTitleID) (Input: none, Output: 8 bytes) 0x20 GetTitleID (ES_GetTitleID) (Input: none, Output: 8 bytes)
0x1d GetDataDir (ES_GetDataDir) (Input: 8 bytes, Output: 30 bytes) 0x1d GetDataDir (ES_GetDataDir) (Input: 8 bytes, Output: 30 bytes)
0x1b DiGetTicketView (Input: none, Output: 216 bytes) 0x1b DiGetTicketView (Input: none, Output: 216 bytes)
0x16 GetConsumption (Input: 8 bytes, Output: 0 bytes, 4 bytes) // there are two output buffers 0x16 GetConsumption (Input: 8 bytes, Output: 0 bytes, 4 bytes) // there are two output buffers
0x12 GetNumTicketViews (ES_GetNumTicketViews) (Input: 8 bytes, Output: 4 bytes) 0x12 GetNumTicketViews (ES_GetNumTicketViews) (Input: 8 bytes, Output: 4 bytes)
0x14 GetTMDViewSize (ES_GetTMDViewSize) (Input: ?, Output: ?) // I don't get this anymore, 0x14 GetTMDViewSize (ES_GetTMDViewSize) (Input: ?, Output: ?) // I don't get this anymore,
it used to come after 0x12 it used to come after 0x12
but only the first two are correctly supported. For the other four we ignore any potential but only the first two are correctly supported. For the other four we ignore any potential
input and only write zero to the out buffer. However, most games only use first two, input and only write zero to the out buffer. However, most games only use first two,
but some Nintendo developed games use the other ones to: but some Nintendo developed games use the other ones to:
0x1b: Mario Galaxy, Mario Kart, SSBB 0x1b: Mario Galaxy, Mario Kart, SSBB
0x16: Mario Galaxy, Mario Kart, SSBB 0x16: Mario Galaxy, Mario Kart, SSBB
0x12: Mario Kart 0x12: Mario Kart
0x14: Mario Kart: But only if we don't return a zeroed out buffer for the 0x12 question, 0x14: Mario Kart: But only if we don't return a zeroed out buffer for the 0x12 question,
and instead answer for example 1 will this question appear. and instead answer for example 1 will this question appear.
*/ */
// ============= // =============
#ifndef _WII_IPC_HLE_DEVICE_ES_H_ #ifndef _WII_IPC_HLE_DEVICE_ES_H_
#define _WII_IPC_HLE_DEVICE_ES_H_ #define _WII_IPC_HLE_DEVICE_ES_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
#include "../VolumeHandler.h" #include "../VolumeHandler.h"
// http://wiibrew.org/index.php?title=/dev/es // http://wiibrew.org/index.php?title=/dev/es
class CWII_IPC_HLE_Device_es : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_es : public IWII_IPC_HLE_Device
{ {
public: public:
enum enum
{ {
IOCTL_ES_ADDTICKET = 0x01, IOCTL_ES_ADDTICKET = 0x01,
IOCTL_ES_ADDTITLESTART = 0x02, IOCTL_ES_ADDTITLESTART = 0x02,
IOCTL_ES_ADDCONTENTSTART = 0x03, IOCTL_ES_ADDCONTENTSTART = 0x03,
IOCTL_ES_ADDCONTENTDATA = 0x04, IOCTL_ES_ADDCONTENTDATA = 0x04,
IOCTL_ES_ADDCONTENTFINISH = 0x05, IOCTL_ES_ADDCONTENTFINISH = 0x05,
IOCTL_ES_ADDTITLEFINISH = 0x06, IOCTL_ES_ADDTITLEFINISH = 0x06,
IOCTL_ES_LAUNCH = 0x08, IOCTL_ES_LAUNCH = 0x08,
IOCTL_ES_OPENCONTENT = 0x09, IOCTL_ES_OPENCONTENT = 0x09,
IOCTL_ES_READCONTENT = 0x0A, IOCTL_ES_READCONTENT = 0x0A,
IOCTL_ES_CLOSECONTENT = 0x0B, IOCTL_ES_CLOSECONTENT = 0x0B,
IOCTL_ES_GETTITLECOUNT = 0x0E, IOCTL_ES_GETTITLECOUNT = 0x0E,
IOCTL_ES_GETTITLES = 0x0F, IOCTL_ES_GETTITLES = 0x0F,
IOCTL_ES_GETVIEWCNT = 0x12, IOCTL_ES_GETVIEWCNT = 0x12,
IOCTL_ES_GETVIEWS = 0x13, IOCTL_ES_GETVIEWS = 0x13,
IOCTL_ES_GETTMDVIEWCNT = 0x14, IOCTL_ES_GETTMDVIEWCNT = 0x14,
IOCTL_ES_GETCONSUMPTION = 0x16, IOCTL_ES_GETCONSUMPTION = 0x16,
IOCTL_ES_DIGETTICKETVIEW = 0x1b, IOCTL_ES_DIGETTICKETVIEW = 0x1b,
IOCTL_ES_DIVERIFY = 0x1C, IOCTL_ES_DIVERIFY = 0x1C,
IOCTL_ES_GETTITLEDIR = 0x1D, IOCTL_ES_GETTITLEDIR = 0x1D,
IOCTL_ES_GETTITLEID = 0x20, IOCTL_ES_GETTITLEID = 0x20,
IOCTL_ES_SEEKCONTENT = 0x23, IOCTL_ES_SEEKCONTENT = 0x23,
IOCTL_ES_ADDTMD = 0x2B, IOCTL_ES_ADDTMD = 0x2B,
IOCTL_ES_ADDTITLECANCEL = 0x2F, IOCTL_ES_ADDTITLECANCEL = 0x2F,
IOCTL_ES_GETSTOREDCONTENTCNT = 0x32, IOCTL_ES_GETSTOREDCONTENTCNT = 0x32,
IOCTL_ES_GETSTOREDCONTENTS = 0x33, IOCTL_ES_GETSTOREDCONTENTS = 0x33,
IOCTL_ES_GETSTOREDTMDSIZE = 0x34, IOCTL_ES_GETSTOREDTMDSIZE = 0x34,
IOCTL_ES_GETSTOREDTMD = 0x35, IOCTL_ES_GETSTOREDTMD = 0x35,
IOCTL_ES_GETSHAREDCONTENTCNT = 0x36, IOCTL_ES_GETSHAREDCONTENTCNT = 0x36,
IOCTL_ES_GETSHAREDCONTENTS = 0x37, IOCTL_ES_GETSHAREDCONTENTS = 0x37,
}; };
CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName) : CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName) :
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{} {}
virtual ~CWII_IPC_HLE_Device_es() virtual ~CWII_IPC_HLE_Device_es()
{} {}
virtual bool Open(u32 _CommandAddress, u32 _Mode) virtual bool Open(u32 _CommandAddress, u32 _Mode)
{ {
Memory::Write_U32(GetDeviceID(), _CommandAddress+4); Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
return true; return true;
} }
virtual bool Close(u32 _CommandAddress) virtual bool Close(u32 _CommandAddress)
{ {
LOG(WII_IPC_ES, "ES: Close"); LOG(WII_IPC_ES, "ES: Close");
Memory::Write_U32(0, _CommandAddress + 4); Memory::Write_U32(0, _CommandAddress + 4);
return true; return true;
} }
virtual bool IOCtlV(u32 _CommandAddress) virtual bool IOCtlV(u32 _CommandAddress)
{ {
SIOCtlVBuffer Buffer(_CommandAddress); SIOCtlVBuffer Buffer(_CommandAddress);
LOG(WII_IPC_ES, "%s (0x%x)", GetDeviceName().c_str(), Buffer.Parameter); LOG(WII_IPC_ES, "%s (0x%x)", GetDeviceName().c_str(), Buffer.Parameter);
// Prepare the out buffer(s) with zeroes as a safety precaution // Prepare the out buffer(s) with zeroes as a safety precaution
// to avoid returning bad values // to avoid returning bad values
for(u32 i = 0; i < Buffer.NumberPayloadBuffer; i++) for(u32 i = 0; i < Buffer.NumberPayloadBuffer; i++)
{ {
Memory::Memset(Buffer.PayloadBuffer[i].m_Address, 0, Memory::Memset(Buffer.PayloadBuffer[i].m_Address, 0,
Buffer.PayloadBuffer[i].m_Size); Buffer.PayloadBuffer[i].m_Size);
} }
switch(Buffer.Parameter) switch(Buffer.Parameter)
{ {
case IOCTL_ES_GETTITLEDIR: // 0x1d case IOCTL_ES_GETTITLEDIR: // 0x1d
{ {
/* I changed reading the TitleID from disc to reading from the /* I changed reading the TitleID from disc to reading from the
InBuffer, if it fails it's because of some kind of memory error InBuffer, if it fails it's because of some kind of memory error
that we would want to fix anyway */ that we would want to fix anyway */
u32 TitleID = Memory::Read_U32(Buffer.InBuffer[0].m_Address); u32 TitleID = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
if (TitleID == 0) TitleID = 0xF00DBEEF; if (TitleID == 0) TitleID = 0xF00DBEEF;
char* pTitleID = (char*)&TitleID; char* pTitleID = (char*)&TitleID;
char* Path = (char*)Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address); char* Path = (char*)Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
sprintf(Path, "/00010000/%08x/data", TitleID); sprintf(Path, "/00010000/%08x/data", TitleID);
LOG(WII_IPC_ES, "ES: IOCTL_ES_GETTITLEDIR: %s)", Path); LOG(WII_IPC_ES, "ES: IOCTL_ES_GETTITLEDIR: %s)", Path);
} }
break; break;
case IOCTL_ES_GETTITLEID: // 0x20 case IOCTL_ES_GETTITLEID: // 0x20
{ {
u32 TitleID = VolumeHandler::Read32(0); u32 TitleID = VolumeHandler::Read32(0);
if (TitleID == 0) TitleID = 0xF00DBEEF; if (TitleID == 0) TitleID = 0xF00DBEEF;
/* This seems to be the right address to write the Title ID to /* This seems to be the right address to write the Title ID to
because then it shows up in the InBuffer of IOCTL_ES_GETTITLEDIR because then it shows up in the InBuffer of IOCTL_ES_GETTITLEDIR
that is called right after this. I have not seen that this that is called right after this. I have not seen that this
have any effect by itself, it probably only matters as an input to have any effect by itself, it probably only matters as an input to
IOCTL_ES_GETTITLEDIR. This values is not stored in 0x3180 or anywhere IOCTL_ES_GETTITLEDIR. This values is not stored in 0x3180 or anywhere
else as I have seen, it's just used as an input buffer in the following else as I have seen, it's just used as an input buffer in the following
IOCTL_ES_GETTITLEDIR call and then forgotten. */ IOCTL_ES_GETTITLEDIR call and then forgotten. */
Memory::Write_U32(TitleID, Buffer.PayloadBuffer[0].m_Address); Memory::Write_U32(TitleID, Buffer.PayloadBuffer[0].m_Address);
LOG(WII_IPC_ES, "ES: IOCTL_ES_GETTITLEID: 0x%x", TitleID); LOG(WII_IPC_ES, "ES: IOCTL_ES_GETTITLEID: 0x%x", TitleID);
} }
break; break;
case IOCTL_ES_GETVIEWCNT: // 0x12 (Input: 8 bytes, Output: 4 bytes) case IOCTL_ES_GETVIEWCNT: // 0x12 (Input: 8 bytes, Output: 4 bytes)
{ {
if(Buffer.NumberInBuffer) if(Buffer.NumberInBuffer)
u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address); u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
// Should we write something here? // Should we write something here?
//Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address); //Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address);
//DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4, //DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4,
// LogTypes::WII_IPC_NET); // LogTypes::WII_IPC_NET);
} }
break; break;
case IOCTL_ES_GETTMDVIEWCNT: // 0x14 case IOCTL_ES_GETTMDVIEWCNT: // 0x14
{ {
if(Buffer.NumberInBuffer) if(Buffer.NumberInBuffer)
u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address); u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
// Should we write something here? // Should we write something here?
//Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address); //Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address);
} }
break; break;
case IOCTL_ES_GETCONSUMPTION: // (Input: 8 bytes, Output: 0 bytes, 4 bytes) case IOCTL_ES_GETCONSUMPTION: // (Input: 8 bytes, Output: 0 bytes, 4 bytes)
//DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4, //DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4,
// LogTypes::WII_IPC_NET); // LogTypes::WII_IPC_NET);
break; break;
case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes) case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes)
break; break;
case IOCTL_ES_GETTITLECOUNT: case IOCTL_ES_GETTITLECOUNT:
{ {
u32 OutBuffer = Memory::Read_U32(Buffer.PayloadBuffer[0].m_Address); u32 OutBuffer = Memory::Read_U32(Buffer.PayloadBuffer[0].m_Address);
Memory::Write_U32(0, OutBuffer); Memory::Write_U32(0, OutBuffer);
LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es command:" LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es command:"
" IOCTL_ES_GETTITLECOUNT: 0x%x", OutBuffer); " IOCTL_ES_GETTITLECOUNT: 0x%x", OutBuffer);
} }
break; break;
default: default:
_dbg_assert_msg_(WII_IPC_HLE, 0, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter); _dbg_assert_msg_(WII_IPC_HLE, 0, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
DumpCommands(_CommandAddress, 8); DumpCommands(_CommandAddress, 8);
LOG(WII_IPC_HLE, "CWII_IPC_HLE_Device_es command:" LOG(WII_IPC_HLE, "CWII_IPC_HLE_Device_es command:"
"Parameter: 0x%08x", Buffer.Parameter); "Parameter: 0x%08x", Buffer.Parameter);
break; break;
} }
// Write return value (0 means OK) // Write return value (0 means OK)
Memory::Write_U32(0, _CommandAddress + 0x4); Memory::Write_U32(0, _CommandAddress + 0x4);
return true; return true;
} }
}; };
#endif #endif

View File

@ -1,61 +1,61 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_DEVICE_FS_H_ #ifndef _WII_IPC_HLE_DEVICE_FS_H_
#define _WII_IPC_HLE_DEVICE_FS_H_ #define _WII_IPC_HLE_DEVICE_FS_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
class CWII_IPC_HLE_Device_fs : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_fs : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string& _rDeviceName); CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_fs(); virtual ~CWII_IPC_HLE_Device_fs();
virtual bool Open(u32 _CommandAddress, u32 _Mode); virtual bool Open(u32 _CommandAddress, u32 _Mode);
#if 0 #if 0
virtual bool Close(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Close()", m_Name.c_str()); return true; } virtual bool Close(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Close()", m_Name.c_str()); return true; }
virtual bool Seek(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Seek()", m_Name.c_str()); return true; } virtual bool Seek(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Seek()", m_Name.c_str()); return true; }
virtual bool Read(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Read()", m_Name.c_str()); return true; } virtual bool Read(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Read()", m_Name.c_str()); return true; }
virtual bool Write(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Write()", m_Name.c_str()); return true; } virtual bool Write(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Write()", m_Name.c_str()); return true; }
#endif #endif
virtual bool IOCtl(u32 _CommandAddress); virtual bool IOCtl(u32 _CommandAddress);
virtual bool IOCtlV(u32 _CommandAddress); virtual bool IOCtlV(u32 _CommandAddress);
private: private:
enum enum
{ {
GET_STATS = 0x02, GET_STATS = 0x02,
CREATE_DIR = 0x03, CREATE_DIR = 0x03,
IOCTL_READ_DIR = 0x04, IOCTL_READ_DIR = 0x04,
SET_ATTR = 0x05, SET_ATTR = 0x05,
GET_ATTR = 0x06, GET_ATTR = 0x06,
DELETE_FILE = 0x07, DELETE_FILE = 0x07,
RENAME_FILE = 0x08, RENAME_FILE = 0x08,
CREATE_FILE = 0x09, CREATE_FILE = 0x09,
IOCTL_GETUSAGE = 0x0C IOCTL_GETUSAGE = 0x0C
}; };
s32 ExecuteCommand(u32 Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize); s32 ExecuteCommand(u32 Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
}; };
#endif #endif

View File

@ -1,126 +1,126 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_DEVICE_NET_H_ #ifndef _WII_IPC_HLE_DEVICE_NET_H_
#define _WII_IPC_HLE_DEVICE_NET_H_ #define _WII_IPC_HLE_DEVICE_NET_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
class CWII_IPC_HLE_Device_net_kd_request : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_net_kd_request : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName); CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_net_kd_request(); virtual ~CWII_IPC_HLE_Device_net_kd_request();
virtual bool Open(u32 _CommandAddress, u32 _Mode); virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool Close(u32 _CommandAddress); virtual bool Close(u32 _CommandAddress);
virtual bool IOCtl(u32 _CommandAddress); virtual bool IOCtl(u32 _CommandAddress);
private: private:
s32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize); s32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
}; };
// ************************************************************************************** // **************************************************************************************
class CWII_IPC_HLE_Device_net_kd_time : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_net_kd_time : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_net_kd_time(u32 _DeviceID, const std::string& _rDeviceName) : CWII_IPC_HLE_Device_net_kd_time(u32 _DeviceID, const std::string& _rDeviceName) :
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{} {}
virtual ~CWII_IPC_HLE_Device_net_kd_time() virtual ~CWII_IPC_HLE_Device_net_kd_time()
{} {}
virtual bool Open(u32 _CommandAddress, u32 _Mode) virtual bool Open(u32 _CommandAddress, u32 _Mode)
{ {
LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str()); LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str());
Memory::Write_U32(GetDeviceID(), _CommandAddress+4); Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
return true; return true;
} }
virtual bool Close(u32 _CommandAddress, u32 _Mode) virtual bool Close(u32 _CommandAddress, u32 _Mode)
{ {
LOG(WII_IPC_NET, "%s - IOCtl: Close", GetDeviceName().c_str()); LOG(WII_IPC_NET, "%s - IOCtl: Close", GetDeviceName().c_str());
Memory::Write_U32(0, _CommandAddress + 4); Memory::Write_U32(0, _CommandAddress + 4);
return true; return true;
} }
virtual bool IOCtl(u32 _CommandAddress) virtual bool IOCtl(u32 _CommandAddress)
{ {
#ifdef LOGGING #ifdef LOGGING
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C); u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
u32 Buffer1 = Memory::Read_U32(_CommandAddress +0x10); u32 Buffer1 = Memory::Read_U32(_CommandAddress +0x10);
u32 BufferSize1 = Memory::Read_U32(_CommandAddress +0x14); u32 BufferSize1 = Memory::Read_U32(_CommandAddress +0x14);
u32 Buffer2 = Memory::Read_U32(_CommandAddress +0x18); u32 Buffer2 = Memory::Read_U32(_CommandAddress +0x18);
u32 BufferSize2 = Memory::Read_U32(_CommandAddress +0x1C); u32 BufferSize2 = Memory::Read_U32(_CommandAddress +0x1C);
#endif #endif
// write return value // write return value
Memory::Write_U32(0, _CommandAddress + 0x4); Memory::Write_U32(0, _CommandAddress + 0x4);
LOG(WII_IPC_NET, "%s - IOCtl:\n" LOG(WII_IPC_NET, "%s - IOCtl:\n"
" Parameter: 0x%x (0x17 could be some kind of Sync RTC) \n" " Parameter: 0x%x (0x17 could be some kind of Sync RTC) \n"
" Buffer1: 0x%08x\n" " Buffer1: 0x%08x\n"
" BufferSize1: 0x%08x\n" " BufferSize1: 0x%08x\n"
" Buffer2: 0x%08x\n" " Buffer2: 0x%08x\n"
" BufferSize2: 0x%08x\n", " BufferSize2: 0x%08x\n",
GetDeviceName().c_str(), Parameter, Buffer1, BufferSize1, Buffer2, BufferSize2); GetDeviceName().c_str(), Parameter, Buffer1, BufferSize1, Buffer2, BufferSize2);
return true; return true;
} }
}; };
// ************************************************************************************** // **************************************************************************************
class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName) : CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName) :
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{} {}
virtual ~CWII_IPC_HLE_Device_net_ip_top() {} virtual ~CWII_IPC_HLE_Device_net_ip_top() {}
virtual bool Open(u32 _CommandAddress, u32 _Mode) virtual bool Open(u32 _CommandAddress, u32 _Mode)
{ {
LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str()); LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str());
Memory::Write_U32(GetDeviceID(), _CommandAddress+4); Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
return true; return true;
} }
}; };
// ************************************************************************************** // **************************************************************************************
class CWII_IPC_HLE_Device_net_ncd_manage : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_net_ncd_manage : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_net_ncd_manage(u32 _DeviceID, const std::string& _rDeviceName); CWII_IPC_HLE_Device_net_ncd_manage(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_net_ncd_manage(); virtual ~CWII_IPC_HLE_Device_net_ncd_manage();
virtual bool Open(u32 _CommandAddress, u32 _Mode); virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool IOCtlV(u32 _CommandAddress); virtual bool IOCtlV(u32 _CommandAddress);
}; };
#endif #endif

View File

@ -1,48 +1,48 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// PRELIMINARY - doesn't work yet // PRELIMINARY - doesn't work yet
#ifndef _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_ #ifndef _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_
#define _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_ #define _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
namespace DiscIO namespace DiscIO
{ {
class IVolume; class IVolume;
class IFileSystem; class IFileSystem;
} }
class CWII_IPC_HLE_Device_sdio_slot0 : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_sdio_slot0 : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName); CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_sdio_slot0(); virtual ~CWII_IPC_HLE_Device_sdio_slot0();
bool Open(u32 _CommandAddress, u32 _Mode); bool Open(u32 _CommandAddress, u32 _Mode);
bool IOCtl(u32 _CommandAddress); bool IOCtl(u32 _CommandAddress);
bool IOCtlV(u32 _CommandAddress); bool IOCtlV(u32 _CommandAddress);
private: private:
u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize); u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize);
}; };
#endif #endif

View File

@ -1,193 +1,193 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_DEVICE_STM_H_ #ifndef _WII_IPC_HLE_DEVICE_STM_H_
#define _WII_IPC_HLE_DEVICE_STM_H_ #define _WII_IPC_HLE_DEVICE_STM_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
enum enum
{ {
IOCTL_STM_EVENTHOOK = 0x1000, IOCTL_STM_EVENTHOOK = 0x1000,
IOCTL_STM_GET_IDLEMODE = 0x3001, IOCTL_STM_GET_IDLEMODE = 0x3001,
IOCTL_STM_RELEASE_EH = 0x3002, IOCTL_STM_RELEASE_EH = 0x3002,
IOCTL_STM_HOTRESET = 0x2001, IOCTL_STM_HOTRESET = 0x2001,
IOCTL_STM_HOTRESET_FOR_PD = 0x2002, IOCTL_STM_HOTRESET_FOR_PD = 0x2002,
IOCTL_STM_SHUTDOWN = 0x2003, IOCTL_STM_SHUTDOWN = 0x2003,
IOCTL_STM_IDLE = 0x2004, IOCTL_STM_IDLE = 0x2004,
IOCTL_STM_WAKEUP = 0x2005, IOCTL_STM_WAKEUP = 0x2005,
IOCTL_STM_VIDIMMING = 0x5001, IOCTL_STM_VIDIMMING = 0x5001,
IOCTL_STM_LEDFLASH = 0x6001, IOCTL_STM_LEDFLASH = 0x6001,
IOCTL_STM_LEDMODE = 0x6002, IOCTL_STM_LEDMODE = 0x6002,
IOCTL_STM_READVER = 0x7001, IOCTL_STM_READVER = 0x7001,
IOCTL_STM_READDDRREG = 0x4001, IOCTL_STM_READDDRREG = 0x4001,
IOCTL_STM_READDDRREG2 = 0x4002, IOCTL_STM_READDDRREG2 = 0x4002,
}; };
// ======================================================= // =======================================================
// The /device/stm/immediate class // The /device/stm/immediate class
// ------------- // -------------
class CWII_IPC_HLE_Device_stm_immediate : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_stm_immediate : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_stm_immediate(u32 _DeviceID, const std::string& _rDeviceName) : CWII_IPC_HLE_Device_stm_immediate(u32 _DeviceID, const std::string& _rDeviceName) :
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
{} {}
virtual ~CWII_IPC_HLE_Device_stm_immediate() virtual ~CWII_IPC_HLE_Device_stm_immediate()
{} {}
virtual bool Open(u32 _CommandAddress, u32 _Mode) virtual bool Open(u32 _CommandAddress, u32 _Mode)
{ {
LOGV(WII_IPC_SD, 0, "STM: Open"); LOGV(WII_IPC_SD, 0, "STM: Open");
Memory::Write_U32(GetDeviceID(), _CommandAddress+4); Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
return true; return true;
} }
virtual bool IOCtl(u32 _CommandAddress) virtual bool IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C); u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress +0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress +0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress +0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress +0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress +0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress +0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress +0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress +0x1C);
// Prepare the out buffer(s) with zeroes as a safety precaution // Prepare the out buffer(s) with zeroes as a safety precaution
// to avoid returning bad values // to avoid returning bad values
Memory::Memset(BufferOut, 0, BufferOutSize); Memory::Memset(BufferOut, 0, BufferOutSize);
u32 ReturnValue = 0; u32 ReturnValue = 0;
switch(Parameter) switch(Parameter)
{ {
case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes) case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes)
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str()); LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
LOG(WII_IPC_SD, " IOCTL_STM_VIDIMMING"); LOG(WII_IPC_SD, " IOCTL_STM_VIDIMMING");
//DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_SD); //DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_SD);
//Memory::Write_U32(1, BufferOut); //Memory::Write_U32(1, BufferOut);
//ReturnValue = 1; //ReturnValue = 1;
break; break;
case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes) case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes)
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str()); LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
LOG(WII_IPC_SD, " IOCTL_STM_LEDMODE"); LOG(WII_IPC_SD, " IOCTL_STM_LEDMODE");
break; break;
default: default:
{ {
_dbg_assert_msg_(WII_IPC_SD, 0, "CWII_IPC_HLE_Device_stm_immediate: 0x%x", Parameter); _dbg_assert_msg_(WII_IPC_SD, 0, "CWII_IPC_HLE_Device_stm_immediate: 0x%x", Parameter);
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str()); LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
LOG(WII_IPC_SD, " Parameter: 0x%x\n", Parameter); LOG(WII_IPC_SD, " Parameter: 0x%x\n", Parameter);
LOG(WII_IPC_SD, " InBuffer: 0x%08x\n", BufferIn); LOG(WII_IPC_SD, " InBuffer: 0x%08x\n", BufferIn);
LOG(WII_IPC_SD, " InBufferSize: 0x%08x\n", BufferInSize); LOG(WII_IPC_SD, " InBufferSize: 0x%08x\n", BufferInSize);
LOG(WII_IPC_SD, " OutBuffer: 0x%08x\n", BufferOut); LOG(WII_IPC_SD, " OutBuffer: 0x%08x\n", BufferOut);
LOG(WII_IPC_SD, " OutBufferSize: 0x%08x\n", BufferOutSize); LOG(WII_IPC_SD, " OutBufferSize: 0x%08x\n", BufferOutSize);
} }
break; break;
} }
// Write return value to the IPC call // Write return value to the IPC call
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
// Generate true or false reply for the main UpdateInterrupts() function // Generate true or false reply for the main UpdateInterrupts() function
return true; return true;
} }
}; };
// ======================================================= // =======================================================
// The /device/stm/eventhook class // The /device/stm/eventhook class
// ------------- // -------------
class CWII_IPC_HLE_Device_stm_eventhook : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_stm_eventhook : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_stm_eventhook(u32 _DeviceID, const std::string& _rDeviceName) CWII_IPC_HLE_Device_stm_eventhook(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_EventHookAddress(0) , m_EventHookAddress(0)
{} {}
virtual ~CWII_IPC_HLE_Device_stm_eventhook() virtual ~CWII_IPC_HLE_Device_stm_eventhook()
{} {}
virtual bool Open(u32 _CommandAddress, u32 _Mode) virtual bool Open(u32 _CommandAddress, u32 _Mode)
{ {
Memory::Write_U32(GetDeviceID(), _CommandAddress + 4); Memory::Write_U32(GetDeviceID(), _CommandAddress + 4);
return true; return true;
} }
virtual bool IOCtl(u32 _CommandAddress) virtual bool IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C); u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress +0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress +0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress +0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress +0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress +0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress +0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress +0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress +0x1C);
// Prepare the out buffer(s) with zeroes as a safety precaution // Prepare the out buffer(s) with zeroes as a safety precaution
// to avoid returning bad values // to avoid returning bad values
Memory::Memset(BufferOut, 0, BufferOutSize); Memory::Memset(BufferOut, 0, BufferOutSize);
u32 ReturnValue = 0; u32 ReturnValue = 0;
// write return value // write return value
switch (Parameter) switch (Parameter)
{ {
case IOCTL_STM_EVENTHOOK: case IOCTL_STM_EVENTHOOK:
{ {
m_EventHookAddress = _CommandAddress; m_EventHookAddress = _CommandAddress;
LOG(WII_IPC_SD, "%s registers event hook:\n", GetDeviceName().c_str()); LOG(WII_IPC_SD, "%s registers event hook:\n", GetDeviceName().c_str());
LOG(WII_IPC_SD, " 0x1000 - IOCTL_STM_EVENTHOOK\n", Parameter); LOG(WII_IPC_SD, " 0x1000 - IOCTL_STM_EVENTHOOK\n", Parameter);
LOG(WII_IPC_SD, " BufferIn: 0x%08x\n", BufferIn); LOG(WII_IPC_SD, " BufferIn: 0x%08x\n", BufferIn);
LOG(WII_IPC_SD, " BufferInSize: 0x%08x\n", BufferInSize); LOG(WII_IPC_SD, " BufferInSize: 0x%08x\n", BufferInSize);
LOG(WII_IPC_SD, " BufferOut: 0x%08x\n", BufferOut); LOG(WII_IPC_SD, " BufferOut: 0x%08x\n", BufferOut);
LOG(WII_IPC_SD, " BufferOutSize: 0x%08x\n", BufferOutSize); LOG(WII_IPC_SD, " BufferOutSize: 0x%08x\n", BufferOutSize);
DumpCommands(BufferIn, BufferInSize/4, LogTypes::WII_IPC_SD); DumpCommands(BufferIn, BufferInSize/4, LogTypes::WII_IPC_SD);
return false; return false;
} }
break; break;
default: default:
{ {
_dbg_assert_msg_(WII_IPC_SD, 0, "CWII_IPC_HLE_Device_stm_eventhook: 0x%x", Parameter); _dbg_assert_msg_(WII_IPC_SD, 0, "CWII_IPC_HLE_Device_stm_eventhook: 0x%x", Parameter);
LOG(WII_IPC_SD, "%s registers event hook:\n", GetDeviceName().c_str()); LOG(WII_IPC_SD, "%s registers event hook:\n", GetDeviceName().c_str());
LOG(WII_IPC_SD, " Parameter: 0x%x\n", Parameter); LOG(WII_IPC_SD, " Parameter: 0x%x\n", Parameter);
LOG(WII_IPC_SD, " BufferIn: 0x%08x\n", BufferIn); LOG(WII_IPC_SD, " BufferIn: 0x%08x\n", BufferIn);
LOG(WII_IPC_SD, " BufferInSize: 0x%08x\n", BufferInSize); LOG(WII_IPC_SD, " BufferInSize: 0x%08x\n", BufferInSize);
LOG(WII_IPC_SD, " BufferOut: 0x%08x\n", BufferOut); LOG(WII_IPC_SD, " BufferOut: 0x%08x\n", BufferOut);
LOG(WII_IPC_SD, " BufferOutSize: 0x%08x\n", BufferOutSize); LOG(WII_IPC_SD, " BufferOutSize: 0x%08x\n", BufferOutSize);
} }
break; break;
} }
// Write return value to the IPC call, 0 means success // Write return value to the IPC call, 0 means success
Memory::Write_U32(0, _CommandAddress + 0x4); Memory::Write_U32(0, _CommandAddress + 0x4);
// Generate true or false reply for the main UpdateInterrupts() function // Generate true or false reply for the main UpdateInterrupts() function
return false; return false;
} }
// STATE_TO_SAVE // STATE_TO_SAVE
u32 m_EventHookAddress; u32 m_EventHookAddress;
}; };
#endif #endif

View File

@ -1,220 +1,220 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_DEVICE_USB_H_ #ifndef _WII_IPC_HLE_DEVICE_USB_H_
#define _WII_IPC_HLE_DEVICE_USB_H_ #define _WII_IPC_HLE_DEVICE_USB_H_
#include "WII_IPC_HLE_Device.h" #include "WII_IPC_HLE_Device.h"
#include "hci.h" #include "hci.h"
#include <vector> #include <vector>
#include <queue> #include <queue>
#include "WII_IPC_HLE_WiiMote.h" #include "WII_IPC_HLE_WiiMote.h"
union UACLHeader union UACLHeader
{ {
struct struct
{ {
unsigned ConnectionHandle : 12; unsigned ConnectionHandle : 12;
unsigned PBFlag : 2; unsigned PBFlag : 2;
unsigned BCFlag : 2; unsigned BCFlag : 2;
unsigned Size : 16; unsigned Size : 16;
}; };
u32 Hex; u32 Hex;
}; };
struct ACLFrame struct ACLFrame
{ {
u16 ConnectionHandle; u16 ConnectionHandle;
u8* data; u8* data;
u32 size; u32 size;
}; };
struct SQueuedEvent struct SQueuedEvent
{ {
u8 m_buffer[1024]; u8 m_buffer[1024];
size_t m_size; size_t m_size;
u16 m_connectionHandle; u16 m_connectionHandle;
SQueuedEvent(size_t size, u16 connectionHandle) SQueuedEvent(size_t size, u16 connectionHandle)
: m_size(size) : m_size(size)
, m_connectionHandle(connectionHandle) , m_connectionHandle(connectionHandle)
{ {
if (m_size > 1024) if (m_size > 1024)
{ {
// i know this code sux... // i know this code sux...
PanicAlert("SQueuedEvent: allocate a to big buffer!!"); PanicAlert("SQueuedEvent: allocate a to big buffer!!");
} }
} }
}; };
class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device
{ {
public: public:
CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName); CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName);
virtual ~CWII_IPC_HLE_Device_usb_oh1_57e_305(); virtual ~CWII_IPC_HLE_Device_usb_oh1_57e_305();
virtual bool Open(u32 _CommandAddress, u32 _Mode); virtual bool Open(u32 _CommandAddress, u32 _Mode);
virtual bool IOCtlV(u32 _CommandAddress); virtual bool IOCtlV(u32 _CommandAddress);
virtual bool IOCtl(u32 _CommandAddress); virtual bool IOCtl(u32 _CommandAddress);
virtual u32 Update(); virtual u32 Update();
void SendACLFrame(u16 _ConnectionHandle, u8* _pData, u32 _Size); void SendACLFrame(u16 _ConnectionHandle, u8* _pData, u32 _Size);
//hack for wiimote plugin //hack for wiimote plugin
public: public:
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes; std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr); CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr);
CWII_IPC_HLE_WiiMote* AccessWiiMote(u16 _ConnectionHandle); CWII_IPC_HLE_WiiMote* AccessWiiMote(u16 _ConnectionHandle);
private: private:
enum enum
{ {
USB_IOCTL_HCI_COMMAND_MESSAGE = 0, USB_IOCTL_HCI_COMMAND_MESSAGE = 0,
USB_IOCTL_BLKMSG = 1, USB_IOCTL_BLKMSG = 1,
USB_IOCTL_INTRMSG = 2, USB_IOCTL_INTRMSG = 2,
USB_IOCTL_SUSPENDDEV = 5, USB_IOCTL_SUSPENDDEV = 5,
USB_IOCTL_RESUMEDEV = 6, USB_IOCTL_RESUMEDEV = 6,
USB_IOCTL_GETDEVLIST = 12, USB_IOCTL_GETDEVLIST = 12,
USB_IOCTL_DEVREMOVALHOOK = 26, USB_IOCTL_DEVREMOVALHOOK = 26,
USB_IOCTL_DEVINSERTHOOK = 27, USB_IOCTL_DEVINSERTHOOK = 27,
}; };
enum enum
{ {
HCI_EVENT_ENDPOINT = 0x81, HCI_EVENT_ENDPOINT = 0x81,
ACL_DATA_ENDPOINT_READ = 0x02, ACL_DATA_ENDPOINT_READ = 0x02,
ACL_DATA_ENDPOINT = 0x82, ACL_DATA_ENDPOINT = 0x82,
}; };
struct SHCICommandMessage struct SHCICommandMessage
{ {
u8 bRequestType; u8 bRequestType;
u8 bRequest; u8 bRequest;
u16 wValue; u16 wValue;
u16 wIndex; u16 wIndex;
u16 wLength; u16 wLength;
u32 m_PayLoadAddr; u32 m_PayLoadAddr;
u32 m_PayLoadSize; u32 m_PayLoadSize;
}; };
bdaddr_t m_ControllerBD; bdaddr_t m_ControllerBD;
u8 m_ClassOfDevice[HCI_CLASS_SIZE]; u8 m_ClassOfDevice[HCI_CLASS_SIZE];
char m_LocalName[HCI_UNIT_NAME_SIZE]; char m_LocalName[HCI_UNIT_NAME_SIZE];
u8 m_PINType; u8 m_PINType;
u8 m_ScanEnable; u8 m_ScanEnable;
u8 m_EventFilterType; u8 m_EventFilterType;
u8 m_EventFilterCondition; u8 m_EventFilterCondition;
u16 m_HostMaxACLSize; u16 m_HostMaxACLSize;
u8 m_HostMaxSCOSize; u8 m_HostMaxSCOSize;
u16 m_HostNumACLPackets; u16 m_HostNumACLPackets;
u16 m_HostNumSCOPackets; u16 m_HostNumSCOPackets;
typedef std::queue<SQueuedEvent> CEventQueue; typedef std::queue<SQueuedEvent> CEventQueue;
typedef std::queue<ACLFrame> CACLFrameQueue; typedef std::queue<ACLFrame> CACLFrameQueue;
CEventQueue m_EventQueue; CEventQueue m_EventQueue;
CACLFrameQueue m_AclFrameQue; CACLFrameQueue m_AclFrameQue;
SIOCtlVBuffer* m_pACLBuffer; SIOCtlVBuffer* m_pACLBuffer;
SIOCtlVBuffer* m_pHCIBuffer; SIOCtlVBuffer* m_pHCIBuffer;
// Events // Events
void AddEventToQueue(const SQueuedEvent& _event); void AddEventToQueue(const SQueuedEvent& _event);
bool SendEventCommandStatus(u16 _Opcode); bool SendEventCommandStatus(u16 _Opcode);
void SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize); void SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize);
bool SendEventInquiryResponse(); bool SendEventInquiryResponse();
bool SendEventInquiryComplete(); bool SendEventInquiryComplete();
bool SendEventRemoteNameReq(bdaddr_t _bd); bool SendEventRemoteNameReq(bdaddr_t _bd);
bool SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote); bool SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote);
bool SendEventConnectionComplete(bdaddr_t _bd); bool SendEventConnectionComplete(bdaddr_t _bd);
bool SendEventReadClockOffsetComplete(u16 _connectionHandle); bool SendEventReadClockOffsetComplete(u16 _connectionHandle);
bool SendEventReadRemoteVerInfo(u16 _connectionHandle); bool SendEventReadRemoteVerInfo(u16 _connectionHandle);
bool SendEventReadRemoteFeatures(u16 _connectionHandle); bool SendEventReadRemoteFeatures(u16 _connectionHandle);
bool SendEventRoleChange(bdaddr_t _bd, bool _master); bool SendEventRoleChange(bdaddr_t _bd, bool _master);
bool SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count); bool SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count);
bool SendEventAuthenticationCompleted(u16 _connectionHandle); bool SendEventAuthenticationCompleted(u16 _connectionHandle);
bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value); bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value);
bool SendEventDisconnect(u16 _connectionHandle, u8 _Reason); bool SendEventDisconnect(u16 _connectionHandle, u8 _Reason);
bool SendEventRequestLinkKey(bdaddr_t _bd); bool SendEventRequestLinkKey(bdaddr_t _bd);
bool SendEventLinkKeyNotification(const CWII_IPC_HLE_WiiMote& _rWiiMote); bool SendEventLinkKeyNotification(const CWII_IPC_HLE_WiiMote& _rWiiMote);
// Execute HCI Message // Execute HCI Message
void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage); void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage);
// OGF 0x01 Link control commands and return parameters // OGF 0x01 Link control commands and return parameters
void CommandWriteInquiryMode(u8* _Input); void CommandWriteInquiryMode(u8* _Input);
void CommandWritePageScanType(u8* _Input); void CommandWritePageScanType(u8* _Input);
void CommandHostBufferSize(u8* _Input); void CommandHostBufferSize(u8* _Input);
void CommandInquiryCancel(u8* _Input); void CommandInquiryCancel(u8* _Input);
void CommandRemoteNameReq(u8* _Input); void CommandRemoteNameReq(u8* _Input);
void CommandCreateCon(u8* _Input); void CommandCreateCon(u8* _Input);
void CommandAcceptCon(u8* _Input); void CommandAcceptCon(u8* _Input);
void CommandReadClockOffset(u8* _Input); void CommandReadClockOffset(u8* _Input);
void CommandReadRemoteVerInfo(u8* _Input); void CommandReadRemoteVerInfo(u8* _Input);
void CommandReadRemoteFeatures(u8* _Input); void CommandReadRemoteFeatures(u8* _Input);
void CommandAuthenticationRequested(u8* _Input); void CommandAuthenticationRequested(u8* _Input);
void CommandInquiry(u8* _Input); void CommandInquiry(u8* _Input);
void CommandDisconnect(u8* _Input); void CommandDisconnect(u8* _Input);
void CommandLinkKeyNegRep(u8* _Input); void CommandLinkKeyNegRep(u8* _Input);
void CommandLinkKeyRep(u8* _Input); void CommandLinkKeyRep(u8* _Input);
// OGF 0x02 Link policy commands and return parameters // OGF 0x02 Link policy commands and return parameters
void CommandWriteLinkPolicy(u8* _Input); void CommandWriteLinkPolicy(u8* _Input);
void CommandSniffMode(u8* _Input); void CommandSniffMode(u8* _Input);
// OGF 0x03 Host Controller and Baseband commands and return parameters // OGF 0x03 Host Controller and Baseband commands and return parameters
void CommandReset(u8* _Input); void CommandReset(u8* _Input);
void CommandWriteLocalName(u8* _Input); void CommandWriteLocalName(u8* _Input);
void CommandWritePageTimeOut(u8* _Input); void CommandWritePageTimeOut(u8* _Input);
void CommandWriteScanEnable(u8* _Input); void CommandWriteScanEnable(u8* _Input);
void CommandWriteUnitClass(u8* _Input); void CommandWriteUnitClass(u8* _Input);
void CommandReadStoredLinkKey(u8* _Input); void CommandReadStoredLinkKey(u8* _Input);
void CommandWritePinType(u8* _Input); void CommandWritePinType(u8* _Input);
void CommandSetEventFilter(u8* _Input); void CommandSetEventFilter(u8* _Input);
void CommandWriteInquiryScanType(u8* _Input); void CommandWriteInquiryScanType(u8* _Input);
void CommandWriteLinkSupervisionTimeout(u8* _Input); void CommandWriteLinkSupervisionTimeout(u8* _Input);
// OGF 0x04 Informational commands and return parameters // OGF 0x04 Informational commands and return parameters
void CommandReadBufferSize(u8* _Input); void CommandReadBufferSize(u8* _Input);
void CommandReadLocalVer(u8* _Input); void CommandReadLocalVer(u8* _Input);
void CommandReadLocalFeatures(u8* _Input); void CommandReadLocalFeatures(u8* _Input);
void CommandReadBDAdrr(u8* _Input); void CommandReadBDAdrr(u8* _Input);
// OGF 0x3F Vendor specific // OGF 0x3F Vendor specific
void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size); void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size);
void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size); void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size);
void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size); void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size);
void LOG_LinkKey(const u8* _pLinkKey); void LOG_LinkKey(const u8* _pLinkKey);
}; };
#endif #endif

View File

@ -1,205 +1,205 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _WII_IPC_HLE_WII_MOTE_ #ifndef _WII_IPC_HLE_WII_MOTE_
#define _WII_IPC_HLE_WII_MOTE_ #define _WII_IPC_HLE_WII_MOTE_
#include <map> #include <map>
#include "hci.h" #include "hci.h"
#include <string> #include <string>
class CWII_IPC_HLE_Device_usb_oh1_57e_305; class CWII_IPC_HLE_Device_usb_oh1_57e_305;
class CBigEndianBuffer class CBigEndianBuffer
{ {
public: public:
CBigEndianBuffer(u8* pBuffer) CBigEndianBuffer(u8* pBuffer)
: m_pBuffer(pBuffer) : m_pBuffer(pBuffer)
{ {
} }
u8 Read8(u32 offset) u8 Read8(u32 offset)
{ {
return m_pBuffer[offset]; return m_pBuffer[offset];
} }
u16 Read16(u32 offset) u16 Read16(u32 offset)
{ {
return Common::swap16(*(u16*)&m_pBuffer[offset]); return Common::swap16(*(u16*)&m_pBuffer[offset]);
} }
u32 Read32(u32 offset) u32 Read32(u32 offset)
{ {
return Common::swap32(*(u32*)&m_pBuffer[offset]); return Common::swap32(*(u32*)&m_pBuffer[offset]);
} }
void Write8(u32 offset, u8 data) void Write8(u32 offset, u8 data)
{ {
m_pBuffer[offset] = data; m_pBuffer[offset] = data;
} }
void Write16(u32 offset, u16 data) void Write16(u32 offset, u16 data)
{ {
*(u16*)&m_pBuffer[offset] = Common::swap16(data); *(u16*)&m_pBuffer[offset] = Common::swap16(data);
} }
void Write32(u32 offset, u32 data) void Write32(u32 offset, u32 data)
{ {
*(u32*)&m_pBuffer[offset] = Common::swap32(data); *(u32*)&m_pBuffer[offset] = Common::swap32(data);
} }
u8* GetPointer(u32 offset) u8* GetPointer(u32 offset)
{ {
return &m_pBuffer[offset]; return &m_pBuffer[offset];
} }
private: private:
u8* m_pBuffer; u8* m_pBuffer;
}; };
class CWII_IPC_HLE_WiiMote class CWII_IPC_HLE_WiiMote
{ {
public: public:
CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number); CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number);
virtual ~CWII_IPC_HLE_WiiMote() virtual ~CWII_IPC_HLE_WiiMote()
{} {}
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// ugly Host handling.... // ugly Host handling....
// we really have to clean all this code // we really have to clean all this code
bool Update(); bool Update();
bool IsConnected() const { return m_Connected; } bool IsConnected() const { return m_Connected; }
void EventConnectionAccepted(); void EventConnectionAccepted();
void EventDisconnect(); void EventDisconnect();
bool EventPagingChanged(u8 _pageMode); bool EventPagingChanged(u8 _pageMode);
void EventCommandWriteLinkPolicy(); void EventCommandWriteLinkPolicy();
const bdaddr_t& GetBD() const { return m_BD; } const bdaddr_t& GetBD() const { return m_BD; }
const uint8_t* GetClass() const { return uclass; } const uint8_t* GetClass() const { return uclass; }
u16 GetConnectionHandle() const { return m_ControllerConnectionHandle; } u16 GetConnectionHandle() const { return m_ControllerConnectionHandle; }
const u8* GetFeatures() const { return features; } const u8* GetFeatures() const { return features; }
const char* GetName() const { return m_Name.c_str(); } const char* GetName() const { return m_Name.c_str(); }
u8 GetLMPVersion() const { return lmp_version; } u8 GetLMPVersion() const { return lmp_version; }
u16 GetLMPSubVersion() const { return lmp_subversion; } u16 GetLMPSubVersion() const { return lmp_subversion; }
u8 GetManufactorID() const { return 0xF; } // Broadcom Corporation u8 GetManufactorID() const { return 0xF; } // Broadcom Corporation
void SendACLFrame(u8* _pData, u32 _Size); //to wiimote void SendACLFrame(u8* _pData, u32 _Size); //to wiimote
void SendL2capData(u16 scid, const void* _pData, u32 _Size); //from wiimote void SendL2capData(u16 scid, const void* _pData, u32 _Size); //from wiimote
const u8* GetLinkKey() const { return m_LinkKey; } const u8* GetLinkKey() const { return m_LinkKey; }
private: private:
// state machine // state machine
bool m_Connected; bool m_Connected;
bool m_HIDControlChannel_Connected; bool m_HIDControlChannel_Connected;
bool m_HIDControlChannel_ConnectedWait; bool m_HIDControlChannel_ConnectedWait;
bool m_HIDControlChannel_Config; bool m_HIDControlChannel_Config;
bool m_HIDControlChannel_ConfigWait; bool m_HIDControlChannel_ConfigWait;
bool m_HIDInterruptChannel_Connected; bool m_HIDInterruptChannel_Connected;
bool m_HIDInterruptChannel_ConnectedWait; bool m_HIDInterruptChannel_ConnectedWait;
bool m_HIDInterruptChannel_Config; bool m_HIDInterruptChannel_Config;
bool m_HIDInterruptChannel_ConfigWait; bool m_HIDInterruptChannel_ConfigWait;
// STATE_TO_SAVE // STATE_TO_SAVE
bdaddr_t m_BD; bdaddr_t m_BD;
u16 m_ControllerConnectionHandle; u16 m_ControllerConnectionHandle;
uint8_t uclass[HCI_CLASS_SIZE]; uint8_t uclass[HCI_CLASS_SIZE];
u8 features[HCI_FEATURES_SIZE]; u8 features[HCI_FEATURES_SIZE];
u8 lmp_version; u8 lmp_version;
u16 lmp_subversion; u16 lmp_subversion;
u8 m_LinkKey[16]; u8 m_LinkKey[16];
std::string m_Name; std::string m_Name;
CWII_IPC_HLE_Device_usb_oh1_57e_305* m_pHost; CWII_IPC_HLE_Device_usb_oh1_57e_305* m_pHost;
struct SChannel struct SChannel
{ {
u16 SCID; u16 SCID;
u16 DCID; u16 DCID;
u16 PSM; u16 PSM;
u16 MTU; u16 MTU;
u16 FlushTimeOut; u16 FlushTimeOut;
}; };
typedef std::map<u32, SChannel> CChannelMap; typedef std::map<u32, SChannel> CChannelMap;
CChannelMap m_Channel; CChannelMap m_Channel;
bool DoesChannelExist(u16 _SCID) bool DoesChannelExist(u16 _SCID)
{ {
return m_Channel.find(_SCID) != m_Channel.end(); return m_Channel.find(_SCID) != m_Channel.end();
} }
void SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLength, u8* _pCommandData); void SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLength, u8* _pCommandData);
void SignalChannel(u8* _pData, u32 _Size); void SignalChannel(u8* _pData, u32 _Size);
void SendConnectionRequest(u16 _SCID, u16 _PSM); void SendConnectionRequest(u16 _SCID, u16 _PSM);
void SendConfigurationRequest(u16 _SCID, u16* _pMTU = NULL, u16* _pFlushTimeOut = NULL); void SendConfigurationRequest(u16 _SCID, u16* _pMTU = NULL, u16* _pFlushTimeOut = NULL);
void SendDisconnectRequest(u16 _SCID); void SendDisconnectRequest(u16 _SCID);
void CommandConnectionReq(u8 _Ident, u8* _pData, u32 _Size); void CommandConnectionReq(u8 _Ident, u8* _pData, u32 _Size);
void CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Size); void CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Size);
void CommandConnectionResponse(u8 _Ident, u8* _pData, u32 _Size); void CommandConnectionResponse(u8 _Ident, u8* _pData, u32 _Size);
void CommandDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size); void CommandDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size);
void CommandCofigurationResponse(u8 _Ident, u8* _pData, u32 _Size); void CommandCofigurationResponse(u8 _Ident, u8* _pData, u32 _Size);
////////////////// //////////////////
// some new ugly stuff // some new ugly stuff
// //
// should be inside the plugin // should be inside the plugin
// //
void HandleSDP(u16 _SCID, u8* _pData, u32 _Size); void HandleSDP(u16 _SCID, u8* _pData, u32 _Size);
void SDPSendServiceSearchResponse(u16 _SCID, u16 _TransactionID, u8* _pServiceSearchPattern, u16 _MaximumServiceRecordCount); void SDPSendServiceSearchResponse(u16 _SCID, u16 _TransactionID, u8* _pServiceSearchPattern, u16 _MaximumServiceRecordCount);
void SDPSendServiceAttributeResponse(u16 _SCID, u16 TransactionID, u32 _ServiceHandle, void SDPSendServiceAttributeResponse(u16 _SCID, u16 TransactionID, u32 _ServiceHandle,
u16 _StartAttrID, u16 _EndAttrID, u16 _StartAttrID, u16 _EndAttrID,
u16 _MaximumAttributeByteCount, u8* _pContinuationState); u16 _MaximumAttributeByteCount, u8* _pContinuationState);
u16 AddAttribToList(int _AttribID, u8* _pBuffer); u16 AddAttribToList(int _AttribID, u8* _pBuffer);
}; };
#endif #endif

View File

@ -1,40 +1,40 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef WIIMOTE_HID_ATTR_H_ #ifndef WIIMOTE_HID_ATTR_H_
#define WIIMOTE_HID_ATTR_H_ #define WIIMOTE_HID_ATTR_H_
struct SAttrib struct SAttrib
{ {
u16 ID; u16 ID;
u8* pData; u8* pData;
u16 size; u16 size;
SAttrib(u16 _ID, u8* _Data, u16 _size) SAttrib(u16 _ID, u8* _Data, u16 _size)
: ID(_ID) : ID(_ID)
, pData(_Data) , pData(_Data)
, size(_size) , size(_size)
{ } { }
}; };
typedef std::vector<SAttrib> CAttribTable; typedef std::vector<SAttrib> CAttribTable;
const CAttribTable& GetAttribTable(); const CAttribTable& GetAttribTable();
const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size); const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size);
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -218,56 +218,56 @@ struct value_string
char* string; char* string;
}; };
static const value_string command_code_vals[] = { static const value_string command_code_vals[] = {
{ 0x01, (char *)"Command Reject" }, { 0x01, (char *)"Command Reject" },
{ 0x02, (char *)"Connection Request" }, { 0x02, (char *)"Connection Request" },
{ 0x03, (char *)"Connection Response" }, { 0x03, (char *)"Connection Response" },
{ 0x04, (char *)"Configure Request" }, { 0x04, (char *)"Configure Request" },
{ 0x05, (char *)"Configure Response" }, { 0x05, (char *)"Configure Response" },
{ 0x06, (char *)"Disconnect Request" }, { 0x06, (char *)"Disconnect Request" },
{ 0x07, (char *)"Disconnect Response" }, { 0x07, (char *)"Disconnect Response" },
{ 0x08, (char *)"Echo Request" }, { 0x08, (char *)"Echo Request" },
{ 0x09, (char *)"Echo Response" }, { 0x09, (char *)"Echo Response" },
{ 0x0A, (char *)"Information Request" }, { 0x0A, (char *)"Information Request" },
{ 0x0B, (char *)"Information Response" }, { 0x0B, (char *)"Information Response" },
{ 0, NULL } { 0, NULL }
}; };
static const value_string psm_vals[] = { static const value_string psm_vals[] = {
{ 0x0001, (char *)"SDP" }, { 0x0001, (char *)"SDP" },
{ 0x0003, (char *)"RFCOMM" }, { 0x0003, (char *)"RFCOMM" },
{ 0x0005, (char *)"TCS-BIN" }, { 0x0005, (char *)"TCS-BIN" },
{ 0x0007, (char *)"TCS-BIN-CORDLESS" }, { 0x0007, (char *)"TCS-BIN-CORDLESS" },
{ 0x000F, (char *)"BNEP" }, { 0x000F, (char *)"BNEP" },
{ 0x0011, (char *)"HID_CONTROL" }, { 0x0011, (char *)"HID_CONTROL" },
{ 0x0013, (char *)"HID_INTERRUPT" }, { 0x0013, (char *)"HID_INTERRUPT" },
{ 0x0015, (char *)"UPnP" }, { 0x0015, (char *)"UPnP" },
{ 0x0017, (char *)"AVCTP" }, { 0x0017, (char *)"AVCTP" },
{ 0x0019, (char *)"AVDTP" }, { 0x0019, (char *)"AVDTP" },
{ 0x001D, (char *)"UDI_C-Plane" }, { 0x001D, (char *)"UDI_C-Plane" },
{ 0, NULL } { 0, NULL }
}; };
static const value_string result_vals[] = { static const value_string result_vals[] = {
{ 0x0000, (char *)"Connection successful" }, { 0x0000, (char *)"Connection successful" },
{ 0x0001, (char *)"Connection pending" }, { 0x0001, (char *)"Connection pending" },
{ 0x0002, (char *)"Connection Refused - PSM not supported" }, { 0x0002, (char *)"Connection Refused - PSM not supported" },
{ 0x0003, (char *)"Connection refused - security block" }, { 0x0003, (char *)"Connection refused - security block" },
{ 0x0004, (char *)"Connection refused - no resources available" }, { 0x0004, (char *)"Connection refused - no resources available" },
{ 0, NULL } { 0, NULL }
}; };
static const value_string status_vals[] = { static const value_string status_vals[] = {
{ 0x0000, (char *)"No further information available" }, { 0x0000, (char *)"No further information available" },
{ 0x0001, (char *)"Authentication panding" }, { 0x0001, (char *)"Authentication panding" },
{ 0x0002, (char *)"Authorization pending" }, { 0x0002, (char *)"Authorization pending" },
{ 0, NULL } { 0, NULL }
}; };

View File

@ -1,130 +1,130 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Dolphin Logging framework. Needs a good ol' spring cleaning methinks. // Dolphin Logging framework. Needs a good ol' spring cleaning methinks.
#ifndef _LOGMANAGER_H #ifndef _LOGMANAGER_H
#define _LOGMANAGER_H #define _LOGMANAGER_H
#include "Common.h" #include "Common.h"
class CLogWindow; class CLogWindow;
// should be inside the LogManager ... // should be inside the LogManager ...
struct CDebugger_Log struct CDebugger_Log
{ {
char m_szName[128]; char m_szName[128];
char m_szShortName[32]; char m_szShortName[32];
char m_szShortName_[32]; // save the unadjusted originals here char m_szShortName_[32]; // save the unadjusted originals here
char m_szFilename[256]; char m_szFilename[256];
bool m_bLogToFile; bool m_bLogToFile;
bool m_bShowInLog; bool m_bShowInLog;
bool m_bEnable; bool m_bEnable;
FILE *m_pFile; FILE *m_pFile;
void Init(); void Init();
void Shutdown(); void Shutdown();
// constructor // constructor
CDebugger_Log(const char* _szShortName, const char* _szName, int a); CDebugger_Log(const char* _szShortName, const char* _szName, int a);
// destructor // destructor
~CDebugger_Log(); ~CDebugger_Log();
}; };
// make a variable that can be accessed from both LogManager.cpp and LogWindow.cpp // make a variable that can be accessed from both LogManager.cpp and LogWindow.cpp
struct CDebugger_LogSettings struct CDebugger_LogSettings
{ {
int m_iVerbosity; // verbosity level 0 - 2 int m_iVerbosity; // verbosity level 0 - 2
bool bResolve; bool bResolve;
bool bWriteMaster; bool bWriteMaster;
bool bUnify; bool bUnify;
// constructor // constructor
CDebugger_LogSettings(); CDebugger_LogSettings();
// destructor // destructor
~CDebugger_LogSettings(); ~CDebugger_LogSettings();
}; };
class LogManager class LogManager
{ {
#define MAX_MESSAGES 8000 // the old value was to large #define MAX_MESSAGES 8000 // the old value was to large
#define MAX_MSGLEN 256 #define MAX_MSGLEN 256
public: public:
// Message // Message
struct SMessage struct SMessage
{ {
bool m_bInUse; bool m_bInUse;
LogTypes::LOG_TYPE m_type; LogTypes::LOG_TYPE m_type;
int m_verbosity; int m_verbosity;
char m_szMessage[MAX_MSGLEN]; char m_szMessage[MAX_MSGLEN];
int m_dwMsgLen; int m_dwMsgLen;
// constructor // constructor
SMessage() : SMessage() :
m_bInUse(false) m_bInUse(false)
{} {}
// set // set
void Set(LogTypes::LOG_TYPE _type, int _verbosity, char* _szMessage) void Set(LogTypes::LOG_TYPE _type, int _verbosity, char* _szMessage)
{ {
strncpy(m_szMessage, _szMessage, MAX_MSGLEN-1); strncpy(m_szMessage, _szMessage, MAX_MSGLEN-1);
m_szMessage[MAX_MSGLEN-1] = 0; m_szMessage[MAX_MSGLEN-1] = 0;
m_dwMsgLen = (int)strlen(m_szMessage); m_dwMsgLen = (int)strlen(m_szMessage);
if (m_dwMsgLen == (MAX_MSGLEN-1)) if (m_dwMsgLen == (MAX_MSGLEN-1))
{ {
m_szMessage[m_dwMsgLen-2] = 0xd; m_szMessage[m_dwMsgLen-2] = 0xd;
m_szMessage[m_dwMsgLen-1] = 0xa; m_szMessage[m_dwMsgLen-1] = 0xa;
} }
m_szMessage[m_dwMsgLen] = 0; m_szMessage[m_dwMsgLen] = 0;
m_type = _type; m_type = _type;
m_verbosity = _verbosity; m_verbosity = _verbosity;
m_bInUse = true; // turn on this message line m_bInUse = true; // turn on this message line
} }
// //
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...); static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
}; };
private: private:
enum LOG_SETTINGS enum LOG_SETTINGS
{ {
VERBOSITY_LEVELS = 3 VERBOSITY_LEVELS = 3
}; };
friend class CDebugger_LogWindow; friend class CDebugger_LogWindow;
friend class CLogWindow; friend class CLogWindow;
static SMessage (*m_Messages)[MAX_MESSAGES]; static SMessage (*m_Messages)[MAX_MESSAGES];
static int m_nextMessages[VERBOSITY_LEVELS + 1]; static int m_nextMessages[VERBOSITY_LEVELS + 1];
static int m_activeLog; static int m_activeLog;
static bool m_bDirty; static bool m_bDirty;
static bool m_bInitialized; static bool m_bInitialized;
static CDebugger_LogSettings* m_LogSettings; static CDebugger_LogSettings* m_LogSettings;
static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them
public: public:
static void Init(); static void Init();
static void Clear(void); static void Clear(void);
static void Shutdown(); static void Shutdown();
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...); static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
}; };
extern bool IsLoggingActivated(); extern bool IsLoggingActivated();
#endif #endif

View File

@ -1,30 +1,30 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _MEMTOOLS_H #ifndef _MEMTOOLS_H
#define _MEMTOOLS_H #define _MEMTOOLS_H
#include "Common.h" #include "Common.h"
namespace EMM namespace EMM
{ {
typedef u32 EAddr; typedef u32 EAddr;
void InstallExceptionHandler(); void InstallExceptionHandler();
} }
#endif #endif

View File

@ -1,64 +1,64 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PATCHENGINE_H #ifndef _PATCHENGINE_H
#define _PATCHENGINE_H #define _PATCHENGINE_H
#include "IniFile.h" #include "IniFile.h"
namespace PatchEngine namespace PatchEngine
{ {
enum PatchType enum PatchType
{ {
PATCH_8BIT, PATCH_8BIT,
PATCH_16BIT, PATCH_16BIT,
PATCH_32BIT, PATCH_32BIT,
}; };
static const char *PatchTypeStrings[] = static const char *PatchTypeStrings[] =
{ {
"byte", "byte",
"word", "word",
"dword", "dword",
0 0
}; };
struct PatchEntry struct PatchEntry
{ {
PatchEntry() {} PatchEntry() {}
PatchEntry(PatchType _t, u32 _addr, u32 _value) : type(_t), address(_addr), value(_value) {} PatchEntry(PatchType _t, u32 _addr, u32 _value) : type(_t), address(_addr), value(_value) {}
PatchType type; PatchType type;
u32 address; u32 address;
u32 value; u32 value;
}; };
struct Patch struct Patch
{ {
std::string name; std::string name;
std::vector<PatchEntry> entries; std::vector<PatchEntry> entries;
bool active; bool active;
}; };
int GetSpeedhackCycles(u32 addr); int GetSpeedhackCycles(u32 addr);
void LoadPatchSection(const char *section, std::vector<Patch> &patches, IniFile &ini); void LoadPatchSection(const char *section, std::vector<Patch> &patches, IniFile &ini);
void LoadPatches(const char *gameID); void LoadPatches(const char *gameID);
void ApplyFramePatches(); void ApplyFramePatches();
void ApplyARPatches(); void ApplyARPatches();
} // namespace } // namespace
#endif //_PATCHENGINE_H #endif //_PATCHENGINE_H

View File

@ -1,61 +1,61 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PLUGIN_DSP_H #ifndef _PLUGIN_DSP_H
#define _PLUGIN_DSP_H #define _PLUGIN_DSP_H
#include "pluginspecs_dsp.h" #include "pluginspecs_dsp.h"
namespace PluginDSP namespace PluginDSP
{ {
bool IsLoaded(); bool IsLoaded();
bool LoadPlugin(const char *_Filename); bool LoadPlugin(const char *_Filename);
void UnloadPlugin(); void UnloadPlugin();
// Function Types // Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllConfig)(HWND); typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TDllDebugger)(HWND, bool); typedef void (__cdecl* TDllDebugger)(HWND, bool);
typedef void (__cdecl* TDSP_Initialize)(DSPInitialize); typedef void (__cdecl* TDSP_Initialize)(DSPInitialize);
typedef void (__cdecl* TDSP_Shutdown)(); typedef void (__cdecl* TDSP_Shutdown)();
typedef void (__cdecl* TDSP_WriteMailBox)(BOOL _CPUMailbox, unsigned short); typedef void (__cdecl* TDSP_WriteMailBox)(BOOL _CPUMailbox, unsigned short);
typedef unsigned short (__cdecl* TDSP_ReadMailBox)(BOOL _CPUMailbox); typedef unsigned short (__cdecl* TDSP_ReadMailBox)(BOOL _CPUMailbox);
typedef unsigned short (__cdecl* TDSP_ReadControlRegister)(); typedef unsigned short (__cdecl* TDSP_ReadControlRegister)();
typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short); typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short);
typedef void (__cdecl* TDSP_Update)(int cycles); typedef void (__cdecl* TDSP_Update)(int cycles);
typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate); typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate);
typedef void (__cdecl* TDSP_DoState)(unsigned char **ptr, int mode); typedef void (__cdecl* TDSP_DoState)(unsigned char **ptr, int mode);
// Function Pointers // Function Pointers
extern TGetDllInfo GetDllInfo; extern TGetDllInfo GetDllInfo;
extern TDllConfig DllConfig; extern TDllConfig DllConfig;
extern TDllDebugger DllDebugger; extern TDllDebugger DllDebugger;
extern TDSP_Initialize DSP_Initialize; extern TDSP_Initialize DSP_Initialize;
extern TDSP_Shutdown DSP_Shutdown; extern TDSP_Shutdown DSP_Shutdown;
extern TDSP_ReadMailBox DSP_ReadMailboxHigh; extern TDSP_ReadMailBox DSP_ReadMailboxHigh;
extern TDSP_ReadMailBox DSP_ReadMailboxLow; extern TDSP_ReadMailBox DSP_ReadMailboxLow;
extern TDSP_WriteMailBox DSP_WriteMailboxHigh; extern TDSP_WriteMailBox DSP_WriteMailboxHigh;
extern TDSP_WriteMailBox DSP_WriteMailboxLow; extern TDSP_WriteMailBox DSP_WriteMailboxLow;
extern TDSP_ReadControlRegister DSP_ReadControlRegister; extern TDSP_ReadControlRegister DSP_ReadControlRegister;
extern TDSP_WriteControlRegister DSP_WriteControlRegister; extern TDSP_WriteControlRegister DSP_WriteControlRegister;
extern TDSP_Update DSP_Update; extern TDSP_Update DSP_Update;
extern TDSP_SendAIBuffer DSP_SendAIBuffer; extern TDSP_SendAIBuffer DSP_SendAIBuffer;
extern TDSP_DoState DSP_DoState; extern TDSP_DoState DSP_DoState;
} // end of namespace PluginDSP } // end of namespace PluginDSP
#endif #endif

View File

@ -1,71 +1,71 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PLUGIN_DVD_H #ifndef _PLUGIN_DVD_H
#define _PLUGIN_DVD_H #define _PLUGIN_DVD_H
#include "PluginSpecs_DVD.h" #include "PluginSpecs_DVD.h"
namespace PluginDVD namespace PluginDVD
{ {
//! IsLoaded //! IsLoaded
bool IsLoaded(); bool IsLoaded();
//! LoadPlugin //! LoadPlugin
bool LoadPlugin(const char *_strFilename); bool LoadPlugin(const char *_strFilename);
//! UnloadPlugin //! UnloadPlugin
void UnloadPlugin(); void UnloadPlugin();
// //
// --- Plugin Functions --- // --- Plugin Functions ---
// //
//! GetDllInfo //! GetDllInfo
void GetDllInfo(PLUGIN_INFO* _PluginInfo) ; void GetDllInfo(PLUGIN_INFO* _PluginInfo) ;
//! DllConfig //! DllConfig
void DllConfig(HWND _hParent); void DllConfig(HWND _hParent);
//! DVD_Initialize //! DVD_Initialize
void DVD_Initialize(SDVDInitialize _DVDInitialize); void DVD_Initialize(SDVDInitialize _DVDInitialize);
//! DVD_Shutdown //! DVD_Shutdown
void DVD_Shutdown(); void DVD_Shutdown();
//! SetISOFile //! SetISOFile
void DVD_SetISOFile(const char* _szFilename); void DVD_SetISOFile(const char* _szFilename);
//! GetISOName //! GetISOName
BOOL DVD_GetISOName(TCHAR * _szFilename, int maxlen); BOOL DVD_GetISOName(TCHAR * _szFilename, int maxlen);
//! DVDReadToPtr //! DVDReadToPtr
bool DVD_ReadToPtr(LPBYTE ptr, u64 _dwOffset, u64 _dwLength); bool DVD_ReadToPtr(LPBYTE ptr, u64 _dwOffset, u64 _dwLength);
//! DVD_IsValid //! DVD_IsValid
bool DVD_IsValid(); bool DVD_IsValid();
//! DVDRead32 //! DVDRead32
u32 DVD_Read32(u64 _dwOffset); u32 DVD_Read32(u64 _dwOffset);
//! SaveLoadState //! SaveLoadState
u32 SaveLoadState(char *ptr, BOOL save); u32 SaveLoadState(char *ptr, BOOL save);
} // end of namespace PluginDVD } // end of namespace PluginDVD
#endif #endif

View File

@ -1,50 +1,50 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PLUGIN_DVD #ifndef _PLUGIN_DVD
#define _PLUGIN_DVD #define _PLUGIN_DVD
#include <string.h> #include <string.h>
#include "pluginspecs_pad.h" #include "pluginspecs_pad.h"
namespace PluginPAD namespace PluginPAD
{ {
bool IsLoaded(); bool IsLoaded();
bool LoadPlugin(const char * _Filename); bool LoadPlugin(const char * _Filename);
void UnloadPlugin(); void UnloadPlugin();
// Function Types // Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllConfig)(HWND); typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TPAD_Initialize)(SPADInitialize); typedef void (__cdecl* TPAD_Initialize)(SPADInitialize);
typedef void (__cdecl* TPAD_Shutdown)(); typedef void (__cdecl* TPAD_Shutdown)();
typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*); typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*);
typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int); typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int);
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)(); typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
// Function Pointers // Function Pointers
extern TGetDllInfo GetDllInfo; extern TGetDllInfo GetDllInfo;
extern TPAD_Shutdown PAD_Shutdown; extern TPAD_Shutdown PAD_Shutdown;
extern TDllConfig DllConfig; extern TDllConfig DllConfig;
extern TPAD_Initialize PAD_Initialize; extern TPAD_Initialize PAD_Initialize;
extern TPAD_GetStatus PAD_GetStatus; extern TPAD_GetStatus PAD_GetStatus;
extern TPAD_Rumble PAD_Rumble; extern TPAD_Rumble PAD_Rumble;
extern TPAD_GetAttachedPads PAD_GetAttachedPads; extern TPAD_GetAttachedPads PAD_GetAttachedPads;
} // end of namespace PluginPAD } // end of namespace PluginPAD
#endif #endif

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