diff --git a/Docs/DSP/DSP_InterC/DSP_InterC/DSPExt.h b/Docs/DSP/DSP_InterC/DSP_InterC/DSPExt.h index b6fb8fc9be..b27a5bbcca 100644 --- a/Docs/DSP/DSP_InterC/DSP_InterC/DSPExt.h +++ b/Docs/DSP/DSP_InterC/DSP_InterC/DSPExt.h @@ -1,33 +1,33 @@ -/*==================================================================== - - filename: opcodes.h - project: GameCube DSP Tool (gcdsp) - created: 2005.03.04 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ - -#ifndef _GDSP_EXT_OP_H -#define _GDSP_EXT_OP_H - -void dsp_op_ext_ops_pro(uint16 _Opcode); -void dsp_op_ext_ops_epi(uint16 _Opcode); - - -#endif +/*==================================================================== + + filename: opcodes.h + project: GameCube DSP Tool (gcdsp) + created: 2005.03.04 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ + +#ifndef _GDSP_EXT_OP_H +#define _GDSP_EXT_OP_H + +void dsp_op_ext_ops_pro(uint16 _Opcode); +void dsp_op_ext_ops_epi(uint16 _Opcode); + + +#endif diff --git a/Docs/DSP/DSP_InterC/DSP_InterC/DSPOpcodes.h b/Docs/DSP/DSP_InterC/DSP_InterC/DSPOpcodes.h index ec250031b6..32627b5e0e 100644 --- a/Docs/DSP/DSP_InterC/DSP_InterC/DSPOpcodes.h +++ b/Docs/DSP/DSP_InterC/DSP_InterC/DSPOpcodes.h @@ -1,48 +1,48 @@ -/*==================================================================== - - filename: gdsp_opcodes.h - project: GCemu - created: 2004-6-18 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie & Tratax - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ -#ifndef _GDSP_OPCODES_H -#define _GDSP_OPCODES_H - -void dsp_op0(uint16 opc); -void dsp_op1(uint16 opc); -void dsp_op2(uint16 opc); -void dsp_op3(uint16 opc); -void dsp_op4(uint16 opc); -void dsp_op5(uint16 opc); -void dsp_op6(uint16 opc); -void dsp_op7(uint16 opc); -void dsp_op8(uint16 opc); -void dsp_op9(uint16 opc); -void dsp_opab(uint16 opc); -void dsp_opcd(uint16 opc); -void dsp_ope(uint16 opc); -void dsp_opf(uint16 opc); - - -#define R_SR 0x13 - -#define FLAG_ENABLE_INTERUPT 11 - -#endif +/*==================================================================== + + filename: gdsp_opcodes.h + project: GCemu + created: 2004-6-18 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie & Tratax + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ +#ifndef _GDSP_OPCODES_H +#define _GDSP_OPCODES_H + +void dsp_op0(uint16 opc); +void dsp_op1(uint16 opc); +void dsp_op2(uint16 opc); +void dsp_op3(uint16 opc); +void dsp_op4(uint16 opc); +void dsp_op5(uint16 opc); +void dsp_op6(uint16 opc); +void dsp_op7(uint16 opc); +void dsp_op8(uint16 opc); +void dsp_op9(uint16 opc); +void dsp_opab(uint16 opc); +void dsp_opcd(uint16 opc); +void dsp_ope(uint16 opc); +void dsp_opf(uint16 opc); + + +#define R_SR 0x13 + +#define FLAG_ENABLE_INTERUPT 11 + +#endif diff --git a/Docs/DSP/DSP_InterC/DSP_InterC/OutBuffer.h b/Docs/DSP/DSP_InterC/DSP_InterC/OutBuffer.h index d0a51bc3ed..0eaf353ce3 100644 --- a/Docs/DSP/DSP_InterC/DSP_InterC/OutBuffer.h +++ b/Docs/DSP/DSP_InterC/DSP_InterC/OutBuffer.h @@ -1,23 +1,23 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -namespace OutBuffer -{ - void Init(); - - void Add(const char* _fmt, ...); - void AddCode(const char* _fmt, ...); - - const char* GetRegName(uint16 reg); - const char* GetMemName(uint16 addr); -} - - - - - -// TODO: reference additional headers your program requires here +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +namespace OutBuffer +{ + void Init(); + + void Add(const char* _fmt, ...); + void AddCode(const char* _fmt, ...); + + const char* GetRegName(uint16 reg); + const char* GetMemName(uint16 addr); +} + + + + + +// TODO: reference additional headers your program requires here diff --git a/Docs/DSP/DSP_InterC/DSP_InterC/gdsp_opcodes_helper.h b/Docs/DSP/DSP_InterC/DSP_InterC/gdsp_opcodes_helper.h index 774fbd5eb6..6abe9ab2c2 100644 --- a/Docs/DSP/DSP_InterC/DSP_InterC/gdsp_opcodes_helper.h +++ b/Docs/DSP/DSP_InterC/DSP_InterC/gdsp_opcodes_helper.h @@ -1,234 +1,234 @@ -/*==================================================================== - - filename: opcodes.h - project: GameCube DSP Tool (gcdsp) - created: 2005.03.04 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ - -#ifndef _GDSP_OPCODES_HELPER_H -#define _GDSP_OPCODES_HELPER_H - -#include "Globals.h" - -#include "gdsp_opcodes.h" -#include "gdsp_memory.h" -#include "gdsp_interpreter.h" -#include "gdsp_registers.h" -#include "gdsp_ext_op.h" - -// --------------------------------------------------------------------------------------- -// -// --- SR -// -// --------------------------------------------------------------------------------------- - -inline void dsp_SR_set_flag(uint8 flag) -{ - g_dsp.r[R_SR] |= (1 << flag); -} - - -inline bool dsp_SR_is_flag_set(uint8 flag) -{ - return((g_dsp.r[R_SR] & (1 << flag)) > 0); -} - - -// --------------------------------------------------------------------------------------- -// -// --- reg -// -// --------------------------------------------------------------------------------------- - -inline uint16 dsp_op_read_reg(uint8 reg) -{ - uint16 val; - - switch (reg & 0x1f) - { - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - val = dsp_reg_load_stack(reg - 0x0c); - break; - - default: - val = g_dsp.r[reg]; - break; - } - - return(val); -} - - -inline void dsp_op_write_reg(uint8 reg, uint16 val) -{ - switch (reg & 0x1f) - { - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - dsp_reg_store_stack(reg - 0x0c, val); - break; - - default: - g_dsp.r[reg] = val; - break; - } -} - - -// --------------------------------------------------------------------------------------- -// -// --- prod -// -// --------------------------------------------------------------------------------------- - - -inline sint64 dsp_get_long_prod() -{ - sint64 val; - sint64 low_prod; - val = (sint8)g_dsp.r[0x16]; - val <<= 32; - low_prod = g_dsp.r[0x15]; - low_prod += g_dsp.r[0x17]; - low_prod <<= 16; - low_prod |= g_dsp.r[0x14]; - val += low_prod; - return(val); -} - - -inline void dsp_set_long_prod(sint64 val) -{ - g_dsp.r[0x14] = (uint16)val; - val >>= 16; - g_dsp.r[0x15] = (uint16)val; - val >>= 16; - g_dsp.r[0x16] = (uint16)val; - g_dsp.r[0x17] = 0; -} - - -// --------------------------------------------------------------------------------------- -// -// --- acc -// -// --------------------------------------------------------------------------------------- - -inline sint64 dsp_get_long_acc(uint8 reg) -{ - _dbg_assert_(reg < 2); - sint64 val; - sint64 low_acc; - val = (sint8)g_dsp.r[0x10 + reg]; - val <<= 32; - low_acc = g_dsp.r[0x1e + reg]; - low_acc <<= 16; - low_acc |= g_dsp.r[0x1c + reg]; - val |= low_acc; - return(val); -} - - -inline uint64 dsp_get_ulong_acc(uint8 reg) -{ - _dbg_assert_(reg < 2); - uint64 val; - uint64 low_acc; - val = (uint8)g_dsp.r[0x10 + reg]; - val <<= 32; - low_acc = g_dsp.r[0x1e + reg]; - low_acc <<= 16; - low_acc |= g_dsp.r[0x1c + reg]; - val |= low_acc; - return(val); -} - - -inline void dsp_set_long_acc(uint8 _reg, sint64 val) -{ - _dbg_assert_(_reg < 2); - g_dsp.r[0x1c + _reg] = (uint16)val; - val >>= 16; - g_dsp.r[0x1e + _reg] = (uint16)val; - val >>= 16; - g_dsp.r[0x10 + _reg] = (uint16)val; -} - - -inline sint16 dsp_get_acc_l(uint8 _reg) -{ - _dbg_assert_(_reg < 2); - return(g_dsp.r[0x1c + _reg]); -} - - -inline sint16 dsp_get_acc_m(uint8 _reg) -{ - _dbg_assert_(_reg < 2); - return(g_dsp.r[0x1e + _reg]); -} - - -inline sint16 dsp_get_acc_h(uint8 _reg) -{ - _dbg_assert_(_reg < 2); - return(g_dsp.r[0x10 + _reg]); -} - - -// --------------------------------------------------------------------------------------- -// -// --- acx -// -// --------------------------------------------------------------------------------------- - - -inline sint64 dsp_get_long_acx(uint8 _reg) -{ - _dbg_assert_(_reg < 2); - sint64 val = (sint16)g_dsp.r[0x1a + _reg]; - val <<= 16; - sint64 low_acc = g_dsp.r[0x18 + _reg]; - val |= low_acc; - return(val); -} - - -inline sint16 dsp_get_ax_l(uint8 _reg) -{ - _dbg_assert_(_reg < 2); - return(g_dsp.r[0x18 + _reg]); -} - - -inline sint16 dsp_get_ax_h(uint8 _reg) -{ - _dbg_assert_(_reg < 2); - return(g_dsp.r[0x1a + _reg]); -} - - -#endif +/*==================================================================== + + filename: opcodes.h + project: GameCube DSP Tool (gcdsp) + created: 2005.03.04 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ + +#ifndef _GDSP_OPCODES_HELPER_H +#define _GDSP_OPCODES_HELPER_H + +#include "Globals.h" + +#include "gdsp_opcodes.h" +#include "gdsp_memory.h" +#include "gdsp_interpreter.h" +#include "gdsp_registers.h" +#include "gdsp_ext_op.h" + +// --------------------------------------------------------------------------------------- +// +// --- SR +// +// --------------------------------------------------------------------------------------- + +inline void dsp_SR_set_flag(uint8 flag) +{ + g_dsp.r[R_SR] |= (1 << flag); +} + + +inline bool dsp_SR_is_flag_set(uint8 flag) +{ + return((g_dsp.r[R_SR] & (1 << flag)) > 0); +} + + +// --------------------------------------------------------------------------------------- +// +// --- reg +// +// --------------------------------------------------------------------------------------- + +inline uint16 dsp_op_read_reg(uint8 reg) +{ + uint16 val; + + switch (reg & 0x1f) + { + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + val = dsp_reg_load_stack(reg - 0x0c); + break; + + default: + val = g_dsp.r[reg]; + break; + } + + return(val); +} + + +inline void dsp_op_write_reg(uint8 reg, uint16 val) +{ + switch (reg & 0x1f) + { + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + dsp_reg_store_stack(reg - 0x0c, val); + break; + + default: + g_dsp.r[reg] = val; + break; + } +} + + +// --------------------------------------------------------------------------------------- +// +// --- prod +// +// --------------------------------------------------------------------------------------- + + +inline sint64 dsp_get_long_prod() +{ + sint64 val; + sint64 low_prod; + val = (sint8)g_dsp.r[0x16]; + val <<= 32; + low_prod = g_dsp.r[0x15]; + low_prod += g_dsp.r[0x17]; + low_prod <<= 16; + low_prod |= g_dsp.r[0x14]; + val += low_prod; + return(val); +} + + +inline void dsp_set_long_prod(sint64 val) +{ + g_dsp.r[0x14] = (uint16)val; + val >>= 16; + g_dsp.r[0x15] = (uint16)val; + val >>= 16; + g_dsp.r[0x16] = (uint16)val; + g_dsp.r[0x17] = 0; +} + + +// --------------------------------------------------------------------------------------- +// +// --- acc +// +// --------------------------------------------------------------------------------------- + +inline sint64 dsp_get_long_acc(uint8 reg) +{ + _dbg_assert_(reg < 2); + sint64 val; + sint64 low_acc; + val = (sint8)g_dsp.r[0x10 + reg]; + val <<= 32; + low_acc = g_dsp.r[0x1e + reg]; + low_acc <<= 16; + low_acc |= g_dsp.r[0x1c + reg]; + val |= low_acc; + return(val); +} + + +inline uint64 dsp_get_ulong_acc(uint8 reg) +{ + _dbg_assert_(reg < 2); + uint64 val; + uint64 low_acc; + val = (uint8)g_dsp.r[0x10 + reg]; + val <<= 32; + low_acc = g_dsp.r[0x1e + reg]; + low_acc <<= 16; + low_acc |= g_dsp.r[0x1c + reg]; + val |= low_acc; + return(val); +} + + +inline void dsp_set_long_acc(uint8 _reg, sint64 val) +{ + _dbg_assert_(_reg < 2); + g_dsp.r[0x1c + _reg] = (uint16)val; + val >>= 16; + g_dsp.r[0x1e + _reg] = (uint16)val; + val >>= 16; + g_dsp.r[0x10 + _reg] = (uint16)val; +} + + +inline sint16 dsp_get_acc_l(uint8 _reg) +{ + _dbg_assert_(_reg < 2); + return(g_dsp.r[0x1c + _reg]); +} + + +inline sint16 dsp_get_acc_m(uint8 _reg) +{ + _dbg_assert_(_reg < 2); + return(g_dsp.r[0x1e + _reg]); +} + + +inline sint16 dsp_get_acc_h(uint8 _reg) +{ + _dbg_assert_(_reg < 2); + return(g_dsp.r[0x10 + _reg]); +} + + +// --------------------------------------------------------------------------------------- +// +// --- acx +// +// --------------------------------------------------------------------------------------- + + +inline sint64 dsp_get_long_acx(uint8 _reg) +{ + _dbg_assert_(_reg < 2); + sint64 val = (sint16)g_dsp.r[0x1a + _reg]; + val <<= 16; + sint64 low_acc = g_dsp.r[0x18 + _reg]; + val |= low_acc; + return(val); +} + + +inline sint16 dsp_get_ax_l(uint8 _reg) +{ + _dbg_assert_(_reg < 2); + return(g_dsp.r[0x18 + _reg]); +} + + +inline sint16 dsp_get_ax_h(uint8 _reg) +{ + _dbg_assert_(_reg < 2); + return(g_dsp.r[0x1a + _reg]); +} + + +#endif diff --git a/Docs/DSP/DSP_InterC/DSP_InterC/stdafx.h b/Docs/DSP/DSP_InterC/DSP_InterC/stdafx.h index 1d7c35fd96..6948aa4ad3 100644 --- a/Docs/DSP/DSP_InterC/DSP_InterC/stdafx.h +++ b/Docs/DSP/DSP_InterC/DSP_InterC/stdafx.h @@ -1,39 +1,39 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#include -#include - - - - - - -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef unsigned long long uint64; -typedef unsigned int uint; - -typedef signed char sint8; -typedef signed short sint16; -typedef signed int sint32; -typedef signed long long sint64; - -extern uint16 FetchOpcode(); -extern void ErrorLog(const char* _fmt, ...); - -inline uint16 swap16(uint16 x) -{ - return((x >> 8) | (x << 8)); -} - -#include "OutBuffer.h" - -// TODO: reference additional headers your program requires here +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + + + + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned int uint32; +typedef unsigned long long uint64; +typedef unsigned int uint; + +typedef signed char sint8; +typedef signed short sint16; +typedef signed int sint32; +typedef signed long long sint64; + +extern uint16 FetchOpcode(); +extern void ErrorLog(const char* _fmt, ...); + +inline uint16 swap16(uint16 x) +{ + return((x >> 8) | (x << 8)); +} + +#include "OutBuffer.h" + +// TODO: reference additional headers your program requires here diff --git a/Docs/DSP/DSP_InterC/DSP_InterC/targetver.h b/Docs/DSP/DSP_InterC/DSP_InterC/targetver.h index a38195a4ef..6fe8eb79e1 100644 --- a/Docs/DSP/DSP_InterC/DSP_InterC/targetver.h +++ b/Docs/DSP/DSP_InterC/DSP_InterC/targetver.h @@ -1,13 +1,13 @@ -#pragma once - -// 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 -// your application. The macros work by enabling all features available on platform versions up to and -// including the version specified. - -// 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. -#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. -#endif - +#pragma once + +// 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 +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// 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. +#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. +#endif + diff --git a/Source/Core/Common/Src/ABI.h b/Source/Core/Common/Src/ABI.h index 2dfbf5aa19..e29c333d5b 100644 --- a/Source/Core/Common/Src/ABI.h +++ b/Source/Core/Common/Src/ABI.h @@ -1,122 +1,122 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _JIT_ABI_H -#define _JIT_ABI_H - -#include "x64Emitter.h" - -// x86/x64 ABI:s, and helpers to help follow them when JIT-ing code. -// All convensions return values in EAX (+ possibly EDX). - -// Linux 32-bit, Windows 32-bit (cdecl, System V): -// * Caller pushes left to right -// * Caller fixes stack after call -// * function subtract from stack for local storage only. -// Scratch: EAX ECX EDX -// Callee-save: EBX ESI EDI EBP -// Parameters: - - -// Windows 64-bit -// * 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_ -// * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space. -// Scratch: RAX RCX RDX R8 R9 R10 R11 -// Callee-save: RBX RSI RDI RBP R12 R13 R14 R15 -// Parameters: RCX RDX R8 R9, further MOV-ed - -// Linux 64-bit -// * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed) -// Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11 -// Callee-save: RBX RBP R12 R13 R14 R15 -// Parameters: RDI RSI RDX RCX R8 R9 - -#ifdef _M_IX86 -// 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 -// choose regs to put stuff in. -#define ABI_PARAM1 RCX -#define ABI_PARAM2 RDX - -// There are no ABI_PARAM* here, since args are pushed. - -// === 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. -#else -// 64 bit calling convention - -#ifdef _WIN32 -// === 64-bit Windows - the really exotic calling convention ================================== - -#define ABI_PARAM1 RCX -#define ABI_PARAM2 RDX -#define ABI_PARAM3 R8 -#define ABI_PARAM4 R9 -#else -// === 64-bit Unix (hopefully MacOSX too) ===================================================== - -#define ABI_PARAM1 RDI -#define ABI_PARAM2 RSI -#define ABI_PARAM3 RDX -#define ABI_PARAM4 RCX -#define ABI_PARAM5 R8 -#define ABI_PARAM6 R9 - -#endif - -#endif - -// Utility functions -// These only support u32 parameters, but that's enough for a lot of uses. -// These will destroy the 1 or 2 first "parameter regs". -void ABI_CallFunctionC(void *func, u32 param1); -void ABI_CallFunctionCC(void *func, u32 param1, u32 param2); -void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2); - -// Pass a register as a paremeter. -void ABI_CallFunctionR(void *func, Gen::X64Reg reg1); -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, -// such as the dispatcher, should be surrounded by these. -void ABI_PushAllCalleeSavedRegsAndAdjustStack(); -void ABI_PopAllCalleeSavedRegsAndAdjustStack(); - -// 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. -// An example is a backpatch injected function. -void ABI_PushAllCallerSavedRegsAndAdjustStack(); -void ABI_PopAllCallerSavedRegsAndAdjustStack(); - -unsigned int ABI_GetAlignedFrameSize(unsigned int frameSize); -void ABI_AlignStack(unsigned int frameSize); -void ABI_RestoreStack(unsigned int frameSize); - -// Sets up a __cdecl function. -// Only x64 really needs the parameter. -void ABI_EmitPrologue(int maxCallParams); -void ABI_EmitEpilogue(int maxCallParams); - -#ifdef _M_IX86 -inline int ABI_GetNumXMMRegs() { return 8; } -#else -inline int ABI_GetNumXMMRegs() { return 16; } -#endif - -#endif // _JIT_ABI_H - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _JIT_ABI_H +#define _JIT_ABI_H + +#include "x64Emitter.h" + +// x86/x64 ABI:s, and helpers to help follow them when JIT-ing code. +// All convensions return values in EAX (+ possibly EDX). + +// Linux 32-bit, Windows 32-bit (cdecl, System V): +// * Caller pushes left to right +// * Caller fixes stack after call +// * function subtract from stack for local storage only. +// Scratch: EAX ECX EDX +// Callee-save: EBX ESI EDI EBP +// Parameters: - + +// Windows 64-bit +// * 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_ +// * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space. +// Scratch: RAX RCX RDX R8 R9 R10 R11 +// Callee-save: RBX RSI RDI RBP R12 R13 R14 R15 +// Parameters: RCX RDX R8 R9, further MOV-ed + +// Linux 64-bit +// * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed) +// Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11 +// Callee-save: RBX RBP R12 R13 R14 R15 +// Parameters: RDI RSI RDX RCX R8 R9 + +#ifdef _M_IX86 +// 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 +// choose regs to put stuff in. +#define ABI_PARAM1 RCX +#define ABI_PARAM2 RDX + +// There are no ABI_PARAM* here, since args are pushed. + +// === 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. +#else +// 64 bit calling convention + +#ifdef _WIN32 +// === 64-bit Windows - the really exotic calling convention ================================== + +#define ABI_PARAM1 RCX +#define ABI_PARAM2 RDX +#define ABI_PARAM3 R8 +#define ABI_PARAM4 R9 +#else +// === 64-bit Unix (hopefully MacOSX too) ===================================================== + +#define ABI_PARAM1 RDI +#define ABI_PARAM2 RSI +#define ABI_PARAM3 RDX +#define ABI_PARAM4 RCX +#define ABI_PARAM5 R8 +#define ABI_PARAM6 R9 + +#endif + +#endif + +// Utility functions +// These only support u32 parameters, but that's enough for a lot of uses. +// These will destroy the 1 or 2 first "parameter regs". +void ABI_CallFunctionC(void *func, u32 param1); +void ABI_CallFunctionCC(void *func, u32 param1, u32 param2); +void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2); + +// Pass a register as a paremeter. +void ABI_CallFunctionR(void *func, Gen::X64Reg reg1); +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, +// such as the dispatcher, should be surrounded by these. +void ABI_PushAllCalleeSavedRegsAndAdjustStack(); +void ABI_PopAllCalleeSavedRegsAndAdjustStack(); + +// 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. +// An example is a backpatch injected function. +void ABI_PushAllCallerSavedRegsAndAdjustStack(); +void ABI_PopAllCallerSavedRegsAndAdjustStack(); + +unsigned int ABI_GetAlignedFrameSize(unsigned int frameSize); +void ABI_AlignStack(unsigned int frameSize); +void ABI_RestoreStack(unsigned int frameSize); + +// Sets up a __cdecl function. +// Only x64 really needs the parameter. +void ABI_EmitPrologue(int maxCallParams); +void ABI_EmitEpilogue(int maxCallParams); + +#ifdef _M_IX86 +inline int ABI_GetNumXMMRegs() { return 8; } +#else +inline int ABI_GetNumXMMRegs() { return 16; } +#endif + +#endif // _JIT_ABI_H + diff --git a/Source/Core/Common/Src/CPUDetect.h b/Source/Core/Common/Src/CPUDetect.h index 03f379d978..810f1eef2d 100644 --- a/Source/Core/Common/Src/CPUDetect.h +++ b/Source/Core/Common/Src/CPUDetect.h @@ -1,66 +1,66 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _CPUDETECT_H -#define _CPUDETECT_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _CPUDETECT_H +#define _CPUDETECT_H + +#include + +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 - -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 - diff --git a/Source/Core/Common/Src/ChunkFile.h b/Source/Core/Common/Src/ChunkFile.h index 96ffc21f02..972e888c4b 100644 --- a/Source/Core/Common/Src/ChunkFile.h +++ b/Source/Core/Common/Src/ChunkFile.h @@ -1,236 +1,236 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _POINTERWRAP_H -#define _POINTERWRAP_H - -// Extremely simple serialization framework. - -// (mis)-features: -// + Super fast -// + Very simple -// + Same code is used for serialization and deserializaition (in most cases) -// - Zero backwards/forwards compatibility -// - Serialization code for anything complex has to be manually written. - -#include - -#include -#include -#include - -#include "Common.h" - -template -struct LinkedListItem : public T -{ - LinkedListItem *next; -}; - - -class PointerWrap -{ -public: - enum Mode // also defined in pluginspecs.h. Didn't want to couple them. - { - MODE_READ = 1, - MODE_WRITE, - MODE_MEASURE, - }; - - u8 **ptr; - Mode mode; - -public: - PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {} - PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_) {} - - void SetMode(Mode mode_) {mode = mode_;} - Mode GetMode() const {return mode;} - u8 **GetPPtr() {return ptr;} - - void DoVoid(void *data, int size) - { - switch (mode) - { - case MODE_READ: memcpy(data, *ptr, size); break; - case MODE_WRITE: memcpy(*ptr, data, size); break; - case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything - default: break; // throw an error? - } - (*ptr) += size; - } - - // Store maps to file. Very useful. - template - void Do(std::map &x) { - // TODO - PanicAlert("Do(map<>) does not yet work."); - } - - // Store vectors. - template - void Do(std::vector &x) { - // TODO - PanicAlert("Do(vector<>) does not yet work."); - } - - // Store strings. - void Do(std::string &x) - { - int stringLen = (int)x.length() + 1; - Do(stringLen); - - switch (mode) - { - case MODE_READ: x = (char*)*ptr; break; - case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; - case MODE_MEASURE: break; - } - (*ptr) += stringLen; - } - - void DoBuffer(u8** pBuffer, u32& _Size) - { - Do(_Size); - - if (_Size > 0) - { - switch (mode) - { - case MODE_READ: *pBuffer = new u8[_Size]; memcpy(*pBuffer, *ptr, _Size); break; - case MODE_WRITE: memcpy(*ptr, *pBuffer, _Size); break; - case MODE_MEASURE: break; - } - } - else - { - *pBuffer = NULL; - } - (*ptr) += _Size; - } - - template - void DoArray(T *x, int count) { - DoVoid((void *)x, sizeof(T) * count); - } - - template - void Do(T &x) { - DoVoid((void *)&x, sizeof(x)); - } - - template - void DoLinkedList(LinkedListItem **list_start) { - // TODO - PanicAlert("Do(vector<>) does not yet work."); - } -}; - - -class CChunkFileReader -{ -public: - template - static bool Load(const std::string& _rFilename, int _Revision, T& _class) - { - FILE* pFile = fopen(_rFilename.c_str(), "rb"); - if (pFile) - { - // get size - fseek(pFile, 0, SEEK_END); - size_t FileSize = ftell(pFile); - fseek(pFile, 0, SEEK_SET); - - if (FileSize < sizeof(SChunkHeader)) - { - fclose(pFile); - return false; - } - - // read the header - SChunkHeader Header; - fread(&Header, sizeof(SChunkHeader), 1, pFile); - if (Header.Revision != _Revision) - { - fclose(pFile); - return false; - } - - // get size - int sz = FileSize - sizeof(SChunkHeader); - if (Header.ExpectedSize != sz) - { - fclose(pFile); - return false; - } - - // read the state - u8* buffer = new u8[sz]; - fread(buffer, 1, sz, pFile); - fclose(pFile); - - u8 *ptr = buffer; - PointerWrap p(&ptr, PointerWrap::MODE_READ); - _class.DoState(p); - delete [] buffer; - - return true; - } - - return false; - } - - template - static bool Save(const std::string& _rFilename, int _Revision, T& _class) - { - FILE* pFile = fopen(_rFilename.c_str(), "wb"); - if (pFile) - { - u8 *ptr = 0; - PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); - _class.DoState(p); - size_t sz = (size_t)ptr; - u8 *buffer = new u8[sz]; - ptr = buffer; - p.SetMode(PointerWrap::MODE_WRITE); - _class.DoState(p); - - SChunkHeader Header; - Header.Compress = 0; - Header.Revision = _Revision; - Header.ExpectedSize = sz; - - fwrite(&Header, sizeof(SChunkHeader), 1, pFile); - fwrite(buffer, sz, 1, pFile); - fclose(pFile); - - return true; - } - - return false; - } -private: - struct SChunkHeader - { - int Revision; - int Compress; - int ExpectedSize; - }; -}; - -#endif // _POINTERWRAP_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _POINTERWRAP_H +#define _POINTERWRAP_H + +// Extremely simple serialization framework. + +// (mis)-features: +// + Super fast +// + Very simple +// + Same code is used for serialization and deserializaition (in most cases) +// - Zero backwards/forwards compatibility +// - Serialization code for anything complex has to be manually written. + +#include + +#include +#include +#include + +#include "Common.h" + +template +struct LinkedListItem : public T +{ + LinkedListItem *next; +}; + + +class PointerWrap +{ +public: + enum Mode // also defined in pluginspecs.h. Didn't want to couple them. + { + MODE_READ = 1, + MODE_WRITE, + MODE_MEASURE, + }; + + u8 **ptr; + Mode mode; + +public: + PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {} + PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_) {} + + void SetMode(Mode mode_) {mode = mode_;} + Mode GetMode() const {return mode;} + u8 **GetPPtr() {return ptr;} + + void DoVoid(void *data, int size) + { + switch (mode) + { + case MODE_READ: memcpy(data, *ptr, size); break; + case MODE_WRITE: memcpy(*ptr, data, size); break; + case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything + default: break; // throw an error? + } + (*ptr) += size; + } + + // Store maps to file. Very useful. + template + void Do(std::map &x) { + // TODO + PanicAlert("Do(map<>) does not yet work."); + } + + // Store vectors. + template + void Do(std::vector &x) { + // TODO + PanicAlert("Do(vector<>) does not yet work."); + } + + // Store strings. + void Do(std::string &x) + { + int stringLen = (int)x.length() + 1; + Do(stringLen); + + switch (mode) + { + case MODE_READ: x = (char*)*ptr; break; + case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; + case MODE_MEASURE: break; + } + (*ptr) += stringLen; + } + + void DoBuffer(u8** pBuffer, u32& _Size) + { + Do(_Size); + + if (_Size > 0) + { + switch (mode) + { + case MODE_READ: *pBuffer = new u8[_Size]; memcpy(*pBuffer, *ptr, _Size); break; + case MODE_WRITE: memcpy(*ptr, *pBuffer, _Size); break; + case MODE_MEASURE: break; + } + } + else + { + *pBuffer = NULL; + } + (*ptr) += _Size; + } + + template + void DoArray(T *x, int count) { + DoVoid((void *)x, sizeof(T) * count); + } + + template + void Do(T &x) { + DoVoid((void *)&x, sizeof(x)); + } + + template + void DoLinkedList(LinkedListItem **list_start) { + // TODO + PanicAlert("Do(vector<>) does not yet work."); + } +}; + + +class CChunkFileReader +{ +public: + template + static bool Load(const std::string& _rFilename, int _Revision, T& _class) + { + FILE* pFile = fopen(_rFilename.c_str(), "rb"); + if (pFile) + { + // get size + fseek(pFile, 0, SEEK_END); + size_t FileSize = ftell(pFile); + fseek(pFile, 0, SEEK_SET); + + if (FileSize < sizeof(SChunkHeader)) + { + fclose(pFile); + return false; + } + + // read the header + SChunkHeader Header; + fread(&Header, sizeof(SChunkHeader), 1, pFile); + if (Header.Revision != _Revision) + { + fclose(pFile); + return false; + } + + // get size + int sz = FileSize - sizeof(SChunkHeader); + if (Header.ExpectedSize != sz) + { + fclose(pFile); + return false; + } + + // read the state + u8* buffer = new u8[sz]; + fread(buffer, 1, sz, pFile); + fclose(pFile); + + u8 *ptr = buffer; + PointerWrap p(&ptr, PointerWrap::MODE_READ); + _class.DoState(p); + delete [] buffer; + + return true; + } + + return false; + } + + template + static bool Save(const std::string& _rFilename, int _Revision, T& _class) + { + FILE* pFile = fopen(_rFilename.c_str(), "wb"); + if (pFile) + { + u8 *ptr = 0; + PointerWrap p(&ptr, PointerWrap::MODE_MEASURE); + _class.DoState(p); + size_t sz = (size_t)ptr; + u8 *buffer = new u8[sz]; + ptr = buffer; + p.SetMode(PointerWrap::MODE_WRITE); + _class.DoState(p); + + SChunkHeader Header; + Header.Compress = 0; + Header.Revision = _Revision; + Header.ExpectedSize = sz; + + fwrite(&Header, sizeof(SChunkHeader), 1, pFile); + fwrite(buffer, sz, 1, pFile); + fclose(pFile); + + return true; + } + + return false; + } +private: + struct SChunkHeader + { + int Revision; + int Compress; + int ExpectedSize; + }; +}; + +#endif // _POINTERWRAP_H diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index c8ef3c8092..b23d75d548 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -1,306 +1,306 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _COMMON_H -#define _COMMON_H - -#define _CRTDBG_MAP_ALLOC -#define _CRTDBG_MAP_ALLOC_NEW - -#ifdef OSX64 -#define MAP_32BIT 0 -#endif - -#define CHECK_HEAP_INTEGRITY() - -#ifdef _WIN32 -#ifdef _DEBUG -#include -#undef CHECK_HEAP_INTEGRITY -#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");} -#endif - -#include "../../../PluginSpecs/CommonTypes.h" -#define HAVE_WIIUSE 1 -#define HAVE_WX 1 -#else -#include "CommonTypes.h" -#include "Config.h" -#endif - -#include -#include -#include - -#include "Paths.h" - -// Function Cross-Compatibility -#ifdef _WIN32 -#define strcasecmp _stricmp -#define unlink _unlink -#else -#define _stricmp strcasecmp -#define _unlink unlink -#endif - -#ifdef _WIN32 - -// 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 -// do support 64-bit offsets in modern distributions. -#define fseek _fseeki64 -#define ftell _ftelli64 - -#define atoll _atoi64 - -#define POSIX 0 -#define NOMINMAX - -#if _M_IX86 -#define Crash() {__asm int 3} -#else -#if _MSC_VER > 1000 -extern "C" { - __declspec(dllimport) void __stdcall DebugBreak(void); -} -#define Crash() {DebugBreak();} -#else -#error fixme -#endif -#endif - -#elif __GNUC__ -#define POSIX 1 -#define MAX_PATH 260 -#define stricmp strcasecmp -#define Crash() {asm ("int $3");} -#ifdef _LP64 -#define _M_X64 1 -#else -#define _M_IX86 1 -#endif -#endif - -// Alignment - -#if defined(_MSC_VER) - -#define GC_ALIGNED16(x) __declspec(align(16)) x -#define GC_ALIGNED32(x) __declspec(align(32)) x -#define GC_ALIGNED64(x) __declspec(align(64)) x -#define GC_ALIGNED16_DECL(x) __declspec(align(16)) x -#define GC_ALIGNED64_DECL(x) __declspec(align(64)) x - -#else - -#define GC_ALIGNED16(x) __attribute((aligned(16))) x -#define GC_ALIGNED32(x) __attribute((aligned(16))) x -#define GC_ALIGNED64(x) __attribute((aligned(64))) x -#define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x -#define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x - -#endif - -// Various Windows compatibility - -#if !defined(_WIN32) -inline u32 _rotl(u32 x, int shift) { - return (x << shift) | (x >> (32 - shift)); -} - -inline u32 _rotr(u32 x, int shift) { - return (x >> shift) | (x << (32 - shift)); -} - -#define LONG int -#ifdef __LINUX__ -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; -#endif - -#ifndef __forceinline -#define __forceinline inline -#endif -#endif - -#if defined (_M_IX86) && defined (_WIN32) -#define HWCALL __cdecl -#else -#define HWCALL -#endif - -#undef min -#undef max - -template -inline T min(const T& a, const T& b) {return a > b ? b : a;} -template -inline T max(const T& a, const T& b) {return a > b ? a : b;} - -// Byte ordering - -namespace Common -{ -inline u8 swap8(u8 _data) {return(_data);} - - -#ifdef _WIN32 -inline u16 swap16(u16 _data) {return(_byteswap_ushort(_data));} -inline u32 swap32(u32 _data) {return(_byteswap_ulong(_data));} -inline u64 swap64(u64 _data) {return(_byteswap_uint64(_data));} - -#elif __linux__ -} -#include -namespace Common -{ -inline u16 swap16(u16 _data) {return(bswap_16(_data));} -inline u32 swap32(u32 _data) {return(bswap_32(_data));} -inline u64 swap64(u64 _data) {return(bswap_64(_data));} - - -#else -inline u16 swap16(u16 data) {return((data >> 8) | (data << 8));} -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));} -#endif - -} // end of namespace Common - -// Utility functions - -void PanicAlert(const char* text, ...); -bool PanicYesNo(const char* text, ...); -bool AskYesNo(const char* text, ...); - -extern void __Log(int logNumber, const char* text, ...); -extern void __Logv(int log, int v, const char *format, ...); - - -// dummy class -class LogTypes -{ - public: - enum LOG_TYPE - { - MASTER_LOG, - BOOT, - PIXELENGINE, - COMMANDPROCESSOR, - VIDEOINTERFACE, - SERIALINTERFACE, - PERIPHERALINTERFACE, - MEMMAP, - DSPINTERFACE, - STREAMINGINTERFACE, - DVDINTERFACE, - GPFIFO, - EXPANSIONINTERFACE, - AUDIO_INTERFACE, - GEKKO, - HLE, - DSPHLE, - VIDEO, - AUDIO, - DYNA_REC, - CONSOLE, - OSREPORT, - WII_IOB, - WII_IPC, - WII_IPC_HLE, - WII_IPC_DVD, - WII_IPC_ES, - WII_IPC_FILEIO, - WII_IPC_SD, - WII_IPC_NET, - WII_IPC_WIIMOTE, - ACTIONREPLAY, - NUMBER_OF_LOGS - }; -}; - -typedef bool (*PanicAlertHandler)(const char* text, bool yes_no); -void RegisterPanicAlertHandler(PanicAlertHandler handler); - -void Host_UpdateLogDisplay(); - -// Logging macros -#ifdef LOGGING - -#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__); -#define LOGV(t,v, ...) __Logv(LogTypes::t, v, __VA_ARGS__); - -#define _dbg_assert_(_t_, _a_) \ - if (!(_a_)){\ - LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ - __LINE__, __FILE__, __TIME__); \ - if (!PanicYesNo("*** Assertion (see log)***\n")){Crash();} \ - } -#define _dbg_assert_msg_(_t_, _a_, ...)\ - if (!(_a_)){\ - LOG(_t_, __VA_ARGS__); \ - if (!PanicYesNo(__VA_ARGS__)){Crash();} \ - } -#define _dbg_update_() Host_UpdateLogDisplay(); - -#else - -#define LOG(_t_, ...) -#define LOGV(_t_,_v_, ...) -#define _dbg_clear_() -#ifndef _dbg_assert_ -#define _dbg_assert_(_t_, _a_) ; -#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ; -#endif -#define _dbg_update_() ; - -#endif - -#ifdef _WIN32 -#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) -#define _assert_msg_(_t_, _a_, _fmt_, ...)\ - if (!(_a_)){\ - if (!PanicYesNo(_fmt_, __VA_ARGS__)){Crash();} \ - } -#else -#define _assert_(a) -#define _assert_msg_(...) -#endif - -// compile time asserts -namespace -{ - -// 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 -#ifdef _WIN32 - #ifndef _SECURE_SCL - #error Please define _SECURE_SCL=0 in the project settings - #else - template struct CompileTimeAssert; - template<> struct CompileTimeAssert {}; - CompileTimeAssert<_SECURE_SCL==0> x; - #endif -#endif - -} - -#endif // #ifndef _COMMON_H - - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _COMMON_H +#define _COMMON_H + +#define _CRTDBG_MAP_ALLOC +#define _CRTDBG_MAP_ALLOC_NEW + +#ifdef OSX64 +#define MAP_32BIT 0 +#endif + +#define CHECK_HEAP_INTEGRITY() + +#ifdef _WIN32 +#ifdef _DEBUG +#include +#undef CHECK_HEAP_INTEGRITY +#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");} +#endif + +#include "../../../PluginSpecs/CommonTypes.h" +#define HAVE_WIIUSE 1 +#define HAVE_WX 1 +#else +#include "CommonTypes.h" +#include "Config.h" +#endif + +#include +#include +#include + +#include "Paths.h" + +// Function Cross-Compatibility +#ifdef _WIN32 +#define strcasecmp _stricmp +#define unlink _unlink +#else +#define _stricmp strcasecmp +#define _unlink unlink +#endif + +#ifdef _WIN32 + +// 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 +// do support 64-bit offsets in modern distributions. +#define fseek _fseeki64 +#define ftell _ftelli64 + +#define atoll _atoi64 + +#define POSIX 0 +#define NOMINMAX + +#if _M_IX86 +#define Crash() {__asm int 3} +#else +#if _MSC_VER > 1000 +extern "C" { + __declspec(dllimport) void __stdcall DebugBreak(void); +} +#define Crash() {DebugBreak();} +#else +#error fixme +#endif +#endif + +#elif __GNUC__ +#define POSIX 1 +#define MAX_PATH 260 +#define stricmp strcasecmp +#define Crash() {asm ("int $3");} +#ifdef _LP64 +#define _M_X64 1 +#else +#define _M_IX86 1 +#endif +#endif + +// Alignment + +#if defined(_MSC_VER) + +#define GC_ALIGNED16(x) __declspec(align(16)) x +#define GC_ALIGNED32(x) __declspec(align(32)) x +#define GC_ALIGNED64(x) __declspec(align(64)) x +#define GC_ALIGNED16_DECL(x) __declspec(align(16)) x +#define GC_ALIGNED64_DECL(x) __declspec(align(64)) x + +#else + +#define GC_ALIGNED16(x) __attribute((aligned(16))) x +#define GC_ALIGNED32(x) __attribute((aligned(16))) x +#define GC_ALIGNED64(x) __attribute((aligned(64))) x +#define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x +#define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x + +#endif + +// Various Windows compatibility + +#if !defined(_WIN32) +inline u32 _rotl(u32 x, int shift) { + return (x << shift) | (x >> (32 - shift)); +} + +inline u32 _rotr(u32 x, int shift) { + return (x >> shift) | (x << (32 - shift)); +} + +#define LONG int +#ifdef __LINUX__ +typedef union _LARGE_INTEGER +{ + long long QuadPart; +} LARGE_INTEGER; +#endif + +#ifndef __forceinline +#define __forceinline inline +#endif +#endif + +#if defined (_M_IX86) && defined (_WIN32) +#define HWCALL __cdecl +#else +#define HWCALL +#endif + +#undef min +#undef max + +template +inline T min(const T& a, const T& b) {return a > b ? b : a;} +template +inline T max(const T& a, const T& b) {return a > b ? a : b;} + +// Byte ordering + +namespace Common +{ +inline u8 swap8(u8 _data) {return(_data);} + + +#ifdef _WIN32 +inline u16 swap16(u16 _data) {return(_byteswap_ushort(_data));} +inline u32 swap32(u32 _data) {return(_byteswap_ulong(_data));} +inline u64 swap64(u64 _data) {return(_byteswap_uint64(_data));} + +#elif __linux__ +} +#include +namespace Common +{ +inline u16 swap16(u16 _data) {return(bswap_16(_data));} +inline u32 swap32(u32 _data) {return(bswap_32(_data));} +inline u64 swap64(u64 _data) {return(bswap_64(_data));} + + +#else +inline u16 swap16(u16 data) {return((data >> 8) | (data << 8));} +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));} +#endif + +} // end of namespace Common + +// Utility functions + +void PanicAlert(const char* text, ...); +bool PanicYesNo(const char* text, ...); +bool AskYesNo(const char* text, ...); + +extern void __Log(int logNumber, const char* text, ...); +extern void __Logv(int log, int v, const char *format, ...); + + +// dummy class +class LogTypes +{ + public: + enum LOG_TYPE + { + MASTER_LOG, + BOOT, + PIXELENGINE, + COMMANDPROCESSOR, + VIDEOINTERFACE, + SERIALINTERFACE, + PERIPHERALINTERFACE, + MEMMAP, + DSPINTERFACE, + STREAMINGINTERFACE, + DVDINTERFACE, + GPFIFO, + EXPANSIONINTERFACE, + AUDIO_INTERFACE, + GEKKO, + HLE, + DSPHLE, + VIDEO, + AUDIO, + DYNA_REC, + CONSOLE, + OSREPORT, + WII_IOB, + WII_IPC, + WII_IPC_HLE, + WII_IPC_DVD, + WII_IPC_ES, + WII_IPC_FILEIO, + WII_IPC_SD, + WII_IPC_NET, + WII_IPC_WIIMOTE, + ACTIONREPLAY, + NUMBER_OF_LOGS + }; +}; + +typedef bool (*PanicAlertHandler)(const char* text, bool yes_no); +void RegisterPanicAlertHandler(PanicAlertHandler handler); + +void Host_UpdateLogDisplay(); + +// Logging macros +#ifdef LOGGING + +#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__); +#define LOGV(t,v, ...) __Logv(LogTypes::t, v, __VA_ARGS__); + +#define _dbg_assert_(_t_, _a_) \ + if (!(_a_)){\ + LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ + __LINE__, __FILE__, __TIME__); \ + if (!PanicYesNo("*** Assertion (see log)***\n")){Crash();} \ + } +#define _dbg_assert_msg_(_t_, _a_, ...)\ + if (!(_a_)){\ + LOG(_t_, __VA_ARGS__); \ + if (!PanicYesNo(__VA_ARGS__)){Crash();} \ + } +#define _dbg_update_() Host_UpdateLogDisplay(); + +#else + +#define LOG(_t_, ...) +#define LOGV(_t_,_v_, ...) +#define _dbg_clear_() +#ifndef _dbg_assert_ +#define _dbg_assert_(_t_, _a_) ; +#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ; +#endif +#define _dbg_update_() ; + +#endif + +#ifdef _WIN32 +#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) +#define _assert_msg_(_t_, _a_, _fmt_, ...)\ + if (!(_a_)){\ + if (!PanicYesNo(_fmt_, __VA_ARGS__)){Crash();} \ + } +#else +#define _assert_(a) +#define _assert_msg_(...) +#endif + +// compile time asserts +namespace +{ + +// 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 +#ifdef _WIN32 + #ifndef _SECURE_SCL + #error Please define _SECURE_SCL=0 in the project settings + #else + template struct CompileTimeAssert; + template<> struct CompileTimeAssert {}; + CompileTimeAssert<_SECURE_SCL==0> x; + #endif +#endif + +} + +#endif // #ifndef _COMMON_H + + diff --git a/Source/Core/Common/Src/DriveUtil.h b/Source/Core/Common/Src/DriveUtil.h index 987d0a937f..675484f247 100644 --- a/Source/Core/Common/Src/DriveUtil.h +++ b/Source/Core/Common/Src/DriveUtil.h @@ -1,28 +1,28 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DRIVEUTIL_H -#define _DRIVEUTIL_H - -#include -#include - -// Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner. - -void GetAllRemovableDrives(std::vector *drives); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DRIVEUTIL_H +#define _DRIVEUTIL_H + +#include +#include + +// Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner. + +void GetAllRemovableDrives(std::vector *drives); + +#endif diff --git a/Source/Core/Common/Src/DynamicLibrary.h b/Source/Core/Common/Src/DynamicLibrary.h index c2cd2cc5f4..9564b10d9d 100644 --- a/Source/Core/Common/Src/DynamicLibrary.h +++ b/Source/Core/Common/Src/DynamicLibrary.h @@ -1,47 +1,47 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DYNAMICLIBRARY_H -#define _DYNAMICLIBRARY_H - -#ifdef _WIN32 -#include -#endif - -#include - -class DynamicLibrary -{ - public: - - DynamicLibrary(); - int Load(const char* filename); - void Unload(); - void* Get(const char* funcname) const; - - bool IsLoaded() const {return(library != 0);} - - private: - std::string library_file; -#ifdef _WIN32 - HINSTANCE library; -#else - void* library; -#endif -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DYNAMICLIBRARY_H +#define _DYNAMICLIBRARY_H + +#ifdef _WIN32 +#include +#endif + +#include + +class DynamicLibrary +{ + public: + + DynamicLibrary(); + int Load(const char* filename); + void Unload(); + void* Get(const char* funcname) const; + + bool IsLoaded() const {return(library != 0);} + + private: + std::string library_file; +#ifdef _WIN32 + HINSTANCE library; +#else + void* library; +#endif +}; + +#endif diff --git a/Source/Core/Common/Src/ExtendedTrace.h b/Source/Core/Common/Src/ExtendedTrace.h index 853d2b4f18..29459cf547 100644 --- a/Source/Core/Common/Src/ExtendedTrace.h +++ b/Source/Core/Common/Src/ExtendedTrace.h @@ -1,56 +1,56 @@ -////////////////////////////////////////////////////////////////////////////////////// -// -// Written by Zoltan Csizmadia, zoltan_csizmadia@yahoo.com -// 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 -// -// History: -// 1.0 Initial version Zoltan Csizmadia -// 1.1 WhineCube version Masken -// 1.2 Dolphin version Masken -// -////////////////////////////////////////////////////////////////////////////////////// -// -// ExtendedTrace.h -// - -#ifndef EXTENDEDTRACE_H_INCLUDED -#define EXTENDEDTRACE_H_INCLUDED - -#if defined(WIN32) - -#include -#include - -#include - -#pragma comment( lib, "imagehlp.lib" ) - -#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath ) -#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo() -#define STACKTRACE(file) StackTrace( GetCurrentThread(), _T(""), file) -#define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), _T(""), file, eip, esp, ebp) -//class File; - -BOOL InitSymInfo( PCSTR ); -BOOL UninitSymInfo(); -void StackTrace( HANDLE, LPCTSTR, FILE *file); -void StackTrace( HANDLE, LPCTSTR, FILE *file, DWORD eip, DWORD esp, DWORD ebp); - -//functions by Masken -void etfprintf(FILE *file, const char *format, ...); -void etfprint(FILE *file, const std::string &text); -#define UEFBUFSIZE 2048 -extern char g_uefbuf[UEFBUFSIZE]; - -#else //not WIN32 - -#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0) -#define EXTENDEDTRACEUNINITIALIZE() ((void)0) -#define STACKTRACE(file) ((void)0) -#define STACKTRACE2(file, eip, esp, ebp) ((void)0) - -#endif //WIN32 - -#endif //EXTENDEDTRACE_H_INCLUDED +////////////////////////////////////////////////////////////////////////////////////// +// +// Written by Zoltan Csizmadia, zoltan_csizmadia@yahoo.com +// 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 +// +// History: +// 1.0 Initial version Zoltan Csizmadia +// 1.1 WhineCube version Masken +// 1.2 Dolphin version Masken +// +////////////////////////////////////////////////////////////////////////////////////// +// +// ExtendedTrace.h +// + +#ifndef EXTENDEDTRACE_H_INCLUDED +#define EXTENDEDTRACE_H_INCLUDED + +#if defined(WIN32) + +#include +#include + +#include + +#pragma comment( lib, "imagehlp.lib" ) + +#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath ) +#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo() +#define STACKTRACE(file) StackTrace( GetCurrentThread(), _T(""), file) +#define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), _T(""), file, eip, esp, ebp) +//class File; + +BOOL InitSymInfo( PCSTR ); +BOOL UninitSymInfo(); +void StackTrace( HANDLE, LPCTSTR, FILE *file); +void StackTrace( HANDLE, LPCTSTR, FILE *file, DWORD eip, DWORD esp, DWORD ebp); + +//functions by Masken +void etfprintf(FILE *file, const char *format, ...); +void etfprint(FILE *file, const std::string &text); +#define UEFBUFSIZE 2048 +extern char g_uefbuf[UEFBUFSIZE]; + +#else //not WIN32 + +#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0) +#define EXTENDEDTRACEUNINITIALIZE() ((void)0) +#define STACKTRACE(file) ((void)0) +#define STACKTRACE2(file, eip, esp, ebp) ((void)0) + +#endif //WIN32 + +#endif //EXTENDEDTRACE_H_INCLUDED diff --git a/Source/Core/Common/Src/FileSearch.h b/Source/Core/Common/Src/FileSearch.h index 4f0d7f7c09..fec300bfbe 100644 --- a/Source/Core/Common/Src/FileSearch.h +++ b/Source/Core/Common/Src/FileSearch.h @@ -1,44 +1,44 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __FILESEARCH_H_ -#define __FILESEARCH_H_ - -#include -#include - -class CFileSearch -{ - public: - - typedef std::vectorXStringVector; - - CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories); - - const XStringVector& GetFileNames() const; - - - private: - - void FindFiles(const std::string& _searchString, const std::string& _strPath); - - - XStringVector m_FileNames; -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __FILESEARCH_H_ +#define __FILESEARCH_H_ + +#include +#include + +class CFileSearch +{ + public: + + typedef std::vectorXStringVector; + + CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories); + + const XStringVector& GetFileNames() const; + + + private: + + void FindFiles(const std::string& _searchString, const std::string& _strPath); + + + XStringVector m_FileNames; +}; + +#endif + diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h index 9a0ef8ffbf..52c99d660b 100644 --- a/Source/Core/Common/Src/FileUtil.h +++ b/Source/Core/Common/Src/FileUtil.h @@ -1,60 +1,60 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _FILEUTIL_H -#define _FILEUTIL_H - -#include -#include - -#include "Common.h" - -namespace File -{ - -struct FSTEntry -{ - bool isDirectory; - u32 size; // file length or number of entries from children - std::string physicalName; // name on disk - std::string virtualName; // name in FST names table - std::vector children; -}; - -std::string SanitizePath(const char *filename); -bool Exists(const char *filename); -void Launch(const char *filename); -void Explore(const char *path); -bool IsDirectory(const char *filename); -bool CreateDir(const char *filename); -bool CreateDirectoryStructure(const std::string& _rFullPath); -bool Delete(const char *filename); -bool DeleteDir(const char *filename); -bool Rename(const char *srcFilename, const char *destFilename); -bool Copy(const char *srcFilename, const char *destFilename); -u64 GetSize(const char *filename); -std::string GetUserDirectory(); -bool CreateEmptyFile(const char *filename); - -u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry); - -bool DeleteDirRecursively(const std::string& _Directory); -void GetCurrentDirectory(std::string& _rDirectory); - -} // namespace - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _FILEUTIL_H +#define _FILEUTIL_H + +#include +#include + +#include "Common.h" + +namespace File +{ + +struct FSTEntry +{ + bool isDirectory; + u32 size; // file length or number of entries from children + std::string physicalName; // name on disk + std::string virtualName; // name in FST names table + std::vector children; +}; + +std::string SanitizePath(const char *filename); +bool Exists(const char *filename); +void Launch(const char *filename); +void Explore(const char *path); +bool IsDirectory(const char *filename); +bool CreateDir(const char *filename); +bool CreateDirectoryStructure(const std::string& _rFullPath); +bool Delete(const char *filename); +bool DeleteDir(const char *filename); +bool Rename(const char *srcFilename, const char *destFilename); +bool Copy(const char *srcFilename, const char *destFilename); +u64 GetSize(const char *filename); +std::string GetUserDirectory(); +bool CreateEmptyFile(const char *filename); + +u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry); + +bool DeleteDirRecursively(const std::string& _Directory); +void GetCurrentDirectory(std::string& _rDirectory); + +} // namespace + +#endif diff --git a/Source/Core/Common/Src/FixedSizeQueue.h b/Source/Core/Common/Src/FixedSizeQueue.h index cb51b5c11c..cdfad71349 100644 --- a/Source/Core/Common/Src/FixedSizeQueue.h +++ b/Source/Core/Common/Src/FixedSizeQueue.h @@ -1,81 +1,81 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _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 -// real STL classes. - -// Not fully featured, no safety checking yet. Add features as needed. - -// TODO: "inline" storage? - -template -class FixedSizeQueue -{ - T *storage; - int head; - int tail; - int count; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future. - - // Make copy constructor private for now. - FixedSizeQueue(FixedSizeQueue &other) { } - -public: - FixedSizeQueue() - { - head = 0; - tail = 0; - storage = new T[N]; - } - - ~FixedSizeQueue() - { - delete [] storage; - } - - void push(T t) { - storage[tail] = t; - tail++; - if (tail == N) - tail = 0; - count++; - } - - void pop() { - head++; - if (head == N) - head = 0; - count--; - } - - T pop_front() { - const T &temp = storage[head]; - pop(); - return temp; - } - - T &front() { return storage[head]; } - const T &front() const { return storage[head]; } - - size_t size() const { - return count; - } -}; - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _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 +// real STL classes. + +// Not fully featured, no safety checking yet. Add features as needed. + +// TODO: "inline" storage? + +template +class FixedSizeQueue +{ + T *storage; + int head; + int tail; + int count; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future. + + // Make copy constructor private for now. + FixedSizeQueue(FixedSizeQueue &other) { } + +public: + FixedSizeQueue() + { + head = 0; + tail = 0; + storage = new T[N]; + } + + ~FixedSizeQueue() + { + delete [] storage; + } + + void push(T t) { + storage[tail] = t; + tail++; + if (tail == N) + tail = 0; + count++; + } + + void pop() { + head++; + if (head == N) + head = 0; + count--; + } + + T pop_front() { + const T &temp = storage[head]; + pop(); + return temp; + } + + T &front() { return storage[head]; } + const T &front() const { return storage[head]; } + + size_t size() const { + return count; + } +}; + #endif // _FIXED_SIZE_QUEUE_H \ No newline at end of file diff --git a/Source/Core/Common/Src/Hash.h b/Source/Core/Common/Src/Hash.h index f2e1df42da..2b4a323a5e 100644 --- a/Source/Core/Common/Src/Hash.h +++ b/Source/Core/Common/Src/Hash.h @@ -1,28 +1,28 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _HASH_H -#define _HASH_H - -#include "Common.h" - -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 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 - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _HASH_H +#define _HASH_H + +#include "Common.h" + +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 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 + + +#endif diff --git a/Source/Core/Common/Src/IniFile.h b/Source/Core/Common/Src/IniFile.h index 9614bf8b46..767f554c3b 100644 --- a/Source/Core/Common/Src/IniFile.h +++ b/Source/Core/Common/Src/IniFile.h @@ -1,88 +1,88 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _INIFILE_H -#define _INIFILE_H - -#include -#include - -#include "StringUtil.h" - -class Section -{ -public: - Section(); - Section(const std::string& _name); - Section(const Section& other); - std::vectorlines; - std::string name; - std::string comment; - - bool operator<(const Section& other) const - { - return(name < other.name); - } -}; - -class IniFile -{ -public: - IniFile(); - ~IniFile(); - - bool Load(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, int 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, const std::string& newValue) {Set(sectionName, key, newValue.c_str());} - void Set(const char* sectionName, const char* key, const std::vector& newValues); - - void SetLines(const char* sectionName, const std::vector &lines); - - // 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, 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, bool* value, bool defaultValue = false); - bool Get(const char* sectionName, const char* key, std::vector& values); - - bool GetKeys(const char* sectionName, std::vector& keys) const; - bool GetLines(const char* sectionName, std::vector& lines) const; - - bool DeleteKey(const char* sectionName, const char* key); - bool DeleteSection(const char* sectionName); - - void SortSections(); - - 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); - -private: - std::vector
sections; - - const Section* GetSection(const char* section) const; - Section* GetSection(const char* section); - Section* GetOrCreateSection(const char* section); - std::string* GetLine(const char* section, const char* key); - void CreateSection(const char* section); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _INIFILE_H +#define _INIFILE_H + +#include +#include + +#include "StringUtil.h" + +class Section +{ +public: + Section(); + Section(const std::string& _name); + Section(const Section& other); + std::vectorlines; + std::string name; + std::string comment; + + bool operator<(const Section& other) const + { + return(name < other.name); + } +}; + +class IniFile +{ +public: + IniFile(); + ~IniFile(); + + bool Load(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, int 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, const std::string& newValue) {Set(sectionName, key, newValue.c_str());} + void Set(const char* sectionName, const char* key, const std::vector& newValues); + + void SetLines(const char* sectionName, const std::vector &lines); + + // 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, 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, bool* value, bool defaultValue = false); + bool Get(const char* sectionName, const char* key, std::vector& values); + + bool GetKeys(const char* sectionName, std::vector& keys) const; + bool GetLines(const char* sectionName, std::vector& lines) const; + + bool DeleteKey(const char* sectionName, const char* key); + bool DeleteSection(const char* sectionName); + + void SortSections(); + + 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); + +private: + std::vector
sections; + + const Section* GetSection(const char* section) const; + Section* GetSection(const char* section); + Section* GetOrCreateSection(const char* section); + std::string* GetLine(const char* section, const char* key); + void CreateSection(const char* section); +}; + +#endif diff --git a/Source/Core/Common/Src/MappedFile.h b/Source/Core/Common/Src/MappedFile.h index 1536672f81..fe1ddd704a 100644 --- a/Source/Core/Common/Src/MappedFile.h +++ b/Source/Core/Common/Src/MappedFile.h @@ -1,51 +1,51 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// Handles giant memory mapped files -// Through some trickery, allows lock on byte boundaries -// instead of allocation granularity boundaries -// for ease of use -// - -#ifndef _MAPPED_FILE_H -#define _MAPPED_FILE_H - -// #pragma warning (disable: 4786) - -#include - -namespace Common -{ -class IMappedFile -{ - public: - - virtual ~IMappedFile() {} - - - virtual bool Open(const char* _szFilename) = 0; - virtual bool IsOpen(void) = 0; - virtual void Close(void) = 0; - virtual u64 GetSize(void) = 0; - virtual u8* Lock(u64 _offset, u64 _size) = 0; - virtual void Unlock(u8* ptr) = 0; - - static IMappedFile* CreateMappedFileDEPRECATED(); -}; -} // end of namespace DiscIO - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// Handles giant memory mapped files +// Through some trickery, allows lock on byte boundaries +// instead of allocation granularity boundaries +// for ease of use +// + +#ifndef _MAPPED_FILE_H +#define _MAPPED_FILE_H + +// #pragma warning (disable: 4786) + +#include + +namespace Common +{ +class IMappedFile +{ + public: + + virtual ~IMappedFile() {} + + + virtual bool Open(const char* _szFilename) = 0; + virtual bool IsOpen(void) = 0; + virtual void Close(void) = 0; + virtual u64 GetSize(void) = 0; + virtual u8* Lock(u64 _offset, u64 _size) = 0; + virtual void Unlock(u8* ptr) = 0; + + static IMappedFile* CreateMappedFileDEPRECATED(); +}; +} // end of namespace DiscIO + +#endif + diff --git a/Source/Core/Common/Src/MathUtil.h b/Source/Core/Common/Src/MathUtil.h index 9d3aa0d91d..b42c4553ff 100644 --- a/Source/Core/Common/Src/MathUtil.h +++ b/Source/Core/Common/Src/MathUtil.h @@ -1,35 +1,35 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MATH_UTIL_H -#define _MATH_UTIL_H - -#include - -/* - There are two different flavors of float to int conversion: - _mm_cvtps_epi32() and _mm_cvttps_epi32(). The first rounds - according to the MXCSR rounding bits. The second one always - uses round towards zero. - */ - -void SaveSSEState(); -void LoadSSEState(); -void LoadDefaultSSEState(); - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MATH_UTIL_H +#define _MATH_UTIL_H + +#include + +/* + There are two different flavors of float to int conversion: + _mm_cvtps_epi32() and _mm_cvttps_epi32(). The first rounds + according to the MXCSR rounding bits. The second one always + uses round towards zero. + */ + +void SaveSSEState(); +void LoadSSEState(); +void LoadDefaultSSEState(); + + +#endif diff --git a/Source/Core/Common/Src/MemArena.h b/Source/Core/Common/Src/MemArena.h index 6a4ae6f3c6..a6651ea8bf 100644 --- a/Source/Core/Common/Src/MemArena.h +++ b/Source/Core/Common/Src/MemArena.h @@ -1,52 +1,52 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MEMARENA_H -#define _MEMARENA_H - -#ifdef _WIN32 -#include -#endif - -#include "Common.h" - -// 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 -// memory mirrors. -// Pass ensure_low_mem = true to CreateView if you want arbitrarily positioned views to end up in the low 2GB. - -class MemArena -{ -public: - void GrabLowMemSpace(size_t size); - void ReleaseSpace(); - void* CreateView(s64 offset, size_t size, bool ensure_low_mem = false); - void* CreateViewAt(s64 offset, size_t size, void* base); - void ReleaseView(void* view, size_t size); - - // This only finds 1 GB in 32-bit - static u8* Find4GBBase(); -private: - -#ifdef _WIN32 - HANDLE hMemoryMapping; -#else - int fd; -#endif -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MEMARENA_H +#define _MEMARENA_H + +#ifdef _WIN32 +#include +#endif + +#include "Common.h" + +// 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 +// memory mirrors. +// Pass ensure_low_mem = true to CreateView if you want arbitrarily positioned views to end up in the low 2GB. + +class MemArena +{ +public: + void GrabLowMemSpace(size_t size); + void ReleaseSpace(); + void* CreateView(s64 offset, size_t size, bool ensure_low_mem = false); + void* CreateViewAt(s64 offset, size_t size, void* base); + void ReleaseView(void* view, size_t size); + + // This only finds 1 GB in 32-bit + static u8* Find4GBBase(); +private: + +#ifdef _WIN32 + HANDLE hMemoryMapping; +#else + int fd; +#endif +}; + +#endif diff --git a/Source/Core/Common/Src/MemoryUtil.h b/Source/Core/Common/Src/MemoryUtil.h index e3415a9e33..a59fe2dc29 100644 --- a/Source/Core/Common/Src/MemoryUtil.h +++ b/Source/Core/Common/Src/MemoryUtil.h @@ -1,31 +1,31 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MEMORYUTIL_H -#define _MEMORYUTIL_H - -void* AllocateExecutableMemory(int size, bool low = true); -void* AllocateMemoryPages(int size); -void FreeMemoryPages(void* ptr, int size); -void WriteProtectMemory(void* ptr, int size, bool executable = false); -void UnWriteProtectMemory(void* ptr, int size, bool allowExecute); - - -inline int GetPageSize() {return(4096);} - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MEMORYUTIL_H +#define _MEMORYUTIL_H + +void* AllocateExecutableMemory(int size, bool low = true); +void* AllocateMemoryPages(int size); +void FreeMemoryPages(void* ptr, int size); +void WriteProtectMemory(void* ptr, int size, bool executable = false); +void UnWriteProtectMemory(void* ptr, int size, bool allowExecute); + + +inline int GetPageSize() {return(4096);} + + +#endif diff --git a/Source/Core/Common/Src/Plugin.h b/Source/Core/Common/Src/Plugin.h index ce022ddbe8..0ae7fc26c5 100644 --- a/Source/Core/Common/Src/Plugin.h +++ b/Source/Core/Common/Src/Plugin.h @@ -1,51 +1,51 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PLUGIN_H -#define _PLUGIN_H - -#include "Common.h" -#include "../../../PluginSpecs/PluginSpecs.h" -#include "DynamicLibrary.h" - -namespace Common -{ -class CPlugin -{ - public: - - static void Release(void); - static bool Load(const char* _szName); - - static bool GetInfo(PLUGIN_INFO& _pluginInfo); - - static void Config(HWND _hwnd); - static void About(HWND _hwnd); - static void Debug(HWND _hwnd, bool Show); - - - private: - - static DynamicLibrary m_hInstLib; - - static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo); - static void (__cdecl * m_DllConfig)(HWND _hParent); - static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show); -}; -} // end of namespace Common - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PLUGIN_H +#define _PLUGIN_H + +#include "Common.h" +#include "../../../PluginSpecs/PluginSpecs.h" +#include "DynamicLibrary.h" + +namespace Common +{ +class CPlugin +{ + public: + + static void Release(void); + static bool Load(const char* _szName); + + static bool GetInfo(PLUGIN_INFO& _pluginInfo); + + static void Config(HWND _hwnd); + static void About(HWND _hwnd); + static void Debug(HWND _hwnd, bool Show); + + + private: + + static DynamicLibrary m_hInstLib; + + static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo); + static void (__cdecl * m_DllConfig)(HWND _hParent); + static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show); +}; +} // end of namespace Common + +#endif diff --git a/Source/Core/Common/Src/StringUtil.h b/Source/Core/Common/Src/StringUtil.h index acea52101c..7840b036fc 100644 --- a/Source/Core/Common/Src/StringUtil.h +++ b/Source/Core/Common/Src/StringUtil.h @@ -1,77 +1,77 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _STRINGUTIL_H -#define _STRINGUTIL_H - -#include - -#include -#include - -#include "Common.h" - -std::string StringFromFormat(const char* format, ...); -void ToStringFromFormat(std::string* out, const char* format, ...); - - -// Expensive! -void StringFromFormatV(std::string* out, const char* format, va_list args); - - -// Cheap! -bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args); - - -template -inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...) -{ - va_list args; - va_start(args, format); - CharArrayFromFormatV(out, Count, format, args); - va_end(args); -} - - -std::string StripSpaces(const std::string &s); -std::string StripQuotes(const std::string &s); -std::string StripNewline(const std::string &s); -std::string ThS(int a, bool b = true); // thousand separator - - -std::string StringFromInt(int value); -std::string StringFromBool(bool value); - -bool TryParseInt(const char* str, int* outVal); -bool TryParseBool(const char* str, bool* output); -bool TryParseUInt(const std::string& str, u32* output); - - -// TODO: kill this -bool AsciiToHex(const char* _szValue, u32& result); - -void SplitString(const std::string& str, const std::string& delim, std::vector& output); -int ChooseStringFrom(const char* str, const char* * items); - - -// filehelper -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); - - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _STRINGUTIL_H +#define _STRINGUTIL_H + +#include + +#include +#include + +#include "Common.h" + +std::string StringFromFormat(const char* format, ...); +void ToStringFromFormat(std::string* out, const char* format, ...); + + +// Expensive! +void StringFromFormatV(std::string* out, const char* format, va_list args); + + +// Cheap! +bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args); + + +template +inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...) +{ + va_list args; + va_start(args, format); + CharArrayFromFormatV(out, Count, format, args); + va_end(args); +} + + +std::string StripSpaces(const std::string &s); +std::string StripQuotes(const std::string &s); +std::string StripNewline(const std::string &s); +std::string ThS(int a, bool b = true); // thousand separator + + +std::string StringFromInt(int value); +std::string StringFromBool(bool value); + +bool TryParseInt(const char* str, int* outVal); +bool TryParseBool(const char* str, bool* output); +bool TryParseUInt(const std::string& str, u32* output); + + +// TODO: kill this +bool AsciiToHex(const char* _szValue, u32& result); + +void SplitString(const std::string& str, const std::string& delim, std::vector& output); +int ChooseStringFrom(const char* str, const char* * items); + + +// filehelper +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); + + +#endif + diff --git a/Source/Core/Common/Src/TestFramework.h b/Source/Core/Common/Src/TestFramework.h index f5472884bc..66d635e905 100644 --- a/Source/Core/Common/Src/TestFramework.h +++ b/Source/Core/Common/Src/TestFramework.h @@ -1,100 +1,100 @@ -// Stupidly simple automated testing framework -// by ector - -// licence: Public Domain - -// 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. - -// 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 :( -// TODO(ector): Find solution. - -// TODO(ector): make sure tests are destroyed and that things compile without TESTING_ENABLE :P - -#define TESTING_ENABLE - -#ifndef _TEST_FRAMEWORK_H -#define _TEST_FRAMEWORK_H - -#include "Common.h" -#include - -#ifdef TESTING_ENABLE - -namespace __test -{ -extern int numTests; -extern int numTestsFailed; -} - -struct TestRunnah -{ - const char* filename; - const char* function; - TestRunnah(const char* _filename, const char* _function) - : filename(_filename), function(_function) {} - - - bool AssertTrue(bool value, int line) - { - if (!value) - { - char string[256]; - sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed"); - PanicAlert("Test Results: %s", string); - TestFailed(); - return(false); - } - - return(true); - } - - - template - bool AssertEqual(T a, T b, int line) - { - if (!(a == b)) - { - // TODO(ector) : better output - char string[256]; - sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed"); - PanicAlert("Test Results: %s", string); - TestFailed(); - return(false); - } - } - - - void TestFailed() - { - __test::numTestsFailed++; - } -}; - - -#define TEST(a) \ - void TEST_ ## a(TestRunnah * __tr); \ - struct DUMMY_ ## a \ - : public TestRunnah { \ - DUMMY_ ## a() \ - : TestRunnah(__FILE__, # a) {\ - TEST_ ## a(this); __test::numTests++;} }; \ - DUMMY_ ## a ddummy_ ## a; \ - void TEST_ ## a(TestRunnah * __tr) - -#else // TESTING_ENABLE - -#define TEST(a) \ - void TEST_ ## a(TestRunnah * __tr) \ - -#endif - -#define CHECK(a) if (!__tr->AssertTrue(a, __LINE__)){return;} -#define CHECK_EQ(a, b) if (!__tr->AssertEqual(a, b, __LINE__)){return;} - -int GetNumTests(); -int GetNumTestsFailed(); - - -#endif +// Stupidly simple automated testing framework +// by ector + +// licence: Public Domain + +// 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. + +// 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 :( +// TODO(ector): Find solution. + +// TODO(ector): make sure tests are destroyed and that things compile without TESTING_ENABLE :P + +#define TESTING_ENABLE + +#ifndef _TEST_FRAMEWORK_H +#define _TEST_FRAMEWORK_H + +#include "Common.h" +#include + +#ifdef TESTING_ENABLE + +namespace __test +{ +extern int numTests; +extern int numTestsFailed; +} + +struct TestRunnah +{ + const char* filename; + const char* function; + TestRunnah(const char* _filename, const char* _function) + : filename(_filename), function(_function) {} + + + bool AssertTrue(bool value, int line) + { + if (!value) + { + char string[256]; + sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed"); + PanicAlert("Test Results: %s", string); + TestFailed(); + return(false); + } + + return(true); + } + + + template + bool AssertEqual(T a, T b, int line) + { + if (!(a == b)) + { + // TODO(ector) : better output + char string[256]; + sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed"); + PanicAlert("Test Results: %s", string); + TestFailed(); + return(false); + } + } + + + void TestFailed() + { + __test::numTestsFailed++; + } +}; + + +#define TEST(a) \ + void TEST_ ## a(TestRunnah * __tr); \ + struct DUMMY_ ## a \ + : public TestRunnah { \ + DUMMY_ ## a() \ + : TestRunnah(__FILE__, # a) {\ + TEST_ ## a(this); __test::numTests++;} }; \ + DUMMY_ ## a ddummy_ ## a; \ + void TEST_ ## a(TestRunnah * __tr) + +#else // TESTING_ENABLE + +#define TEST(a) \ + void TEST_ ## a(TestRunnah * __tr) \ + +#endif + +#define CHECK(a) if (!__tr->AssertTrue(a, __LINE__)){return;} +#define CHECK_EQ(a, b) if (!__tr->AssertEqual(a, b, __LINE__)){return;} + +int GetNumTests(); +int GetNumTestsFailed(); + + +#endif diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h index 43e64595ff..e1cc4895b8 100644 --- a/Source/Core/Common/Src/Thread.h +++ b/Source/Core/Common/Src/Thread.h @@ -1,117 +1,117 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _THREAD_H -#define _THREAD_H - -#ifdef _WIN32 -#include -#else -#include -#endif - -#ifdef _WIN32 -#define THREAD_RETURN DWORD WINAPI -#else -#define THREAD_RETURN void* -#endif - -#include "Common.h" - - -namespace Common -{ -class CriticalSection -{ -#ifdef _WIN32 - CRITICAL_SECTION section; -#elif __GNUC__ - pthread_mutex_t mutex; -#endif -public: - - CriticalSection(int spincount = 1000); - ~CriticalSection(); - void Enter(); - bool TryEnter(); - void Leave(); -}; - -#ifdef _WIN32 -typedef DWORD (WINAPI * ThreadFunc)(void* arg); -#elif __GNUC__ -typedef void* (*ThreadFunc)(void* arg); -#endif - -class Thread -{ -public: - Thread(ThreadFunc entry, void* arg); - ~Thread(); - - void WaitForDeath(); - void SetAffinity(int mask); - static void SetCurrentThreadAffinity(int mask); - - -private: - -#ifdef _WIN32 - HANDLE m_hThread; - DWORD m_threadId; -#elif __GNUC__ - pthread_t thread_id; -#endif -}; - - -class Event -{ - public: - - Event(); - - void Init(); - void Shutdown(); - - void Set(); - void Wait(); - - - private: - -#ifdef _WIN32 - HANDLE m_hEvent; -#elif __GNUC__ - bool is_set_; - pthread_cond_t event_; - pthread_mutex_t mutex_; -#endif -}; - -void SleepCurrentThread(int ms); - -void SetCurrentThreadName(const char *name); - -LONG SyncInterlockedExchangeAdd(LONG *Dest, LONG Val); -LONG SyncInterlockedExchange(LONG *Dest, LONG Val); -LONG SyncInterlockedIncrement(LONG *Dest); - -} // end of namespace Common - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _THREAD_H +#define _THREAD_H + +#ifdef _WIN32 +#include +#else +#include +#endif + +#ifdef _WIN32 +#define THREAD_RETURN DWORD WINAPI +#else +#define THREAD_RETURN void* +#endif + +#include "Common.h" + + +namespace Common +{ +class CriticalSection +{ +#ifdef _WIN32 + CRITICAL_SECTION section; +#elif __GNUC__ + pthread_mutex_t mutex; +#endif +public: + + CriticalSection(int spincount = 1000); + ~CriticalSection(); + void Enter(); + bool TryEnter(); + void Leave(); +}; + +#ifdef _WIN32 +typedef DWORD (WINAPI * ThreadFunc)(void* arg); +#elif __GNUC__ +typedef void* (*ThreadFunc)(void* arg); +#endif + +class Thread +{ +public: + Thread(ThreadFunc entry, void* arg); + ~Thread(); + + void WaitForDeath(); + void SetAffinity(int mask); + static void SetCurrentThreadAffinity(int mask); + + +private: + +#ifdef _WIN32 + HANDLE m_hThread; + DWORD m_threadId; +#elif __GNUC__ + pthread_t thread_id; +#endif +}; + + +class Event +{ + public: + + Event(); + + void Init(); + void Shutdown(); + + void Set(); + void Wait(); + + + private: + +#ifdef _WIN32 + HANDLE m_hEvent; +#elif __GNUC__ + bool is_set_; + pthread_cond_t event_; + pthread_mutex_t mutex_; +#endif +}; + +void SleepCurrentThread(int ms); + +void SetCurrentThreadName(const char *name); + +LONG SyncInterlockedExchangeAdd(LONG *Dest, LONG Val); +LONG SyncInterlockedExchange(LONG *Dest, LONG Val); +LONG SyncInterlockedIncrement(LONG *Dest); + +} // end of namespace Common + + +#endif diff --git a/Source/Core/Common/Src/Thunk.h b/Source/Core/Common/Src/Thunk.h index 5ce19a9ef1..5d438e15e8 100644 --- a/Source/Core/Common/Src/Thunk.h +++ b/Source/Core/Common/Src/Thunk.h @@ -1,39 +1,39 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _THUNK_H -#define _THUNK_H - -// 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 -// 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. - -// This process is called thunking. - -// 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. -// NOT THREAD SAFE. This may only be used from the CPU thread. -// Any other thread using this stuff will be FATAL. - -void Thunk_Init(); -void Thunk_Reset(); -void Thunk_Shutdown(); - -void *ProtectFunction(void *function, int num_params); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _THUNK_H +#define _THUNK_H + +// 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 +// 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. + +// This process is called thunking. + +// 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. +// NOT THREAD SAFE. This may only be used from the CPU thread. +// Any other thread using this stuff will be FATAL. + +void Thunk_Init(); +void Thunk_Reset(); +void Thunk_Shutdown(); + +void *ProtectFunction(void *function, int num_params); + +#endif diff --git a/Source/Core/Common/Src/Timer.h b/Source/Core/Common/Src/Timer.h index b591dad7c3..4be5ab07d1 100644 --- a/Source/Core/Common/Src/Timer.h +++ b/Source/Core/Common/Src/Timer.h @@ -1,49 +1,49 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _TIMER_H -#define _TIMER_H - -#include "Common.h" - -namespace Common -{ -class Timer -{ - public: - - Timer(); - - void Update(); - - - // Always in milliseconds, regardless of alternative internal representation - s64 GetTimeDifference(void); - - static void IncreaseResolution(); - static void RestoreResolution(); - static u64 GetTimeSinceJan1970(); - - - public: - - u64 m_LastTime; - u64 m_frequency; -}; -} // end of namespace Common - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _TIMER_H +#define _TIMER_H + +#include "Common.h" + +namespace Common +{ +class Timer +{ + public: + + Timer(); + + void Update(); + + + // Always in milliseconds, regardless of alternative internal representation + s64 GetTimeDifference(void); + + static void IncreaseResolution(); + static void RestoreResolution(); + static u64 GetTimeSinceJan1970(); + + + public: + + u64 m_LastTime; + u64 m_frequency; +}; +} // end of namespace Common + +#endif diff --git a/Source/Core/Common/Src/WaveFile.h b/Source/Core/Common/Src/WaveFile.h index 8f3a8057fe..b9a6528155 100644 --- a/Source/Core/Common/Src/WaveFile.h +++ b/Source/Core/Common/Src/WaveFile.h @@ -1,55 +1,55 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -// WaveFileWriter - -// Simple utility class to make it easy to write long 16-bit stereo -// audio streams to disk. -// 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. -// Alternatively, AddSamplesBE for big endian wave data. -// If Stop is not called when it destructs, the destructor will call Stop(). - -#ifndef _WAVEFILE_H -#define _WAVEFILE_H - -#include - -class WaveFileWriter -{ - FILE *file; - bool skip_silence; - u32 audio_size; - short *conv_buffer; - void Write(u32 value); - void Write4(const char *ptr); - -public: - WaveFileWriter(); - ~WaveFileWriter(); - - bool Start(const char *filename); - void Stop(); - - void SetSkipSilence(bool skip) { skip_silence = skip; } - - void AddStereoSamples(const short *sample_data, int count); - void AddStereoSamplesBE(const short *sample_data, int count); // big endian - u32 GetAudioSize() { return audio_size; } -}; - -#endif // _WAVEFILE_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +// WaveFileWriter + +// Simple utility class to make it easy to write long 16-bit stereo +// audio streams to disk. +// 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. +// Alternatively, AddSamplesBE for big endian wave data. +// If Stop is not called when it destructs, the destructor will call Stop(). + +#ifndef _WAVEFILE_H +#define _WAVEFILE_H + +#include + +class WaveFileWriter +{ + FILE *file; + bool skip_silence; + u32 audio_size; + short *conv_buffer; + void Write(u32 value); + void Write4(const char *ptr); + +public: + WaveFileWriter(); + ~WaveFileWriter(); + + bool Start(const char *filename); + void Stop(); + + void SetSkipSilence(bool skip) { skip_silence = skip; } + + void AddStereoSamples(const short *sample_data, int count); + void AddStereoSamplesBE(const short *sample_data, int count); // big endian + u32 GetAudioSize() { return audio_size; } +}; + +#endif // _WAVEFILE_H diff --git a/Source/Core/Common/Src/stdafx.h b/Source/Core/Common/Src/stdafx.h index 3df0d4afa6..546a643aae 100644 --- a/Source/Core/Common/Src/stdafx.h +++ b/Source/Core/Common/Src/stdafx.h @@ -1,35 +1,35 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x501 -#endif -#ifndef _WIN32_IE -#define _WIN32_IE 0x0500 // Default value is 0x0400 -#endif - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#define _CRT_SECURE_NO_DEPRECATE 1 -#define _CRT_NONSTDC_NO_DEPRECATE 1 - -#include -#include -#include - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x501 +#endif +#ifndef _WIN32_IE +#define _WIN32_IE 0x0500 // Default value is 0x0400 +#endif + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#define _CRT_SECURE_NO_DEPRECATE 1 +#define _CRT_NONSTDC_NO_DEPRECATE 1 + +#include +#include +#include + diff --git a/Source/Core/Common/Src/svnrev_template.h b/Source/Core/Common/Src/svnrev_template.h index d7a944d4b0..442eb8e3f5 100644 --- a/Source/Core/Common/Src/svnrev_template.h +++ b/Source/Core/Common/Src/svnrev_template.h @@ -1,2 +1,2 @@ -#define SVN_REV $WCREV$ +#define SVN_REV $WCREV$ #define SVN_REV_STR "$WCREV$" \ No newline at end of file diff --git a/Source/Core/Common/Src/x64Analyzer.h b/Source/Core/Common/Src/x64Analyzer.h index 68c52ca932..e65a0d4319 100644 --- a/Source/Core/Common/Src/x64Analyzer.h +++ b/Source/Core/Common/Src/x64Analyzer.h @@ -1,56 +1,56 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _X64ANALYZER_H -#define _X64ANALYZER_H - -#include "Common.h" - -struct InstructionInfo -{ - int operandSize; //8, 16, 32, 64 - int instructionSize; - int regOperandReg; - int otherReg; - int scaledReg; - bool zeroExtend; - bool signExtend; - bool hasImmediate; - bool isMemoryWrite; - u64 immediate; - s32 displacement; -}; - -struct ModRM -{ - int mod, reg, rm; - ModRM(u8 modRM, u8 rex) - { - mod = modRM >> 6; - reg = ((modRM >> 3) & 7) | ((rex & 4)?8:0); - rm = modRM & 7; - } -}; - - -enum AccessType{ - OP_ACCESS_READ = 0, - OP_ACCESS_WRITE = 1 -}; - -bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int accessType); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _X64ANALYZER_H +#define _X64ANALYZER_H + +#include "Common.h" + +struct InstructionInfo +{ + int operandSize; //8, 16, 32, 64 + int instructionSize; + int regOperandReg; + int otherReg; + int scaledReg; + bool zeroExtend; + bool signExtend; + bool hasImmediate; + bool isMemoryWrite; + u64 immediate; + s32 displacement; +}; + +struct ModRM +{ + int mod, reg, rm; + ModRM(u8 modRM, u8 rex) + { + mod = modRM >> 6; + reg = ((modRM >> 3) & 7) | ((rex & 4)?8:0); + rm = modRM & 7; + } +}; + + +enum AccessType{ + OP_ACCESS_READ = 0, + OP_ACCESS_WRITE = 1 +}; + +bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int accessType); + +#endif diff --git a/Source/Core/Common/Src/x64Emitter.h b/Source/Core/Common/Src/x64Emitter.h index 0238569a28..c96b20b4cf 100644 --- a/Source/Core/Common/Src/x64Emitter.h +++ b/Source/Core/Common/Src/x64Emitter.h @@ -1,563 +1,563 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -// WARNING - THIS LIBRARY IS NOT THREAD SAFE!!! - -#ifndef _DOLPHIN_INTEL_CODEGEN -#define _DOLPHIN_INTEL_CODEGEN - -#include "Common.h" - -namespace Gen -{ - enum X64Reg - { - EAX = 0, EBX = 3, ECX = 1, EDX = 2, - ESI = 6, EDI = 7, EBP = 5, ESP = 4, - - RAX = 0, RBX = 3, RCX = 1, RDX = 2, - RSI = 6, RDI = 7, RBP = 5, RSP = 4, - R8 = 8, R9 = 9, R10 = 10,R11 = 11, - R12 = 12,R13 = 13,R14 = 14,R15 = 15, - - AL = 0, BL = 3, CL = 1, DL = 2, - AH = 4, BH = 7, CH = 5, DH = 6, - - AX = 0, BX = 3, CX = 1, DX = 2, - SI = 6, DI = 7, BP = 5, SP = 4, - - XMM0=0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, - - INVALID_REG = 0xFFFFFFFF - }; - - enum CCFlags - { - CC_O = 0, - CC_NO = 1, - CC_B = 2, CC_C = 2, CC_NAE = 2, - CC_NB = 3, CC_NC = 3, CC_AE = 3, - CC_Z = 4, CC_E = 4, - CC_NZ = 5, CC_NE = 5, - CC_BE = 6, CC_NA = 6, - CC_NBE = 7, CC_A = 7, - CC_S = 8, - CC_NS = 9, - CC_P = 0xA, CC_PE = 0xA, - CC_NP = 0xB, CC_PO = 0xB, - CC_L = 0xC, CC_NGE = 0xC, - CC_NL = 0xD, CC_GE = 0xD, - CC_LE = 0xE, CC_NG = 0xE, - CC_NLE = 0xF, CC_G = 0xF - }; - - enum - { - NUMGPRs = 16, - NUMXMMs = 16, - }; - - enum - { - SCALE_NONE = 0, - SCALE_1 = 1, - SCALE_2 = 2, - SCALE_4 = 4, - SCALE_8 = 8, - SCALE_ATREG = 16, - SCALE_RIP = 0xFF, - SCALE_IMM8 = 0xF0, - SCALE_IMM16 = 0xF1, - SCALE_IMM32 = 0xF2, - SCALE_IMM64 = 0xF3, - }; - - void SetCodePtr(u8 *ptr); - void ReserveCodeSpace(int bytes); - const u8 *AlignCode4(); - const u8 *AlignCode16(); - const u8 *AlignCodePage(); - const u8 *GetCodePtr(); - u8 *GetWritableCodePtr(); - - - // Safe way to temporarily redirect the code generator. - class GenContext - { - u8 **code_ptr_ptr; - u8 *saved_ptr; - public: - GenContext(u8 **code_ptr_ptr_) - { - saved_ptr = GetWritableCodePtr(); - code_ptr_ptr = code_ptr_ptr_; - SetCodePtr(*code_ptr_ptr); - } - ~GenContext() - { - *code_ptr_ptr = GetWritableCodePtr(); - SetCodePtr(saved_ptr); - } - }; - - enum NormalOp { - nrmADD, - nrmADC, - nrmSUB, - nrmSBB, - nrmAND, - nrmOR , - nrmXOR, - nrmMOV, - nrmTEST, - nrmCMP, - nrmXCHG, - }; - - // Make the generation routine examine which direction to go - // probably has to be a static - - // RIP addressing does not benefit from micro op fusion on Core arch - struct OpArg - { - OpArg() {} //dummy op arg, used for storage - OpArg(u64 _offset, int _scale, X64Reg rmReg = RAX, X64Reg scaledReg = RAX) - { - operandReg = 0; - scale = (u8)_scale; - offsetOrBaseReg = (u8)rmReg; - indexReg = (u8)scaledReg; - //if scale == 0 never mind offseting - offset = _offset; - } - void WriteRex(bool op64, int customOp = -1) const; - void WriteRest(int extraBytes=0, X64Reg operandReg=(X64Reg)0xFF) const; - void WriteSingleByteOp(u8 op, X64Reg operandReg, int bits); - //This one is public - must be written to - u64 offset; //use RIP-relative as much as possible - avoid 64-bit immediates at all costs - u8 operandReg; - - void WriteNormalOp(bool toRM, NormalOp op, const OpArg &operand, int bits) const; - bool IsImm() const {return scale == SCALE_IMM8 || scale == SCALE_IMM16 || scale == SCALE_IMM32 || scale == SCALE_IMM64;} - bool IsSimpleReg() const {return scale == SCALE_NONE;} - bool IsSimpleReg(X64Reg reg) const { - if (!IsSimpleReg()) - return false; - return GetSimpleReg() == reg; - } - bool CanDoOpWith(const OpArg &other) const - { - if (IsSimpleReg()) return true; - if (!IsSimpleReg() && !other.IsSimpleReg() && !other.IsImm()) return false; - return true; - } - - int GetImmBits() const - { - switch (scale) - { - case SCALE_IMM8: return 8; - case SCALE_IMM16: return 16; - case SCALE_IMM32: return 32; - case SCALE_IMM64: return 64; - default: return -1; - } - } - X64Reg GetSimpleReg() const - { - if (scale == SCALE_NONE) - return (X64Reg)offsetOrBaseReg; - else - return INVALID_REG; - } - private: - u8 scale; - u8 offsetOrBaseReg; - u8 indexReg; - }; - - inline OpArg M(void *ptr) {return OpArg((u64)ptr, (int)SCALE_RIP);} - inline OpArg R(X64Reg value) {return OpArg(0, SCALE_NONE, value);} - inline OpArg MatR(X64Reg value) {return OpArg(0, SCALE_ATREG, value);} - inline OpArg MDisp(X64Reg value, int offset) { - return OpArg((u32)offset, SCALE_ATREG, value); } - inline OpArg MComplex(X64Reg base, X64Reg scaled, int scale, int offset) - { - return OpArg(offset, scale, base, scaled); - } - inline OpArg Imm8 (u8 imm) {return OpArg(imm, SCALE_IMM8);} - inline OpArg Imm16(u16 imm) {return OpArg(imm, SCALE_IMM16);} //rarely used - inline OpArg Imm32(u32 imm) {return OpArg(imm, SCALE_IMM32);} - inline OpArg Imm64(u64 imm) {return OpArg(imm, SCALE_IMM64);} -#ifdef _M_X64 - inline OpArg ImmPtr(void* imm) {return Imm64((u64)imm);} -#else - inline OpArg ImmPtr(void* imm) {return Imm32((u32)imm);} -#endif - - void INT3(); - void NOP(int count = 1); //nop padding - TODO: fast nop slides, for amd and intel (check their manuals) - void PAUSE(); - void RET(); - void STC(); - void CLC(); - void CMC(); - void PUSH(X64Reg reg); - void POP(X64Reg reg); - void PUSH(int bits, const OpArg ®); - void POP(int bits, const OpArg ®); - void PUSHF(); - void POPF(); - - typedef const u8* JumpTarget; - - struct FixupBranch - { - u8 *ptr; - int type; //0 = 8bit 1 = 32bit - }; - - FixupBranch J(bool force5bytes = false); - - void JMP(const u8 * addr, bool force5Bytes = false); - void JMP(OpArg arg); - void JMPptr(const OpArg &arg); - void JMPself(); //infinite loop! - - void CALL(void *fnptr); - void CALLptr(OpArg arg); - - FixupBranch J_CC(CCFlags conditionCode, bool force5bytes = false); - void J_CC(CCFlags conditionCode, JumpTarget target); - void J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes = false); - - void SetJumpTarget(const FixupBranch &branch); - - //WARNING - INC and DEC slow on Intel Core, but not on AMD, since it creates - //false flags dependencies because they only update a subset of the flags - - // ector - I hereby BAN inc and dec due to their horribleness :P - // void INC(int bits, OpArg arg); - // void DEC(int bits, OpArg arg); - - void SETcc(CCFlags flag, OpArg dest); - // Note: CMOV brings small if any benefit on current cpus, unfortunately. - void CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag); - - void LFENCE(); - void MFENCE(); - void SFENCE(); - - void BSF(int bits, X64Reg dest, OpArg src); //bottom bit to top bit - void BSR(int bits, X64Reg dest, OpArg src); //top bit to bottom bit - - //These two can not be executed on early Intel 64-bit CPU:s, only on AMD! - - void LAHF(); // 3 cycle vector path - void SAHF(); // direct path fast - - //Looking for one of these? It's BANNED!! Some instructions are slow on modern CPU - //LOOP, LOOPNE, LOOPE, ENTER, LEAVE, XLAT, REP MOVSB/MOVSD, REP SCASD + other string instr., - - //Actually REP MOVSD could be useful :P - - void MOVNTI(int bits, OpArg dest, X64Reg src); - - void MUL(int bits, OpArg src); //UNSIGNED - void DIV(int bits, OpArg src); - void IMUL(int bits, OpArg src); //SIGNED - void IDIV(int bits, OpArg src); - void IMUL(int bits, X64Reg regOp, OpArg src); - void IMUL(int bits, X64Reg regOp, OpArg src, OpArg imm); - - - void NEG(int bits, OpArg src); - void NOT(int bits, OpArg src); - - void ROL(int bits, OpArg dest, OpArg shift); - void ROR(int bits, OpArg dest, OpArg shift); - void RCL(int bits, OpArg dest, OpArg shift); - void RCR(int bits, OpArg dest, OpArg shift); - void SHL(int bits, OpArg dest, OpArg shift); - void SHR(int bits, OpArg dest, OpArg shift); - void SAR(int bits, OpArg dest, OpArg shift); - - - void CWD(int bits = 16); - inline void CDQ() {CWD(32);} - inline void CQO() {CWD(64);} - void CBW(int bits = 8); - inline void CWDE() {CBW(16);} - inline void CDQE() {CBW(32);} - - void LEA(int bits, X64Reg dest, OpArg src); - - - enum PrefetchLevel - { - PF_NTA, //Non-temporal (data used once and only once) - PF_T0, //All cache levels - PF_T1, //Levels 2+ (aliased to T0 on AMD) - PF_T2, //Levels 3+ (aliased to T0 on AMD) - }; - void PREFETCH(PrefetchLevel level, OpArg arg); - - - void ADD (int bits, const OpArg &a1, const OpArg &a2); - void ADC (int bits, const OpArg &a1, const OpArg &a2); - void SUB (int bits, const OpArg &a1, const OpArg &a2); - void SBB (int bits, const OpArg &a1, const OpArg &a2); - void AND (int bits, const OpArg &a1, const OpArg &a2); - void OR (int bits, const OpArg &a1, const OpArg &a2); - void XOR (int bits, const OpArg &a1, const OpArg &a2); - void MOV (int bits, const OpArg &a1, const OpArg &a2); - void TEST(int bits, const OpArg &a1, const OpArg &a2); - void CMP (int bits, const OpArg &a1, const OpArg &a2); - - // XCHG is SLOW and should be avoided. - //void XCHG(int bits, const OpArg &a1, const OpArg &a2); - - void XCHG_AHAL(); - void BSWAP(int bits, X64Reg reg); - void MOVSX(int dbits, int sbits, X64Reg dest, OpArg src); //automatically uses MOVSXD if necessary - void MOVZX(int dbits, int sbits, X64Reg dest, OpArg src); - - enum SSECompare - { - EQ = 0, - LT, - LE, - UNORD, - NEQ, - NLT, - NLE, - ORD, - }; - - // WARNING - These two take 11-13 cycles and are VectorPath! (AMD64) - void STMXCSR(OpArg memloc); - void LDMXCSR(OpArg memloc); - - // Regular SSE/SSE2 instructions - void ADDSS(X64Reg regOp, OpArg arg); - void ADDSD(X64Reg regOp, OpArg arg); - void SUBSS(X64Reg regOp, OpArg arg); - void SUBSD(X64Reg regOp, OpArg arg); - void CMPSS(X64Reg regOp, OpArg arg, u8 compare); - void CMPSD(X64Reg regOp, OpArg arg, u8 compare); - void ANDSS(X64Reg regOp, OpArg arg); - void ANDSD(X64Reg regOp, OpArg arg); - void ANDNSS(X64Reg regOp, OpArg arg); - void ANDNSD(X64Reg regOp, OpArg arg); - void ORSS(X64Reg regOp, OpArg arg); - void ORSD(X64Reg regOp, OpArg arg); - void XORSS(X64Reg regOp, OpArg arg); - void XORSD(X64Reg regOp, OpArg arg); - void MULSS(X64Reg regOp, OpArg arg); - void MULSD(X64Reg regOp, OpArg arg); - void DIVSS(X64Reg regOp, OpArg arg); - void DIVSD(X64Reg regOp, OpArg arg); - void MINSS(X64Reg regOp, OpArg arg); - void MINSD(X64Reg regOp, OpArg arg); - void MAXSS(X64Reg regOp, OpArg arg); - void MAXSD(X64Reg regOp, OpArg arg); - void SQRTSS(X64Reg regOp, OpArg arg); - void SQRTSD(X64Reg regOp, OpArg arg); - void RSQRTSS(X64Reg regOp, OpArg arg); - void RSQRTSD(X64Reg regOp, OpArg arg); - - void COMISS(X64Reg regOp, OpArg arg); - void COMISD(X64Reg regOp, OpArg arg); - - void ADDPS(X64Reg regOp, OpArg arg); - void ADDPD(X64Reg regOp, OpArg arg); - void SUBPS(X64Reg regOp, OpArg arg); - void SUBPD(X64Reg regOp, OpArg arg); - void CMPPS(X64Reg regOp, OpArg arg, u8 compare); - void CMPPD(X64Reg regOp, OpArg arg, u8 compare); - void ANDPS(X64Reg regOp, OpArg arg); - void ANDPD(X64Reg regOp, OpArg arg); - void ANDNPS(X64Reg regOp, OpArg arg); - void ANDNPD(X64Reg regOp, OpArg arg); - void ORPS(X64Reg regOp, OpArg arg); - void ORPD(X64Reg regOp, OpArg arg); - void XORPS(X64Reg regOp, OpArg arg); - void XORPD(X64Reg regOp, OpArg arg); - void MULPS(X64Reg regOp, OpArg arg); - void MULPD(X64Reg regOp, OpArg arg); - void DIVPS(X64Reg regOp, OpArg arg); - void DIVPD(X64Reg regOp, OpArg arg); - void MINPS(X64Reg regOp, OpArg arg); - void MINPD(X64Reg regOp, OpArg arg); - void MAXPS(X64Reg regOp, OpArg arg); - void MAXPD(X64Reg regOp, OpArg arg); - void SQRTPS(X64Reg regOp, OpArg arg); - void SQRTPD(X64Reg regOp, OpArg arg); - void RSQRTPS(X64Reg regOp, OpArg arg); - void RSQRTPD(X64Reg regOp, OpArg arg); - void SHUFPS(X64Reg regOp, OpArg arg, u8 shuffle); - void SHUFPD(X64Reg regOp, OpArg arg, u8 shuffle); - - void MOVDDUP(X64Reg regOp, OpArg arg); - - void COMISS(X64Reg regOp, OpArg arg); - void COMISD(X64Reg regOp, OpArg arg); - void UCOMISS(X64Reg regOp, OpArg arg); - void UCOMISD(X64Reg regOp, OpArg arg); - - void MOVAPS(X64Reg regOp, OpArg arg); - void MOVAPD(X64Reg regOp, OpArg arg); - void MOVAPS(OpArg arg, X64Reg regOp); - void MOVAPD(OpArg arg, X64Reg regOp); - - void MOVUPS(X64Reg regOp, OpArg arg); - void MOVUPD(X64Reg regOp, OpArg arg); - void MOVUPS(OpArg arg, X64Reg regOp); - void MOVUPD(OpArg arg, X64Reg regOp); - - void MOVSS(X64Reg regOp, OpArg arg); - void MOVSD(X64Reg regOp, OpArg arg); - void MOVSS(OpArg arg, X64Reg regOp); - void MOVSD(OpArg arg, X64Reg regOp); - - void MOVMSKPS(X64Reg dest, OpArg arg); - void MOVMSKPD(X64Reg dest, OpArg arg); - - void MOVD_xmm(X64Reg dest, const OpArg &arg); - void MOVQ_xmm(X64Reg dest, OpArg arg); - void MOVD_xmm(const OpArg &arg, X64Reg src); - void MOVQ_xmm(OpArg arg, X64Reg src); - - void MASKMOVDQU(X64Reg dest, X64Reg src); - void LDDQU(X64Reg dest, OpArg src); - - void UNPCKLPD(X64Reg dest, OpArg src); - void UNPCKHPD(X64Reg dest, OpArg src); - - void CVTPS2PD(X64Reg dest, OpArg src); - void CVTPD2PS(X64Reg dest, OpArg src); - void CVTSS2SD(X64Reg dest, OpArg src); - void CVTSD2SS(X64Reg dest, OpArg src); - void CVTSD2SI(X64Reg dest, OpArg src); - void CVTDQ2PD(X64Reg regOp, OpArg arg); - void CVTPD2DQ(X64Reg regOp, OpArg arg); - void CVTDQ2PS(X64Reg regOp, const OpArg &arg); - - //Integer SSE instructions - void PACKSSDW(X64Reg dest, OpArg arg); - void PACKSSWB(X64Reg dest, OpArg arg); - //void PACKUSDW(X64Reg dest, OpArg arg); - void PACKUSWB(X64Reg dest, OpArg arg); - - void PUNPCKLBW(X64Reg dest, const OpArg &arg); - void PUNPCKLWD(X64Reg dest, const OpArg &arg); - void PUNPCKLDQ(X64Reg dest, const OpArg &arg); - - void PSRAD(X64Reg dest, int shift); - - void PAND(X64Reg dest, OpArg arg); - void PANDN(X64Reg dest, OpArg arg); - void PXOR(X64Reg dest, OpArg arg); - void POR(X64Reg dest, OpArg arg); - - void PADDB(X64Reg dest, OpArg arg); - void PADDW(X64Reg dest, OpArg arg); - void PADDD(X64Reg dest, OpArg arg); - void PADDQ(X64Reg dest, OpArg arg); - - void PADDSB(X64Reg dest, OpArg arg); - void PADDSW(X64Reg dest, OpArg arg); - void PADDUSB(X64Reg dest, OpArg arg); - void PADDUSW(X64Reg dest, OpArg arg); - - void PSUBB(X64Reg dest, OpArg arg); - void PSUBW(X64Reg dest, OpArg arg); - void PSUBD(X64Reg dest, OpArg arg); - void PSUBQ(X64Reg dest, OpArg arg); - - void PSUBSB(X64Reg dest, OpArg arg); - void PSUBSW(X64Reg dest, OpArg arg); - void PSUBUSB(X64Reg dest, OpArg arg); - void PSUBUSW(X64Reg dest, OpArg arg); - - void PAVGB(X64Reg dest, OpArg arg); - void PAVGW(X64Reg dest, OpArg arg); - - void PCMPEQB(X64Reg dest, OpArg arg); - void PCMPEQW(X64Reg dest, OpArg arg); - void PCMPEQD(X64Reg dest, OpArg arg); - - void PCMPGTB(X64Reg dest, OpArg arg); - void PCMPGTW(X64Reg dest, OpArg arg); - void PCMPGTD(X64Reg dest, OpArg arg); - - void PEXTRW(X64Reg dest, OpArg arg, u8 subreg); - void PINSRW(X64Reg dest, OpArg arg, u8 subreg); - - void PMADDWD(X64Reg dest, OpArg arg); - void PSADBW(X64Reg dest, OpArg arg); - - void PMAXSW(X64Reg dest, OpArg arg); - void PMAXUB(X64Reg dest, OpArg arg); - void PMINSW(X64Reg dest, OpArg arg); - void PMINUB(X64Reg dest, OpArg arg); - - void PMOVMSKB(X64Reg dest, OpArg arg); - void PSHUFB(X64Reg dest, OpArg arg); - - void RTDSC(); - -void CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2); -void CallCdeclFunction4(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3); -void CallCdeclFunction5(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); -void CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5); - -#if defined(_M_IX86) || !defined(_WIN32) - -#define CallCdeclFunction3_I(a,b,c,d) CallCdeclFunction3((void *)(a), (b), (c), (d)) -#define CallCdeclFunction4_I(a,b,c,d,e) CallCdeclFunction4((void *)(a), (b), (c), (d), (e)) -#define CallCdeclFunction5_I(a,b,c,d,e,f) CallCdeclFunction5((void *)(a), (b), (c), (d), (e), (f)) -#define CallCdeclFunction6_I(a,b,c,d,e,f,g) CallCdeclFunction6((void *)(a), (b), (c), (d), (e), (f), (g)) - -#define DECLARE_IMPORT(x) - -#else - -// Comments from VertexLoader.cpp about these horrors: - -// This is a horrible hack that is necessary in 64-bit mode because Opengl32.dll is based way, way above the 32-bit -// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we -// want to grab the function pointers from the import table instead. - -void ___CallCdeclImport3(void* impptr, u32 arg0, u32 arg1, u32 arg2); -void ___CallCdeclImport4(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3); -void ___CallCdeclImport5(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); -void ___CallCdeclImport6(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5); - -#define CallCdeclFunction3_I(a,b,c,d) ___CallCdeclImport3(&__imp_##a,b,c,d) -#define CallCdeclFunction4_I(a,b,c,d,e) ___CallCdeclImport4(&__imp_##a,b,c,d,e) -#define CallCdeclFunction5_I(a,b,c,d,e,f) ___CallCdeclImport5(&__imp_##a,b,c,d,e,f) -#define CallCdeclFunction6_I(a,b,c,d,e,f,g) ___CallCdeclImport6(&__imp_##a,b,c,d,e,f,g) - -#define DECLARE_IMPORT(x) extern "C" void *__imp_##x - -#endif - -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +// WARNING - THIS LIBRARY IS NOT THREAD SAFE!!! + +#ifndef _DOLPHIN_INTEL_CODEGEN +#define _DOLPHIN_INTEL_CODEGEN + +#include "Common.h" + +namespace Gen +{ + enum X64Reg + { + EAX = 0, EBX = 3, ECX = 1, EDX = 2, + ESI = 6, EDI = 7, EBP = 5, ESP = 4, + + RAX = 0, RBX = 3, RCX = 1, RDX = 2, + RSI = 6, RDI = 7, RBP = 5, RSP = 4, + R8 = 8, R9 = 9, R10 = 10,R11 = 11, + R12 = 12,R13 = 13,R14 = 14,R15 = 15, + + AL = 0, BL = 3, CL = 1, DL = 2, + AH = 4, BH = 7, CH = 5, DH = 6, + + AX = 0, BX = 3, CX = 1, DX = 2, + SI = 6, DI = 7, BP = 5, SP = 4, + + XMM0=0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, + + INVALID_REG = 0xFFFFFFFF + }; + + enum CCFlags + { + CC_O = 0, + CC_NO = 1, + CC_B = 2, CC_C = 2, CC_NAE = 2, + CC_NB = 3, CC_NC = 3, CC_AE = 3, + CC_Z = 4, CC_E = 4, + CC_NZ = 5, CC_NE = 5, + CC_BE = 6, CC_NA = 6, + CC_NBE = 7, CC_A = 7, + CC_S = 8, + CC_NS = 9, + CC_P = 0xA, CC_PE = 0xA, + CC_NP = 0xB, CC_PO = 0xB, + CC_L = 0xC, CC_NGE = 0xC, + CC_NL = 0xD, CC_GE = 0xD, + CC_LE = 0xE, CC_NG = 0xE, + CC_NLE = 0xF, CC_G = 0xF + }; + + enum + { + NUMGPRs = 16, + NUMXMMs = 16, + }; + + enum + { + SCALE_NONE = 0, + SCALE_1 = 1, + SCALE_2 = 2, + SCALE_4 = 4, + SCALE_8 = 8, + SCALE_ATREG = 16, + SCALE_RIP = 0xFF, + SCALE_IMM8 = 0xF0, + SCALE_IMM16 = 0xF1, + SCALE_IMM32 = 0xF2, + SCALE_IMM64 = 0xF3, + }; + + void SetCodePtr(u8 *ptr); + void ReserveCodeSpace(int bytes); + const u8 *AlignCode4(); + const u8 *AlignCode16(); + const u8 *AlignCodePage(); + const u8 *GetCodePtr(); + u8 *GetWritableCodePtr(); + + + // Safe way to temporarily redirect the code generator. + class GenContext + { + u8 **code_ptr_ptr; + u8 *saved_ptr; + public: + GenContext(u8 **code_ptr_ptr_) + { + saved_ptr = GetWritableCodePtr(); + code_ptr_ptr = code_ptr_ptr_; + SetCodePtr(*code_ptr_ptr); + } + ~GenContext() + { + *code_ptr_ptr = GetWritableCodePtr(); + SetCodePtr(saved_ptr); + } + }; + + enum NormalOp { + nrmADD, + nrmADC, + nrmSUB, + nrmSBB, + nrmAND, + nrmOR , + nrmXOR, + nrmMOV, + nrmTEST, + nrmCMP, + nrmXCHG, + }; + + // Make the generation routine examine which direction to go + // probably has to be a static + + // RIP addressing does not benefit from micro op fusion on Core arch + struct OpArg + { + OpArg() {} //dummy op arg, used for storage + OpArg(u64 _offset, int _scale, X64Reg rmReg = RAX, X64Reg scaledReg = RAX) + { + operandReg = 0; + scale = (u8)_scale; + offsetOrBaseReg = (u8)rmReg; + indexReg = (u8)scaledReg; + //if scale == 0 never mind offseting + offset = _offset; + } + void WriteRex(bool op64, int customOp = -1) const; + void WriteRest(int extraBytes=0, X64Reg operandReg=(X64Reg)0xFF) const; + void WriteSingleByteOp(u8 op, X64Reg operandReg, int bits); + //This one is public - must be written to + u64 offset; //use RIP-relative as much as possible - avoid 64-bit immediates at all costs + u8 operandReg; + + void WriteNormalOp(bool toRM, NormalOp op, const OpArg &operand, int bits) const; + bool IsImm() const {return scale == SCALE_IMM8 || scale == SCALE_IMM16 || scale == SCALE_IMM32 || scale == SCALE_IMM64;} + bool IsSimpleReg() const {return scale == SCALE_NONE;} + bool IsSimpleReg(X64Reg reg) const { + if (!IsSimpleReg()) + return false; + return GetSimpleReg() == reg; + } + bool CanDoOpWith(const OpArg &other) const + { + if (IsSimpleReg()) return true; + if (!IsSimpleReg() && !other.IsSimpleReg() && !other.IsImm()) return false; + return true; + } + + int GetImmBits() const + { + switch (scale) + { + case SCALE_IMM8: return 8; + case SCALE_IMM16: return 16; + case SCALE_IMM32: return 32; + case SCALE_IMM64: return 64; + default: return -1; + } + } + X64Reg GetSimpleReg() const + { + if (scale == SCALE_NONE) + return (X64Reg)offsetOrBaseReg; + else + return INVALID_REG; + } + private: + u8 scale; + u8 offsetOrBaseReg; + u8 indexReg; + }; + + inline OpArg M(void *ptr) {return OpArg((u64)ptr, (int)SCALE_RIP);} + inline OpArg R(X64Reg value) {return OpArg(0, SCALE_NONE, value);} + inline OpArg MatR(X64Reg value) {return OpArg(0, SCALE_ATREG, value);} + inline OpArg MDisp(X64Reg value, int offset) { + return OpArg((u32)offset, SCALE_ATREG, value); } + inline OpArg MComplex(X64Reg base, X64Reg scaled, int scale, int offset) + { + return OpArg(offset, scale, base, scaled); + } + inline OpArg Imm8 (u8 imm) {return OpArg(imm, SCALE_IMM8);} + inline OpArg Imm16(u16 imm) {return OpArg(imm, SCALE_IMM16);} //rarely used + inline OpArg Imm32(u32 imm) {return OpArg(imm, SCALE_IMM32);} + inline OpArg Imm64(u64 imm) {return OpArg(imm, SCALE_IMM64);} +#ifdef _M_X64 + inline OpArg ImmPtr(void* imm) {return Imm64((u64)imm);} +#else + inline OpArg ImmPtr(void* imm) {return Imm32((u32)imm);} +#endif + + void INT3(); + void NOP(int count = 1); //nop padding - TODO: fast nop slides, for amd and intel (check their manuals) + void PAUSE(); + void RET(); + void STC(); + void CLC(); + void CMC(); + void PUSH(X64Reg reg); + void POP(X64Reg reg); + void PUSH(int bits, const OpArg ®); + void POP(int bits, const OpArg ®); + void PUSHF(); + void POPF(); + + typedef const u8* JumpTarget; + + struct FixupBranch + { + u8 *ptr; + int type; //0 = 8bit 1 = 32bit + }; + + FixupBranch J(bool force5bytes = false); + + void JMP(const u8 * addr, bool force5Bytes = false); + void JMP(OpArg arg); + void JMPptr(const OpArg &arg); + void JMPself(); //infinite loop! + + void CALL(void *fnptr); + void CALLptr(OpArg arg); + + FixupBranch J_CC(CCFlags conditionCode, bool force5bytes = false); + void J_CC(CCFlags conditionCode, JumpTarget target); + void J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes = false); + + void SetJumpTarget(const FixupBranch &branch); + + //WARNING - INC and DEC slow on Intel Core, but not on AMD, since it creates + //false flags dependencies because they only update a subset of the flags + + // ector - I hereby BAN inc and dec due to their horribleness :P + // void INC(int bits, OpArg arg); + // void DEC(int bits, OpArg arg); + + void SETcc(CCFlags flag, OpArg dest); + // Note: CMOV brings small if any benefit on current cpus, unfortunately. + void CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag); + + void LFENCE(); + void MFENCE(); + void SFENCE(); + + void BSF(int bits, X64Reg dest, OpArg src); //bottom bit to top bit + void BSR(int bits, X64Reg dest, OpArg src); //top bit to bottom bit + + //These two can not be executed on early Intel 64-bit CPU:s, only on AMD! + + void LAHF(); // 3 cycle vector path + void SAHF(); // direct path fast + + //Looking for one of these? It's BANNED!! Some instructions are slow on modern CPU + //LOOP, LOOPNE, LOOPE, ENTER, LEAVE, XLAT, REP MOVSB/MOVSD, REP SCASD + other string instr., + + //Actually REP MOVSD could be useful :P + + void MOVNTI(int bits, OpArg dest, X64Reg src); + + void MUL(int bits, OpArg src); //UNSIGNED + void DIV(int bits, OpArg src); + void IMUL(int bits, OpArg src); //SIGNED + void IDIV(int bits, OpArg src); + void IMUL(int bits, X64Reg regOp, OpArg src); + void IMUL(int bits, X64Reg regOp, OpArg src, OpArg imm); + + + void NEG(int bits, OpArg src); + void NOT(int bits, OpArg src); + + void ROL(int bits, OpArg dest, OpArg shift); + void ROR(int bits, OpArg dest, OpArg shift); + void RCL(int bits, OpArg dest, OpArg shift); + void RCR(int bits, OpArg dest, OpArg shift); + void SHL(int bits, OpArg dest, OpArg shift); + void SHR(int bits, OpArg dest, OpArg shift); + void SAR(int bits, OpArg dest, OpArg shift); + + + void CWD(int bits = 16); + inline void CDQ() {CWD(32);} + inline void CQO() {CWD(64);} + void CBW(int bits = 8); + inline void CWDE() {CBW(16);} + inline void CDQE() {CBW(32);} + + void LEA(int bits, X64Reg dest, OpArg src); + + + enum PrefetchLevel + { + PF_NTA, //Non-temporal (data used once and only once) + PF_T0, //All cache levels + PF_T1, //Levels 2+ (aliased to T0 on AMD) + PF_T2, //Levels 3+ (aliased to T0 on AMD) + }; + void PREFETCH(PrefetchLevel level, OpArg arg); + + + void ADD (int bits, const OpArg &a1, const OpArg &a2); + void ADC (int bits, const OpArg &a1, const OpArg &a2); + void SUB (int bits, const OpArg &a1, const OpArg &a2); + void SBB (int bits, const OpArg &a1, const OpArg &a2); + void AND (int bits, const OpArg &a1, const OpArg &a2); + void OR (int bits, const OpArg &a1, const OpArg &a2); + void XOR (int bits, const OpArg &a1, const OpArg &a2); + void MOV (int bits, const OpArg &a1, const OpArg &a2); + void TEST(int bits, const OpArg &a1, const OpArg &a2); + void CMP (int bits, const OpArg &a1, const OpArg &a2); + + // XCHG is SLOW and should be avoided. + //void XCHG(int bits, const OpArg &a1, const OpArg &a2); + + void XCHG_AHAL(); + void BSWAP(int bits, X64Reg reg); + void MOVSX(int dbits, int sbits, X64Reg dest, OpArg src); //automatically uses MOVSXD if necessary + void MOVZX(int dbits, int sbits, X64Reg dest, OpArg src); + + enum SSECompare + { + EQ = 0, + LT, + LE, + UNORD, + NEQ, + NLT, + NLE, + ORD, + }; + + // WARNING - These two take 11-13 cycles and are VectorPath! (AMD64) + void STMXCSR(OpArg memloc); + void LDMXCSR(OpArg memloc); + + // Regular SSE/SSE2 instructions + void ADDSS(X64Reg regOp, OpArg arg); + void ADDSD(X64Reg regOp, OpArg arg); + void SUBSS(X64Reg regOp, OpArg arg); + void SUBSD(X64Reg regOp, OpArg arg); + void CMPSS(X64Reg regOp, OpArg arg, u8 compare); + void CMPSD(X64Reg regOp, OpArg arg, u8 compare); + void ANDSS(X64Reg regOp, OpArg arg); + void ANDSD(X64Reg regOp, OpArg arg); + void ANDNSS(X64Reg regOp, OpArg arg); + void ANDNSD(X64Reg regOp, OpArg arg); + void ORSS(X64Reg regOp, OpArg arg); + void ORSD(X64Reg regOp, OpArg arg); + void XORSS(X64Reg regOp, OpArg arg); + void XORSD(X64Reg regOp, OpArg arg); + void MULSS(X64Reg regOp, OpArg arg); + void MULSD(X64Reg regOp, OpArg arg); + void DIVSS(X64Reg regOp, OpArg arg); + void DIVSD(X64Reg regOp, OpArg arg); + void MINSS(X64Reg regOp, OpArg arg); + void MINSD(X64Reg regOp, OpArg arg); + void MAXSS(X64Reg regOp, OpArg arg); + void MAXSD(X64Reg regOp, OpArg arg); + void SQRTSS(X64Reg regOp, OpArg arg); + void SQRTSD(X64Reg regOp, OpArg arg); + void RSQRTSS(X64Reg regOp, OpArg arg); + void RSQRTSD(X64Reg regOp, OpArg arg); + + void COMISS(X64Reg regOp, OpArg arg); + void COMISD(X64Reg regOp, OpArg arg); + + void ADDPS(X64Reg regOp, OpArg arg); + void ADDPD(X64Reg regOp, OpArg arg); + void SUBPS(X64Reg regOp, OpArg arg); + void SUBPD(X64Reg regOp, OpArg arg); + void CMPPS(X64Reg regOp, OpArg arg, u8 compare); + void CMPPD(X64Reg regOp, OpArg arg, u8 compare); + void ANDPS(X64Reg regOp, OpArg arg); + void ANDPD(X64Reg regOp, OpArg arg); + void ANDNPS(X64Reg regOp, OpArg arg); + void ANDNPD(X64Reg regOp, OpArg arg); + void ORPS(X64Reg regOp, OpArg arg); + void ORPD(X64Reg regOp, OpArg arg); + void XORPS(X64Reg regOp, OpArg arg); + void XORPD(X64Reg regOp, OpArg arg); + void MULPS(X64Reg regOp, OpArg arg); + void MULPD(X64Reg regOp, OpArg arg); + void DIVPS(X64Reg regOp, OpArg arg); + void DIVPD(X64Reg regOp, OpArg arg); + void MINPS(X64Reg regOp, OpArg arg); + void MINPD(X64Reg regOp, OpArg arg); + void MAXPS(X64Reg regOp, OpArg arg); + void MAXPD(X64Reg regOp, OpArg arg); + void SQRTPS(X64Reg regOp, OpArg arg); + void SQRTPD(X64Reg regOp, OpArg arg); + void RSQRTPS(X64Reg regOp, OpArg arg); + void RSQRTPD(X64Reg regOp, OpArg arg); + void SHUFPS(X64Reg regOp, OpArg arg, u8 shuffle); + void SHUFPD(X64Reg regOp, OpArg arg, u8 shuffle); + + void MOVDDUP(X64Reg regOp, OpArg arg); + + void COMISS(X64Reg regOp, OpArg arg); + void COMISD(X64Reg regOp, OpArg arg); + void UCOMISS(X64Reg regOp, OpArg arg); + void UCOMISD(X64Reg regOp, OpArg arg); + + void MOVAPS(X64Reg regOp, OpArg arg); + void MOVAPD(X64Reg regOp, OpArg arg); + void MOVAPS(OpArg arg, X64Reg regOp); + void MOVAPD(OpArg arg, X64Reg regOp); + + void MOVUPS(X64Reg regOp, OpArg arg); + void MOVUPD(X64Reg regOp, OpArg arg); + void MOVUPS(OpArg arg, X64Reg regOp); + void MOVUPD(OpArg arg, X64Reg regOp); + + void MOVSS(X64Reg regOp, OpArg arg); + void MOVSD(X64Reg regOp, OpArg arg); + void MOVSS(OpArg arg, X64Reg regOp); + void MOVSD(OpArg arg, X64Reg regOp); + + void MOVMSKPS(X64Reg dest, OpArg arg); + void MOVMSKPD(X64Reg dest, OpArg arg); + + void MOVD_xmm(X64Reg dest, const OpArg &arg); + void MOVQ_xmm(X64Reg dest, OpArg arg); + void MOVD_xmm(const OpArg &arg, X64Reg src); + void MOVQ_xmm(OpArg arg, X64Reg src); + + void MASKMOVDQU(X64Reg dest, X64Reg src); + void LDDQU(X64Reg dest, OpArg src); + + void UNPCKLPD(X64Reg dest, OpArg src); + void UNPCKHPD(X64Reg dest, OpArg src); + + void CVTPS2PD(X64Reg dest, OpArg src); + void CVTPD2PS(X64Reg dest, OpArg src); + void CVTSS2SD(X64Reg dest, OpArg src); + void CVTSD2SS(X64Reg dest, OpArg src); + void CVTSD2SI(X64Reg dest, OpArg src); + void CVTDQ2PD(X64Reg regOp, OpArg arg); + void CVTPD2DQ(X64Reg regOp, OpArg arg); + void CVTDQ2PS(X64Reg regOp, const OpArg &arg); + + //Integer SSE instructions + void PACKSSDW(X64Reg dest, OpArg arg); + void PACKSSWB(X64Reg dest, OpArg arg); + //void PACKUSDW(X64Reg dest, OpArg arg); + void PACKUSWB(X64Reg dest, OpArg arg); + + void PUNPCKLBW(X64Reg dest, const OpArg &arg); + void PUNPCKLWD(X64Reg dest, const OpArg &arg); + void PUNPCKLDQ(X64Reg dest, const OpArg &arg); + + void PSRAD(X64Reg dest, int shift); + + void PAND(X64Reg dest, OpArg arg); + void PANDN(X64Reg dest, OpArg arg); + void PXOR(X64Reg dest, OpArg arg); + void POR(X64Reg dest, OpArg arg); + + void PADDB(X64Reg dest, OpArg arg); + void PADDW(X64Reg dest, OpArg arg); + void PADDD(X64Reg dest, OpArg arg); + void PADDQ(X64Reg dest, OpArg arg); + + void PADDSB(X64Reg dest, OpArg arg); + void PADDSW(X64Reg dest, OpArg arg); + void PADDUSB(X64Reg dest, OpArg arg); + void PADDUSW(X64Reg dest, OpArg arg); + + void PSUBB(X64Reg dest, OpArg arg); + void PSUBW(X64Reg dest, OpArg arg); + void PSUBD(X64Reg dest, OpArg arg); + void PSUBQ(X64Reg dest, OpArg arg); + + void PSUBSB(X64Reg dest, OpArg arg); + void PSUBSW(X64Reg dest, OpArg arg); + void PSUBUSB(X64Reg dest, OpArg arg); + void PSUBUSW(X64Reg dest, OpArg arg); + + void PAVGB(X64Reg dest, OpArg arg); + void PAVGW(X64Reg dest, OpArg arg); + + void PCMPEQB(X64Reg dest, OpArg arg); + void PCMPEQW(X64Reg dest, OpArg arg); + void PCMPEQD(X64Reg dest, OpArg arg); + + void PCMPGTB(X64Reg dest, OpArg arg); + void PCMPGTW(X64Reg dest, OpArg arg); + void PCMPGTD(X64Reg dest, OpArg arg); + + void PEXTRW(X64Reg dest, OpArg arg, u8 subreg); + void PINSRW(X64Reg dest, OpArg arg, u8 subreg); + + void PMADDWD(X64Reg dest, OpArg arg); + void PSADBW(X64Reg dest, OpArg arg); + + void PMAXSW(X64Reg dest, OpArg arg); + void PMAXUB(X64Reg dest, OpArg arg); + void PMINSW(X64Reg dest, OpArg arg); + void PMINUB(X64Reg dest, OpArg arg); + + void PMOVMSKB(X64Reg dest, OpArg arg); + void PSHUFB(X64Reg dest, OpArg arg); + + void RTDSC(); + +void CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2); +void CallCdeclFunction4(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3); +void CallCdeclFunction5(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); +void CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5); + +#if defined(_M_IX86) || !defined(_WIN32) + +#define CallCdeclFunction3_I(a,b,c,d) CallCdeclFunction3((void *)(a), (b), (c), (d)) +#define CallCdeclFunction4_I(a,b,c,d,e) CallCdeclFunction4((void *)(a), (b), (c), (d), (e)) +#define CallCdeclFunction5_I(a,b,c,d,e,f) CallCdeclFunction5((void *)(a), (b), (c), (d), (e), (f)) +#define CallCdeclFunction6_I(a,b,c,d,e,f,g) CallCdeclFunction6((void *)(a), (b), (c), (d), (e), (f), (g)) + +#define DECLARE_IMPORT(x) + +#else + +// Comments from VertexLoader.cpp about these horrors: + +// This is a horrible hack that is necessary in 64-bit mode because Opengl32.dll is based way, way above the 32-bit +// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we +// want to grab the function pointers from the import table instead. + +void ___CallCdeclImport3(void* impptr, u32 arg0, u32 arg1, u32 arg2); +void ___CallCdeclImport4(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3); +void ___CallCdeclImport5(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4); +void ___CallCdeclImport6(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5); + +#define CallCdeclFunction3_I(a,b,c,d) ___CallCdeclImport3(&__imp_##a,b,c,d) +#define CallCdeclFunction4_I(a,b,c,d,e) ___CallCdeclImport4(&__imp_##a,b,c,d,e) +#define CallCdeclFunction5_I(a,b,c,d,e,f) ___CallCdeclImport5(&__imp_##a,b,c,d,e,f) +#define CallCdeclFunction6_I(a,b,c,d,e,f,g) ___CallCdeclImport6(&__imp_##a,b,c,d,e,f,g) + +#define DECLARE_IMPORT(x) extern "C" void *__imp_##x + +#endif + +} + +#endif diff --git a/Source/Core/Core/Src/ARDecrypt.h b/Source/Core/Core/Src/ARDecrypt.h index e48eff71e7..6f6f98dc00 100644 --- a/Source/Core/Core/Src/ARDecrypt.h +++ b/Source/Core/Core/Src/ARDecrypt.h @@ -1,36 +1,36 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _ARDECRYPT_H_ -#define _ARDECRYPT_H_ - -#ifdef _WIN32 -#include -#endif - -#include -#include -#include -#include -#include "Common.h" -#include "ActionReplay.h" - -extern int total; -extern const char *filter; - -void DecryptARCode(std::vector vCodes, std::vector &ops); - -#endif //_ARDECRYPT_H_ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _ARDECRYPT_H_ +#define _ARDECRYPT_H_ + +#ifdef _WIN32 +#include +#endif + +#include +#include +#include +#include +#include "Common.h" +#include "ActionReplay.h" + +extern int total; +extern const char *filter; + +void DecryptARCode(std::vector vCodes, std::vector &ops); + +#endif //_ARDECRYPT_H_ diff --git a/Source/Core/Core/Src/ActionReplay.h b/Source/Core/Core/Src/ActionReplay.h index 5c92d3c070..0838e36ac4 100644 --- a/Source/Core/Core/Src/ActionReplay.h +++ b/Source/Core/Core/Src/ActionReplay.h @@ -1,42 +1,42 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _ACTIONREPLAY_H_ -#define _ACTIONREPLAY_H_ - -#include "IniFile.h" - -struct AREntry { - u32 cmd_addr; - u32 value; -}; - -struct ARCode { - std::string name; - std::vector ops; - bool active; -}; - -void ActionReplayRunAllActive(); -bool RunActionReplayCode(const ARCode &arcode); -void LoadActionReplayCodes(IniFile &ini); -size_t ActionReplay_GetCodeListSize(); -ARCode ActionReplay_GetARCode(size_t index); -void ActionReplay_SetARCode_IsActive(bool active, size_t index); -void ActionReplay_UpdateActiveList(); - -#endif //_ACTIONREPLAY_H_ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _ACTIONREPLAY_H_ +#define _ACTIONREPLAY_H_ + +#include "IniFile.h" + +struct AREntry { + u32 cmd_addr; + u32 value; +}; + +struct ARCode { + std::string name; + std::vector ops; + bool active; +}; + +void ActionReplayRunAllActive(); +bool RunActionReplayCode(const ARCode &arcode); +void LoadActionReplayCodes(IniFile &ini); +size_t ActionReplay_GetCodeListSize(); +ARCode ActionReplay_GetARCode(size_t index); +void ActionReplay_SetARCode_IsActive(bool active, size_t index); +void ActionReplay_UpdateActiveList(); + +#endif //_ACTIONREPLAY_H_ diff --git a/Source/Core/Core/Src/Boot/Boot.h b/Source/Core/Core/Src/Boot/Boot.h index 235ccf4024..ba7bbe4228 100644 --- a/Source/Core/Core/Src/Boot/Boot.h +++ b/Source/Core/Core/Src/Boot/Boot.h @@ -1,60 +1,60 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BOOT_H -#define _BOOT_H - -#include - -#include "Common.h" -#include "../CoreParameter.h" - -class CBoot -{ -public: - - enum TBootFileType - { - BOOT_ERROR, - BOOT_DOL, - BOOT_ELF, - BOOT_ISO, - BOOT_BIOS - }; - - static bool BootUp(const SCoreStartupParameter& _StartupPara); - static bool IsElfWii(const char *filename); - - static std::string GenerateMapFilename(); - -private: - enum { BIOS_SIZE = 2*1024*1024 }; - - static void RunFunction(u32 _iAddr, bool _bUseDebugger); - - static void UpdateDebugger_MapLoaded(const char* _gameID = NULL); - - static bool LoadMapFromFilename(const std::string& _rFilename, const char* _gameID = NULL); - static bool Boot_ELF(const char *filename); - - static void EmulatedBIOS(bool _bDebug); - static bool EmulatedBIOS_Wii(bool _bDebug); - static bool Load_BIOS(const std::string& _rBiosFilename); - static void Load_FST(bool _bIsWii); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BOOT_H +#define _BOOT_H + +#include + +#include "Common.h" +#include "../CoreParameter.h" + +class CBoot +{ +public: + + enum TBootFileType + { + BOOT_ERROR, + BOOT_DOL, + BOOT_ELF, + BOOT_ISO, + BOOT_BIOS + }; + + static bool BootUp(const SCoreStartupParameter& _StartupPara); + static bool IsElfWii(const char *filename); + + static std::string GenerateMapFilename(); + +private: + enum { BIOS_SIZE = 2*1024*1024 }; + + static void RunFunction(u32 _iAddr, bool _bUseDebugger); + + static void UpdateDebugger_MapLoaded(const char* _gameID = NULL); + + static bool LoadMapFromFilename(const std::string& _rFilename, const char* _gameID = NULL); + static bool Boot_ELF(const char *filename); + + static void EmulatedBIOS(bool _bDebug); + static bool EmulatedBIOS_Wii(bool _bDebug); + static bool Load_BIOS(const std::string& _rBiosFilename); + static void Load_FST(bool _bIsWii); +}; + +#endif diff --git a/Source/Core/Core/Src/Boot/Boot_DOL.h b/Source/Core/Core/Src/Boot/Boot_DOL.h index 73a6feb230..cbec73186e 100644 --- a/Source/Core/Core/Src/Boot/Boot_DOL.h +++ b/Source/Core/Core/Src/Boot/Boot_DOL.h @@ -1,55 +1,55 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BOOT_DOL_H -#define _BOOT_DOL_H - -#include "Common.h" - -class CDolLoader -{ -public: - CDolLoader(const char* _szFilename); - u32 GetEntryPoint(); - -private: - enum - { - DOL_NUM_TEXT = 7, - DOL_NUM_DATA = 11 - }; - struct SDolHeader - { - u32 textOffset[DOL_NUM_TEXT]; - u32 dataOffset[DOL_NUM_DATA]; - - u32 textAddress[DOL_NUM_TEXT]; - u32 dataAddress[DOL_NUM_DATA]; - - u32 textSize[DOL_NUM_TEXT]; - u32 dataSize[DOL_NUM_DATA]; - - u32 bssAddress; - u32 bssSize; - u32 entryPoint; - u32 padd[7]; - }; - SDolHeader m_dolheader; - bool m_bInit; -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BOOT_DOL_H +#define _BOOT_DOL_H + +#include "Common.h" + +class CDolLoader +{ +public: + CDolLoader(const char* _szFilename); + u32 GetEntryPoint(); + +private: + enum + { + DOL_NUM_TEXT = 7, + DOL_NUM_DATA = 11 + }; + struct SDolHeader + { + u32 textOffset[DOL_NUM_TEXT]; + u32 dataOffset[DOL_NUM_DATA]; + + u32 textAddress[DOL_NUM_TEXT]; + u32 dataAddress[DOL_NUM_DATA]; + + u32 textSize[DOL_NUM_TEXT]; + u32 dataSize[DOL_NUM_DATA]; + + u32 bssAddress; + u32 bssSize; + u32 entryPoint; + u32 padd[7]; + }; + SDolHeader m_dolheader; + bool m_bInit; +}; + +#endif diff --git a/Source/Core/Core/Src/Boot/Boot_ELF.h b/Source/Core/Core/Src/Boot/Boot_ELF.h index 6ad1ff06f7..e6c9df51d2 100644 --- a/Source/Core/Core/Src/Boot/Boot_ELF.h +++ b/Source/Core/Core/Src/Boot/Boot_ELF.h @@ -1,18 +1,18 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once diff --git a/Source/Core/Core/Src/Boot/ElfReader.h b/Source/Core/Core/Src/Boot/ElfReader.h index b2752f3f95..9457dba29e 100644 --- a/Source/Core/Core/Src/Boot/ElfReader.h +++ b/Source/Core/Core/Src/Boot/ElfReader.h @@ -1,89 +1,89 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _ELFREADER_H -#define _ELFREADER_H - -#include "ElfTypes.h" - -enum KnownElfTypes -{ - KNOWNELF_PSP = 0, - KNOWNELF_DS = 1, - KNOWNELF_GBA = 2, - KNOWNELF_GC = 3, -}; - -typedef int SectionID; - -class ElfReader -{ - char *base; - u32 *base32; - - Elf32_Ehdr *header; - Elf32_Phdr *segments; - Elf32_Shdr *sections; - - u32 *sectionOffsets; - u32 *sectionAddrs; - bool bRelocate; - u32 entryPoint; - -public: - ElfReader(void *ptr); - ~ElfReader() { } - - u32 Read32(int off) const { return base32[off>>2]; } - - // Quick accessors - ElfType GetType() const { return (ElfType)(header->e_type); } - ElfMachine GetMachine() const { return (ElfMachine)(header->e_machine); } - u32 GetEntryPoint() const { return entryPoint; } - u32 GetFlags() const { return (u32)(header->e_flags); } - - int GetNumSegments() const { return (int)(header->e_phnum); } - int GetNumSections() const { return (int)(header->e_shnum); } - const u8 *GetPtr(int offset) const { return (u8*)base + offset; } - const char *GetSectionName(int section) const; - const u8 *GetSectionDataPtr(int section) const - { - if (section < 0 || section >= header->e_shnum) - return 0; - if (sections[section].sh_type != SHT_NOBITS) - return GetPtr(sections[section].sh_offset); - else - return 0; - } - const u8 *GetSegmentPtr(int segment) - { - return GetPtr(segments[segment].p_offset); - } - u32 GetSectionAddr(SectionID section) const { return sectionAddrs[section]; } - int GetSectionSize(SectionID section) const { return sections[section].sh_size; } - SectionID GetSectionByName(const char *name, int firstSection = 0) const; //-1 for not found - - bool DidRelocate() { - return bRelocate; - } - // More indepth stuff:) - bool LoadInto(u32 vaddr); - bool LoadSymbols(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _ELFREADER_H +#define _ELFREADER_H + +#include "ElfTypes.h" + +enum KnownElfTypes +{ + KNOWNELF_PSP = 0, + KNOWNELF_DS = 1, + KNOWNELF_GBA = 2, + KNOWNELF_GC = 3, +}; + +typedef int SectionID; + +class ElfReader +{ + char *base; + u32 *base32; + + Elf32_Ehdr *header; + Elf32_Phdr *segments; + Elf32_Shdr *sections; + + u32 *sectionOffsets; + u32 *sectionAddrs; + bool bRelocate; + u32 entryPoint; + +public: + ElfReader(void *ptr); + ~ElfReader() { } + + u32 Read32(int off) const { return base32[off>>2]; } + + // Quick accessors + ElfType GetType() const { return (ElfType)(header->e_type); } + ElfMachine GetMachine() const { return (ElfMachine)(header->e_machine); } + u32 GetEntryPoint() const { return entryPoint; } + u32 GetFlags() const { return (u32)(header->e_flags); } + + int GetNumSegments() const { return (int)(header->e_phnum); } + int GetNumSections() const { return (int)(header->e_shnum); } + const u8 *GetPtr(int offset) const { return (u8*)base + offset; } + const char *GetSectionName(int section) const; + const u8 *GetSectionDataPtr(int section) const + { + if (section < 0 || section >= header->e_shnum) + return 0; + if (sections[section].sh_type != SHT_NOBITS) + return GetPtr(sections[section].sh_offset); + else + return 0; + } + const u8 *GetSegmentPtr(int segment) + { + return GetPtr(segments[segment].p_offset); + } + u32 GetSectionAddr(SectionID section) const { return sectionAddrs[section]; } + int GetSectionSize(SectionID section) const { return sections[section].sh_size; } + SectionID GetSectionByName(const char *name, int firstSection = 0) const; //-1 for not found + + bool DidRelocate() { + return bRelocate; + } + // More indepth stuff:) + bool LoadInto(u32 vaddr); + bool LoadSymbols(); +}; + +#endif + diff --git a/Source/Core/Core/Src/Boot/ElfTypes.h b/Source/Core/Core/Src/Boot/ElfTypes.h index db440eb481..ab89f2de92 100644 --- a/Source/Core/Core/Src/Boot/ElfTypes.h +++ b/Source/Core/Core/Src/Boot/ElfTypes.h @@ -1,281 +1,281 @@ -#ifndef _ELFTYPES_H -#define _ELFTYPES_H - -// ELF Header Constants - -// File type -enum ElfType -{ - ET_NONE =0, - ET_REL =1, - ET_EXEC =2, - ET_DYN =3, - ET_CORE =4, - ET_LOPROC =0xFF00, - ET_HIPROC =0xFFFF, -}; - -// Machine/Architecture -enum ElfMachine -{ - EM_NONE =0, - EM_M32 =1, - EM_SPARC =2, - EM_386 =3, - EM_68K =4, - EM_88K =5, - EM_860 =7, - EM_MIPS =8 -}; - -// File version -#define EV_NONE 0 -#define EV_CURRENT 1 - -// Identification index -#define EI_MAG0 0 -#define EI_MAG1 1 -#define EI_MAG2 2 -#define EI_MAG3 3 -#define EI_CLASS 4 -#define EI_DATA 5 -#define EI_VERSION 6 -#define EI_PAD 7 -#define EI_NIDENT 16 - -// Magic number -#define ELFMAG0 0x7F -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' - -// File class -#define ELFCLASSNONE 0 -#define ELFCLASS32 1 -#define ELFCLASS64 2 - -// Encoding -#define ELFDATANONE 0 -#define ELFDATA2LSB 1 -#define ELFDATA2MSB 2 - - -///////////////////// -// Sections constants - -// Section indexes -#define SHN_UNDEF 0 -#define SHN_LORESERVE 0xFF00 -#define SHN_LOPROC 0xFF00 -#define SHN_HIPROC 0xFF1F -#define SHN_ABS 0xFFF1 -#define SHN_COMMON 0xFFF2 -#define SHN_HIRESERVE 0xFFFF - -// Section types -#define SHT_NULL 0 -#define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_RELA 4 -#define SHT_HASH 5 -#define SHT_DYNAMIC 6 -#define SHT_NOTE 7 -#define SHT_NOBITS 8 -#define SHT_REL 9 -#define SHT_SHLIB 10 -#define SHT_DYNSYM 11 -#define SHT_LOPROC 0x70000000 -#define SHT_HIPROC 0x7FFFFFFF -#define SHT_LOUSER 0x80000000 -#define SHT_HIUSER 0xFFFFFFFF - -// Custom section types -#define SHT_PSPREL 0x700000a0 - - -// Section flags -enum ElfSectionFlags -{ - SHF_WRITE =0x1, - SHF_ALLOC =0x2, - SHF_EXECINSTR =0x4, - SHF_MASKPROC =0xF0000000, -}; - -// Symbol binding -#define STB_LOCAL 0 -#define STB_GLOBAL 1 -#define STB_WEAK 2 -#define STB_LOPROC 13 -#define STB_HIPROC 15 - -// Symbol types -#define STT_NOTYPE 0 -#define STT_OBJECT 1 -#define STT_FUNC 2 -#define STT_SECTION 3 -#define STT_FILE 4 -#define STT_LOPROC 13 -#define STT_HIPROC 15 - -// Undefined name -#define STN_UNDEF 0 - -// Relocation types -#define R_386_NONE 0 -#define R_386_32 1 -#define R_386_PC32 2 -#define R_386_GOT32 3 -#define R_386_PLT32 4 -#define R_386_COPY 5 -#define R_386_GLOB_DAT 6 -#define R_386_JMP_SLOT 7 -#define R_386_RELATIVE 8 -#define R_386_GOTOFF 9 -#define R_386_GOTPC 10 - -// Segment types -#define PT_NULL 0 -#define PT_LOAD 1 -#define PT_DYNAMIC 2 -#define PT_INTERP 3 -#define PT_NOTE 4 -#define PT_SHLIB 5 -#define PT_PHDR 6 -#define PT_LOPROC 0x70000000 -#define PT_HIPROC 0x7FFFFFFF - -// Segment flags -#define PF_X 1 -#define PF_W 2 -#define PF_R 4 - -// Dynamic Array Tags -#define DT_NULL 0 -#define DT_NEEDED 1 -#define DT_PLTRELSZ 2 -#define DT_PLTGOT 3 -#define DT_HASH 4 -#define DT_STRTAB 5 -#define DT_SYMTAB 6 -#define DT_RELA 7 -#define DT_RELASZ 8 -#define DT_RELAENT 9 -#define DT_STRSZ 10 -#define DT_SYMENT 11 -#define DT_INIT 12 -#define DT_FINI 13 -#define DT_SONAME 14 -#define DT_RPATH 15 -#define DT_SYMBOLIC 16 -#define DT_REL 17 -#define DT_RELSZ 18 -#define DT_RELENT 19 -#define DT_PLTREL 20 -#define DT_DEBUG 21 -#define DT_TEXTREL 22 -#define DT_JMPREL 23 -#define DT_LOPROC 0x70000000 -#define DT_HIPROC 0x7FFFFFFF - -typedef unsigned int Elf32_Addr; -typedef unsigned short Elf32_Half; -typedef unsigned int Elf32_Off; -typedef signed int Elf32_Sword; -typedef unsigned int Elf32_Word; - - -// ELF file header -struct Elf32_Ehdr -{ - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; -}; - -// Section header -struct Elf32_Shdr -{ - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; -}; - -// Segment header -struct Elf32_Phdr -{ - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; -}; - -// Symbol table entry -struct Elf32_Sym -{ - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Half st_shndx; -}; - -#define ELF32_ST_BIND(i) ((i)>>4) -#define ELF32_ST_TYPE(i) ((i)&0xf) -#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) - -// Relocation entries -struct Elf32_Rel -{ - Elf32_Addr r_offset; - Elf32_Word r_info; -}; - -struct Elf32_Rela -{ - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; -}; - -#define ELF32_R_SYM(i) ((i)>>8) -#define ELF32_R_TYPE(i) ((unsigned char)(i)) -#define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t)) - - -struct Elf32_Dyn -{ - Elf32_Sword d_tag; - union - { - Elf32_Word d_val; - Elf32_Addr d_ptr; - } d_un; -}; - -#endif - +#ifndef _ELFTYPES_H +#define _ELFTYPES_H + +// ELF Header Constants + +// File type +enum ElfType +{ + ET_NONE =0, + ET_REL =1, + ET_EXEC =2, + ET_DYN =3, + ET_CORE =4, + ET_LOPROC =0xFF00, + ET_HIPROC =0xFFFF, +}; + +// Machine/Architecture +enum ElfMachine +{ + EM_NONE =0, + EM_M32 =1, + EM_SPARC =2, + EM_386 =3, + EM_68K =4, + EM_88K =5, + EM_860 =7, + EM_MIPS =8 +}; + +// File version +#define EV_NONE 0 +#define EV_CURRENT 1 + +// Identification index +#define EI_MAG0 0 +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_PAD 7 +#define EI_NIDENT 16 + +// Magic number +#define ELFMAG0 0x7F +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' + +// File class +#define ELFCLASSNONE 0 +#define ELFCLASS32 1 +#define ELFCLASS64 2 + +// Encoding +#define ELFDATANONE 0 +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 + + +///////////////////// +// Sections constants + +// Section indexes +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xFF00 +#define SHN_LOPROC 0xFF00 +#define SHN_HIPROC 0xFF1F +#define SHN_ABS 0xFFF1 +#define SHN_COMMON 0xFFF2 +#define SHN_HIRESERVE 0xFFFF + +// Section types +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7FFFFFFF +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0xFFFFFFFF + +// Custom section types +#define SHT_PSPREL 0x700000a0 + + +// Section flags +enum ElfSectionFlags +{ + SHF_WRITE =0x1, + SHF_ALLOC =0x2, + SHF_EXECINSTR =0x4, + SHF_MASKPROC =0xF0000000, +}; + +// Symbol binding +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 +#define STB_LOPROC 13 +#define STB_HIPROC 15 + +// Symbol types +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_LOPROC 13 +#define STT_HIPROC 15 + +// Undefined name +#define STN_UNDEF 0 + +// Relocation types +#define R_386_NONE 0 +#define R_386_32 1 +#define R_386_PC32 2 +#define R_386_GOT32 3 +#define R_386_PLT32 4 +#define R_386_COPY 5 +#define R_386_GLOB_DAT 6 +#define R_386_JMP_SLOT 7 +#define R_386_RELATIVE 8 +#define R_386_GOTOFF 9 +#define R_386_GOTPC 10 + +// Segment types +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7FFFFFFF + +// Segment flags +#define PF_X 1 +#define PF_W 2 +#define PF_R 4 + +// Dynamic Array Tags +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7FFFFFFF + +typedef unsigned int Elf32_Addr; +typedef unsigned short Elf32_Half; +typedef unsigned int Elf32_Off; +typedef signed int Elf32_Sword; +typedef unsigned int Elf32_Word; + + +// ELF file header +struct Elf32_Ehdr +{ + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +}; + +// Section header +struct Elf32_Shdr +{ + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +}; + +// Segment header +struct Elf32_Phdr +{ + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +}; + +// Symbol table entry +struct Elf32_Sym +{ + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; +}; + +#define ELF32_ST_BIND(i) ((i)>>4) +#define ELF32_ST_TYPE(i) ((i)&0xf) +#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) + +// Relocation entries +struct Elf32_Rel +{ + Elf32_Addr r_offset; + Elf32_Word r_info; +}; + +struct Elf32_Rela +{ + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +}; + +#define ELF32_R_SYM(i) ((i)>>8) +#define ELF32_R_TYPE(i) ((unsigned char)(i)) +#define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t)) + + +struct Elf32_Dyn +{ + Elf32_Sword d_tag; + union + { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } d_un; +}; + +#endif + diff --git a/Source/Core/Core/Src/Console.h b/Source/Core/Core/Src/Console.h index 96e1063b4e..24a2790aba 100644 --- a/Source/Core/Core/Src/Console.h +++ b/Source/Core/Core/Src/Console.h @@ -1,27 +1,27 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -// Simple debugging console currently residing in the Logging window. Not used much. - -#ifndef _CONSOLE_H -#define _CONSOLE_H - -void Console_Submit(const char *cmd); - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +// Simple debugging console currently residing in the Logging window. Not used much. + +#ifndef _CONSOLE_H +#define _CONSOLE_H + +void Console_Submit(const char *cmd); + +#endif + diff --git a/Source/Core/Core/Src/Core.h b/Source/Core/Core/Src/Core.h index 8c3606804c..2382d0651b 100644 --- a/Source/Core/Core/Src/Core.h +++ b/Source/Core/Core/Src/Core.h @@ -1,75 +1,75 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -// Core - -// The external interface to the emulator core. Plus some extras. -// This is another part of the emu that needs cleaning - Core.cpp really has -// too much random junk inside. - -#ifndef _CORE_H -#define _CORE_H - -#include -#include - -#include "Common.h" -#include "CoreParameter.h" - -namespace Core -{ - enum EState - { - CORE_UNINITIALIZED, - CORE_PAUSE, - CORE_RUN, - }; - - // Init core - bool Init(const SCoreStartupParameter _CoreParameter); - void Stop(); - - bool SetState(EState _State); - EState GetState(); - - // Save/Load state - void SaveState(); - void LoadState(); - - // get core parameters - extern SCoreStartupParameter g_CoreStartupParameter; //uck - const SCoreStartupParameter& GetStartupParameter(); - - // make a screen shot - bool MakeScreenshot(const std::string& _rFilename); - void* GetWindowHandle(); - - extern bool bReadTrace; - extern bool bWriteTrace; - - 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 char *message, int time_in_ms); // This displays messages in a user-visible way. - - int SyncTrace(); - void SetBlockStart(u32 addr); - void StopTrace(); -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +// Core + +// The external interface to the emulator core. Plus some extras. +// This is another part of the emu that needs cleaning - Core.cpp really has +// too much random junk inside. + +#ifndef _CORE_H +#define _CORE_H + +#include +#include + +#include "Common.h" +#include "CoreParameter.h" + +namespace Core +{ + enum EState + { + CORE_UNINITIALIZED, + CORE_PAUSE, + CORE_RUN, + }; + + // Init core + bool Init(const SCoreStartupParameter _CoreParameter); + void Stop(); + + bool SetState(EState _State); + EState GetState(); + + // Save/Load state + void SaveState(); + void LoadState(); + + // get core parameters + extern SCoreStartupParameter g_CoreStartupParameter; //uck + const SCoreStartupParameter& GetStartupParameter(); + + // make a screen shot + bool MakeScreenshot(const std::string& _rFilename); + void* GetWindowHandle(); + + extern bool bReadTrace; + extern bool bWriteTrace; + + 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 char *message, int time_in_ms); // This displays messages in a user-visible way. + + int SyncTrace(); + void SetBlockStart(u32 addr); + void StopTrace(); +} // namespace + +#endif + diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index d7a0138bb7..aca1877c0f 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -1,108 +1,108 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _COREPARAMETER_H -#define _COREPARAMETER_H - -#ifdef _WIN32 -#include -#endif - -#include - - -struct SCoreStartupParameter -{ -#ifdef _WIN32 - HINSTANCE hInstance; -#endif - - // windows/GUI related - void* hMainWindow; - - // flags - bool bEnableDebugging; bool bAutomaticStart; - bool bUseJIT; - - bool bJITUnlimitedCache, bJITOff; // JIT - bool bJITLoadStoreOff, bJITLoadStorelXzOff, bJITLoadStorelwzOff, bJITLoadStorelbzxOff; - bool bJITLoadStoreFloatingOff; - bool bJITLoadStorePairedOff; - bool bJITFloatingPointOff; - bool bJITIntegerOff; - bool bJITPairedOff; - bool bJITSystemRegistersOff; - - bool bUseDualCore; - bool bSkipIdle; - bool bNTSC; - bool bHLEBios; - bool bUseFastMem; - bool bLockThreads; - bool bOptimizeQuantizers; - bool bEnableCheats; - bool bEnableIsoCache; - - bool bRunCompareServer; - bool bRunCompareClient; - int SelectedLanguage; - - bool bWii; - - enum EBootBios - { - BOOT_DEFAULT, - BOOT_BIOS_JAP, - BOOT_BIOS_USA, - BOOT_BIOS_EUR, - }; - - enum EBootType - { - BOOT_ISO, - BOOT_ELF, - BOOT_DOL, - BOOT_BIOS - }; - EBootType m_BootType; - - // files - std::string m_strVideoPlugin; - std::string m_strPadPlugin; - std::string m_strDSPPlugin; - std::string m_strWiimotePlugin; - - std::string m_strFilename; - std::string m_strBios; - std::string m_strMemoryCardA; - std::string m_strMemoryCardB; - std::string m_strSRAM; - std::string m_strDefaultGCM; - std::string m_strDVDRoot; - std::string m_strUniqueID; - std::string m_strName; - - // - SCoreStartupParameter(); - - void LoadDefaults(); - bool AutoSetup(EBootBios _BootBios); - const std::string &GetUniqueID() const { return m_strUniqueID; } -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _COREPARAMETER_H +#define _COREPARAMETER_H + +#ifdef _WIN32 +#include +#endif + +#include + + +struct SCoreStartupParameter +{ +#ifdef _WIN32 + HINSTANCE hInstance; +#endif + + // windows/GUI related + void* hMainWindow; + + // flags + bool bEnableDebugging; bool bAutomaticStart; + bool bUseJIT; + + bool bJITUnlimitedCache, bJITOff; // JIT + bool bJITLoadStoreOff, bJITLoadStorelXzOff, bJITLoadStorelwzOff, bJITLoadStorelbzxOff; + bool bJITLoadStoreFloatingOff; + bool bJITLoadStorePairedOff; + bool bJITFloatingPointOff; + bool bJITIntegerOff; + bool bJITPairedOff; + bool bJITSystemRegistersOff; + + bool bUseDualCore; + bool bSkipIdle; + bool bNTSC; + bool bHLEBios; + bool bUseFastMem; + bool bLockThreads; + bool bOptimizeQuantizers; + bool bEnableCheats; + bool bEnableIsoCache; + + bool bRunCompareServer; + bool bRunCompareClient; + int SelectedLanguage; + + bool bWii; + + enum EBootBios + { + BOOT_DEFAULT, + BOOT_BIOS_JAP, + BOOT_BIOS_USA, + BOOT_BIOS_EUR, + }; + + enum EBootType + { + BOOT_ISO, + BOOT_ELF, + BOOT_DOL, + BOOT_BIOS + }; + EBootType m_BootType; + + // files + std::string m_strVideoPlugin; + std::string m_strPadPlugin; + std::string m_strDSPPlugin; + std::string m_strWiimotePlugin; + + std::string m_strFilename; + std::string m_strBios; + std::string m_strMemoryCardA; + std::string m_strMemoryCardB; + std::string m_strSRAM; + std::string m_strDefaultGCM; + std::string m_strDVDRoot; + std::string m_strUniqueID; + std::string m_strName; + + // + SCoreStartupParameter(); + + void LoadDefaults(); + bool AutoSetup(EBootBios _BootBios); + const std::string &GetUniqueID() const { return m_strUniqueID; } +}; + +#endif + diff --git a/Source/Core/Core/Src/CoreTiming.h b/Source/Core/Core/Src/CoreTiming.h index ed98ef4a85..80e8196199 100644 --- a/Source/Core/Core/Src/CoreTiming.h +++ b/Source/Core/Core/Src/CoreTiming.h @@ -1,85 +1,85 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _CORETIMING_H -#define _CORETIMING_H - -// This is a system to schedule events into the emulated machine's future. Time is measured -// in main CPU clock cycles. - -// 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. - -// 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. -// So to schedule a new event on a regular basis: -// inside callback: -// ScheduleEvent(periodInCycles - cyclesLate, callback, "whatever") - -#include "Common.h" - -#include - -#include "ChunkFile.h" - -namespace CoreTiming -{ - -void Init(); -void Shutdown(); - -typedef void (*TimedCallback)(u64 userdata, int cyclesLate); - -u64 GetTicks(); -u64 GetIdleTicks(); - -void DoState(PointerWrap &p); - -// Returns the event_type identifier. -int RegisterEvent(const char *name, TimedCallback callback); -void UnregisterAllEvents(); - -// userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from disk, -// when we implement state saves. -void ScheduleEvent(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. -void RemoveEvent(int event_type); -bool IsScheduled(int event_type); -void Advance(); - -// Pretend that the main CPU has executed enough cycles to reach the next event. -void Idle(); - -// Clear all pending events. This should ONLY be done on exit or state load. -void ClearPendingEvents(); - -void LogPendingEvents(); -void SetMaximumSlice(int maximumSliceLength); - -void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted)); - -std::string GetScheduledEventsSummary(); - -extern int downcount; -extern int slicelength; - -}; // end of namespace - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _CORETIMING_H +#define _CORETIMING_H + +// This is a system to schedule events into the emulated machine's future. Time is measured +// in main CPU clock cycles. + +// 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. + +// 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. +// So to schedule a new event on a regular basis: +// inside callback: +// ScheduleEvent(periodInCycles - cyclesLate, callback, "whatever") + +#include "Common.h" + +#include + +#include "ChunkFile.h" + +namespace CoreTiming +{ + +void Init(); +void Shutdown(); + +typedef void (*TimedCallback)(u64 userdata, int cyclesLate); + +u64 GetTicks(); +u64 GetIdleTicks(); + +void DoState(PointerWrap &p); + +// Returns the event_type identifier. +int RegisterEvent(const char *name, TimedCallback callback); +void UnregisterAllEvents(); + +// userdata MAY NOT CONTAIN POINTERS. userdata might get written and reloaded from disk, +// when we implement state saves. +void ScheduleEvent(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. +void RemoveEvent(int event_type); +bool IsScheduled(int event_type); +void Advance(); + +// Pretend that the main CPU has executed enough cycles to reach the next event. +void Idle(); + +// Clear all pending events. This should ONLY be done on exit or state load. +void ClearPendingEvents(); + +void LogPendingEvents(); +void SetMaximumSlice(int maximumSliceLength); + +void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted)); + +std::string GetScheduledEventsSummary(); + +extern int downcount; +extern int slicelength; + +}; // end of namespace + +#endif diff --git a/Source/Core/Core/Src/Debugger/DebugInterface.h b/Source/Core/Core/Src/Debugger/DebugInterface.h index cfa81b93ec..d8c751f665 100644 --- a/Source/Core/Core/Src/Debugger/DebugInterface.h +++ b/Source/Core/Core/Src/Debugger/DebugInterface.h @@ -1,32 +1,32 @@ -#ifndef _DEBUGINTERFACE_H -#define _DEBUGINTERFACE_H - -#include - -class DebugInterface -{ -protected: - virtual ~DebugInterface() {} -public: - virtual const char *disasm(unsigned int /*address*/) {return "NODEBUGGER";} - virtual const char *getRawMemoryString(unsigned int /*address*/){return "NODEBUGGER";} - virtual int getInstructionSize(int /*instruction*/) {return 1;} - - virtual bool isAlive() {return true;} - virtual bool isBreakpoint(unsigned int /*address*/) {return false;} - virtual void setBreakpoint(unsigned int /*address*/){} - virtual void clearBreakpoint(unsigned int /*address*/){} - virtual void clearAllBreakpoints() {} - virtual void toggleBreakpoint(unsigned int /*address*/){} - virtual unsigned int readMemory(unsigned int /*address*/){return 0;} - virtual unsigned int readInstruction(unsigned int /*address*/){return 0;} - virtual unsigned int getPC() {return 0;} - virtual void setPC(unsigned int /*address*/) {} - virtual void step() {} - virtual void runToBreakpoint() {} - virtual void insertBLR(unsigned int /*address*/) {} - virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;} - virtual std::string getDescription(unsigned int /*address*/) = 0; -}; - -#endif +#ifndef _DEBUGINTERFACE_H +#define _DEBUGINTERFACE_H + +#include + +class DebugInterface +{ +protected: + virtual ~DebugInterface() {} +public: + virtual const char *disasm(unsigned int /*address*/) {return "NODEBUGGER";} + virtual const char *getRawMemoryString(unsigned int /*address*/){return "NODEBUGGER";} + virtual int getInstructionSize(int /*instruction*/) {return 1;} + + virtual bool isAlive() {return true;} + virtual bool isBreakpoint(unsigned int /*address*/) {return false;} + virtual void setBreakpoint(unsigned int /*address*/){} + virtual void clearBreakpoint(unsigned int /*address*/){} + virtual void clearAllBreakpoints() {} + virtual void toggleBreakpoint(unsigned int /*address*/){} + virtual unsigned int readMemory(unsigned int /*address*/){return 0;} + virtual unsigned int readInstruction(unsigned int /*address*/){return 0;} + virtual unsigned int getPC() {return 0;} + virtual void setPC(unsigned int /*address*/) {} + virtual void step() {} + virtual void runToBreakpoint() {} + virtual void insertBLR(unsigned int /*address*/) {} + virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;} + virtual std::string getDescription(unsigned int /*address*/) = 0; +}; + +#endif diff --git a/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.h b/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.h index 382877b7be..92e746807c 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.h +++ b/Source/Core/Core/Src/Debugger/Debugger_BreakPoints.h @@ -1,100 +1,100 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DEBUGGER_BREAKPOINTS_H -#define _DEBUGGER_BREAKPOINTS_H - -#include -#include - -#include "Common.h" - -struct TBreakPoint -{ - u32 iAddress; - bool bOn; - bool bTemporary; -}; - -struct TMemCheck -{ - TMemCheck(); - u32 StartAddress; - u32 EndAddress; - - bool bRange; - - bool OnRead; - bool OnWrite; - - bool Log; - bool Break; - - u32 numHits; - - void Action(u32 _iValue, u32 addr, bool write, int size, u32 pc); -}; - -class CBreakPoints -{ -public: - - typedef std::vector TBreakPoints; - typedef std::vector TMemChecks; - - static const TBreakPoints& GetBreakPoints() { return m_BreakPoints; } - static const TMemChecks& GetMemChecks() { return m_MemChecks; } - - // is address breakpoint - static bool IsAddressBreakPoint(u32 _iAddress); - - //memory breakpoint - static TMemCheck *GetMemCheck(u32 address); - - // is break on count - static void SetBreakCount(u32 count) { m_iBreakOnCount = count; } - static u32 GetBreakCount() { return m_iBreakOnCount; } - - static bool IsTempBreakPoint(u32 _iAddress); - - // AddBreakPoint - static void AddBreakPoint(u32 _iAddress, bool temp=false); - - // Remove Breakpoint - static void RemoveBreakPoint(u32 _iAddress); - - static void AddMemoryCheck(const TMemCheck& _rMemoryCheck); - - static void ClearAllBreakPoints(); - static void UpdateBreakPointView(); - - static void AddAutoBreakpoints(); - - static void DeleteElementByAddress(u32 _Address); - -private: - - static TBreakPoints m_BreakPoints; - - static TMemChecks m_MemChecks; - - static u32 m_iBreakOnCount; - -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DEBUGGER_BREAKPOINTS_H +#define _DEBUGGER_BREAKPOINTS_H + +#include +#include + +#include "Common.h" + +struct TBreakPoint +{ + u32 iAddress; + bool bOn; + bool bTemporary; +}; + +struct TMemCheck +{ + TMemCheck(); + u32 StartAddress; + u32 EndAddress; + + bool bRange; + + bool OnRead; + bool OnWrite; + + bool Log; + bool Break; + + u32 numHits; + + void Action(u32 _iValue, u32 addr, bool write, int size, u32 pc); +}; + +class CBreakPoints +{ +public: + + typedef std::vector TBreakPoints; + typedef std::vector TMemChecks; + + static const TBreakPoints& GetBreakPoints() { return m_BreakPoints; } + static const TMemChecks& GetMemChecks() { return m_MemChecks; } + + // is address breakpoint + static bool IsAddressBreakPoint(u32 _iAddress); + + //memory breakpoint + static TMemCheck *GetMemCheck(u32 address); + + // is break on count + static void SetBreakCount(u32 count) { m_iBreakOnCount = count; } + static u32 GetBreakCount() { return m_iBreakOnCount; } + + static bool IsTempBreakPoint(u32 _iAddress); + + // AddBreakPoint + static void AddBreakPoint(u32 _iAddress, bool temp=false); + + // Remove Breakpoint + static void RemoveBreakPoint(u32 _iAddress); + + static void AddMemoryCheck(const TMemCheck& _rMemoryCheck); + + static void ClearAllBreakPoints(); + static void UpdateBreakPointView(); + + static void AddAutoBreakpoints(); + + static void DeleteElementByAddress(u32 _Address); + +private: + + static TBreakPoints m_BreakPoints; + + static TMemChecks m_MemChecks; + + static u32 m_iBreakOnCount; + +}; + +#endif + diff --git a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h index bbd29b7733..d5a8cf267d 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h +++ b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h @@ -1,43 +1,43 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DEBUGGER_SYMBOLMAP_H -#define _DEBUGGER_SYMBOLMAP_H - -#include -#include - -#include "Common.h" - -namespace Debugger -{ - -struct CallstackEntry -{ - std::string Name; - u32 vAddress; -}; - -bool GetCallstack(std::vector &output); -void PrintCallstack(); -void PrintCallstack(LogTypes::LOG_TYPE _Log); -void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title); - -} // end of namespace Debugger - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DEBUGGER_SYMBOLMAP_H +#define _DEBUGGER_SYMBOLMAP_H + +#include +#include + +#include "Common.h" + +namespace Debugger +{ + +struct CallstackEntry +{ + std::string Name; + u32 vAddress; +}; + +bool GetCallstack(std::vector &output); +void PrintCallstack(); +void PrintCallstack(LogTypes::LOG_TYPE _Log); +void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title); + +} // end of namespace Debugger + +#endif + diff --git a/Source/Core/Core/Src/Debugger/Dump.h b/Source/Core/Core/Src/Debugger/Dump.h index 54d267d0db..4057379500 100644 --- a/Source/Core/Core/Src/Debugger/Dump.h +++ b/Source/Core/Core/Src/Debugger/Dump.h @@ -1,52 +1,52 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// uncompress the dumps from costis GC-Debugger tool -// -// -#ifndef _DUMP_H -#define _DUMP_H - -#include "Common.h" - -class CDump -{ -public: - - CDump(const char* _szFilename); - ~CDump(); - - int GetNumberOfSteps(); - u32 GetGPR(int _step, int _gpr); - u32 GetPC(int _step); - -private: - enum - { - OFFSET_GPR = 0x4, - OFFSET_PC = 0x194, - STRUCTUR_SIZE = 0x2BC - }; - - u8 *m_pData; - - bool m_bInit; - size_t m_size; - - u32 Read32(u32 _pos); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// uncompress the dumps from costis GC-Debugger tool +// +// +#ifndef _DUMP_H +#define _DUMP_H + +#include "Common.h" + +class CDump +{ +public: + + CDump(const char* _szFilename); + ~CDump(); + + int GetNumberOfSteps(); + u32 GetGPR(int _step, int _gpr); + u32 GetPC(int _step); + +private: + enum + { + OFFSET_GPR = 0x4, + OFFSET_PC = 0x194, + STRUCTUR_SIZE = 0x2BC + }; + + u8 *m_pData; + + bool m_bInit; + size_t m_size; + + u32 Read32(u32 _pos); +}; + +#endif diff --git a/Source/Core/Core/Src/Debugger/GCELF.h b/Source/Core/Core/Src/Debugger/GCELF.h index edcc448f53..f6325d001b 100644 --- a/Source/Core/Core/Src/Debugger/GCELF.h +++ b/Source/Core/Core/Src/Debugger/GCELF.h @@ -1,109 +1,109 @@ -#ifndef GCELF_H -#define GCELF_H - -// ELF File Types -#define ET_NONE 0 // No file type -#define ET_REL 1 // Relocatable file -#define ET_EXEC 2 // Executable file -#define ET_DYN 3 // Shared object file -#define ET_CORE 4 // Core file -#define ET_LOPROC 0xFF00 // Processor specific -#define ET_HIPROC 0xFFFF // Processor specific - -// ELF Machine Types -#define EM_NONE 0 // No machine -#define EM_M32 1 // AT&T WE 32100 -#define EM_SPARC 2 // SPARC -#define EM_386 3 // Intel Architecture -#define EM_68K 4 // Motorola 68000 -#define EM_88K 5 // Motorola 88000 -#define EM_860 6 // Intel 80860 -#define EM_MIPS 7 // MIPS RS3000 Big-Endian -#define EM_MIPS_RS4_BE 8 // MIPS RS4000 Big-Endian -#define EM_ARM 40 // ARM/Thumb Architecture - -// ELF Version Types -#define EV_NONE 0 // Invalid version -#define EV_CURRENT 1 // Current version - -// ELF Section Header Types -#define SHT_NULL 0 -#define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_RELA 4 -#define SHT_HASH 5 -#define SHT_DYNAMIC 6 -#define SHT_NOTE 7 -#define SHT_NOBITS 8 -#define SHT_REL 9 -#define SHT_SHLIB 10 -#define SHT_DYNSYM 11 - - -typedef struct -{ - unsigned char ID[4]; - unsigned char clazz; - unsigned char data; - unsigned char version; - unsigned char pad[9]; - unsigned short e_type; // ELF file type - unsigned short e_machine; // ELF target machine - unsigned int e_version; // ELF file version number - unsigned int e_entry; - unsigned int e_phoff; - unsigned int e_shoff; - unsigned int e_flags; - unsigned short e_ehsize; - unsigned short e_phentsize; - unsigned short e_phnum; - unsigned short e_shentsize; - unsigned short e_shnum; - unsigned short e_shtrndx; -} ELF_Header; - -typedef struct { - unsigned int type; - unsigned int offset; - unsigned int vaddr; - unsigned int paddr; - unsigned int filesz; - unsigned int memsz; - unsigned int flags; - unsigned int align; -} Program_Header; - -typedef struct -{ - unsigned int name; - unsigned int type; - unsigned int flags; - unsigned int addr; - unsigned int offset; - unsigned int size; - unsigned int link; - unsigned int info; - unsigned int addralign; - unsigned int entsize; -} Section_Header; - -typedef struct { - unsigned int name; - unsigned int value; - unsigned int size; - unsigned char info; - unsigned char other; - unsigned short shndx; -} Symbol_Header; - -typedef struct { - unsigned int offset; - unsigned int info; - signed int addend; -} Rela_Header; - -const char ELFID[4] = {0x7F, 'E', 'L', 'F'}; - -#endif - +#ifndef GCELF_H +#define GCELF_H + +// ELF File Types +#define ET_NONE 0 // No file type +#define ET_REL 1 // Relocatable file +#define ET_EXEC 2 // Executable file +#define ET_DYN 3 // Shared object file +#define ET_CORE 4 // Core file +#define ET_LOPROC 0xFF00 // Processor specific +#define ET_HIPROC 0xFFFF // Processor specific + +// ELF Machine Types +#define EM_NONE 0 // No machine +#define EM_M32 1 // AT&T WE 32100 +#define EM_SPARC 2 // SPARC +#define EM_386 3 // Intel Architecture +#define EM_68K 4 // Motorola 68000 +#define EM_88K 5 // Motorola 88000 +#define EM_860 6 // Intel 80860 +#define EM_MIPS 7 // MIPS RS3000 Big-Endian +#define EM_MIPS_RS4_BE 8 // MIPS RS4000 Big-Endian +#define EM_ARM 40 // ARM/Thumb Architecture + +// ELF Version Types +#define EV_NONE 0 // Invalid version +#define EV_CURRENT 1 // Current version + +// ELF Section Header Types +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 + + +typedef struct +{ + unsigned char ID[4]; + unsigned char clazz; + unsigned char data; + unsigned char version; + unsigned char pad[9]; + unsigned short e_type; // ELF file type + unsigned short e_machine; // ELF target machine + unsigned int e_version; // ELF file version number + unsigned int e_entry; + unsigned int e_phoff; + unsigned int e_shoff; + unsigned int e_flags; + unsigned short e_ehsize; + unsigned short e_phentsize; + unsigned short e_phnum; + unsigned short e_shentsize; + unsigned short e_shnum; + unsigned short e_shtrndx; +} ELF_Header; + +typedef struct { + unsigned int type; + unsigned int offset; + unsigned int vaddr; + unsigned int paddr; + unsigned int filesz; + unsigned int memsz; + unsigned int flags; + unsigned int align; +} Program_Header; + +typedef struct +{ + unsigned int name; + unsigned int type; + unsigned int flags; + unsigned int addr; + unsigned int offset; + unsigned int size; + unsigned int link; + unsigned int info; + unsigned int addralign; + unsigned int entsize; +} Section_Header; + +typedef struct { + unsigned int name; + unsigned int value; + unsigned int size; + unsigned char info; + unsigned char other; + unsigned short shndx; +} Symbol_Header; + +typedef struct { + unsigned int offset; + unsigned int info; + signed int addend; +} Rela_Header; + +const char ELFID[4] = {0x7F, 'E', 'L', 'F'}; + +#endif + diff --git a/Source/Core/Core/Src/Debugger/PPCDebugInterface.h b/Source/Core/Core/Src/Debugger/PPCDebugInterface.h index 1a5b5c2b8b..eb7d580b2f 100644 --- a/Source/Core/Core/Src/Debugger/PPCDebugInterface.h +++ b/Source/Core/Core/Src/Debugger/PPCDebugInterface.h @@ -1,34 +1,34 @@ -#ifndef _PPCDEBUGINTERFACE_H -#define _PPCDEBUGINTERFACE_H - -#include - -#include "DebugInterface.h" - -//wrapper between disasm control and Dolphin debugger - -class PPCDebugInterface : public DebugInterface -{ -public: - PPCDebugInterface(){} - virtual const char *disasm(unsigned int address); - virtual const char *getRawMemoryString(unsigned int address); - virtual int getInstructionSize(int instruction) {return 4;} - virtual bool isAlive(); - virtual bool isBreakpoint(unsigned int address); - virtual void setBreakpoint(unsigned int address); - virtual void clearBreakpoint(unsigned int address); - virtual void clearAllBreakpoints(); - virtual void toggleBreakpoint(unsigned int address); - virtual unsigned int readMemory(unsigned int address); - virtual unsigned int readInstruction(unsigned int address); - virtual unsigned int getPC(); - virtual void setPC(unsigned int address); - virtual void step() {} - virtual void runToBreakpoint(); - virtual void insertBLR(unsigned int address); - virtual int getColor(unsigned int address); - virtual std::string getDescription(unsigned int address); -}; - -#endif +#ifndef _PPCDEBUGINTERFACE_H +#define _PPCDEBUGINTERFACE_H + +#include + +#include "DebugInterface.h" + +//wrapper between disasm control and Dolphin debugger + +class PPCDebugInterface : public DebugInterface +{ +public: + PPCDebugInterface(){} + virtual const char *disasm(unsigned int address); + virtual const char *getRawMemoryString(unsigned int address); + virtual int getInstructionSize(int instruction) {return 4;} + virtual bool isAlive(); + virtual bool isBreakpoint(unsigned int address); + virtual void setBreakpoint(unsigned int address); + virtual void clearBreakpoint(unsigned int address); + virtual void clearAllBreakpoints(); + virtual void toggleBreakpoint(unsigned int address); + virtual unsigned int readMemory(unsigned int address); + virtual unsigned int readInstruction(unsigned int address); + virtual unsigned int getPC(); + virtual void setPC(unsigned int address); + virtual void step() {} + virtual void runToBreakpoint(); + virtual void insertBLR(unsigned int address); + virtual int getColor(unsigned int address); + virtual std::string getDescription(unsigned int address); +}; + +#endif diff --git a/Source/Core/Core/Src/DolLoader.h b/Source/Core/Core/Src/DolLoader.h index a2ec525fc7..a97bdb1f35 100644 --- a/Source/Core/Core/Src/DolLoader.h +++ b/Source/Core/Core/Src/DolLoader.h @@ -1,120 +1,120 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -///////////////////////////////////////////////////////////////////////////////////////////////////// -// M O D U L E B E G I N /////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common.h" - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// C L A S S///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////// - -class CDolLoader -{ -public: - - CDolLoader(const char* _szFilename) : - m_bInit(false) - { - // try to open file - FILE* pStream = NULL; - fopen_s(&pStream, _szFilename, "rb"); - if (pStream) - { - fread(&m_dolheader, 1, sizeof(SDolHeader), pStream); - - // swap memory - u32* p = (u32*)&m_dolheader; - for (int i=0; i<(sizeof(SDolHeader)>>2); i++) - p[i] = Common::swap32(p[i]); - - // load all text (code) sections - for(int i=0; i>2); i++) + p[i] = Common::swap32(p[i]); + + // load all text (code) sections + for(int i=0; i -#endif - -extern bool MT; -namespace CommandProcessor -{ -// internal hardware addresses -enum -{ - STATUS_REGISTER = 0x00, - CTRL_REGISTER = 0x02, - CLEAR_REGISTER = 0x04, - FIFO_TOKEN_REGISTER = 0x0E, - FIFO_BOUNDING_BOX_LEFT = 0x10, - FIFO_BOUNDING_BOX_RIGHT = 0x12, - FIFO_BOUNDING_BOX_TOP = 0x14, - FIFO_BOUNDING_BOX_BOTTOM = 0x16, - FIFO_BASE_LO = 0x20, - FIFO_BASE_HI = 0x22, - FIFO_END_LO = 0x24, - FIFO_END_HI = 0x26, - FIFO_HI_WATERMARK_LO = 0x28, - FIFO_HI_WATERMARK_HI = 0x2a, - FIFO_LO_WATERMARK_LO = 0x2c, - FIFO_LO_WATERMARK_HI = 0x2e, - FIFO_RW_DISTANCE_LO = 0x30, - FIFO_RW_DISTANCE_HI = 0x32, - FIFO_WRITE_POINTER_LO = 0x34, - FIFO_WRITE_POINTER_HI = 0x36, - FIFO_READ_POINTER_LO = 0x38, - FIFO_READ_POINTER_HI = 0x3A, - FIFO_BP_LO = 0x3C, - FIFO_BP_HI = 0x3E -}; - -extern SCPFifoStruct fifo; - -// Init -void Init(); -void Shutdown(); -void DoState(PointerWrap &p); - -// Read -void HWCALL Read16(u16& _rReturnValue, const u32 _Address); -void HWCALL Write16(const u16 _Data, const u32 _Address); -void HWCALL Read32(u32& _rReturnValue, const u32 _Address); -void HWCALL Write32(const u32 _Data, const u32 _Address); - -// for CGPFIFO -void CatchUpGPU(); -void GatherPipeBursted(); -void UpdateInterrupts(); -void UpdateInterruptsFromVideoPlugin(); - -bool AllowIdleSkipping(); - -// for DC GP watchdog hack -void IncrementGPWDToken(); -void WaitForFrameFinish(); - -} // end of namespace CommandProcessor - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _COMMANDPROCESSOR_H +#define _COMMANDPROCESSOR_H + +#include "Common.h" +#include "pluginspecs_video.h" +class PointerWrap; + +#ifdef _WIN32 +#include +#endif + +extern bool MT; +namespace CommandProcessor +{ +// internal hardware addresses +enum +{ + STATUS_REGISTER = 0x00, + CTRL_REGISTER = 0x02, + CLEAR_REGISTER = 0x04, + FIFO_TOKEN_REGISTER = 0x0E, + FIFO_BOUNDING_BOX_LEFT = 0x10, + FIFO_BOUNDING_BOX_RIGHT = 0x12, + FIFO_BOUNDING_BOX_TOP = 0x14, + FIFO_BOUNDING_BOX_BOTTOM = 0x16, + FIFO_BASE_LO = 0x20, + FIFO_BASE_HI = 0x22, + FIFO_END_LO = 0x24, + FIFO_END_HI = 0x26, + FIFO_HI_WATERMARK_LO = 0x28, + FIFO_HI_WATERMARK_HI = 0x2a, + FIFO_LO_WATERMARK_LO = 0x2c, + FIFO_LO_WATERMARK_HI = 0x2e, + FIFO_RW_DISTANCE_LO = 0x30, + FIFO_RW_DISTANCE_HI = 0x32, + FIFO_WRITE_POINTER_LO = 0x34, + FIFO_WRITE_POINTER_HI = 0x36, + FIFO_READ_POINTER_LO = 0x38, + FIFO_READ_POINTER_HI = 0x3A, + FIFO_BP_LO = 0x3C, + FIFO_BP_HI = 0x3E +}; + +extern SCPFifoStruct fifo; + +// Init +void Init(); +void Shutdown(); +void DoState(PointerWrap &p); + +// Read +void HWCALL Read16(u16& _rReturnValue, const u32 _Address); +void HWCALL Write16(const u16 _Data, const u32 _Address); +void HWCALL Read32(u32& _rReturnValue, const u32 _Address); +void HWCALL Write32(const u32 _Data, const u32 _Address); + +// for CGPFIFO +void CatchUpGPU(); +void GatherPipeBursted(); +void UpdateInterrupts(); +void UpdateInterruptsFromVideoPlugin(); + +bool AllowIdleSkipping(); + +// for DC GP watchdog hack +void IncrementGPWDToken(); +void WaitForFrameFinish(); + +} // end of namespace CommandProcessor + +#endif + diff --git a/Source/Core/Core/Src/HW/DSP.h b/Source/Core/Core/Src/HW/DSP.h index db268ad965..ed419c2c34 100644 --- a/Source/Core/Core/Src/HW/DSP.h +++ b/Source/Core/Core/Src/HW/DSP.h @@ -1,60 +1,60 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DSPINTERFACE_H -#define _DSPINTERFACE_H - -#include "Common.h" -class PointerWrap; - -namespace DSP -{ - -enum DSPInterruptType -{ - INT_DSP = 0, - INT_ARAM = 1, - INT_AID = 2 -}; - -void Init(); -void Shutdown(); -void DoState(PointerWrap &p); - -void GenerateDSPInterrupt(DSPInterruptType _DSPInterruptType, bool _bSet = true); -void GenerateDSPInterruptFromPlugin(DSPInterruptType _DSPInterruptType, bool _bSet = true); - -// Read32 -void HWCALL Read16(u16& _uReturnValue, const u32 _uAddress); -void HWCALL Read32(u32& _uReturnValue, const u32 _uAddress); - -// Write -void HWCALL Write16(const u16 _uValue, const u32 _uAddress); -void HWCALL Write32(const u32 _uValue, const u32 _uAddress); - -// Audio/DSP Plugin Helper -u8 ReadARAM(const u32 _uAddress); - -// Debugger Helper -u8* GetARAMPtr(); - -void UpdateAudioDMA(); - -}// end of namespace DSP - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DSPINTERFACE_H +#define _DSPINTERFACE_H + +#include "Common.h" +class PointerWrap; + +namespace DSP +{ + +enum DSPInterruptType +{ + INT_DSP = 0, + INT_ARAM = 1, + INT_AID = 2 +}; + +void Init(); +void Shutdown(); +void DoState(PointerWrap &p); + +void GenerateDSPInterrupt(DSPInterruptType _DSPInterruptType, bool _bSet = true); +void GenerateDSPInterruptFromPlugin(DSPInterruptType _DSPInterruptType, bool _bSet = true); + +// Read32 +void HWCALL Read16(u16& _uReturnValue, const u32 _uAddress); +void HWCALL Read32(u32& _uReturnValue, const u32 _uAddress); + +// Write +void HWCALL Write16(const u16 _uValue, const u32 _uAddress); +void HWCALL Write32(const u32 _uValue, const u32 _uAddress); + +// Audio/DSP Plugin Helper +u8 ReadARAM(const u32 _uAddress); + +// Debugger Helper +u8* GetARAMPtr(); + +void UpdateAudioDMA(); + +}// end of namespace DSP + +#endif + diff --git a/Source/Core/Core/Src/HW/DVDInterface.h b/Source/Core/Core/Src/HW/DVDInterface.h index 6b90cd88c6..3fcc9cb805 100644 --- a/Source/Core/Core/Src/HW/DVDInterface.h +++ b/Source/Core/Core/Src/HW/DVDInterface.h @@ -1,50 +1,50 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DVDINTERFACE_H -#define _DVDINTERFACE_H - -#include "Common.h" -class PointerWrap; - -namespace DVDInterface -{ - -void Init(); -void Shutdown(); -void DoState(PointerWrap &p); - -void SetDiscInside(bool _DiscInside); - -// Lid Functions -void SetLidOpen(bool open); -bool IsLidOpen(); - -// DVD Access Functions -bool DVDRead(u32 _iDVDOffset, u32 _iRamAddress, u32 _iLength); -bool DVDReadADPCM(u8* _pDestBuffer, u32 _iNumSamples); - -// Read32 -void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); - -// Write32 -void HWCALL Write32(const u32 _iValue, const u32 _iAddress); - -} // end of namespace DVDInterface - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DVDINTERFACE_H +#define _DVDINTERFACE_H + +#include "Common.h" +class PointerWrap; + +namespace DVDInterface +{ + +void Init(); +void Shutdown(); +void DoState(PointerWrap &p); + +void SetDiscInside(bool _DiscInside); + +// Lid Functions +void SetLidOpen(bool open); +bool IsLidOpen(); + +// DVD Access Functions +bool DVDRead(u32 _iDVDOffset, u32 _iRamAddress, u32 _iLength); +bool DVDReadADPCM(u8* _pDestBuffer, u32 _iNumSamples); + +// Read32 +void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); + +// Write32 +void HWCALL Write32(const u32 _iValue, const u32 _iAddress); + +} // end of namespace DVDInterface + +#endif + diff --git a/Source/Core/Core/Src/HW/EXI.h b/Source/Core/Core/Src/HW/EXI.h index ebfbdb6555..47b6cd0202 100644 --- a/Source/Core/Core/Src/HW/EXI.h +++ b/Source/Core/Core/Src/HW/EXI.h @@ -1,39 +1,39 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _EXIINTERFACE_H -#define _EXIINTERFACE_H - -#include "Common.h" -class PointerWrap; - -namespace ExpansionInterface -{ - -void Init(); -void Shutdown(); -void DoState(PointerWrap &p); - -void Update(); -void UpdateInterrupts(); - -void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); -void HWCALL Write32(const u32 _iValue, const u32 _iAddress); - -} // end of namespace ExpansionInterface - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _EXIINTERFACE_H +#define _EXIINTERFACE_H + +#include "Common.h" +class PointerWrap; + +namespace ExpansionInterface +{ + +void Init(); +void Shutdown(); +void DoState(PointerWrap &p); + +void Update(); +void UpdateInterrupts(); + +void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); +void HWCALL Write32(const u32 _iValue, const u32 _iAddress); + +} // end of namespace ExpansionInterface + +#endif + diff --git a/Source/Core/Core/Src/HW/EXI_Channel.h b/Source/Core/Core/Src/HW/EXI_Channel.h index bb193f7c48..bbe8dc3d16 100644 --- a/Source/Core/Core/Src/HW/EXI_Channel.h +++ b/Source/Core/Core/Src/HW/EXI_Channel.h @@ -1,113 +1,113 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _EXICHANNEL_H -#define _EXICHANNEL_H - -#include "Common.h" - -#include "EXI_Device.h" - -class CEXIChannel -{ -private: - - enum - { - EXI_STATUS = 0, - EXI_DMAADDR = 1, - EXI_DMALENGTH = 2, - EXI_DMACONTROL = 3, - EXI_IMMDATA = 4 - }; - - // EXI Status Register - union UEXI_STATUS - { - u32 hex; - struct - { - unsigned EXIINTMASK : 1; // 31 - unsigned EXIINT : 1; //30 - unsigned TCINTMASK : 1; //29 - unsigned TCINT : 1; //28 - unsigned CLK : 3; //27 - unsigned CHIP_SELECT : 3; //24 - unsigned EXTINTMASK : 1; //21 - unsigned EXTINT : 1; //20 - unsigned EXT : 1; // External Insertion Status (1: External EXI device present) //19 - unsigned ROMDIS : 1; // ROM Disable //18 - unsigned :18; - }; - UEXI_STATUS() {hex = 0;} - UEXI_STATUS(u32 _hex) {hex = _hex;} - }; - - // EXI Control Register - union UEXI_CONTROL - { - u32 hex; - struct - { - unsigned TSTART : 1; - unsigned DMA : 1; - unsigned RW : 2; - unsigned TLEN : 2; - unsigned :26; - }; - }; - - // STATE_TO_SAVE - UEXI_STATUS m_Status; - UEXI_CONTROL m_Control; - u32 m_DMAMemoryAddress; - u32 m_DMALength; - u32 m_ImmData; - - // get device - IEXIDevice* GetDevice(u8 _CHIP_SELECT); - - // Devices - enum - { - NUM_DEVICES = 3 - }; - - IEXIDevice* m_pDevices[NUM_DEVICES]; - -public: - - // channelId for debugging - u32 m_ChannelId; - - CEXIChannel(); - ~CEXIChannel(); - - void AddDevice(const TEXIDevices _device, const unsigned int _iSlot); - - // Remove all devices - void RemoveDevices(); - - void Read32(u32& _uReturnValue, const u32 _iRegister); - void Write32(const u32 _iValue, const u32 _iRegister); - - void Update(); - bool IsCausingInterrupt(); - void UpdateInterrupts(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _EXICHANNEL_H +#define _EXICHANNEL_H + +#include "Common.h" + +#include "EXI_Device.h" + +class CEXIChannel +{ +private: + + enum + { + EXI_STATUS = 0, + EXI_DMAADDR = 1, + EXI_DMALENGTH = 2, + EXI_DMACONTROL = 3, + EXI_IMMDATA = 4 + }; + + // EXI Status Register + union UEXI_STATUS + { + u32 hex; + struct + { + unsigned EXIINTMASK : 1; // 31 + unsigned EXIINT : 1; //30 + unsigned TCINTMASK : 1; //29 + unsigned TCINT : 1; //28 + unsigned CLK : 3; //27 + unsigned CHIP_SELECT : 3; //24 + unsigned EXTINTMASK : 1; //21 + unsigned EXTINT : 1; //20 + unsigned EXT : 1; // External Insertion Status (1: External EXI device present) //19 + unsigned ROMDIS : 1; // ROM Disable //18 + unsigned :18; + }; + UEXI_STATUS() {hex = 0;} + UEXI_STATUS(u32 _hex) {hex = _hex;} + }; + + // EXI Control Register + union UEXI_CONTROL + { + u32 hex; + struct + { + unsigned TSTART : 1; + unsigned DMA : 1; + unsigned RW : 2; + unsigned TLEN : 2; + unsigned :26; + }; + }; + + // STATE_TO_SAVE + UEXI_STATUS m_Status; + UEXI_CONTROL m_Control; + u32 m_DMAMemoryAddress; + u32 m_DMALength; + u32 m_ImmData; + + // get device + IEXIDevice* GetDevice(u8 _CHIP_SELECT); + + // Devices + enum + { + NUM_DEVICES = 3 + }; + + IEXIDevice* m_pDevices[NUM_DEVICES]; + +public: + + // channelId for debugging + u32 m_ChannelId; + + CEXIChannel(); + ~CEXIChannel(); + + void AddDevice(const TEXIDevices _device, const unsigned int _iSlot); + + // Remove all devices + void RemoveDevices(); + + void Read32(u32& _uReturnValue, const u32 _iRegister); + void Write32(const u32 _iValue, const u32 _iRegister); + + void Update(); + bool IsCausingInterrupt(); + void UpdateInterrupts(); +}; + +#endif + diff --git a/Source/Core/Core/Src/HW/EXI_Device.h b/Source/Core/Core/Src/HW/EXI_Device.h index 4fa09d0a10..699574eb48 100644 --- a/Source/Core/Core/Src/HW/EXI_Device.h +++ b/Source/Core/Core/Src/HW/EXI_Device.h @@ -1,64 +1,64 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _EXIDEVICE_H -#define _EXIDEVICE_H - -#include "Common.h" - -class IEXIDevice -{ -private: - // byte transfer function for this device - virtual void TransferByte(u8& _byte) {}; - -public: - // immediate copy functions - virtual void ImmWrite(u32 _uData, u32 _uSize); - virtual u32 ImmRead(u32 _uSize); - - // dma copy functions - virtual void DMAWrite(u32 _uAddr, u32 _uSize); - virtual void DMARead (u32 _uAddr, u32 _uSize); - - virtual bool IsPresent(); - virtual void SetCS(int _iCS); - - // update - virtual void Update(); - - // is generating interrupt ? - virtual bool IsInterruptSet(); - - virtual ~IEXIDevice() {}; -}; - -enum TEXIDevices -{ - EXIDEVICE_DUMMY, - EXIDEVICE_MEMORYCARD_A, - EXIDEVICE_MEMORYCARD_B, - EXIDEVICE_IPL, - EXIDEVICE_AD16, - EXIDEVICE_MIC, - EXIDEVICE_ETH, -}; - -extern IEXIDevice* EXIDevice_Create(TEXIDevices _EXIDevice); - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _EXIDEVICE_H +#define _EXIDEVICE_H + +#include "Common.h" + +class IEXIDevice +{ +private: + // byte transfer function for this device + virtual void TransferByte(u8& _byte) {}; + +public: + // immediate copy functions + virtual void ImmWrite(u32 _uData, u32 _uSize); + virtual u32 ImmRead(u32 _uSize); + + // dma copy functions + virtual void DMAWrite(u32 _uAddr, u32 _uSize); + virtual void DMARead (u32 _uAddr, u32 _uSize); + + virtual bool IsPresent(); + virtual void SetCS(int _iCS); + + // update + virtual void Update(); + + // is generating interrupt ? + virtual bool IsInterruptSet(); + + virtual ~IEXIDevice() {}; +}; + +enum TEXIDevices +{ + EXIDEVICE_DUMMY, + EXIDEVICE_MEMORYCARD_A, + EXIDEVICE_MEMORYCARD_B, + EXIDEVICE_IPL, + EXIDEVICE_AD16, + EXIDEVICE_MIC, + EXIDEVICE_ETH, +}; + +extern IEXIDevice* EXIDevice_Create(TEXIDevices _EXIDevice); + +#endif + diff --git a/Source/Core/Core/Src/HW/EXI_DeviceAD16.h b/Source/Core/Core/Src/HW/EXI_DeviceAD16.h index 1e9be70ba9..385d29cb99 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceAD16.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceAD16.h @@ -1,51 +1,51 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _EXIDEVICE_AD16_H -#define _EXIDEVICE_AD16_H - -class CEXIAD16 : public IEXIDevice -{ -public: - CEXIAD16(); - virtual void SetCS(int _iCS); - virtual bool IsPresent(); - -private: - enum - { - init = 0x00, - write = 0xa0, - read = 0xa2 - }; - - union UAD16Reg - { - u32 U32; - u32 U8[4]; - }; - - // STATE_TO_SAVE - u32 m_uPosition; - u32 m_uCommand; - UAD16Reg m_uAD16Register; - - virtual void TransferByte(u8& _uByte); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _EXIDEVICE_AD16_H +#define _EXIDEVICE_AD16_H + +class CEXIAD16 : public IEXIDevice +{ +public: + CEXIAD16(); + virtual void SetCS(int _iCS); + virtual bool IsPresent(); + +private: + enum + { + init = 0x00, + write = 0xa0, + read = 0xa2 + }; + + union UAD16Reg + { + u32 U32; + u32 U8[4]; + }; + + // STATE_TO_SAVE + u32 m_uPosition; + u32 m_uCommand; + UAD16Reg m_uAD16Register; + + virtual void TransferByte(u8& _uByte); +}; + +#endif + diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h index 6a66187c9b..5e6b7ee04e 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h @@ -1,62 +1,62 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _EXIDEVICE_IPL_H -#define _EXIDEVICE_IPL_H - -#include "EXI_Device.h" - -class CEXIIPL : public IEXIDevice -{ -public: - CEXIIPL(); - virtual ~CEXIIPL(); - virtual void SetCS(int _iCS); - bool IsPresent(); - static u32 GetGCTime(); - -private: - - enum - { - ROM_SIZE = 1024*1024*2, - ROM_MASK = (ROM_SIZE - 1) - }; - - //! IPL - u8* m_pIPL; - - // STATE_TO_SAVE - //! RealTimeClock - u8 m_RTC[4]; - - //! SRam - u8 m_SRAM[64]; - - //! Helper - u32 m_uPosition; - u32 m_uAddress; - u32 m_uRWOffset; - - char m_szBuffer[256]; - int m_count; - - virtual void TransferByte(u8 &_uByte); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _EXIDEVICE_IPL_H +#define _EXIDEVICE_IPL_H + +#include "EXI_Device.h" + +class CEXIIPL : public IEXIDevice +{ +public: + CEXIIPL(); + virtual ~CEXIIPL(); + virtual void SetCS(int _iCS); + bool IsPresent(); + static u32 GetGCTime(); + +private: + + enum + { + ROM_SIZE = 1024*1024*2, + ROM_MASK = (ROM_SIZE - 1) + }; + + //! IPL + u8* m_pIPL; + + // STATE_TO_SAVE + //! RealTimeClock + u8 m_RTC[4]; + + //! SRam + u8 m_SRAM[64]; + + //! Helper + u32 m_uPosition; + u32 m_uAddress; + u32 m_uRWOffset; + + char m_szBuffer[256]; + int m_count; + + virtual void TransferByte(u8 &_uByte); +}; + +#endif + diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h index 0a26916296..d9dc3f923b 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h @@ -1,85 +1,85 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _EXI_DEVICEMEMORYCARD_H -#define _EXI_DEVICEMEMORYCARD_H - -class CEXIMemoryCard : public IEXIDevice -{ -public: - CEXIMemoryCard(const std::string& _rName, const std::string& _rFilename, int card_index); - virtual ~CEXIMemoryCard(); - void SetCS(int cs); - void Update(); - bool IsInterruptSet(); - bool IsPresent(); - - inline const std::string &GetFileName() const { return m_strFilename; }; - -private: - // 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. - static void FlushCallback(u64 userdata, int cyclesLate); - - // Flushes the memory card contents to disk. - void Flush(bool exiting = false); - - enum - { - cmdNintendoID = 0x00, - cmdReadArray = 0x52, - cmdArrayToBuffer = 0x53, - cmdSetInterrupt = 0x81, - cmdWriteBuffer = 0x82, - cmdReadStatus = 0x83, - cmdReadID = 0x85, - cmdReadErrorBuffer = 0x86, - cmdWakeUp = 0x87, - cmdSleep = 0x88, - cmdClearStatus = 0x89, - cmdSectorErase = 0xF1, - cmdPageProgram = 0xF2, - cmdExtraByteProgram = 0xF3, - cmdChipErase = 0xF4, - }; - - std::string m_strFilename; - int card_index; - int et_this_card; - //! memory card state - - // STATE_TO_SAVE - int interruptSwitch; - bool m_bInterruptSet; - int command; - int status; - u32 m_uPosition; - u8 programming_buffer[128]; - u32 formatDelay; - - //! memory card parameters - unsigned int nintendo_card_id, card_id; - unsigned int address; - int memory_card_size; //! in bytes, must be power of 2. - u8 *memory_card_content; - -protected: - virtual void TransferByte(u8 &byte); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _EXI_DEVICEMEMORYCARD_H +#define _EXI_DEVICEMEMORYCARD_H + +class CEXIMemoryCard : public IEXIDevice +{ +public: + CEXIMemoryCard(const std::string& _rName, const std::string& _rFilename, int card_index); + virtual ~CEXIMemoryCard(); + void SetCS(int cs); + void Update(); + bool IsInterruptSet(); + bool IsPresent(); + + inline const std::string &GetFileName() const { return m_strFilename; }; + +private: + // 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. + static void FlushCallback(u64 userdata, int cyclesLate); + + // Flushes the memory card contents to disk. + void Flush(bool exiting = false); + + enum + { + cmdNintendoID = 0x00, + cmdReadArray = 0x52, + cmdArrayToBuffer = 0x53, + cmdSetInterrupt = 0x81, + cmdWriteBuffer = 0x82, + cmdReadStatus = 0x83, + cmdReadID = 0x85, + cmdReadErrorBuffer = 0x86, + cmdWakeUp = 0x87, + cmdSleep = 0x88, + cmdClearStatus = 0x89, + cmdSectorErase = 0xF1, + cmdPageProgram = 0xF2, + cmdExtraByteProgram = 0xF3, + cmdChipErase = 0xF4, + }; + + std::string m_strFilename; + int card_index; + int et_this_card; + //! memory card state + + // STATE_TO_SAVE + int interruptSwitch; + bool m_bInterruptSet; + int command; + int status; + u32 m_uPosition; + u8 programming_buffer[128]; + u32 formatDelay; + + //! memory card parameters + unsigned int nintendo_card_id, card_id; + unsigned int address; + int memory_card_size; //! in bytes, must be power of 2. + u8 *memory_card_content; + +protected: + virtual void TransferByte(u8 &byte); +}; + +#endif + diff --git a/Source/Core/Core/Src/HW/GPFifo.h b/Source/Core/Core/Src/HW/GPFifo.h index 0b122a9741..a3d85e4074 100644 --- a/Source/Core/Core/Src/HW/GPFifo.h +++ b/Source/Core/Core/Src/HW/GPFifo.h @@ -1,61 +1,61 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _GPFIFO_H -#define _GPFIFO_H - -#include "Common.h" -class PointerWrap; - -namespace GPFifo -{ - -enum -{ - GATHER_PIPE_SIZE = 32 -}; - -extern u8 m_gatherPipe[GATHER_PIPE_SIZE*16]; //more room, for the fastmodes - -// pipe counter -extern u32 m_gatherPipeCount; - -// Init -void Init(); -void DoState(PointerWrap &p); - -// ResetGatherPipe -void ResetGatherPipe(); -void CheckGatherPipe(); - -bool IsEmpty(); - -// Write -void HWCALL Write8(const u8 _iValue, const u32 _iAddress); -void HWCALL Write16(const u16 _iValue, const u32 _iAddress); -void HWCALL Write32(const u32 _iValue, const u32 _iAddress); - -// These expect pre-byteswapped values -// Also there's an upper limit of about 512 per batch -// Most likely these should be inlined into JIT instead -void HWCALL FastWrite8(const u8 _iValue); -void HWCALL FastWrite16(const u16 _iValue); -void HWCALL FastWrite32(const u32 _iValue); - -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _GPFIFO_H +#define _GPFIFO_H + +#include "Common.h" +class PointerWrap; + +namespace GPFifo +{ + +enum +{ + GATHER_PIPE_SIZE = 32 +}; + +extern u8 m_gatherPipe[GATHER_PIPE_SIZE*16]; //more room, for the fastmodes + +// pipe counter +extern u32 m_gatherPipeCount; + +// Init +void Init(); +void DoState(PointerWrap &p); + +// ResetGatherPipe +void ResetGatherPipe(); +void CheckGatherPipe(); + +bool IsEmpty(); + +// Write +void HWCALL Write8(const u8 _iValue, const u32 _iAddress); +void HWCALL Write16(const u16 _iValue, const u32 _iAddress); +void HWCALL Write32(const u32 _iValue, const u32 _iAddress); + +// These expect pre-byteswapped values +// Also there's an upper limit of about 512 per batch +// Most likely these should be inlined into JIT instead +void HWCALL FastWrite8(const u8 _iValue); +void HWCALL FastWrite16(const u16 _iValue); +void HWCALL FastWrite32(const u32 _iValue); + +}; + +#endif diff --git a/Source/Core/Core/Src/HW/HW.h b/Source/Core/Core/Src/HW/HW.h index 8aaaf1ba71..131f08072f 100644 --- a/Source/Core/Core/Src/HW/HW.h +++ b/Source/Core/Core/Src/HW/HW.h @@ -1,31 +1,31 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _HW_H -#define _HW_H - -#include "Common.h" -#include "ChunkFile.h" - -namespace HW -{ - void Init(); - void Shutdown(); - void DoState(PointerWrap &p); -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _HW_H +#define _HW_H + +#include "Common.h" +#include "ChunkFile.h" + +namespace HW +{ + void Init(); + void Shutdown(); + void DoState(PointerWrap &p); +} + +#endif diff --git a/Source/Core/Core/Src/HW/Memmap.h b/Source/Core/Core/Src/HW/Memmap.h index 87d383ed33..12b5e4822a 100644 --- a/Source/Core/Core/Src/HW/Memmap.h +++ b/Source/Core/Core/Src/HW/Memmap.h @@ -1,136 +1,136 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _MEMMAP_H -#define _MEMMAP_H - -#include - -#include "Common.h" - -class PointerWrap; - -typedef void (HWCALL *writeFn8 )(const u8, const u32); -typedef void (HWCALL *writeFn16)(const u16,const u32); -typedef void (HWCALL *writeFn32)(const u32,const u32); -typedef void (HWCALL *writeFn64)(const u64,const u32); - -typedef void (HWCALL *readFn8 )(u8&, const u32); -typedef void (HWCALL *readFn16)(u16&, const u32); -typedef void (HWCALL *readFn32)(u32&, const u32); -typedef void (HWCALL *readFn64)(u64&, const u32); - -namespace Memory -{ - // 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. - // on 32-bit, you have to mask your offsets with 0x3FFFFFFF. This means that some things are mirrored, - // but eh... it works. - extern u8 *base; - extern u8* m_pRAM; - extern u8* m_pL1Cache; - // the size should be 24mb only, but the RAM_MASK wouldn't work anymore - enum - { - RAM_SIZE = 0x2000000, - RAM_MASK = 0x1FFFFFF, - FAKEVMEM_SIZE = 0x2000000, - FAKEVMEM_MASK = 0x1FFFFFF, - REALRAM_SIZE = 0x1800000, - L1_CACHE_SIZE = 0x40000, - L1_CACHE_MASK = 0x3FFFF, - EFB_SIZE = 0x200000, - EFB_MASK = 0x1FFFFF, - IO_SIZE = 0x10000, - EXRAM_SIZE = 0x4000000, - EXRAM_MASK = 0x3FFFFFF, -#ifdef _M_IX86 - MEMVIEW32_MASK = 0x3FFFFFFF, -#endif - }; - - bool IsInitialized(); - bool Init(); - bool Shutdown(); - void DoState(PointerWrap &p); - - void Clear(); - bool AreMemoryBreakpointsActivated(); - - //ONLY for use by GUI - u8 ReadUnchecked_U8(const u32 _Address); - u32 ReadUnchecked_U32(const u32 _Address); - - void WriteUnchecked_U8(const u8 _Data, const u32 _Address); - void WriteUnchecked_U32(const u32 _Data, const u32 _Address); - - void InitHWMemFuncs(); - void InitHWMemFuncsWii(); - - u32 Read_Instruction(const u32 _Address); - bool IsRAMAddress(const u32 addr, bool allow_locked_cache = false); - writeFn32 GetHWWriteFun32(const u32 _Address); - - inline u8* GetCachePtr() {return m_pL1Cache;} - inline u8* GetMainRAMPtr() {return m_pRAM;} - inline u32 ReadFast32(const u32 _Address) - { -#ifdef _M_IX86 - return Common::swap32(*(u32 *)(base + (_Address & MEMVIEW32_MASK))); //ReadUnchecked_U32(_Address); -#elif defined(_M_X64) - return Common::swap32(*(u32 *)(base + _Address)); -#endif - } - - u32 Read_Opcode(const u32 _Address); - - //For use by emulator - u8 Read_U8(const u32 _Address); - u16 Read_U16(const u32 _Address); - u32 Read_U32(const u32 _Address); - u64 Read_U64(const u32 _Address); - - void Write_U8(const u8 _Data, const u32 _Address); - void Write_U16(const u16 _Data, const u32 _Address); - void Write_U32(const u32 _Data, const u32 _Address); - void Write_U64(const u64 _Data, const u32 _Address); - - void WriteHW_U32(const u32 _Data, const u32 _Address); - void GetString(std::string& _string, const u32 _Address); - void WriteBigEData(const u8 *_pData, const u32 _Address, const u32 size); - void ReadBigEData(u8 *_pDest, const u32 _Address, const u32 size); - u8* GetPointer(const u32 _Address); - 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 Memset(const u32 _Address, const u8 _Data, const u32 _iLength); - - void SDRUpdated(); - - enum XCheckTLBFlag - { - FLAG_NO_EXCEPTION, - FLAG_READ, - FLAG_WRITE, - FLAG_OPCODE, - }; - - u32 CheckDTLB(u32 _Address, XCheckTLBFlag _Flag); - - extern u32 pagetable_base; - extern u32 pagetable_hashmask; -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _MEMMAP_H +#define _MEMMAP_H + +#include + +#include "Common.h" + +class PointerWrap; + +typedef void (HWCALL *writeFn8 )(const u8, const u32); +typedef void (HWCALL *writeFn16)(const u16,const u32); +typedef void (HWCALL *writeFn32)(const u32,const u32); +typedef void (HWCALL *writeFn64)(const u64,const u32); + +typedef void (HWCALL *readFn8 )(u8&, const u32); +typedef void (HWCALL *readFn16)(u16&, const u32); +typedef void (HWCALL *readFn32)(u32&, const u32); +typedef void (HWCALL *readFn64)(u64&, const u32); + +namespace Memory +{ + // 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. + // on 32-bit, you have to mask your offsets with 0x3FFFFFFF. This means that some things are mirrored, + // but eh... it works. + extern u8 *base; + extern u8* m_pRAM; + extern u8* m_pL1Cache; + // the size should be 24mb only, but the RAM_MASK wouldn't work anymore + enum + { + RAM_SIZE = 0x2000000, + RAM_MASK = 0x1FFFFFF, + FAKEVMEM_SIZE = 0x2000000, + FAKEVMEM_MASK = 0x1FFFFFF, + REALRAM_SIZE = 0x1800000, + L1_CACHE_SIZE = 0x40000, + L1_CACHE_MASK = 0x3FFFF, + EFB_SIZE = 0x200000, + EFB_MASK = 0x1FFFFF, + IO_SIZE = 0x10000, + EXRAM_SIZE = 0x4000000, + EXRAM_MASK = 0x3FFFFFF, +#ifdef _M_IX86 + MEMVIEW32_MASK = 0x3FFFFFFF, +#endif + }; + + bool IsInitialized(); + bool Init(); + bool Shutdown(); + void DoState(PointerWrap &p); + + void Clear(); + bool AreMemoryBreakpointsActivated(); + + //ONLY for use by GUI + u8 ReadUnchecked_U8(const u32 _Address); + u32 ReadUnchecked_U32(const u32 _Address); + + void WriteUnchecked_U8(const u8 _Data, const u32 _Address); + void WriteUnchecked_U32(const u32 _Data, const u32 _Address); + + void InitHWMemFuncs(); + void InitHWMemFuncsWii(); + + u32 Read_Instruction(const u32 _Address); + bool IsRAMAddress(const u32 addr, bool allow_locked_cache = false); + writeFn32 GetHWWriteFun32(const u32 _Address); + + inline u8* GetCachePtr() {return m_pL1Cache;} + inline u8* GetMainRAMPtr() {return m_pRAM;} + inline u32 ReadFast32(const u32 _Address) + { +#ifdef _M_IX86 + return Common::swap32(*(u32 *)(base + (_Address & MEMVIEW32_MASK))); //ReadUnchecked_U32(_Address); +#elif defined(_M_X64) + return Common::swap32(*(u32 *)(base + _Address)); +#endif + } + + u32 Read_Opcode(const u32 _Address); + + //For use by emulator + u8 Read_U8(const u32 _Address); + u16 Read_U16(const u32 _Address); + u32 Read_U32(const u32 _Address); + u64 Read_U64(const u32 _Address); + + void Write_U8(const u8 _Data, const u32 _Address); + void Write_U16(const u16 _Data, const u32 _Address); + void Write_U32(const u32 _Data, const u32 _Address); + void Write_U64(const u64 _Data, const u32 _Address); + + void WriteHW_U32(const u32 _Data, const u32 _Address); + void GetString(std::string& _string, const u32 _Address); + void WriteBigEData(const u8 *_pData, const u32 _Address, const u32 size); + void ReadBigEData(u8 *_pDest, const u32 _Address, const u32 size); + u8* GetPointer(const u32 _Address); + 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 Memset(const u32 _Address, const u8 _Data, const u32 _iLength); + + void SDRUpdated(); + + enum XCheckTLBFlag + { + FLAG_NO_EXCEPTION, + FLAG_READ, + FLAG_WRITE, + FLAG_OPCODE, + }; + + u32 CheckDTLB(u32 _Address, XCheckTLBFlag _Flag); + + extern u32 pagetable_base; + extern u32 pagetable_hashmask; +}; + +#endif diff --git a/Source/Core/Core/Src/HW/MemoryInterface.h b/Source/Core/Core/Src/HW/MemoryInterface.h index 7310293262..fba99ee684 100644 --- a/Source/Core/Core/Src/HW/MemoryInterface.h +++ b/Source/Core/Core/Src/HW/MemoryInterface.h @@ -1,34 +1,34 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _MEMORYINTERFACE_H -#define _MEMORYINTERFACE_H - -#include "Common.h" -class PointerWrap; - -namespace MemoryInterface -{ -void DoState(PointerWrap &p); - -void HWCALL Read16(u16& _uReturnValue, const u32 _iAddress); -void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); -void HWCALL Write32(const u32 _iValue, const u32 _iAddress); -void HWCALL Write16(const u16 _iValue, const u32 _iAddress); -} // end of namespace MemoryInterface - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _MEMORYINTERFACE_H +#define _MEMORYINTERFACE_H + +#include "Common.h" +class PointerWrap; + +namespace MemoryInterface +{ +void DoState(PointerWrap &p); + +void HWCALL Read16(u16& _uReturnValue, const u32 _iAddress); +void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); +void HWCALL Write32(const u32 _iValue, const u32 _iAddress); +void HWCALL Write16(const u16 _iValue, const u32 _iAddress); +} // end of namespace MemoryInterface + +#endif + diff --git a/Source/Core/Core/Src/HW/PeripheralInterface.h b/Source/Core/Core/Src/HW/PeripheralInterface.h index de0d5ebbeb..c63d707184 100644 --- a/Source/Core/Core/Src/HW/PeripheralInterface.h +++ b/Source/Core/Core/Src/HW/PeripheralInterface.h @@ -1,116 +1,116 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PERIPHERALINTERFACE_H -#define _PERIPHERALINTERFACE_H - -#include "Common.h" -class PointerWrap; - -// -// PERIPHERALINTERFACE -// Handles communication with cpu services like the write gatherer used for fifos, and interrupts -// - -class CPeripheralInterface -{ -friend class CRegisters; - -public: - enum InterruptCause - { - INT_CAUSE_ERROR = 0x1, // ? - INT_CAUSE_RSW = 0x2, // Reset Switch - INT_CAUSE_DI = 0x4, // DVD interrupt - INT_CAUSE_SI = 0x8, // Serial interface - INT_CAUSE_EXI = 0x10, // Expansion interface - INT_CAUSE_AUDIO = 0x20, // Audio Interface Streaming - INT_CAUSE_DSP = 0x40, // DSP interface - INT_CAUSE_MEMORY = 0x80, // Memory interface - INT_CAUSE_VI = 0x100, // Video interface - INT_CAUSE_PE_TOKEN = 0x200, // GP Token - INT_CAUSE_PE_FINISH = 0x400, // GP Finished - INT_CAUSE_CP = 0x800, // Command Fifo - INT_CAUSE_DEBUG = 0x1000, // ? - INT_CAUSE_HSP = 0x2000, // High Speed Port - INT_CAUSE_WII_IPC = 0x4000, // Wii IPC - INT_CAUSE_RST_BUTTON = 0x10000 // ResetButtonState (1 = unpressed, 0 = pressed) - }; - -private: - - // internal hardware addresses - enum - { - PI_INTERRUPT_CAUSE = 0x000, - PI_INTERRUPT_MASK = 0x004, - PI_FIFO_BASE = 0x00C, - PI_FIFO_END = 0x010, - PI_FIFO_WPTR = 0x014, - PI_FIFO_RESET = 0x018, // ??? - GXAbortFrameWrites to it - PI_RESET_CODE = 0x024, - PI_MB_REV = 0x02C, - }; - - //This must always be byteswapped :( (UNUSED ATM) - struct PIRegMem - { - u32 rInterruptCause; //00 - u32 rInterruptMask; //04 - u32 unused0; //08 - u32 FifoBase; //0C - u32 FifoEnd; //10 - u32 FifoWptr; //14 - u32 FifoReset; //18 - u32 unused1; //1C - u32 unused2; //20 - u32 ResetCode; //24 - u32 unused3; //28 - u32 MBRev; //2C - }; - - static volatile u32 m_InterruptMask; - static volatile u32 m_InterruptCause; - - static void UpdateException(); - - // Debug_GetInterruptName - static const char* Debug_GetInterruptName(InterruptCause _causemask); - -public: - - static u32 Fifo_CPUBase; - static u32 Fifo_CPUEnd; - static u32 Fifo_CPUWritePointer; - - static void Init(); - static void DoState(PointerWrap &p); - - static void SetInterrupt(InterruptCause _causemask, bool _bSet=true); - - // Read32 - static void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); - - // Write32 - static void HWCALL Write32(const u32 _iValue, const u32 _iAddress); - - // SetResetButton (you have to release the button again to make a reset) - static void SetResetButton(bool _bSet); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PERIPHERALINTERFACE_H +#define _PERIPHERALINTERFACE_H + +#include "Common.h" +class PointerWrap; + +// +// PERIPHERALINTERFACE +// Handles communication with cpu services like the write gatherer used for fifos, and interrupts +// + +class CPeripheralInterface +{ +friend class CRegisters; + +public: + enum InterruptCause + { + INT_CAUSE_ERROR = 0x1, // ? + INT_CAUSE_RSW = 0x2, // Reset Switch + INT_CAUSE_DI = 0x4, // DVD interrupt + INT_CAUSE_SI = 0x8, // Serial interface + INT_CAUSE_EXI = 0x10, // Expansion interface + INT_CAUSE_AUDIO = 0x20, // Audio Interface Streaming + INT_CAUSE_DSP = 0x40, // DSP interface + INT_CAUSE_MEMORY = 0x80, // Memory interface + INT_CAUSE_VI = 0x100, // Video interface + INT_CAUSE_PE_TOKEN = 0x200, // GP Token + INT_CAUSE_PE_FINISH = 0x400, // GP Finished + INT_CAUSE_CP = 0x800, // Command Fifo + INT_CAUSE_DEBUG = 0x1000, // ? + INT_CAUSE_HSP = 0x2000, // High Speed Port + INT_CAUSE_WII_IPC = 0x4000, // Wii IPC + INT_CAUSE_RST_BUTTON = 0x10000 // ResetButtonState (1 = unpressed, 0 = pressed) + }; + +private: + + // internal hardware addresses + enum + { + PI_INTERRUPT_CAUSE = 0x000, + PI_INTERRUPT_MASK = 0x004, + PI_FIFO_BASE = 0x00C, + PI_FIFO_END = 0x010, + PI_FIFO_WPTR = 0x014, + PI_FIFO_RESET = 0x018, // ??? - GXAbortFrameWrites to it + PI_RESET_CODE = 0x024, + PI_MB_REV = 0x02C, + }; + + //This must always be byteswapped :( (UNUSED ATM) + struct PIRegMem + { + u32 rInterruptCause; //00 + u32 rInterruptMask; //04 + u32 unused0; //08 + u32 FifoBase; //0C + u32 FifoEnd; //10 + u32 FifoWptr; //14 + u32 FifoReset; //18 + u32 unused1; //1C + u32 unused2; //20 + u32 ResetCode; //24 + u32 unused3; //28 + u32 MBRev; //2C + }; + + static volatile u32 m_InterruptMask; + static volatile u32 m_InterruptCause; + + static void UpdateException(); + + // Debug_GetInterruptName + static const char* Debug_GetInterruptName(InterruptCause _causemask); + +public: + + static u32 Fifo_CPUBase; + static u32 Fifo_CPUEnd; + static u32 Fifo_CPUWritePointer; + + static void Init(); + static void DoState(PointerWrap &p); + + static void SetInterrupt(InterruptCause _causemask, bool _bSet=true); + + // Read32 + static void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); + + // Write32 + static void HWCALL Write32(const u32 _iValue, const u32 _iAddress); + + // SetResetButton (you have to release the button again to make a reset) + static void SetResetButton(bool _bSet); +}; + +#endif + diff --git a/Source/Core/Core/Src/HW/PixelEngine.h b/Source/Core/Core/Src/HW/PixelEngine.h index 7b74c1f7ba..a913d1bb28 100644 --- a/Source/Core/Core/Src/HW/PixelEngine.h +++ b/Source/Core/Core/Src/HW/PixelEngine.h @@ -1,43 +1,43 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _PIXELENGINE_H -#define _PIXELENGINE_H - -#include "CommonTypes.h" -class PointerWrap; - -namespace PixelEngine -{ -void Init(); -void DoState(PointerWrap &p); - -// Read -void HWCALL Read16(u16& _uReturnValue, const u32 _iAddress); - -// Write -void HWCALL Write16(const u16 _iValue, const u32 _iAddress); -void HWCALL Write32(const u32 _iValue, const u32 _iAddress); - -// gfx plugin support -void SetToken(const u16 _token, const int _bSetTokenAcknowledge); -void SetFinish(void); -bool AllowIdleSkipping(); - -} // end of namespace PixelEngine - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _PIXELENGINE_H +#define _PIXELENGINE_H + +#include "CommonTypes.h" +class PointerWrap; + +namespace PixelEngine +{ +void Init(); +void DoState(PointerWrap &p); + +// Read +void HWCALL Read16(u16& _uReturnValue, const u32 _iAddress); + +// Write +void HWCALL Write16(const u16 _iValue, const u32 _iAddress); +void HWCALL Write32(const u32 _iValue, const u32 _iAddress); + +// gfx plugin support +void SetToken(const u16 _token, const int _bSetTokenAcknowledge); +void SetFinish(void); +bool AllowIdleSkipping(); + +} // end of namespace PixelEngine + +#endif + diff --git a/Source/Core/Core/Src/HW/SerialInterface.h b/Source/Core/Core/Src/HW/SerialInterface.h index c0d9454bc5..4bfb59c2ff 100644 --- a/Source/Core/Core/Src/HW/SerialInterface.h +++ b/Source/Core/Core/Src/HW/SerialInterface.h @@ -1,39 +1,39 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _SERIALINTERFACE_H -#define _SERIALINTERFACE_H - -#include "Common.h" -class PointerWrap; - -namespace SerialInterface -{ - -void Init(); -void Shutdown(); -void DoState(PointerWrap &p); - -void UpdateDevices(); - -void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); -void HWCALL Write32(const u32 _iValue, const u32 _iAddress); - -}; // end of namespace SerialInterface - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _SERIALINTERFACE_H +#define _SERIALINTERFACE_H + +#include "Common.h" +class PointerWrap; + +namespace SerialInterface +{ + +void Init(); +void Shutdown(); +void DoState(PointerWrap &p); + +void UpdateDevices(); + +void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); +void HWCALL Write32(const u32 _iValue, const u32 _iAddress); + +}; // end of namespace SerialInterface + +#endif + diff --git a/Source/Core/Core/Src/HW/SerialInterface_Devices.h b/Source/Core/Core/Src/HW/SerialInterface_Devices.h index 516b23efb3..cae353d456 100644 --- a/Source/Core/Core/Src/HW/SerialInterface_Devices.h +++ b/Source/Core/Core/Src/HW/SerialInterface_Devices.h @@ -1,139 +1,139 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _SERIALINTERFACE_DEVICES_H -#define _SERIALINTERFACE_DEVICES_H - -#include "Common.h" -class PointerWrap; - -class ISIDevice -{ -protected: - int m_iDeviceNumber; - -public: - - // constructor - ISIDevice(int _iDeviceNumber) : - m_iDeviceNumber(_iDeviceNumber) - { } - virtual ~ISIDevice() { } - - // run the SI Buffer - virtual int RunBuffer(u8* _pBuffer, int _iLength); - - // return true on new data - virtual bool GetData(u32& _Hi, u32& _Low) = 0; - - // send a command directly (no detour per buffer) - virtual void SendCommand(u32 _Cmd) = 0; -}; - -// ===================================================================================================== -// standard gamecube controller -// ===================================================================================================== - -class CSIDevice_GCController : public ISIDevice -{ -private: - - // commands - enum EBufferCommands - { - CMD_INVALID = 0xFFFFFFFF, - CMD_RESET = 0x00, - CMD_ORIGIN = 0x41, - CMD_RECALIBRATE = 0x42, - }; - - struct SOrigin - { - u8 uCommand; - u8 unk_1; - u8 uOriginStickX; - u8 uOriginStickY; - u8 uSubStickStickX; // ??? - u8 uSubStickStickY; // ??? - u8 uTrigger_L; // ??? - u8 uTrigger_R; // ??? - u8 unk_4; - u8 unk_5; - u8 unk_6; - u8 unk_7; - }; - - enum EDirectCommands - { - CMD_RUMBLE = 0x40 - }; - - union UCommand - { - u32 Hex; - struct - { - unsigned Parameter1 : 8; - unsigned Parameter2 : 8; - unsigned Command : 8; - unsigned : 8; - }; - UCommand() {Hex = 0;} - UCommand(u32 _iValue) {Hex = _iValue;} - }; - - SOrigin m_origin; - int DeviceNum; - -public: - - // constructor - CSIDevice_GCController(int _iDeviceNumber); - - // run the SI Buffer - virtual int RunBuffer(u8* _pBuffer, int _iLength); - - // return true on new data - virtual bool GetData(u32& _Hi, u32& _Low); - - // send a command directly - virtual void SendCommand(u32 _Cmd); -}; - -// ===================================================================================================== -// dummy - no device attached -// ===================================================================================================== - -class CSIDevice_Dummy : public ISIDevice -{ -public: - - // constructor - CSIDevice_Dummy(int _iDeviceNumber); - - // run the SI Buffer - virtual int RunBuffer(u8* _pBuffer, int _iLength); - - // return true on new data - virtual bool GetData(u32& _Hi, u32& _Low); - - // send a command directly - virtual void SendCommand(u32 _Cmd); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _SERIALINTERFACE_DEVICES_H +#define _SERIALINTERFACE_DEVICES_H + +#include "Common.h" +class PointerWrap; + +class ISIDevice +{ +protected: + int m_iDeviceNumber; + +public: + + // constructor + ISIDevice(int _iDeviceNumber) : + m_iDeviceNumber(_iDeviceNumber) + { } + virtual ~ISIDevice() { } + + // run the SI Buffer + virtual int RunBuffer(u8* _pBuffer, int _iLength); + + // return true on new data + virtual bool GetData(u32& _Hi, u32& _Low) = 0; + + // send a command directly (no detour per buffer) + virtual void SendCommand(u32 _Cmd) = 0; +}; + +// ===================================================================================================== +// standard gamecube controller +// ===================================================================================================== + +class CSIDevice_GCController : public ISIDevice +{ +private: + + // commands + enum EBufferCommands + { + CMD_INVALID = 0xFFFFFFFF, + CMD_RESET = 0x00, + CMD_ORIGIN = 0x41, + CMD_RECALIBRATE = 0x42, + }; + + struct SOrigin + { + u8 uCommand; + u8 unk_1; + u8 uOriginStickX; + u8 uOriginStickY; + u8 uSubStickStickX; // ??? + u8 uSubStickStickY; // ??? + u8 uTrigger_L; // ??? + u8 uTrigger_R; // ??? + u8 unk_4; + u8 unk_5; + u8 unk_6; + u8 unk_7; + }; + + enum EDirectCommands + { + CMD_RUMBLE = 0x40 + }; + + union UCommand + { + u32 Hex; + struct + { + unsigned Parameter1 : 8; + unsigned Parameter2 : 8; + unsigned Command : 8; + unsigned : 8; + }; + UCommand() {Hex = 0;} + UCommand(u32 _iValue) {Hex = _iValue;} + }; + + SOrigin m_origin; + int DeviceNum; + +public: + + // constructor + CSIDevice_GCController(int _iDeviceNumber); + + // run the SI Buffer + virtual int RunBuffer(u8* _pBuffer, int _iLength); + + // return true on new data + virtual bool GetData(u32& _Hi, u32& _Low); + + // send a command directly + virtual void SendCommand(u32 _Cmd); +}; + +// ===================================================================================================== +// dummy - no device attached +// ===================================================================================================== + +class CSIDevice_Dummy : public ISIDevice +{ +public: + + // constructor + CSIDevice_Dummy(int _iDeviceNumber); + + // run the SI Buffer + virtual int RunBuffer(u8* _pBuffer, int _iLength); + + // return true on new data + virtual bool GetData(u32& _Hi, u32& _Low); + + // send a command directly + virtual void SendCommand(u32 _Cmd); +}; + +#endif + diff --git a/Source/Core/Core/Src/HW/SystemTimers.h b/Source/Core/Core/Src/HW/SystemTimers.h index ca325fbb0d..0b20a5d118 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.h +++ b/Source/Core/Core/Src/HW/SystemTimers.h @@ -1,35 +1,35 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _SYSTEMTIMERS_H -#define _SYSTEMTIMERS_H - -#include "Common.h" - -namespace SystemTimers -{ - -u32 GetTicksPerSecond(); -void Init(); -void Shutdown(); - -// Notify timing system that somebody wrote to the decrementer -void DecrementerSet(); - -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _SYSTEMTIMERS_H +#define _SYSTEMTIMERS_H + +#include "Common.h" + +namespace SystemTimers +{ + +u32 GetTicksPerSecond(); +void Init(); +void Shutdown(); + +// Notify timing system that somebody wrote to the decrementer +void DecrementerSet(); + +} + +#endif diff --git a/Source/Core/Core/Src/HW/VideoInterface.h b/Source/Core/Core/Src/HW/VideoInterface.h index 3874ab7b82..1871828054 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.h +++ b/Source/Core/Core/Src/HW/VideoInterface.h @@ -1,65 +1,65 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _VIDEOINTERFACE_H -#define _VIDEOINTERFACE_H - -#include "Common.h" -class PointerWrap; - -namespace VideoInterface -{ - enum VIInterruptType - { - INT_PRERETRACE = 0, - INT_POSTRETRACE = 1, - INT_REG_2, - INT_REG_3, - }; - - void Init(); - void DoState(PointerWrap &p); - - void HWCALL Read16(u16& _uReturnValue, const u32 _uAddress); - void HWCALL Read32(u32& _uReturnValue, const u32 _uAddress); - - void HWCALL Write16(const u16 _uValue, const u32 _uAddress); - void HWCALL Write32(const u32 _uValue, const u32 _uAddress); - - void GenerateVIInterrupt(VIInterruptType _VIInterrupt); - - // returns a pointer to the current visible framebuffer - u8* GetFrameBufferPointer(); - - // pre init - void PreInit(bool _bNTSC); - - // VI Unknown Regs - extern u8 m_UVIUnknownRegs[0x1000]; - - // ?????? - void Update(); - - - // UpdateInterrupts: check if we have to generate a new VI Interrupt - void UpdateInterrupts(); - - // ?????? - void UpdateTiming(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _VIDEOINTERFACE_H +#define _VIDEOINTERFACE_H + +#include "Common.h" +class PointerWrap; + +namespace VideoInterface +{ + enum VIInterruptType + { + INT_PRERETRACE = 0, + INT_POSTRETRACE = 1, + INT_REG_2, + INT_REG_3, + }; + + void Init(); + void DoState(PointerWrap &p); + + void HWCALL Read16(u16& _uReturnValue, const u32 _uAddress); + void HWCALL Read32(u32& _uReturnValue, const u32 _uAddress); + + void HWCALL Write16(const u16 _uValue, const u32 _uAddress); + void HWCALL Write32(const u32 _uValue, const u32 _uAddress); + + void GenerateVIInterrupt(VIInterruptType _VIInterrupt); + + // returns a pointer to the current visible framebuffer + u8* GetFrameBufferPointer(); + + // pre init + void PreInit(bool _bNTSC); + + // VI Unknown Regs + extern u8 m_UVIUnknownRegs[0x1000]; + + // ?????? + void Update(); + + + // UpdateInterrupts: check if we have to generate a new VI Interrupt + void UpdateInterrupts(); + + // ?????? + void UpdateTiming(); +}; + +#endif + diff --git a/Source/Core/Core/Src/HW/WII_IOB.h b/Source/Core/Core/Src/HW/WII_IOB.h index 4e84986707..0ef3bdcf09 100644 --- a/Source/Core/Core/Src/HW/WII_IOB.h +++ b/Source/Core/Core/Src/HW/WII_IOB.h @@ -1,45 +1,45 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _WII_IOBRIDGE_H_ -#define _WII_IOBRIDGE_H_ - -#include "Common.h" -class PointerWrap; - -namespace WII_IOBridge -{ - -void Init(); -void Shutdown(); -void DoState(PointerWrap &p); - -void Update(); - -void HWCALL Read8(u8& _rReturnValue, const u32 _Address); -void HWCALL Read16(u16& _rReturnValue, const u32 _Address); -void HWCALL Read32(u32& _rReturnValue, const u32 _Address); -void HWCALL Read64(u64& _rReturnValue, const u32 _Address); - -void HWCALL Write8(const u8 _Value, const u32 _Address); -void HWCALL Write16(const u16 _Value, const u32 _Address); -void HWCALL Write32(const u32 _Value, const u32 _Address); -void HWCALL Write64(const u64 _Value, const u32 _Address); - -} // end of namespace AudioInterface - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _WII_IOBRIDGE_H_ +#define _WII_IOBRIDGE_H_ + +#include "Common.h" +class PointerWrap; + +namespace WII_IOBridge +{ + +void Init(); +void Shutdown(); +void DoState(PointerWrap &p); + +void Update(); + +void HWCALL Read8(u8& _rReturnValue, const u32 _Address); +void HWCALL Read16(u16& _rReturnValue, const u32 _Address); +void HWCALL Read32(u32& _rReturnValue, const u32 _Address); +void HWCALL Read64(u64& _rReturnValue, const u32 _Address); + +void HWCALL Write8(const u8 _Value, const u32 _Address); +void HWCALL Write16(const u16 _Value, const u32 _Address); +void HWCALL Write32(const u32 _Value, const u32 _Address); +void HWCALL Write64(const u64 _Value, const u32 _Address); + +} // end of namespace AudioInterface + +#endif + diff --git a/Source/Core/Core/Src/HW/WII_IPC.h b/Source/Core/Core/Src/HW/WII_IPC.h index 30e9db5d71..8e36ce8da6 100644 --- a/Source/Core/Core/Src/HW/WII_IPC.h +++ b/Source/Core/Core/Src/HW/WII_IPC.h @@ -1,42 +1,42 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _WII_IPC_H_ -#define _WII_IPC_H_ - -#include "Common.h" -class PointerWrap; - -namespace WII_IPCInterface -{ - -void Init(); -void Shutdown(); -void DoState(PointerWrap &p); - -void Update(); -bool IsReady(); -void GenerateReply(u32 _AnswerAddress); -void GenerateAck(u32 _AnswerAddress); - -void HWCALL Read32(u32& _rReturnValue, const u32 _Address); - -void HWCALL Write32(const u32 _Value, const u32 _Address); - -} // end of namespace AudioInterface - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _WII_IPC_H_ +#define _WII_IPC_H_ + +#include "Common.h" +class PointerWrap; + +namespace WII_IPCInterface +{ + +void Init(); +void Shutdown(); +void DoState(PointerWrap &p); + +void Update(); +bool IsReady(); +void GenerateReply(u32 _AnswerAddress); +void GenerateAck(u32 _AnswerAddress); + +void HWCALL Read32(u32& _rReturnValue, const u32 _Address); + +void HWCALL Write32(const u32 _Value, const u32 _Address); + +} // end of namespace AudioInterface + +#endif + diff --git a/Source/Core/Core/Src/Host.h b/Source/Core/Core/Src/Host.h index 1c73c9079e..64f8c5ed92 100644 --- a/Source/Core/Core/Src/Host.h +++ b/Source/Core/Core/Src/Host.h @@ -1,56 +1,56 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _HOST_H -#define _HOST_H - - -// Host - defines an interface for the emulator core to communicate back to the -// OS-specific layer - -// The emulator core is abstracted from the OS using 2 interfaces: -// Common and Host. - -// Common simply provides OS-neutral implementations of things like threads, mutexes, -// INI file manipulation, memory mapping, etc. - -// 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 -// write GUI interfaces that control things than to squash GUI into some model that wasn't -// designed for it. - -// The host can be just a command line app that opens a window, or a full blown debugger -// interface. - -void Host_BootingStarted(); -void Host_BootingEnded(); -void Host_UpdateMainFrame(); -void Host_UpdateDisasmDialog(); -void Host_UpdateLogDisplay(); -void Host_UpdateMemoryView(); -void Host_NotifyMapLoaded(); -void Host_UpdateBreakPointView(); -void Host_SetDebugMode(bool enable); - -void Host_SetWaitCursor(bool enable); - -void Host_UpdateStatusBar(const char* _pText); - -void Host_SysMessage(const char *fmt, ...); -void Host_SetWiiMoteConnectionState(int _State); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _HOST_H +#define _HOST_H + + +// Host - defines an interface for the emulator core to communicate back to the +// OS-specific layer + +// The emulator core is abstracted from the OS using 2 interfaces: +// Common and Host. + +// Common simply provides OS-neutral implementations of things like threads, mutexes, +// INI file manipulation, memory mapping, etc. + +// 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 +// write GUI interfaces that control things than to squash GUI into some model that wasn't +// designed for it. + +// The host can be just a command line app that opens a window, or a full blown debugger +// interface. + +void Host_BootingStarted(); +void Host_BootingEnded(); +void Host_UpdateMainFrame(); +void Host_UpdateDisasmDialog(); +void Host_UpdateLogDisplay(); +void Host_UpdateMemoryView(); +void Host_NotifyMapLoaded(); +void Host_UpdateBreakPointView(); +void Host_SetDebugMode(bool enable); + +void Host_SetWaitCursor(bool enable); + +void Host_UpdateStatusBar(const char* _pText); + +void Host_SysMessage(const char *fmt, ...); +void Host_SetWiiMoteConnectionState(int _State); + +#endif diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h index 385472edc8..c4bb54a064 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h @@ -1,50 +1,50 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _WII_IPC_HLE_H_ -#define _WII_IPC_HLE_H_ - -namespace WII_IPC_HLE_Interface -{ - -// Init -void Init(); - -// Shutdown -void Shutdown(); - -// Update -void Update(); - -// Acknowledge command -bool AckCommand(u32 _Address); - -enum ECommandType -{ - COMMAND_OPEN_DEVICE = 1, - COMMAND_CLOSE_DEVICE = 2, - COMMAND_READ = 3, - COMMAND_WRITE = 4, - COMMAND_SEEK = 5, - COMMAND_IOCTL = 6, - COMMAND_IOCTLV = 7, -}; - -} // end of namespace AudioInterface - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _WII_IPC_HLE_H_ +#define _WII_IPC_HLE_H_ + +namespace WII_IPC_HLE_Interface +{ + +// Init +void Init(); + +// Shutdown +void Shutdown(); + +// Update +void Update(); + +// Acknowledge command +bool AckCommand(u32 _Address); + +enum ECommandType +{ + COMMAND_OPEN_DEVICE = 1, + COMMAND_CLOSE_DEVICE = 2, + COMMAND_READ = 3, + COMMAND_WRITE = 4, + COMMAND_SEEK = 5, + COMMAND_IOCTL = 6, + COMMAND_IOCTLV = 7, +}; + +} // end of namespace AudioInterface + +#endif + diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h index 5e51f2b0d3..41fdefbe18 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h @@ -1,200 +1,200 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _WII_IPC_HLE_DEVICE_H_ -#define _WII_IPC_HLE_DEVICE_H_ - -#include -#include -#include "../HW/Memmap.h" -#include "../HW/CPU.h" - -class IWII_IPC_HLE_Device -{ -public: - - IWII_IPC_HLE_Device(u32 _DeviceID, const std::string& _rName) : - m_Name(_rName), - m_DeviceID(_DeviceID) - {} - - virtual ~IWII_IPC_HLE_Device() - {} - - const std::string& GetDeviceName() const { return m_Name; } - 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 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 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 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 u32 Update() { return 0; } - - virtual bool ReturnFileHandle() { return false; } - - -private: - - // STATE_TO_SAVE - std::string m_Name; - u32 m_DeviceID; - - -protected: - - // =================================================== - /* A struct for IOS ioctlv calls */ - // ---------------- - struct SIOCtlVBuffer - { - SIOCtlVBuffer(u32 _Address) - : m_Address(_Address) - { - /* 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 - stored. */ - Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0 - NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1 - NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2 - BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3 - - // The start of the out buffer - u32 BufferVectorOffset = BufferVector; - - //if(Parameter = 0x1d) PanicAlert("%i: %i", Parameter, NumberInBuffer); - - // Write the address and size for all in messages - for (u32 i = 0; i < NumberInBuffer; i++) - { - SBuffer Buffer; - Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); - - /* Restore cached address, mauled by emulatee's ioctl functions. Why? - What is the purpose of this? After we have read the values, why would - anyone ned it */ - //Memory::Write_U32(Buffer.m_Address | 0x80000000, BufferVectorOffset); - BufferVectorOffset += 4; - - Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); - BufferVectorOffset += 4; - LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer in%i: 0x%08x, 0x%x", - i, Buffer.m_Address, Buffer.m_Size); - InBuffer.push_back(Buffer); - } - - // Write the address and size for all out or in-out messages - for (u32 i = 0; i < NumberPayloadBuffer; i++) - { - SBuffer Buffer; - Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); - - //Memory::Write_U32(Buffer.m_Address | 0x80000000, BufferVectorOffset); - BufferVectorOffset += 4; - - Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); - BufferVectorOffset += 4; - LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer io%i: 0x%08x, 0x%x", - i, Buffer.m_Address, Buffer.m_Size); - PayloadBuffer.push_back(Buffer); - } - } - - // STATE_TO_SAVE - const u32 m_Address; - - u32 Parameter; - u32 NumberInBuffer; - u32 NumberPayloadBuffer; - u32 BufferVector; - u32 BufferSize; - - struct SBuffer { u32 m_Address, m_Size; }; - std::vector InBuffer; - std::vector PayloadBuffer; - }; - - - // =================================================== - /* Write out the IPC struct from _CommandAddress to _NumberOfCommands numbers - of 4 byte commands. */ - // ---------------- - void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8, - int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0) - { - // Because I have to use __Logv here I add this #if - #if defined(_DEBUG) || defined(DEBUGFAST) - __Logv(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str()); - for (u32 i = 0; i < _NumberOfCommands; i++) - { - __Logv(LogType, Verbosity, " Command%02i: 0x%08x", i, - Memory::Read_U32(_CommandAddress + i*4)); - } - #endif - } - - - void DumpAsync( u32 BufferVector, u32 _CommandAddress, u32 NumberInBuffer, u32 NumberOutBuffer ) - { - LOGV(WII_IPC_HLE, 1, "======= DumpAsync ======"); - // write return value - u32 BufferOffset = BufferVector; - Memory::Write_U32(1, _CommandAddress + 0x4); - - for (u32 i=0; i +#include +#include "../HW/Memmap.h" +#include "../HW/CPU.h" + +class IWII_IPC_HLE_Device +{ +public: + + IWII_IPC_HLE_Device(u32 _DeviceID, const std::string& _rName) : + m_Name(_rName), + m_DeviceID(_DeviceID) + {} + + virtual ~IWII_IPC_HLE_Device() + {} + + const std::string& GetDeviceName() const { return m_Name; } + 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 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 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 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 u32 Update() { return 0; } + + virtual bool ReturnFileHandle() { return false; } + + +private: + + // STATE_TO_SAVE + std::string m_Name; + u32 m_DeviceID; + + +protected: + + // =================================================== + /* A struct for IOS ioctlv calls */ + // ---------------- + struct SIOCtlVBuffer + { + SIOCtlVBuffer(u32 _Address) + : m_Address(_Address) + { + /* 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 + stored. */ + Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0 + NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1 + NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2 + BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3 + + // The start of the out buffer + u32 BufferVectorOffset = BufferVector; + + //if(Parameter = 0x1d) PanicAlert("%i: %i", Parameter, NumberInBuffer); + + // Write the address and size for all in messages + for (u32 i = 0; i < NumberInBuffer; i++) + { + SBuffer Buffer; + Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); + + /* Restore cached address, mauled by emulatee's ioctl functions. Why? + What is the purpose of this? After we have read the values, why would + anyone ned it */ + //Memory::Write_U32(Buffer.m_Address | 0x80000000, BufferVectorOffset); + BufferVectorOffset += 4; + + Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); + BufferVectorOffset += 4; + LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer in%i: 0x%08x, 0x%x", + i, Buffer.m_Address, Buffer.m_Size); + InBuffer.push_back(Buffer); + } + + // Write the address and size for all out or in-out messages + for (u32 i = 0; i < NumberPayloadBuffer; i++) + { + SBuffer Buffer; + Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); + + //Memory::Write_U32(Buffer.m_Address | 0x80000000, BufferVectorOffset); + BufferVectorOffset += 4; + + Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); + BufferVectorOffset += 4; + LOGV(WII_IPC_HLE, 3, "SIOCtlVBuffer io%i: 0x%08x, 0x%x", + i, Buffer.m_Address, Buffer.m_Size); + PayloadBuffer.push_back(Buffer); + } + } + + // STATE_TO_SAVE + const u32 m_Address; + + u32 Parameter; + u32 NumberInBuffer; + u32 NumberPayloadBuffer; + u32 BufferVector; + u32 BufferSize; + + struct SBuffer { u32 m_Address, m_Size; }; + std::vector InBuffer; + std::vector PayloadBuffer; + }; + + + // =================================================== + /* Write out the IPC struct from _CommandAddress to _NumberOfCommands numbers + of 4 byte commands. */ + // ---------------- + void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8, + int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0) + { + // Because I have to use __Logv here I add this #if + #if defined(_DEBUG) || defined(DEBUGFAST) + __Logv(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str()); + for (u32 i = 0; i < _NumberOfCommands; i++) + { + __Logv(LogType, Verbosity, " Command%02i: 0x%08x", i, + Memory::Read_U32(_CommandAddress + i*4)); + } + #endif + } + + + void DumpAsync( u32 BufferVector, u32 _CommandAddress, u32 NumberInBuffer, u32 NumberOutBuffer ) + { + LOGV(WII_IPC_HLE, 1, "======= DumpAsync ======"); + // write return value + u32 BufferOffset = BufferVector; + Memory::Write_U32(1, _CommandAddress + 0x4); + + for (u32 i=0; i -#include - -#include "WII_IPC_HLE_WiiMote.h" - - -union UACLHeader -{ - struct - { - unsigned ConnectionHandle : 12; - unsigned PBFlag : 2; - unsigned BCFlag : 2; - unsigned Size : 16; - }; - u32 Hex; -}; - -struct ACLFrame -{ - u16 ConnectionHandle; - u8* data; - u32 size; -}; - -struct SQueuedEvent -{ - u8 m_buffer[1024]; - size_t m_size; - u16 m_connectionHandle; - - SQueuedEvent(size_t size, u16 connectionHandle) - : m_size(size) - , m_connectionHandle(connectionHandle) - { - if (m_size > 1024) - { - // i know this code sux... - PanicAlert("SQueuedEvent: allocate a to big buffer!!"); - } - } -}; - -class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device -{ -public: - - CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName); - - virtual ~CWII_IPC_HLE_Device_usb_oh1_57e_305(); - - virtual bool Open(u32 _CommandAddress, u32 _Mode); - - virtual bool IOCtlV(u32 _CommandAddress); - virtual bool IOCtl(u32 _CommandAddress); - - virtual u32 Update(); - - void SendACLFrame(u16 _ConnectionHandle, u8* _pData, u32 _Size); - - //hack for wiimote plugin - -public: - - std::vector m_WiiMotes; - CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr); - CWII_IPC_HLE_WiiMote* AccessWiiMote(u16 _ConnectionHandle); - -private: - - enum - { - USB_IOCTL_HCI_COMMAND_MESSAGE = 0, - USB_IOCTL_BLKMSG = 1, - USB_IOCTL_INTRMSG = 2, - USB_IOCTL_SUSPENDDEV = 5, - USB_IOCTL_RESUMEDEV = 6, - USB_IOCTL_GETDEVLIST = 12, - USB_IOCTL_DEVREMOVALHOOK = 26, - USB_IOCTL_DEVINSERTHOOK = 27, - }; - - enum - { - HCI_EVENT_ENDPOINT = 0x81, - ACL_DATA_ENDPOINT_READ = 0x02, - ACL_DATA_ENDPOINT = 0x82, - }; - - - struct SHCICommandMessage - { - u8 bRequestType; - u8 bRequest; - u16 wValue; - u16 wIndex; - u16 wLength; - - u32 m_PayLoadAddr; - u32 m_PayLoadSize; - }; - - bdaddr_t m_ControllerBD; - u8 m_ClassOfDevice[HCI_CLASS_SIZE]; - char m_LocalName[HCI_UNIT_NAME_SIZE]; - u8 m_PINType; - u8 m_ScanEnable; - - u8 m_EventFilterType; - u8 m_EventFilterCondition; - - u16 m_HostMaxACLSize; - u8 m_HostMaxSCOSize; - u16 m_HostNumACLPackets; - u16 m_HostNumSCOPackets; - - typedef std::queue CEventQueue; - typedef std::queue CACLFrameQueue; - - CEventQueue m_EventQueue; - CACLFrameQueue m_AclFrameQue; - - SIOCtlVBuffer* m_pACLBuffer; - SIOCtlVBuffer* m_pHCIBuffer; - - // Events - void AddEventToQueue(const SQueuedEvent& _event); - bool SendEventCommandStatus(u16 _Opcode); - void SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize); - bool SendEventInquiryResponse(); - bool SendEventInquiryComplete(); - bool SendEventRemoteNameReq(bdaddr_t _bd); - bool SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote); - bool SendEventConnectionComplete(bdaddr_t _bd); - bool SendEventReadClockOffsetComplete(u16 _connectionHandle); - bool SendEventReadRemoteVerInfo(u16 _connectionHandle); - bool SendEventReadRemoteFeatures(u16 _connectionHandle); - bool SendEventRoleChange(bdaddr_t _bd, bool _master); - bool SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count); - bool SendEventAuthenticationCompleted(u16 _connectionHandle); - bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value); - bool SendEventDisconnect(u16 _connectionHandle, u8 _Reason); - bool SendEventRequestLinkKey(bdaddr_t _bd); - bool SendEventLinkKeyNotification(const CWII_IPC_HLE_WiiMote& _rWiiMote); - - // Execute HCI Message - void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage); - - // OGF 0x01 Link control commands and return parameters - void CommandWriteInquiryMode(u8* _Input); - void CommandWritePageScanType(u8* _Input); - void CommandHostBufferSize(u8* _Input); - void CommandInquiryCancel(u8* _Input); - void CommandRemoteNameReq(u8* _Input); - void CommandCreateCon(u8* _Input); - void CommandAcceptCon(u8* _Input); - void CommandReadClockOffset(u8* _Input); - void CommandReadRemoteVerInfo(u8* _Input); - void CommandReadRemoteFeatures(u8* _Input); - void CommandAuthenticationRequested(u8* _Input); - void CommandInquiry(u8* _Input); - void CommandDisconnect(u8* _Input); - void CommandLinkKeyNegRep(u8* _Input); - void CommandLinkKeyRep(u8* _Input); - - // OGF 0x02 Link policy commands and return parameters - void CommandWriteLinkPolicy(u8* _Input); - void CommandSniffMode(u8* _Input); - - // OGF 0x03 Host Controller and Baseband commands and return parameters - void CommandReset(u8* _Input); - void CommandWriteLocalName(u8* _Input); - void CommandWritePageTimeOut(u8* _Input); - void CommandWriteScanEnable(u8* _Input); - void CommandWriteUnitClass(u8* _Input); - void CommandReadStoredLinkKey(u8* _Input); - void CommandWritePinType(u8* _Input); - void CommandSetEventFilter(u8* _Input); - void CommandWriteInquiryScanType(u8* _Input); - void CommandWriteLinkSupervisionTimeout(u8* _Input); - - // OGF 0x04 Informational commands and return parameters - void CommandReadBufferSize(u8* _Input); - void CommandReadLocalVer(u8* _Input); - void CommandReadLocalFeatures(u8* _Input); - void CommandReadBDAdrr(u8* _Input); - - // OGF 0x3F Vendor specific - void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size); - void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size); - - void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size); - - void LOG_LinkKey(const u8* _pLinkKey); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _WII_IPC_HLE_DEVICE_USB_H_ +#define _WII_IPC_HLE_DEVICE_USB_H_ + +#include "WII_IPC_HLE_Device.h" +#include "hci.h" +#include +#include + +#include "WII_IPC_HLE_WiiMote.h" + + +union UACLHeader +{ + struct + { + unsigned ConnectionHandle : 12; + unsigned PBFlag : 2; + unsigned BCFlag : 2; + unsigned Size : 16; + }; + u32 Hex; +}; + +struct ACLFrame +{ + u16 ConnectionHandle; + u8* data; + u32 size; +}; + +struct SQueuedEvent +{ + u8 m_buffer[1024]; + size_t m_size; + u16 m_connectionHandle; + + SQueuedEvent(size_t size, u16 connectionHandle) + : m_size(size) + , m_connectionHandle(connectionHandle) + { + if (m_size > 1024) + { + // i know this code sux... + PanicAlert("SQueuedEvent: allocate a to big buffer!!"); + } + } +}; + +class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device +{ +public: + + CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName); + + virtual ~CWII_IPC_HLE_Device_usb_oh1_57e_305(); + + virtual bool Open(u32 _CommandAddress, u32 _Mode); + + virtual bool IOCtlV(u32 _CommandAddress); + virtual bool IOCtl(u32 _CommandAddress); + + virtual u32 Update(); + + void SendACLFrame(u16 _ConnectionHandle, u8* _pData, u32 _Size); + + //hack for wiimote plugin + +public: + + std::vector m_WiiMotes; + CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr); + CWII_IPC_HLE_WiiMote* AccessWiiMote(u16 _ConnectionHandle); + +private: + + enum + { + USB_IOCTL_HCI_COMMAND_MESSAGE = 0, + USB_IOCTL_BLKMSG = 1, + USB_IOCTL_INTRMSG = 2, + USB_IOCTL_SUSPENDDEV = 5, + USB_IOCTL_RESUMEDEV = 6, + USB_IOCTL_GETDEVLIST = 12, + USB_IOCTL_DEVREMOVALHOOK = 26, + USB_IOCTL_DEVINSERTHOOK = 27, + }; + + enum + { + HCI_EVENT_ENDPOINT = 0x81, + ACL_DATA_ENDPOINT_READ = 0x02, + ACL_DATA_ENDPOINT = 0x82, + }; + + + struct SHCICommandMessage + { + u8 bRequestType; + u8 bRequest; + u16 wValue; + u16 wIndex; + u16 wLength; + + u32 m_PayLoadAddr; + u32 m_PayLoadSize; + }; + + bdaddr_t m_ControllerBD; + u8 m_ClassOfDevice[HCI_CLASS_SIZE]; + char m_LocalName[HCI_UNIT_NAME_SIZE]; + u8 m_PINType; + u8 m_ScanEnable; + + u8 m_EventFilterType; + u8 m_EventFilterCondition; + + u16 m_HostMaxACLSize; + u8 m_HostMaxSCOSize; + u16 m_HostNumACLPackets; + u16 m_HostNumSCOPackets; + + typedef std::queue CEventQueue; + typedef std::queue CACLFrameQueue; + + CEventQueue m_EventQueue; + CACLFrameQueue m_AclFrameQue; + + SIOCtlVBuffer* m_pACLBuffer; + SIOCtlVBuffer* m_pHCIBuffer; + + // Events + void AddEventToQueue(const SQueuedEvent& _event); + bool SendEventCommandStatus(u16 _Opcode); + void SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize); + bool SendEventInquiryResponse(); + bool SendEventInquiryComplete(); + bool SendEventRemoteNameReq(bdaddr_t _bd); + bool SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote); + bool SendEventConnectionComplete(bdaddr_t _bd); + bool SendEventReadClockOffsetComplete(u16 _connectionHandle); + bool SendEventReadRemoteVerInfo(u16 _connectionHandle); + bool SendEventReadRemoteFeatures(u16 _connectionHandle); + bool SendEventRoleChange(bdaddr_t _bd, bool _master); + bool SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count); + bool SendEventAuthenticationCompleted(u16 _connectionHandle); + bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value); + bool SendEventDisconnect(u16 _connectionHandle, u8 _Reason); + bool SendEventRequestLinkKey(bdaddr_t _bd); + bool SendEventLinkKeyNotification(const CWII_IPC_HLE_WiiMote& _rWiiMote); + + // Execute HCI Message + void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage); + + // OGF 0x01 Link control commands and return parameters + void CommandWriteInquiryMode(u8* _Input); + void CommandWritePageScanType(u8* _Input); + void CommandHostBufferSize(u8* _Input); + void CommandInquiryCancel(u8* _Input); + void CommandRemoteNameReq(u8* _Input); + void CommandCreateCon(u8* _Input); + void CommandAcceptCon(u8* _Input); + void CommandReadClockOffset(u8* _Input); + void CommandReadRemoteVerInfo(u8* _Input); + void CommandReadRemoteFeatures(u8* _Input); + void CommandAuthenticationRequested(u8* _Input); + void CommandInquiry(u8* _Input); + void CommandDisconnect(u8* _Input); + void CommandLinkKeyNegRep(u8* _Input); + void CommandLinkKeyRep(u8* _Input); + + // OGF 0x02 Link policy commands and return parameters + void CommandWriteLinkPolicy(u8* _Input); + void CommandSniffMode(u8* _Input); + + // OGF 0x03 Host Controller and Baseband commands and return parameters + void CommandReset(u8* _Input); + void CommandWriteLocalName(u8* _Input); + void CommandWritePageTimeOut(u8* _Input); + void CommandWriteScanEnable(u8* _Input); + void CommandWriteUnitClass(u8* _Input); + void CommandReadStoredLinkKey(u8* _Input); + void CommandWritePinType(u8* _Input); + void CommandSetEventFilter(u8* _Input); + void CommandWriteInquiryScanType(u8* _Input); + void CommandWriteLinkSupervisionTimeout(u8* _Input); + + // OGF 0x04 Informational commands and return parameters + void CommandReadBufferSize(u8* _Input); + void CommandReadLocalVer(u8* _Input); + void CommandReadLocalFeatures(u8* _Input); + void CommandReadBDAdrr(u8* _Input); + + // OGF 0x3F Vendor specific + void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size); + void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size); + + void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size); + + void LOG_LinkKey(const u8* _pLinkKey); +}; + +#endif + diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h index 810bea8fb2..e8df39293e 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h @@ -1,205 +1,205 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _WII_IPC_HLE_WII_MOTE_ -#define _WII_IPC_HLE_WII_MOTE_ - -#include -#include "hci.h" -#include - -class CWII_IPC_HLE_Device_usb_oh1_57e_305; - - -class CBigEndianBuffer -{ -public: - CBigEndianBuffer(u8* pBuffer) - : m_pBuffer(pBuffer) - { - } - - u8 Read8(u32 offset) - { - return m_pBuffer[offset]; - } - - u16 Read16(u32 offset) - { - return Common::swap16(*(u16*)&m_pBuffer[offset]); - } - - u32 Read32(u32 offset) - { - return Common::swap32(*(u32*)&m_pBuffer[offset]); - } - - void Write8(u32 offset, u8 data) - { - m_pBuffer[offset] = data; - } - - void Write16(u32 offset, u16 data) - { - *(u16*)&m_pBuffer[offset] = Common::swap16(data); - } - - void Write32(u32 offset, u32 data) - { - *(u32*)&m_pBuffer[offset] = Common::swap32(data); - } - - u8* GetPointer(u32 offset) - { - return &m_pBuffer[offset]; - } - -private: - - u8* m_pBuffer; - -}; - - - - -class CWII_IPC_HLE_WiiMote -{ -public: - - CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number); - - virtual ~CWII_IPC_HLE_WiiMote() - {} - - ////////////////////////////////////////////////////////////// - // ugly Host handling.... - // we really have to clean all this code - - bool Update(); - bool IsConnected() const { return m_Connected; } - - - void EventConnectionAccepted(); - void EventDisconnect(); - bool EventPagingChanged(u8 _pageMode); - void EventCommandWriteLinkPolicy(); - - const bdaddr_t& GetBD() const { return m_BD; } - - const uint8_t* GetClass() const { return uclass; } - - u16 GetConnectionHandle() const { return m_ControllerConnectionHandle; } - - const u8* GetFeatures() const { return features; } - - const char* GetName() const { return m_Name.c_str(); } - - u8 GetLMPVersion() const { return lmp_version; } - - u16 GetLMPSubVersion() const { return lmp_subversion; } - - u8 GetManufactorID() const { return 0xF; } // Broadcom Corporation - - void SendACLFrame(u8* _pData, u32 _Size); //to wiimote - - void SendL2capData(u16 scid, const void* _pData, u32 _Size); //from wiimote - - const u8* GetLinkKey() const { return m_LinkKey; } - -private: - - // state machine - bool m_Connected; - bool m_HIDControlChannel_Connected; - bool m_HIDControlChannel_ConnectedWait; - bool m_HIDControlChannel_Config; - bool m_HIDControlChannel_ConfigWait; - bool m_HIDInterruptChannel_Connected; - bool m_HIDInterruptChannel_ConnectedWait; - bool m_HIDInterruptChannel_Config; - bool m_HIDInterruptChannel_ConfigWait; - - - - // STATE_TO_SAVE - bdaddr_t m_BD; - - u16 m_ControllerConnectionHandle; - - uint8_t uclass[HCI_CLASS_SIZE]; - - u8 features[HCI_FEATURES_SIZE]; - - u8 lmp_version; - - u16 lmp_subversion; - - u8 m_LinkKey[16]; - - std::string m_Name; - - CWII_IPC_HLE_Device_usb_oh1_57e_305* m_pHost; - - struct SChannel - { - u16 SCID; - u16 DCID; - u16 PSM; - - u16 MTU; - u16 FlushTimeOut; - }; - - typedef std::map CChannelMap; - CChannelMap m_Channel; - - bool DoesChannelExist(u16 _SCID) - { - return m_Channel.find(_SCID) != m_Channel.end(); - } - - void SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLength, u8* _pCommandData); - - void SignalChannel(u8* _pData, u32 _Size); - - void SendConnectionRequest(u16 _SCID, u16 _PSM); - void SendConfigurationRequest(u16 _SCID, u16* _pMTU = NULL, u16* _pFlushTimeOut = NULL); - void SendDisconnectRequest(u16 _SCID); - - void CommandConnectionReq(u8 _Ident, u8* _pData, u32 _Size); - void CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Size); - void CommandConnectionResponse(u8 _Ident, u8* _pData, u32 _Size); - void CommandDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size); - void CommandCofigurationResponse(u8 _Ident, u8* _pData, u32 _Size); - - - ////////////////// - // some new ugly stuff - // - // should be inside the plugin - // - void HandleSDP(u16 _SCID, u8* _pData, u32 _Size); - void SDPSendServiceSearchResponse(u16 _SCID, u16 _TransactionID, u8* _pServiceSearchPattern, u16 _MaximumServiceRecordCount); - - void SDPSendServiceAttributeResponse(u16 _SCID, u16 TransactionID, u32 _ServiceHandle, - u16 _StartAttrID, u16 _EndAttrID, - u16 _MaximumAttributeByteCount, u8* _pContinuationState); - - u16 AddAttribToList(int _AttribID, u8* _pBuffer); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _WII_IPC_HLE_WII_MOTE_ +#define _WII_IPC_HLE_WII_MOTE_ + +#include +#include "hci.h" +#include + +class CWII_IPC_HLE_Device_usb_oh1_57e_305; + + +class CBigEndianBuffer +{ +public: + CBigEndianBuffer(u8* pBuffer) + : m_pBuffer(pBuffer) + { + } + + u8 Read8(u32 offset) + { + return m_pBuffer[offset]; + } + + u16 Read16(u32 offset) + { + return Common::swap16(*(u16*)&m_pBuffer[offset]); + } + + u32 Read32(u32 offset) + { + return Common::swap32(*(u32*)&m_pBuffer[offset]); + } + + void Write8(u32 offset, u8 data) + { + m_pBuffer[offset] = data; + } + + void Write16(u32 offset, u16 data) + { + *(u16*)&m_pBuffer[offset] = Common::swap16(data); + } + + void Write32(u32 offset, u32 data) + { + *(u32*)&m_pBuffer[offset] = Common::swap32(data); + } + + u8* GetPointer(u32 offset) + { + return &m_pBuffer[offset]; + } + +private: + + u8* m_pBuffer; + +}; + + + + +class CWII_IPC_HLE_WiiMote +{ +public: + + CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number); + + virtual ~CWII_IPC_HLE_WiiMote() + {} + + ////////////////////////////////////////////////////////////// + // ugly Host handling.... + // we really have to clean all this code + + bool Update(); + bool IsConnected() const { return m_Connected; } + + + void EventConnectionAccepted(); + void EventDisconnect(); + bool EventPagingChanged(u8 _pageMode); + void EventCommandWriteLinkPolicy(); + + const bdaddr_t& GetBD() const { return m_BD; } + + const uint8_t* GetClass() const { return uclass; } + + u16 GetConnectionHandle() const { return m_ControllerConnectionHandle; } + + const u8* GetFeatures() const { return features; } + + const char* GetName() const { return m_Name.c_str(); } + + u8 GetLMPVersion() const { return lmp_version; } + + u16 GetLMPSubVersion() const { return lmp_subversion; } + + u8 GetManufactorID() const { return 0xF; } // Broadcom Corporation + + void SendACLFrame(u8* _pData, u32 _Size); //to wiimote + + void SendL2capData(u16 scid, const void* _pData, u32 _Size); //from wiimote + + const u8* GetLinkKey() const { return m_LinkKey; } + +private: + + // state machine + bool m_Connected; + bool m_HIDControlChannel_Connected; + bool m_HIDControlChannel_ConnectedWait; + bool m_HIDControlChannel_Config; + bool m_HIDControlChannel_ConfigWait; + bool m_HIDInterruptChannel_Connected; + bool m_HIDInterruptChannel_ConnectedWait; + bool m_HIDInterruptChannel_Config; + bool m_HIDInterruptChannel_ConfigWait; + + + + // STATE_TO_SAVE + bdaddr_t m_BD; + + u16 m_ControllerConnectionHandle; + + uint8_t uclass[HCI_CLASS_SIZE]; + + u8 features[HCI_FEATURES_SIZE]; + + u8 lmp_version; + + u16 lmp_subversion; + + u8 m_LinkKey[16]; + + std::string m_Name; + + CWII_IPC_HLE_Device_usb_oh1_57e_305* m_pHost; + + struct SChannel + { + u16 SCID; + u16 DCID; + u16 PSM; + + u16 MTU; + u16 FlushTimeOut; + }; + + typedef std::map CChannelMap; + CChannelMap m_Channel; + + bool DoesChannelExist(u16 _SCID) + { + return m_Channel.find(_SCID) != m_Channel.end(); + } + + void SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLength, u8* _pCommandData); + + void SignalChannel(u8* _pData, u32 _Size); + + void SendConnectionRequest(u16 _SCID, u16 _PSM); + void SendConfigurationRequest(u16 _SCID, u16* _pMTU = NULL, u16* _pFlushTimeOut = NULL); + void SendDisconnectRequest(u16 _SCID); + + void CommandConnectionReq(u8 _Ident, u8* _pData, u32 _Size); + void CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Size); + void CommandConnectionResponse(u8 _Ident, u8* _pData, u32 _Size); + void CommandDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size); + void CommandCofigurationResponse(u8 _Ident, u8* _pData, u32 _Size); + + + ////////////////// + // some new ugly stuff + // + // should be inside the plugin + // + void HandleSDP(u16 _SCID, u8* _pData, u32 _Size); + void SDPSendServiceSearchResponse(u16 _SCID, u16 _TransactionID, u8* _pServiceSearchPattern, u16 _MaximumServiceRecordCount); + + void SDPSendServiceAttributeResponse(u16 _SCID, u16 TransactionID, u32 _ServiceHandle, + u16 _StartAttrID, u16 _EndAttrID, + u16 _MaximumAttributeByteCount, u8* _pContinuationState); + + u16 AddAttribToList(int _AttribID, u8* _pBuffer); +}; + +#endif diff --git a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h index e6aeca6803..391f9e6925 100644 --- a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h +++ b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h @@ -1,40 +1,40 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef WIIMOTE_HID_ATTR_H_ -#define WIIMOTE_HID_ATTR_H_ - -struct SAttrib -{ - u16 ID; - u8* pData; - u16 size; - - SAttrib(u16 _ID, u8* _Data, u16 _size) - : ID(_ID) - , pData(_Data) - , size(_size) - { } -}; - -typedef std::vector CAttribTable; - -const CAttribTable& GetAttribTable(); - -const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size); - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef WIIMOTE_HID_ATTR_H_ +#define WIIMOTE_HID_ATTR_H_ + +struct SAttrib +{ + u16 ID; + u8* pData; + u16 size; + + SAttrib(u16 _ID, u8* _Data, u16 _size) + : ID(_ID) + , pData(_Data) + , size(_size) + { } +}; + +typedef std::vector CAttribTable; + +const CAttribTable& GetAttribTable(); + +const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size); + #endif \ No newline at end of file diff --git a/Source/Core/Core/Src/IPC_HLE/hci.h b/Source/Core/Core/Src/IPC_HLE/hci.h index 79288d4b0f..958fd95904 100644 --- a/Source/Core/Core/Src/IPC_HLE/hci.h +++ b/Source/Core/Core/Src/IPC_HLE/hci.h @@ -1,2561 +1,2561 @@ -#ifndef _NETBT_HCI_H_ -#define _NETBT_HCI_H_ - -#if defined(_MSC_VER) -#pragma pack(push, 1) -#endif - - -typedef u8 uint8_t; -#ifdef _WIN32 - typedef s8 int8_t; -#endif -typedef u16 uint16_t; -typedef s16 int16_t; -typedef u32 uint32_t; -typedef s32 int32_t; - - -#ifdef __cplusplus -extern "C" { -#endif - - /* - * Bluetooth Address Family Protocol Numbers - */ -#define BTPROTO_HCI 1 -#define BTPROTO_L2CAP 2 -#define BTPROTO_RFCOMM 3 -#define BTPROTO_SCO 4 - -#define BLUETOOTH_BDADDR_SIZE 6 - - typedef struct { - u8 b[BLUETOOTH_BDADDR_SIZE]; - } bdaddr_t; - -#define BDADDR_ANY {0, 0, 0, 0, 0, 0} - - /* $NetBSD: hci.h,v 1.23 2008/03/06 20:56:26 plunky Exp $ */ - - /*- - * Copyright (c) 2005 Iain Hibbert. - * Copyright (c) 2006 Itronix Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of Itronix Inc. may not be used to endorse - * or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - /*- - * Copyright (c) 2001 Maksim Yevmenkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: hci.h,v 1.23 2008/03/06 20:56:26 plunky Exp $ - * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $ - */ - - /* - * This file contains everything that applications need to know from - * Host Controller Interface (HCI). Information taken from Bluetooth - * Core Specifications (v1.1, v2.0 and v2.1) - * - * This file can be included by both kernel and userland applications. - * - * NOTE: Here and after Bluetooth device is called a "unit". Bluetooth - * specification refers to both devices and units. They are the - * same thing (I think), so to be consistent word "unit" will be - * used. - */ - - - - /************************************************************************** - ************************************************************************** - ** Common defines and types (HCI) - ************************************************************************** - **************************************************************************/ - -#define HCI_LAP_SIZE 3 /* unit LAP */ -#define HCI_KEY_SIZE 16 /* link key */ -#define HCI_PIN_SIZE 16 /* link PIN */ -#define HCI_EVENT_MASK_SIZE 8 /* event mask */ -#define HCI_CLASS_SIZE 3 /* unit class */ -#define HCI_FEATURES_SIZE 8 /* LMP features */ -#define HCI_UNIT_NAME_SIZE 248 /* unit name size */ -#define HCI_DEVNAME_SIZE 16 /* same as dv_xname */ -#define HCI_COMMANDS_SIZE 64 /* supported commands mask */ - - /* HCI specification */ -#define HCI_SPEC_V10 0x00 /* v1.0 */ -#define HCI_SPEC_V11 0x01 /* v1.1 */ -#define HCI_SPEC_V12 0x02 /* v1.2 */ -#define HCI_SPEC_V20 0x03 /* v2.0 */ -#define HCI_SPEC_V21 0x04 /* v2.1 */ - /* 0x05 - 0xFF - reserved for future use */ - - /* LMP features (and page 0 of extended features) */ - /* ------------------- byte 0 --------------------*/ -#define HCI_LMP_3SLOT 0x01 -#define HCI_LMP_5SLOT 0x02 -#define HCI_LMP_ENCRYPTION 0x04 -#define HCI_LMP_SLOT_OFFSET 0x08 -#define HCI_LMP_TIMIACCURACY 0x10 -#define HCI_LMP_ROLE_SWITCH 0x20 -#define HCI_LMP_HOLD_MODE 0x40 -#define HCI_LMP_SNIFF_MODE 0x80 - /* ------------------- byte 1 --------------------*/ -#define HCI_LMP_PARK_MODE 0x01 -#define HCI_LMP_RSSI 0x02 -#define HCI_LMP_CHANNEL_QUALITY 0x04 -#define HCI_LMP_SCO_LINK 0x08 -#define HCI_LMP_HV2_PKT 0x10 -#define HCI_LMP_HV3_PKT 0x20 -#define HCI_LMP_ULAW_LOG 0x40 -#define HCI_LMP_ALAW_LOG 0x80 - /* ------------------- byte 2 --------------------*/ -#define HCI_LMP_CVSD 0x01 -#define HCI_LMP_PAGISCHEME 0x02 -#define HCI_LMP_POWER_CONTROL 0x04 -#define HCI_LMP_TRANSPARENT_SCO 0x08 -#define HCI_LMP_FLOW_CONTROL_LAG0 0x10 -#define HCI_LMP_FLOW_CONTROL_LAG1 0x20 -#define HCI_LMP_FLOW_CONTROL_LAG2 0x40 -#define HCI_LMP_BC_ENCRYPTION 0x80 - /* ------------------- byte 3 --------------------*/ - /* reserved 0x01 */ -#define HCI_LMP_EDR_ACL_2MBPS 0x02 -#define HCI_LMP_EDR_ACL_3MBPS 0x04 -#define HCI_LMP_ENHANCED_ISCAN 0x08 -#define HCI_LMP_INTERLACED_ISCAN 0x10 -#define HCI_LMP_INTERLACED_PSCAN 0x20 -#define HCI_LMP_RSSI_INQUIRY 0x40 -#define HCI_LMP_EV3_PKT 0x80 - /* ------------------- byte 4 --------------------*/ -#define HCI_LMP_EV4_PKT 0x01 -#define HCI_LMP_EV5_PKT 0x02 - /* reserved 0x04 */ -#define HCI_LMP_AFH_CAPABLE_SLAVE 0x08 -#define HCI_LMP_AFH_CLASS_SLAVE 0x10 - /* reserved 0x20 */ - /* reserved 0x40 */ -#define HCI_LMP_3SLOT_EDR_ACL 0x80 - /* ------------------- byte 5 --------------------*/ -#define HCI_LMP_5SLOT_EDR_ACL 0x01 -#define HCI_LMP_SNIFF_SUBRATING 0x02 -#define HCI_LMP_PAUSE_ENCRYPTION 0x04 -#define HCI_LMP_AFH_CAPABLE_MASTER 0x08 -#define HCI_LMP_AFH_CLASS_MASTER 0x10 -#define HCI_LMP_EDR_eSCO_2MBPS 0x20 -#define HCI_LMP_EDR_eSCO_3MBPS 0x40 -#define HCI_LMP_3SLOT_EDR_eSCO 0x80 - /* ------------------- byte 6 --------------------*/ -#define HCI_LMP_EXTENDED_INQUIRY 0x01 - /* reserved 0x02 */ - /* reserved 0x04 */ -#define HCI_LMP_SIMPLE_PAIRING 0x08 -#define HCI_LMP_ENCAPSULATED_PDU 0x10 -#define HCI_LMP_ERRDATA_REPORTING 0x20 -#define HCI_LMP_NOFLUSH_PB_FLAG 0x40 - /* reserved 0x80 */ - /* ------------------- byte 7 --------------------*/ -#define HCI_LMP_LINK_SUPERVISION_TO 0x01 -#define HCI_LMP_INQ_RSP_TX_POWER 0x02 -#define HCI_LMP_EXTENDED_FEATURES 0x80 - - /* Link types */ -#define HCI_LINK_SCO 0x00 /* Voice */ -#define HCI_LINK_ACL 0x01 /* Data */ -#define HCI_LINK_eSCO 0x02 /* eSCO */ - /* 0x03 - 0xFF - reserved for future use */ - - /* - * ACL/SCO packet type bits are set to enable the - * packet type, except for 2MBPS and 3MBPS when they - * are unset to enable the packet type. - */ - /* ACL Packet types for "Create Connection" */ -#define HCI_PKT_2MBPS_DH1 0x0002 -#define HCI_PKT_3MBPS_DH1 0x0004 -#define HCI_PKT_DM1 0x0008 -#define HCI_PKT_DH1 0x0010 -#define HCI_PKT_2MBPS_DH3 0x0100 -#define HCI_PKT_3MBPS_DH3 0x0200 -#define HCI_PKT_DM3 0x0400 -#define HCI_PKT_DH3 0x0800 -#define HCI_PKT_2MBPS_DH5 0x1000 -#define HCI_PKT_3MBPS_DH5 0x2000 -#define HCI_PKT_DM5 0x4000 -#define HCI_PKT_DH5 0x8000 - - /* SCO Packet types for "Setup Synchronous Connection" */ -#define HCI_PKT_HV1 0x0001 -#define HCI_PKT_HV2 0x0002 -#define HCI_PKT_HV3 0x0004 -#define HCI_PKT_EV3 0x0008 -#define HCI_PKT_EV4 0x0010 -#define HCI_PKT_EV5 0x0020 -#define HCI_PKT_2MBPS_EV3 0x0040 -#define HCI_PKT_3MBPS_EV3 0x0080 -#define HCI_PKT_2MBPS_EV5 0x0100 -#define HCI_PKT_3MBPS_EV5 0x0200 - - /* - * Connection modes/Unit modes - * - * This is confusing. It means that one of the units change its mode - * for the specific connection. For example one connection was put on - * hold (but i could be wrong :) - */ - - /* Page scan modes (are deprecated) */ -#define HCI_MANDATORY_PAGE_SCAN_MODE 0x00 -#define HCI_OPTIONAL_PAGE_SCAN_MODE1 0x01 -#define HCI_OPTIONAL_PAGE_SCAN_MODE2 0x02 -#define HCI_OPTIONAL_PAGE_SCAN_MODE3 0x03 - /* 0x04 - 0xFF - reserved for future use */ - - /* Page scan repetition modes */ -#define HCI_SCAN_REP_MODE0 0x00 -#define HCI_SCAN_REP_MODE1 0x01 -#define HCI_SCAN_REP_MODE2 0x02 - /* 0x03 - 0xFF - reserved for future use */ - - /* Page scan period modes */ -#define HCI_PAGE_SCAN_PERIOD_MODE0 0x00 -#define HCI_PAGE_SCAN_PERIOD_MODE1 0x01 -#define HCI_PAGE_SCAN_PERIOD_MODE2 0x02 - /* 0x03 - 0xFF - reserved for future use */ - - /* Scan enable */ -#define HCI_NO_SCAN_ENABLE 0x00 -#define HCI_INQUIRY_SCAN_ENABLE 0x01 -#define HCI_PAGE_SCAN_ENABLE 0x02 - /* 0x04 - 0xFF - reserved for future use */ - - /* Hold mode activities */ -#define HCI_HOLD_MODE_NO_CHANGE 0x00 -#define HCI_HOLD_MODE_SUSPEND_PAGE_SCAN 0x01 -#define HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN 0x02 -#define HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY 0x04 - /* 0x08 - 0x80 - reserved for future use */ - - /* Connection roles */ -#define HCI_ROLE_MASTER 0x00 -#define HCI_ROLE_SLAVE 0x01 - /* 0x02 - 0xFF - reserved for future use */ - - /* Key flags */ -#define HCI_USE_SEMI_PERMANENT_LINK_KEYS 0x00 -#define HCI_USE_TEMPORARY_LINK_KEY 0x01 - /* 0x02 - 0xFF - reserved for future use */ - - /* Pin types */ -#define HCI_PIN_TYPE_VARIABLE 0x00 -#define HCI_PIN_TYPE_FIXED 0x01 - - /* Link key types */ -#define HCI_LINK_KEY_TYPE_COMBINATION_KEY 0x00 -#define HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY 0x01 -#define HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY 0x02 - /* 0x03 - 0xFF - reserved for future use */ - - /* Encryption modes */ -#define HCI_ENCRYPTION_MODE_NONE 0x00 -#define HCI_ENCRYPTION_MODE_P2P 0x01 -#define HCI_ENCRYPTION_MODE_ALL 0x02 - /* 0x03 - 0xFF - reserved for future use */ - - /* Quality of service types */ -#define HCI_SERVICE_TYPE_NO_TRAFFIC 0x00 -#define HCI_SERVICE_TYPE_BEST_EFFORT 0x01 -#define HCI_SERVICE_TYPE_GUARANTEED 0x02 - /* 0x03 - 0xFF - reserved for future use */ - - /* Link policy settings */ -#define HCI_LINK_POLICY_DISABLE_ALL_LM_MODES 0x0000 -#define HCI_LINK_POLICY_ENABLE_ROLE_SWITCH 0x0001 /* Master/Slave switch */ -#define HCI_LINK_POLICY_ENABLE_HOLD_MODE 0x0002 -#define HCI_LINK_POLICY_ENABLE_SNIFF_MODE 0x0004 -#define HCI_LINK_POLICY_ENABLE_PARK_MODE 0x0008 - /* 0x0010 - 0x8000 - reserved for future use */ - - /* Event masks */ -#define HCI_EVMSK_ALL 0x00000000ffffffff -#define HCI_EVMSK_NONE 0x0000000000000000 -#define HCI_EVMSK_INQUIRY_COMPL 0x0000000000000001 -#define HCI_EVMSK_INQUIRY_RESULT 0x0000000000000002 -#define HCI_EVMSK_CON_COMPL 0x0000000000000004 -#define HCI_EVMSK_CON_REQ 0x0000000000000008 -#define HCI_EVMSK_DISCON_COMPL 0x0000000000000010 -#define HCI_EVMSK_AUTH_COMPL 0x0000000000000020 -#define HCI_EVMSK_REMOTE_NAME_REQ_COMPL 0x0000000000000040 -#define HCI_EVMSK_ENCRYPTION_CHANGE 0x0000000000000080 -#define HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL 0x0000000000000100 -#define HCI_EVMSK_MASTER_LINK_KEY_COMPL 0x0000000000000200 -#define HCI_EVMSK_READ_REMOTE_FEATURES_COMPL 0x0000000000000400 -#define HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL 0x0000000000000800 -#define HCI_EVMSK_QOS_SETUP_COMPL 0x0000000000001000 -#define HCI_EVMSK_COMMAND_COMPL 0x0000000000002000 -#define HCI_EVMSK_COMMAND_STATUS 0x0000000000004000 -#define HCI_EVMSK_HARDWARE_ERROR 0x0000000000008000 -#define HCI_EVMSK_FLUSH_OCCUR 0x0000000000010000 -#define HCI_EVMSK_ROLE_CHANGE 0x0000000000020000 -#define HCI_EVMSK_NUM_COMPL_PKTS 0x0000000000040000 -#define HCI_EVMSK_MODE_CHANGE 0x0000000000080000 -#define HCI_EVMSK_RETURN_LINK_KEYS 0x0000000000100000 -#define HCI_EVMSK_PIN_CODE_REQ 0x0000000000200000 -#define HCI_EVMSK_LINK_KEY_REQ 0x0000000000400000 -#define HCI_EVMSK_LINK_KEY_NOTIFICATION 0x0000000000800000 -#define HCI_EVMSK_LOOPBACK_COMMAND 0x0000000001000000 -#define HCI_EVMSK_DATA_BUFFER_OVERFLOW 0x0000000002000000 -#define HCI_EVMSK_MAX_SLOT_CHANGE 0x0000000004000000 -#define HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE 0x0000000008000000 -#define HCI_EVMSK_CON_PKT_TYPE_CHANGED 0x0000000010000000 -#define HCI_EVMSK_QOS_VIOLATION 0x0000000020000000 -#define HCI_EVMSK_PAGE_SCAN_MODE_CHANGE 0x0000000040000000 -#define HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE 0x0000000080000000 - /* 0x0000000100000000 - 0x8000000000000000 - reserved for future use */ - - /* Filter types */ -#define HCI_FILTER_TYPE_NONE 0x00 -#define HCI_FILTER_TYPE_INQUIRY_RESULT 0x01 -#define HCI_FILTER_TYPE_CON_SETUP 0x02 - /* 0x03 - 0xFF - reserved for future use */ - - /* Filter condition types for HCI_FILTER_TYPE_INQUIRY_RESULT */ -#define HCI_FILTER_COND_INQUIRY_NEW_UNIT 0x00 -#define HCI_FILTER_COND_INQUIRY_UNIT_CLASS 0x01 -#define HCI_FILTER_COND_INQUIRY_BDADDR 0x02 - /* 0x03 - 0xFF - reserved for future use */ - - /* Filter condition types for HCI_FILTER_TYPE_CON_SETUP */ -#define HCI_FILTER_COND_CON_ANY_UNIT 0x00 -#define HCI_FILTER_COND_CON_UNIT_CLASS 0x01 -#define HCI_FILTER_COND_CON_BDADDR 0x02 - /* 0x03 - 0xFF - reserved for future use */ - - /* Xmit level types */ -#define HCI_XMIT_LEVEL_CURRENT 0x00 -#define HCI_XMIT_LEVEL_MAXIMUM 0x01 - /* 0x02 - 0xFF - reserved for future use */ - - /* Host Controller to Host flow control */ -#define HCI_HC2H_FLOW_CONTROL_NONE 0x00 -#define HCI_HC2H_FLOW_CONTROL_ACL 0x01 -#define HCI_HC2H_FLOW_CONTROL_SCO 0x02 -#define HCI_HC2H_FLOW_CONTROL_BOTH 0x03 - /* 0x04 - 0xFF - reserved future use */ - - /* Loopback modes */ -#define HCI_LOOPBACK_NONE 0x00 -#define HCI_LOOPBACK_LOCAL 0x01 -#define HCI_LOOPBACK_REMOTE 0x02 - /* 0x03 - 0xFF - reserved future use */ - - /************************************************************************** - ************************************************************************** - ** Link level defines, headers and types - ************************************************************************** - **************************************************************************/ - - /* - * Macro(s) to combine OpCode and extract OGF (OpCode Group Field) - * and OCF (OpCode Command Field) from OpCode. - */ - -#define HCI_OPCODE(gf,cf) ((((gf) & 0x3f) << 10) | ((cf) & 0x3ff)) -#define HCI_OCF(op) ((op) & 0x3ff) -#define HCI_OGF(op) (((op) >> 10) & 0x3f) - - /* - * Macro(s) to extract/combine connection handle, BC (Broadcast) and - * PB (Packet boundary) flags. - */ - -#define HCI_CON_HANDLE(h) ((h) & 0x0fff) -#define HCI_PB_FLAG(h) (((h) & 0x3000) >> 12) -#define HCI_BC_FLAG(h) (((h) & 0xc000) >> 14) -#define HCI_MK_CON_HANDLE(h, pb, bc) \ - (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) - - /* PB flag values */ - /* 00 - reserved for future use */ -#define HCI_PACKET_FRAGMENT 0x1 -#define HCI_PACKET_START 0x2 - /* 11 - reserved for future use */ - - /* BC flag values */ -#define HCI_POINT2POINT 0x0 /* only Host controller to Host */ -#define HCI_BROADCAST_ACTIVE 0x1 /* both directions */ -#define HCI_BROADCAST_PICONET 0x2 /* both directions */ - /* 11 - reserved for future use */ - - /* HCI command packet header */ - typedef struct { - uint8_t type; /* MUST be 0x01 */ - uint16_t opcode; /* OpCode */ - uint8_t length; /* parameter(s) length in bytes */ - } hci_cmd_hdr_t; - -#define HCI_CMD_PKT 0x01 -#define HCI_CMD_PKT_SIZE (sizeof(hci_cmd_hdr_t) + 0xff) - - /* ACL data packet header */ - typedef struct { - uint8_t type; /* MUST be 0x02 */ - uint16_t con_handle; /* connection handle + PB + BC flags */ - uint16_t length; /* payload length in bytes */ - } hci_acldata_hdr_t; - -#define HCI_ACL_DATA_PKT 0x02 -#define HCI_ACL_PKT_SIZE (sizeof(hci_acldata_hdr_t) + 0xffff) - - /* SCO data packet header */ - typedef struct { - uint8_t type; /* MUST be 0x03 */ - uint16_t con_handle; /* connection handle + reserved bits */ - uint8_t length; /* payload length in bytes */ - } hci_scodata_hdr_t; - -#define HCI_SCO_DATA_PKT 0x03 -#define HCI_SCO_PKT_SIZE (sizeof(hci_scodata_hdr_t) + 0xff) - - /* HCI event packet header */ - typedef struct { - uint8_t type; /* MUST be 0x04 */ - uint8_t event; /* event */ - uint8_t length; /* parameter(s) length in bytes */ - } hci_event_hdr_t; - -#define HCI_EVENT_PKT 0x04 -#define HCI_EVENT_PKT_SIZE (sizeof(hci_event_hdr_t) + 0xff) - - /* HCI status return parameter */ - typedef struct { - uint8_t status; /* 0x00 - success */ - } hci_status_rp; - - /************************************************************************** - ************************************************************************** - ** OGF 0x01 Link control commands and return parameters - ************************************************************************** - **************************************************************************/ - -#define HCI_OGF_LINK_CONTROL 0x01 - -#define HCI_OCF_INQUIRY 0x0001 -#define HCI_CMD_INQUIRY 0x0401 - typedef struct { - uint8_t lap[HCI_LAP_SIZE]; /* LAP */ - uint8_t inquiry_length; /* (N x 1.28) sec */ - uint8_t num_responses; /* Max. # of responses */ - } hci_inquiry_cp; - /* No return parameter(s) */ - -#define HCI_OCF_INQUIRY_CANCEL 0x0002 -#define HCI_CMD_INQUIRY_CANCEL 0x0402 - /* No command parameter(s) */ - typedef hci_status_rp hci_inquiry_cancel_rp; - -#define HCI_OCF_PERIODIC_INQUIRY 0x0003 -#define HCI_CMD_PERIODIC_INQUIRY 0x0403 - typedef struct { - uint16_t max_period_length; /* Max. and min. amount of time */ - uint16_t min_period_length; /* between consecutive inquiries */ - uint8_t lap[HCI_LAP_SIZE]; /* LAP */ - uint8_t inquiry_length; /* (inquiry_length * 1.28) sec */ - uint8_t num_responses; /* Max. # of responses */ - } hci_periodic_inquiry_cp; - - typedef hci_status_rp hci_periodic_inquiry_rp; - -#define HCI_OCF_EXIT_PERIODIC_INQUIRY 0x0004 -#define HCI_CMD_EXIT_PERIODIC_INQUIRY 0x0404 - /* No command parameter(s) */ - typedef hci_status_rp hci_exit_periodic_inquiry_rp; - -#define HCI_OCF_CREATE_CON 0x0005 -#define HCI_CMD_CREATE_CON 0x0405 - typedef struct { - bdaddr_t bdaddr; /* destination address */ - uint16_t pkt_type; /* packet type */ - uint8_t page_scan_rep_mode; /* page scan repetition mode */ - uint8_t page_scan_mode; /* reserved - set to 0x00 */ - uint16_t clock_offset; /* clock offset */ - uint8_t accept_role_switch; /* accept role switch? 0x00 == No */ - } hci_create_con_cp; - /* No return parameter(s) */ - -#define HCI_OCF_DISCONNECT 0x0006 -#define HCI_CMD_DISCONNECT 0x0406 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t reason; /* reason to disconnect */ - } hci_discon_cp; - /* No return parameter(s) */ - - /* Add SCO Connection is deprecated */ -#define HCI_OCF_ADD_SCO_CON 0x0007 -#define HCI_CMD_ADD_SCO_CON 0x0407 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t pkt_type; /* packet type */ - } hci_add_sco_con_cp; - /* No return parameter(s) */ - -#define HCI_OCF_CREATE_CON_CANCEL 0x0008 -#define HCI_CMD_CREATE_CON_CANCEL 0x0408 - typedef struct { - bdaddr_t bdaddr; /* destination address */ - } hci_create_con_cancel_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* destination address */ - } hci_create_con_cancel_rp; - -#define HCI_OCF_ACCEPT_CON 0x0009 -#define HCI_CMD_ACCEPT_CON 0x0409 - typedef struct { - bdaddr_t bdaddr; /* address of unit to be connected */ - uint8_t role; /* connection role */ - } hci_accept_con_cp; - /* No return parameter(s) */ - -#define HCI_OCF_REJECT_CON 0x000a -#define HCI_CMD_REJECT_CON 0x040A - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t reason; /* reason to reject */ - } hci_reject_con_cp; - /* No return parameter(s) */ - -#define HCI_OCF_LINK_KEY_REP 0x000b -#define HCI_CMD_LINK_KEY_REP 0x040B - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t key[HCI_KEY_SIZE]; /* key */ - } hci_link_key_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* unit address */ - } hci_link_key_rep_rp; - -#define HCI_OCF_LINK_KEY_NEG_REP 0x000c -#define HCI_CMD_LINK_KEY_NEG_REP 0x040C - typedef struct { - bdaddr_t bdaddr; /* remote address */ - } hci_link_key_neg_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* unit address */ - } hci_link_key_neg_rep_rp; - -#define HCI_OCF_PIN_CODE_REP 0x000d -#define HCI_CMD_PIN_CODE_REP 0x040D - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t pin_size; /* pin code length (in bytes) */ - uint8_t pin[HCI_PIN_SIZE]; /* pin code */ - } hci_pin_code_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* unit address */ - } hci_pin_code_rep_rp; - -#define HCI_OCF_PIN_CODE_NEG_REP 0x000e -#define HCI_CMD_PIN_CODE_NEG_REP 0x040E - typedef struct { - bdaddr_t bdaddr; /* remote address */ - } hci_pin_code_neg_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* unit address */ - } hci_pin_code_neg_rep_rp; - -#define HCI_OCF_CHANGE_CON_PACKET_TYPE 0x000f -#define HCI_CMD_CHANGE_CON_PACKET_TYPE 0x040F - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t pkt_type; /* packet type */ - } hci_change_con_pkt_type_cp; - /* No return parameter(s) */ - -#define HCI_OCF_AUTH_REQ 0x0011 -#define HCI_CMD_AUTH_REQ 0x0411 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_auth_req_cp; - /* No return parameter(s) */ - -#define HCI_OCF_SET_CON_ENCRYPTION 0x0013 -#define HCI_CMD_SET_CON_ENCRYPTION 0x0413 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t encryption_enable; /* 0x00 - disable, 0x01 - enable */ - } hci_set_con_encryption_cp; - /* No return parameter(s) */ - -#define HCI_OCF_CHANGE_CON_LINK_KEY 0x0015 -#define HCI_CMD_CHANGE_CON_LINK_KEY 0x0415 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_change_con_link_key_cp; - /* No return parameter(s) */ - -#define HCI_OCF_MASTER_LINK_KEY 0x0017 -#define HCI_CMD_MASTER_LINK_KEY 0x0417 - typedef struct { - uint8_t key_flag; /* key flag */ - } hci_master_link_key_cp; - /* No return parameter(s) */ - -#define HCI_OCF_REMOTE_NAME_REQ 0x0019 -#define HCI_CMD_REMOTE_NAME_REQ 0x0419 - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t page_scan_rep_mode; /* page scan repetition mode */ - uint8_t page_scan_mode; /* page scan mode */ - uint16_t clock_offset; /* clock offset */ - } hci_remote_name_req_cp; - /* No return parameter(s) */ - -#define HCI_OCF_REMOTE_NAME_REQ_CANCEL 0x001a -#define HCI_CMD_REMOTE_NAME_REQ_CANCEL 0x041A - typedef struct { - bdaddr_t bdaddr; /* remote address */ - } hci_remote_name_req_cancel_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_remote_name_req_cancel_rp; - -#define HCI_OCF_READ_REMOTE_FEATURES 0x001b -#define HCI_CMD_READ_REMOTE_FEATURES 0x041B - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_remote_features_cp; - /* No return parameter(s) */ - -#define HCI_OCF_READ_REMOTE_EXTENDED_FEATURES 0x001c -#define HCI_CMD_READ_REMOTE_EXTENDED_FEATURES 0x041C - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t page; /* page number */ - } hci_read_remote_extended_features_cp; - /* No return parameter(s) */ - -#define HCI_OCF_READ_REMOTE_VER_INFO 0x001d -#define HCI_CMD_READ_REMOTE_VER_INFO 0x041D - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_remote_ver_info_cp; - /* No return parameter(s) */ - -#define HCI_OCF_READ_CLOCK_OFFSET 0x001f -#define HCI_CMD_READ_CLOCK_OFFSET 0x041F - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_clock_offset_cp; - /* No return parameter(s) */ - -#define HCI_OCF_READ_LMP_HANDLE 0x0020 -#define HCI_CMD_READ_LMP_HANDLE 0x0420 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_lmp_handle_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t lmp_handle; /* LMP handle */ - uint32_t reserved; /* reserved */ - } hci_read_lmp_handle_rp; - -#define HCI_OCF_SETUP_SCO_CON 0x0028 -#define HCI_CMD_SETUP_SCO_CON 0x0428 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint32_t tx_bandwidth; /* transmit bandwidth */ - uint32_t rx_bandwidth; /* receive bandwidth */ - uint16_t latency; /* maximum latency */ - uint16_t voice; /* voice setting */ - uint8_t rt_effort; /* retransmission effort */ - uint16_t pkt_type; /* packet types */ - } hci_setup_sco_con_cp; - /* No return parameter(s) */ - -#define HCI_OCF_ACCEPT_SCO_CON_REQ 0x0029 -#define HCI_CMD_ACCEPT_SCO_CON_REQ 0x0429 - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint32_t tx_bandwidth; /* transmit bandwidth */ - uint32_t rx_bandwidth; /* receive bandwidth */ - uint16_t latency; /* maximum latency */ - uint16_t content; /* voice setting */ - uint8_t rt_effort; /* retransmission effort */ - uint16_t pkt_type; /* packet types */ - } hci_accept_sco_con_req_cp; - /* No return parameter(s) */ - -#define HCI_OCF_REJECT_SCO_CON_REQ 0x002a -#define HCI_CMD_REJECT_SCO_CON_REQ 0x042a - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t reason; /* reject error code */ - } hci_reject_sco_con_req_cp; - /* No return parameter(s) */ - -#define HCI_OCF_IO_CAPABILITY_REP 0x002b -#define HCI_CMD_IO_CAPABILITY_REP 0x042a - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t io_cap; /* IO capability */ - uint8_t oob_data; /* OOB data present */ - uint8_t auth_req; /* auth requirements */ - } hci_io_capability_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_io_capability_rep_rp; - -#define HCI_OCF_USER_CONFIRM_REP 0x002c -#define HCI_CMD_USER_CONFIRM_REP 0x042c - typedef struct { - bdaddr_t bdaddr; /* remote address */ - } hci_user_confirm_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_user_confirm_rep_rp; - -#define HCI_OCF_USER_CONFIRM_NEG_REP 0x002d -#define HCI_CMD_USER_CONFIRM_NEG_REP 0x042d - typedef struct { - bdaddr_t bdaddr; /* remote address */ - } hci_user_confirm_neg_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_user_confirm_neg_rep_rp; - -#define HCI_OCF_USER_PASSKEY_REP 0x002e -#define HCI_CMD_USER_PASSKEY_REP 0x042e - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint32_t value; /* 000000 - 999999 */ - } hci_user_passkey_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_user_passkey_rep_rp; - -#define HCI_OCF_USER_PASSKEY_NEG_REP 0x002f -#define HCI_CMD_USER_PASSKEY_NEG_REP 0x042f - typedef struct { - bdaddr_t bdaddr; /* remote address */ - } hci_user_passkey_neg_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_user_passkey_neg_rep_rp; - -#define HCI_OCF_OOB_DATA_REP 0x0030 -#define HCI_CMD_OOB_DATA_REP 0x0430 - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t c[16]; /* pairing hash */ - uint8_t r[16]; /* pairing randomizer */ - } hci_user_oob_data_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_user_oob_data_rep_rp; - -#define HCI_OCF_OOB_DATA_NEG_REP 0x0033 -#define HCI_CMD_OOB_DATA_NEG_REP 0x0433 - typedef struct { - bdaddr_t bdaddr; /* remote address */ - } hci_user_oob_data_neg_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_user_oob_data_neg_rep_rp; - -#define HCI_OCF_IO_CAPABILITY_NEG_REP 0x0034 -#define HCI_CMD_IO_CAPABILITY_NEG_REP 0x0434 - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t reason; /* error code */ - } hci_io_capability_neg_rep_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_io_capability_neg_rep_rp; - - /************************************************************************** - ************************************************************************** - ** OGF 0x02 Link policy commands and return parameters - ************************************************************************** - **************************************************************************/ - -#define HCI_OGF_LINK_POLICY 0x02 - -#define HCI_OCF_HOLD_MODE 0x0001 -#define HCI_CMD_HOLD_MODE 0x0801 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t max_interval; /* (max_interval * 0.625) msec */ - uint16_t min_interval; /* (max_interval * 0.625) msec */ - } hci_hold_mode_cp; - /* No return parameter(s) */ - -#define HCI_OCF_SNIFF_MODE 0x0003 -#define HCI_CMD_SNIFF_MODE 0x0803 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t max_interval; /* (max_interval * 0.625) msec */ - uint16_t min_interval; /* (max_interval * 0.625) msec */ - uint16_t attempt; /* (2 * attempt - 1) * 0.625 msec */ - uint16_t timeout; /* (2 * attempt - 1) * 0.625 msec */ - } hci_sniff_mode_cp; - /* No return parameter(s) */ - -#define HCI_OCF_EXIT_SNIFF_MODE 0x0004 -#define HCI_CMD_EXIT_SNIFF_MODE 0x0804 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_exit_sniff_mode_cp; - /* No return parameter(s) */ - -#define HCI_OCF_PARK_MODE 0x0005 -#define HCI_CMD_PARK_MODE 0x0805 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t max_interval; /* (max_interval * 0.625) msec */ - uint16_t min_interval; /* (max_interval * 0.625) msec */ - } hci_park_mode_cp; - /* No return parameter(s) */ - -#define HCI_OCF_EXIT_PARK_MODE 0x0006 -#define HCI_CMD_EXIT_PARK_MODE 0x0806 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_exit_park_mode_cp; - /* No return parameter(s) */ - -#define HCI_OCF_QOS_SETUP 0x0007 -#define HCI_CMD_QOS_SETUP 0x0807 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t flags; /* reserved for future use */ - uint8_t service_type; /* service type */ - uint32_t token_rate; /* bytes per second */ - uint32_t peak_bandwidth; /* bytes per second */ - uint32_t latency; /* microseconds */ - uint32_t delay_variation; /* microseconds */ - } hci_qos_setup_cp; - /* No return parameter(s) */ - -#define HCI_OCF_ROLE_DISCOVERY 0x0009 -#define HCI_CMD_ROLE_DISCOVERY 0x0809 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_role_discovery_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t role; /* role for the connection handle */ - } hci_role_discovery_rp; - -#define HCI_OCF_SWITCH_ROLE 0x000b -#define HCI_CMD_SWITCH_ROLE 0x080B - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t role; /* new local role */ - } hci_switch_role_cp; - /* No return parameter(s) */ - -#define HCI_OCF_READ_LINK_POLICY_SETTINGS 0x000c -#define HCI_CMD_READ_LINK_POLICY_SETTINGS 0x080C - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_link_policy_settings_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint16_t settings; /* link policy settings */ - } hci_read_link_policy_settings_rp; - -#define HCI_OCF_WRITE_LINK_POLICY_SETTINGS 0x000d -#define HCI_CMD_WRITE_LINK_POLICY_SETTINGS 0x080D - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t settings; /* link policy settings */ - } hci_write_link_policy_settings_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - } hci_write_link_policy_settings_rp; - -#define HCI_OCF_READ_DEFAULT_LINK_POLICY_SETTINGS 0x000e -#define HCI_CMD_READ_DEFAULT_LINK_POLICY_SETTINGS 0x080E - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t settings; /* link policy settings */ - } hci_read_default_link_policy_settings_rp; - -#define HCI_OCF_WRITE_DEFAULT_LINK_POLICY_SETTINGS 0x000f -#define HCI_CMD_WRITE_DEFAULT_LINK_POLICY_SETTINGS 0x080F - typedef struct { - uint16_t settings; /* link policy settings */ - } hci_write_default_link_policy_settings_cp; - - typedef hci_status_rp hci_write_default_link_policy_settings_rp; - -#define HCI_OCF_FLOW_SPECIFICATION 0x0010 -#define HCI_CMD_FLOW_SPECIFICATION 0x0810 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t flags; /* reserved */ - uint8_t flow_direction; - uint8_t service_type; - uint32_t token_rate; - uint32_t token_bucket; - uint32_t peak_bandwidth; - uint32_t latency; - } hci_flow_specification_cp; - /* No return parameter(s) */ - -#define HCI_OCF_SNIFF_SUBRATING 0x0011 -#define HCI_CMD_SNIFF_SUBRATING 0x0810 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t max_latency; - uint16_t max_timeout; /* max remote timeout */ - uint16_t min_timeout; /* min local timeout */ - } hci_sniff_subrating_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - } hci_sniff_subrating_rp; - - /************************************************************************** - ************************************************************************** - ** OGF 0x03 Host Controller and Baseband commands and return parameters - ************************************************************************** - **************************************************************************/ - -#define HCI_OGF_HC_BASEBAND 0x03 - -#define HCI_OCF_SET_EVENT_MASK 0x0001 -#define HCI_CMD_SET_EVENT_MASK 0x0C01 - typedef struct { - uint8_t event_mask[HCI_EVENT_MASK_SIZE]; /* event_mask */ - } hci_set_event_mask_cp; - - typedef hci_status_rp hci_set_event_mask_rp; - -#define HCI_OCF_RESET 0x0003 -#define HCI_CMD_RESET 0x0C03 - /* No command parameter(s) */ - typedef hci_status_rp hci_reset_rp; - -#define HCI_OCF_SET_EVENT_FILTER 0x0005 -#define HCI_CMD_SET_EVENT_FILTER 0x0C05 - typedef struct { - uint8_t filter_type; /* filter type */ - uint8_t filter_condition_type; /* filter condition type */ - /* variable size condition - uint8_t condition[]; -- conditions */ - } hci_set_event_filter_cp; - - typedef hci_status_rp hci_set_event_filter_rp; - -#define HCI_OCF_FLUSH 0x0008 -#define HCI_CMD_FLUSH 0x0C08 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_flush_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - } hci_flush_rp; - -#define HCI_OCF_READ_PIN_TYPE 0x0009 -#define HCI_CMD_READ_PIN_TYPE 0x0C09 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t pin_type; /* PIN type */ - } hci_read_pin_type_rp; - -#define HCI_OCF_WRITE_PIN_TYPE 0x000a -#define HCI_CMD_WRITE_PIN_TYPE 0x0C0A - typedef struct { - uint8_t pin_type; /* PIN type */ - } hci_write_pin_type_cp; - - typedef hci_status_rp hci_write_pin_type_rp; - -#define HCI_OCF_CREATE_NEW_UNIT_KEY 0x000b -#define HCI_CMD_CREATE_NEW_UNIT_KEY 0x0C0B - /* No command parameter(s) */ - typedef hci_status_rp hci_create_new_unit_key_rp; - -#define HCI_OCF_READ_STORED_LINK_KEY 0x000d -#define HCI_CMD_READ_STORED_LINK_KEY 0x0C0D - typedef struct { - bdaddr_t bdaddr; /* address */ - uint8_t read_all; /* read all keys? 0x01 - yes */ - } hci_read_stored_link_key_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t max_num_keys; /* Max. number of keys */ - uint16_t num_keys_read; /* Number of stored keys */ - } hci_read_stored_link_key_rp; - -#define HCI_OCF_WRITE_STORED_LINK_KEY 0x0011 -#define HCI_CMD_WRITE_STORED_LINK_KEY 0x0C11 - typedef struct { - uint8_t num_keys_write; /* # of keys to write */ - /* these are repeated "num_keys_write" times - bdaddr_t bdaddr; --- remote address(es) - uint8_t key[HCI_KEY_SIZE]; --- key(s) */ - } hci_write_stored_link_key_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t num_keys_written; /* # of keys successfully written */ - } hci_write_stored_link_key_rp; - -#define HCI_OCF_DELETE_STORED_LINK_KEY 0x0012 -#define HCI_CMD_DELETE_STORED_LINK_KEY 0x0C12 - typedef struct { - bdaddr_t bdaddr; /* address */ - uint8_t delete_all; /* delete all keys? 0x01 - yes */ - } hci_delete_stored_link_key_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t num_keys_deleted; /* Number of keys deleted */ - } hci_delete_stored_link_key_rp; - -#define HCI_OCF_WRITE_LOCAL_NAME 0x0013 -#define HCI_CMD_WRITE_LOCAL_NAME 0x0C13 - typedef struct { - char name[HCI_UNIT_NAME_SIZE]; /* new unit name */ - } hci_write_local_name_cp; - - typedef hci_status_rp hci_write_local_name_rp; - -#define HCI_OCF_READ_LOCAL_NAME 0x0014 -#define HCI_CMD_READ_LOCAL_NAME 0x0C14 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - char name[HCI_UNIT_NAME_SIZE]; /* unit name */ - } hci_read_local_name_rp; - -#define HCI_OCF_READ_CON_ACCEPT_TIMEOUT 0x0015 -#define HCI_CMD_READ_CON_ACCEPT_TIMEOUT 0x0C15 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t timeout; /* (timeout * 0.625) msec */ - } hci_read_con_accept_timeout_rp; - -#define HCI_OCF_WRITE_CON_ACCEPT_TIMEOUT 0x0016 -#define HCI_CMD_WRITE_CON_ACCEPT_TIMEOUT 0x0C16 - typedef struct { - uint16_t timeout; /* (timeout * 0.625) msec */ - } hci_write_con_accept_timeout_cp; - - typedef hci_status_rp hci_write_con_accept_timeout_rp; - -#define HCI_OCF_READ_PAGE_TIMEOUT 0x0017 -#define HCI_CMD_READ_PAGE_TIMEOUT 0x0C17 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t timeout; /* (timeout * 0.625) msec */ - } hci_read_page_timeout_rp; - -#define HCI_OCF_WRITE_PAGE_TIMEOUT 0x0018 -#define HCI_CMD_WRITE_PAGE_TIMEOUT 0x0C18 - typedef struct { - uint16_t timeout; /* (timeout * 0.625) msec */ - } hci_write_page_timeout_cp; - - typedef hci_status_rp hci_write_page_timeout_rp; - -#define HCI_OCF_READ_SCAN_ENABLE 0x0019 -#define HCI_CMD_READ_SCAN_ENABLE 0x0C19 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t scan_enable; /* Scan enable */ - } hci_read_scan_enable_rp; - -#define HCI_OCF_WRITE_SCAN_ENABLE 0x001a -#define HCI_CMD_WRITE_SCAN_ENABLE 0x0C1A - typedef struct { - uint8_t scan_enable; /* Scan enable */ - } hci_write_scan_enable_cp; - - typedef hci_status_rp hci_write_scan_enable_rp; - -#define HCI_OCF_READ_PAGE_SCAN_ACTIVITY 0x001b -#define HCI_CMD_READ_PAGE_SCAN_ACTIVITY 0x0C1B - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t page_scan_interval; /* interval * 0.625 msec */ - uint16_t page_scan_window; /* window * 0.625 msec */ - } hci_read_page_scan_activity_rp; - -#define HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY 0x001c -#define HCI_CMD_WRITE_PAGE_SCAN_ACTIVITY 0x0C1C - typedef struct { - uint16_t page_scan_interval; /* interval * 0.625 msec */ - uint16_t page_scan_window; /* window * 0.625 msec */ - } hci_write_page_scan_activity_cp; - - typedef hci_status_rp hci_write_page_scan_activity_rp; - -#define HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY 0x001d -#define HCI_CMD_READ_INQUIRY_SCAN_ACTIVITY 0x0C1D - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t inquiry_scan_interval; /* interval * 0.625 msec */ - uint16_t inquiry_scan_window; /* window * 0.625 msec */ - } hci_read_inquiry_scan_activity_rp; - -#define HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY 0x001e -#define HCI_CMD_WRITE_INQUIRY_SCAN_ACTIVITY 0x0C1E - typedef struct { - uint16_t inquiry_scan_interval; /* interval * 0.625 msec */ - uint16_t inquiry_scan_window; /* window * 0.625 msec */ - } hci_write_inquiry_scan_activity_cp; - - typedef hci_status_rp hci_write_inquiry_scan_activity_rp; - -#define HCI_OCF_READ_AUTH_ENABLE 0x001f -#define HCI_CMD_READ_AUTH_ENABLE 0x0C1F - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t auth_enable; /* 0x01 - enabled */ - } hci_read_auth_enable_rp; - -#define HCI_OCF_WRITE_AUTH_ENABLE 0x0020 -#define HCI_CMD_WRITE_AUTH_ENABLE 0x0C20 - typedef struct { - uint8_t auth_enable; /* 0x01 - enabled */ - } hci_write_auth_enable_cp; - - typedef hci_status_rp hci_write_auth_enable_rp; - - /* Read Encryption Mode is deprecated */ -#define HCI_OCF_READ_ENCRYPTION_MODE 0x0021 -#define HCI_CMD_READ_ENCRYPTION_MODE 0x0C21 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t encryption_mode; /* encryption mode */ - } hci_read_encryption_mode_rp; - - /* Write Encryption Mode is deprecated */ -#define HCI_OCF_WRITE_ENCRYPTION_MODE 0x0022 -#define HCI_CMD_WRITE_ENCRYPTION_MODE 0x0C22 - typedef struct { - uint8_t encryption_mode; /* encryption mode */ - } hci_write_encryption_mode_cp; - - typedef hci_status_rp hci_write_encryption_mode_rp; - -#define HCI_OCF_READ_UNIT_CLASS 0x0023 -#define HCI_CMD_READ_UNIT_CLASS 0x0C23 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ - } hci_read_unit_class_rp; - -#define HCI_OCF_WRITE_UNIT_CLASS 0x0024 -#define HCI_CMD_WRITE_UNIT_CLASS 0x0C24 - typedef struct { - uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ - } hci_write_unit_class_cp; - - typedef hci_status_rp hci_write_unit_class_rp; - -#define HCI_OCF_READ_VOICE_SETTING 0x0025 -#define HCI_CMD_READ_VOICE_SETTING 0x0C25 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t settings; /* voice settings */ - } hci_read_voice_setting_rp; - -#define HCI_OCF_WRITE_VOICE_SETTING 0x0026 -#define HCI_CMD_WRITE_VOICE_SETTING 0x0C26 - typedef struct { - uint16_t settings; /* voice settings */ - } hci_write_voice_setting_cp; - - typedef hci_status_rp hci_write_voice_setting_rp; - -#define HCI_OCF_READ_AUTO_FLUSH_TIMEOUT 0x0027 -#define HCI_CMD_READ_AUTO_FLUSH_TIMEOUT 0x0C27 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_auto_flush_timeout_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */ - } hci_read_auto_flush_timeout_rp; - -#define HCI_OCF_WRITE_AUTO_FLUSH_TIMEOUT 0x0028 -#define HCI_CMD_WRITE_AUTO_FLUSH_TIMEOUT 0x0C28 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */ - } hci_write_auto_flush_timeout_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - } hci_write_auto_flush_timeout_rp; - -#define HCI_OCF_READ_NUM_BROADCAST_RETRANS 0x0029 -#define HCI_CMD_READ_NUM_BROADCAST_RETRANS 0x0C29 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t counter; /* number of broadcast retransmissions */ - } hci_read_num_broadcast_retrans_rp; - -#define HCI_OCF_WRITE_NUM_BROADCAST_RETRANS 0x002a -#define HCI_CMD_WRITE_NUM_BROADCAST_RETRANS 0x0C2A - typedef struct { - uint8_t counter; /* number of broadcast retransmissions */ - } hci_write_num_broadcast_retrans_cp; - - typedef hci_status_rp hci_write_num_broadcast_retrans_rp; - -#define HCI_OCF_READ_HOLD_MODE_ACTIVITY 0x002b -#define HCI_CMD_READ_HOLD_MODE_ACTIVITY 0x0C2B - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t hold_mode_activity; /* Hold mode activities */ - } hci_read_hold_mode_activity_rp; - -#define HCI_OCF_WRITE_HOLD_MODE_ACTIVITY 0x002c -#define HCI_CMD_WRITE_HOLD_MODE_ACTIVITY 0x0C2C - typedef struct { - uint8_t hold_mode_activity; /* Hold mode activities */ - } hci_write_hold_mode_activity_cp; - - typedef hci_status_rp hci_write_hold_mode_activity_rp; - -#define HCI_OCF_READ_XMIT_LEVEL 0x002d -#define HCI_CMD_READ_XMIT_LEVEL 0x0C2D - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t type; /* Xmit level type */ - } hci_read_xmit_level_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - char level; /* -30 <= level <= 30 dBm */ - } hci_read_xmit_level_rp; - -#define HCI_OCF_READ_SCO_FLOW_CONTROL 0x002e -#define HCI_CMD_READ_SCO_FLOW_CONTROL 0x0C2E - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t flow_control; /* 0x00 - disabled */ - } hci_read_sco_flow_control_rp; - -#define HCI_OCF_WRITE_SCO_FLOW_CONTROL 0x002f -#define HCI_CMD_WRITE_SCO_FLOW_CONTROL 0x0C2F - typedef struct { - uint8_t flow_control; /* 0x00 - disabled */ - } hci_write_sco_flow_control_cp; - - typedef hci_status_rp hci_write_sco_flow_control_rp; - -#define HCI_OCF_HC2H_FLOW_CONTROL 0x0031 -#define HCI_CMD_HC2H_FLOW_CONTROL 0x0C31 - typedef struct { - uint8_t hc2h_flow; /* Host Controller to Host flow control */ - } hci_hc2h_flow_control_cp; - - typedef hci_status_rp hci_h2hc_flow_control_rp; - -#define HCI_OCF_HOST_BUFFER_SIZE 0x0033 -#define HCI_CMD_HOST_BUFFER_SIZE 0x0C33 - typedef struct { - uint16_t max_acl_size; /* Max. size of ACL packet (bytes) */ - uint8_t max_sco_size; /* Max. size of SCO packet (bytes) */ - uint16_t num_acl_pkts; /* Max. number of ACL packets */ - uint16_t num_sco_pkts; /* Max. number of SCO packets */ - } hci_host_buffer_size_cp; - - typedef hci_status_rp hci_host_buffer_size_rp; - -#define HCI_OCF_HOST_NUM_COMPL_PKTS 0x0035 -#define HCI_CMD_HOST_NUM_COMPL_PKTS 0x0C35 - typedef struct { - uint8_t nu_con_handles; /* # of connection handles */ - /* these are repeated "num_con_handles" times - uint16_t con_handle; --- connection handle(s) - uint16_t compl_pkts; --- # of completed packets */ - } hci_host_num_compl_pkts_cp; - /* No return parameter(s) */ - -#define HCI_OCF_READ_LINK_SUPERVISION_TIMEOUT 0x0036 -#define HCI_CMD_READ_LINK_SUPERVISION_TIMEOUT 0x0C36 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_link_supervision_timeout_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint16_t timeout; /* Link supervision timeout * 0.625 msec */ - } hci_read_link_supervision_timeout_rp; - -#define HCI_OCF_WRITE_LINK_SUPERVISION_TIMEOUT 0x0037 -#define HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT 0x0C37 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t timeout; /* Link supervision timeout * 0.625 msec */ - } hci_write_link_supervision_timeout_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - } hci_write_link_supervision_timeout_rp; - -#define HCI_OCF_READ_NUM_SUPPORTED_IAC 0x0038 -#define HCI_CMD_READ_NUM_SUPPORTED_IAC 0x0C38 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t num_iac; /* # of supported IAC during scan */ - } hci_read_num_supported_iac_rp; - -#define HCI_OCF_READ_IAC_LAP 0x0039 -#define HCI_CMD_READ_IAC_LAP 0x0C39 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t num_iac; /* # of IAC */ - /* these are repeated "num_iac" times - uint8_t laps[HCI_LAP_SIZE]; --- LAPs */ - } hci_read_iac_lap_rp; - -#define HCI_OCF_WRITE_IAC_LAP 0x003a -#define HCI_CMD_WRITE_IAC_LAP 0x0C3A - typedef struct { - uint8_t num_iac; /* # of IAC */ - /* these are repeated "num_iac" times - uint8_t laps[HCI_LAP_SIZE]; --- LAPs */ - } hci_write_iac_lap_cp; - - typedef hci_status_rp hci_write_iac_lap_rp; - - /* Read Page Scan Period Mode is deprecated */ -#define HCI_OCF_READ_PAGE_SCAN_PERIOD 0x003b -#define HCI_CMD_READ_PAGE_SCAN_PERIOD 0x0C3B - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t page_scan_period_mode; /* Page scan period mode */ - } hci_read_page_scan_period_rp; - - /* Write Page Scan Period Mode is deprecated */ -#define HCI_OCF_WRITE_PAGE_SCAN_PERIOD 0x003c -#define HCI_CMD_WRITE_PAGE_SCAN_PERIOD 0x0C3C - typedef struct { - uint8_t page_scan_period_mode; /* Page scan period mode */ - } hci_write_page_scan_period_cp; - - typedef hci_status_rp hci_write_page_scan_period_rp; - - /* Read Page Scan Mode is deprecated */ -#define HCI_OCF_READ_PAGE_SCAN 0x003d -#define HCI_CMD_READ_PAGE_SCAN 0x0C3D - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t page_scan_mode; /* Page scan mode */ - } hci_read_page_scan_rp; - - /* Write Page Scan Mode is deprecated */ -#define HCI_OCF_WRITE_PAGE_SCAN 0x003e -#define HCI_CMD_WRITE_PAGE_SCAN 0x0C3E - typedef struct { - uint8_t page_scan_mode; /* Page scan mode */ - } hci_write_page_scan_cp; - - typedef hci_status_rp hci_write_page_scan_rp; - -#define HCI_OCF_SET_AFH_CLASSIFICATION 0x003f -#define HCI_CMD_SET_AFH_CLASSIFICATION 0x0C3F - typedef struct { - uint8_t classification[10]; - } hci_set_afh_classification_cp; - - typedef hci_status_rp hci_set_afh_classification_rp; - -#define HCI_OCF_READ_INQUIRY_SCAN_TYPE 0x0042 -#define HCI_CMD_READ_INQUIRY_SCAN_TYPE 0x0C42 - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t type; /* inquiry scan type */ - } hci_read_inquiry_scan_type_rp; - -#define HCI_OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043 -#define HCI_CMD_WRITE_INQUIRY_SCAN_TYPE 0x0C43 - typedef struct { - uint8_t type; /* inquiry scan type */ - } hci_write_inquiry_scan_type_cp; - - typedef hci_status_rp hci_write_inquiry_scan_type_rp; - -#define HCI_OCF_READ_INQUIRY_MODE 0x0044 -#define HCI_CMD_READ_INQUIRY_MODE 0x0C44 - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t mode; /* inquiry mode */ - } hci_read_inquiry_mode_rp; - -#define HCI_OCF_WRITE_INQUIRY_MODE 0x0045 -#define HCI_CMD_WRITE_INQUIRY_MODE 0x0C45 - typedef struct { - uint8_t mode; /* inquiry mode */ - } hci_write_inquiry_mode_cp; - - typedef hci_status_rp hci_write_inquiry_mode_rp; - -#define HCI_OCF_READ_PAGE_SCAN_TYPE 0x0046 -#define HCI_CMD_READ_PAGE_SCAN_TYPE 0x0C46 - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t type; /* page scan type */ - } hci_read_page_scan_type_rp; - -#define HCI_OCF_WRITE_PAGE_SCAN_TYPE 0x0047 -#define HCI_CMD_WRITE_PAGE_SCAN_TYPE 0x0C47 - typedef struct { - uint8_t type; /* page scan type */ - } hci_write_page_scan_type_cp; - - typedef hci_status_rp hci_write_page_scan_type_rp; - -#define HCI_OCF_READ_AFH_ASSESSMENT 0x0048 -#define HCI_CMD_READ_AFH_ASSESSMENT 0x0C48 - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t mode; /* assessment mode */ - } hci_read_afh_assessment_rp; - -#define HCI_OCF_WRITE_AFH_ASSESSMENT 0x0049 -#define HCI_CMD_WRITE_AFH_ASSESSMENT 0x0C49 - typedef struct { - uint8_t mode; /* assessment mode */ - } hci_write_afh_assessment_cp; - - typedef hci_status_rp hci_write_afh_assessment_rp; - -#define HCI_OCF_READ_EXTENDED_INQUIRY_RSP 0x0051 -#define HCI_CMD_READ_EXTENDED_INQUIRY_RSP 0x0C51 - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t fec_required; - uint8_t response[240]; - } hci_read_extended_inquiry_rsp_rp; - -#define HCI_OCF_WRITE_EXTENDED_INQUIRY_RSP 0x0052 -#define HCI_CMD_WRITE_EXTENDED_INQUIRY_RSP 0x0C52 - typedef struct { - uint8_t fec_required; - uint8_t response[240]; - } hci_write_extended_inquiry_rsp_cp; - - typedef hci_status_rp hci_write_extended_inquiry_rsp_rp; - -#define HCI_OCF_REFRESH_ENCRYPTION_KEY 0x0053 -#define HCI_CMD_REFRESH_ENCRYPTION_KEY 0x0C53 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_refresh_encryption_key_cp; - - typedef hci_status_rp hci_refresh_encryption_key_rp; - -#define HCI_OCF_READ_SIMPLE_PAIRING_MODE 0x0055 -#define HCI_CMD_READ_SIMPLE_PAIRING_MODE 0x0C55 - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t mode; /* simple pairing mode */ - } hci_read_simple_pairing_mode_rp; - -#define HCI_OCF_WRITE_SIMPLE_PAIRING_MODE 0x0056 -#define HCI_CMD_WRITE_SIMPLE_PAIRING_MODE 0x0C56 - typedef struct { - uint8_t mode; /* simple pairing mode */ - } hci_write_simple_pairing_mode_cp; - - typedef hci_status_rp hci_write_simple_pairing_mode_rp; - -#define HCI_OCF_READ_LOCAL_OOB_DATA 0x0057 -#define HCI_CMD_READ_LOCAL_OOB_DATA 0x0C57 - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t c[16]; /* pairing hash */ - uint8_t r[16]; /* pairing randomizer */ - } hci_read_local_oob_data_rp; - -#define HCI_OCF_READ_INQUIRY_RSP_XMIT_POWER 0x0058 -#define HCI_CMD_READ_INQUIRY_RSP_XMIT_POWER 0x0C58 - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - int8_t power; /* TX power */ - } hci_read_inquiry_rsp_xmit_power_rp; - -#define HCI_OCF_WRITE_INQUIRY_RSP_XMIT_POWER 0x0059 -#define HCI_CMD_WRITE_INQUIRY_RSP_XMIT_POWER 0x0C59 - typedef struct { - int8_t power; /* TX power */ - } hci_write_inquiry_rsp_xmit_power_cp; - - typedef hci_status_rp hci_write_inquiry_rsp_xmit_power_rp; - -#define HCI_OCF_READ_DEFAULT_ERRDATA_REPORTING 0x005A -#define HCI_CMD_READ_DEFAULT_ERRDATA_REPORTING 0x0C5A - /* No command parameter(s) */ - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t reporting; /* erroneous data reporting */ - } hci_read_default_errdata_reporting_rp; - -#define HCI_OCF_WRITE_DEFAULT_ERRDATA_REPORTING 0x005B -#define HCI_CMD_WRITE_DEFAULT_ERRDATA_REPORTING 0x0C5B - typedef struct { - uint8_t reporting; /* erroneous data reporting */ - } hci_write_default_errdata_reporting_cp; - - typedef hci_status_rp hci_write_default_errdata_reporting_rp; - -#define HCI_OCF_ENHANCED_FLUSH 0x005F -#define HCI_CMD_ENHANCED_FLUSH 0x0C5F - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t packet_type; - } hci_enhanced_flush_cp; - - /* No response parameter(s) */ - -#define HCI_OCF_SEND_KEYPRESS_NOTIFICATION 0x0060 -#define HCI_CMD_SEND_KEYPRESS_NOTIFICATION 0x0C60 - typedef struct { - bdaddr_t bdaddr; /* remote address */ - uint8_t type; /* notification type */ - } hci_send_keypress_notification_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote address */ - } hci_send_keypress_notification_rp; - - /************************************************************************** - ************************************************************************** - ** OGF 0x04 Informational commands and return parameters - ************************************************************************** - **************************************************************************/ - -#define HCI_OGF_INFO 0x04 - -#define HCI_OCF_READ_LOCAL_VER 0x0001 -#define HCI_CMD_READ_LOCAL_VER 0x1001 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t hci_version; /* HCI version */ - uint16_t hci_revision; /* HCI revision */ - uint8_t lmp_version; /* LMP version */ - uint16_t manufacturer; /* Hardware manufacturer name */ - uint16_t lmp_subversion; /* LMP sub-version */ - } hci_read_local_ver_rp; - -#define HCI_OCF_READ_LOCAL_COMMANDS 0x0002 -#define HCI_CMD_READ_LOCAL_COMMANDS 0x1002 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t commands[HCI_COMMANDS_SIZE]; /* opcode bitmask */ - } hci_read_local_commands_rp; - -#define HCI_OCF_READ_LOCAL_FEATURES 0x0003 -#define HCI_CMD_READ_LOCAL_FEATURES 0x1003 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ - } hci_read_local_features_rp; - -#define HCI_OCF_READ_LOCAL_EXTENDED_FEATURES 0x0004 -#define HCI_CMD_READ_LOCAL_EXTENDED_FEATURES 0x1004 - typedef struct { - uint8_t page; /* page number */ - } hci_read_local_extended_features_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t page; /* page number */ - uint8_t max_page; /* maximum page number */ - uint8_t features[HCI_FEATURES_SIZE]; /* LMP features */ - } hci_read_local_extended_features_rp; - -#define HCI_OCF_READ_BUFFER_SIZE 0x0005 -#define HCI_CMD_READ_BUFFER_SIZE 0x1005 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t max_acl_size; /* Max. size of ACL packet (bytes) */ - uint8_t max_sco_size; /* Max. size of SCO packet (bytes) */ - uint16_t num_acl_pkts; /* Max. number of ACL packets */ - uint16_t num_sco_pkts; /* Max. number of SCO packets */ - } hci_read_buffer_size_rp; - - /* Read Country Code is deprecated */ -#define HCI_OCF_READ_COUNTRY_CODE 0x0007 -#define HCI_CMD_READ_COUNTRY_CODE 0x1007 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t country_code; /* 0x00 - NAM, EUR, JP; 0x01 - France */ - } hci_read_country_code_rp; - -#define HCI_OCF_READ_BDADDR 0x0009 -#define HCI_CMD_READ_BDADDR 0x1009 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* unit address */ - } hci_read_bdaddr_rp; - - /************************************************************************** - ************************************************************************** - ** OGF 0x05 Status commands and return parameters - ************************************************************************** - **************************************************************************/ - -#define HCI_OGF_STATUS 0x05 - -#define HCI_OCF_READ_FAILED_CONTACT_CNTR 0x0001 -#define HCI_CMD_READ_FAILED_CONTACT_CNTR 0x1401 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_failed_contact_cntr_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint16_t counter; /* number of consecutive failed contacts */ - } hci_read_failed_contact_cntr_rp; - -#define HCI_OCF_RESET_FAILED_CONTACT_CNTR 0x0002 -#define HCI_CMD_RESET_FAILED_CONTACT_CNTR 0x1402 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_reset_failed_contact_cntr_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - } hci_reset_failed_contact_cntr_rp; - -#define HCI_OCF_READ_LINK_QUALITY 0x0003 -#define HCI_CMD_READ_LINK_QUALITY 0x1403 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_link_quality_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t quality; /* higher value means better quality */ - } hci_read_link_quality_rp; - -#define HCI_OCF_READ_RSSI 0x0005 -#define HCI_CMD_READ_RSSI 0x1405 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_rssi_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - char rssi; /* -127 <= rssi <= 127 dB */ - } hci_read_rssi_rp; - -#define HCI_OCF_READ_AFH_CHANNEL_MAP 0x0006 -#define HCI_CMD_READ_AFH_CHANNEL_MAP 0x1406 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_read_afh_channel_map_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t mode; /* AFH mode */ - uint8_t map[10]; /* AFH Channel Map */ - } hci_read_afh_channel_map_rp; - -#define HCI_OCF_READ_CLOCK 0x0007 -#define HCI_CMD_READ_CLOCK 0x1407 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t clock; /* which clock */ - } hci_read_clock_cp; - - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint32_t clock; /* clock value */ - uint16_t accuracy; /* clock accuracy */ - } hci_read_clock_rp; - - - /************************************************************************** - ************************************************************************** - ** OGF 0x06 Testing commands and return parameters - ************************************************************************** - **************************************************************************/ - -#define HCI_OGF_TESTING 0x06 - -#define HCI_OCF_READ_LOOPBACK_MODE 0x0001 -#define HCI_CMD_READ_LOOPBACK_MODE 0x1801 - /* No command parameter(s) */ - typedef struct { - uint8_t status; /* 0x00 - success */ - uint8_t lbmode; /* loopback mode */ - } hci_read_loopback_mode_rp; - -#define HCI_OCF_WRITE_LOOPBACK_MODE 0x0002 -#define HCI_CMD_WRITE_LOOPBACK_MODE 0x1802 - typedef struct { - uint8_t lbmode; /* loopback mode */ - } hci_write_loopback_mode_cp; - - typedef hci_status_rp hci_write_loopback_mode_rp; - -#define HCI_OCF_ENABLE_UNIT_UNDER_TEST 0x0003 -#define HCI_CMD_ENABLE_UNIT_UNDER_TEST 0x1803 - /* No command parameter(s) */ - typedef hci_status_rp hci_enable_unit_under_test_rp; - -#define HCI_OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x0004 -#define HCI_CMD_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x1804 - typedef struct { - uint8_t mode; /* simple pairing debug mode */ - } hci_write_simple_pairing_debug_mode_cp; - - typedef hci_status_rp hci_write_simple_pairing_debug_mode_rp; - - /************************************************************************** - ************************************************************************** - ** OGF 0x3e Bluetooth Logo Testing - ** OGF 0x3f Vendor Specific - ************************************************************************** - **************************************************************************/ - -#define HCI_OGF_BT_LOGO 0x3e -#define HCI_OGF_VENDOR 0x3f - - /* Ericsson specific FC */ -#define HCI_CMD_ERICSSON_WRITE_PCM_SETTINGS 0xFC07 -#define HCI_CMD_ERICSSON_SET_UART_BAUD_RATE 0xFC09 -#define HCI_CMD_ERICSSON_SET_SCO_DATA_PATH 0xFC1D - - /* Cambridge Silicon Radio specific FC */ -#define HCI_CMD_CSR_EXTN 0xFC00 - - - /************************************************************************** - ************************************************************************** - ** Events and event parameters - ************************************************************************** - **************************************************************************/ - -#define HCI_EVENT_INQUIRY_COMPL 0x01 - typedef struct { - uint8_t status; /* 0x00 - success */ - } hci_inquiry_compl_ep; - -#define HCI_EVENT_INQUIRY_RESULT 0x02 - typedef struct { - uint8_t num_responses; /* number of responses */ - /* hci_inquiry_response[num_responses] -- see below */ - } hci_inquiry_result_ep; - - typedef struct { - bdaddr_t bdaddr; /* unit address */ - uint8_t page_scan_rep_mode; /* page scan rep. mode */ - uint8_t page_scan_period_mode; /* page scan period mode */ - uint8_t page_scan_mode; /* page scan mode */ - uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ - uint16_t clock_offset; /* clock offset */ - } hci_inquiry_response; - -#define HCI_EVENT_CON_COMPL 0x03 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* Connection handle */ - bdaddr_t bdaddr; /* remote unit address */ - uint8_t link_type; /* Link type */ - uint8_t encryption_mode; /* Encryption mode */ - } hci_con_compl_ep; - -#define HCI_EVENT_CON_REQ 0x04 - typedef struct { - bdaddr_t bdaddr; /* remote unit address */ - uint8_t uclass[HCI_CLASS_SIZE]; /* remote unit class */ - uint8_t link_type; /* link type */ - } hci_con_req_ep; - -#define HCI_EVENT_DISCON_COMPL 0x05 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t reason; /* reason to disconnect */ - } hci_discon_compl_ep; - -#define HCI_EVENT_AUTH_COMPL 0x06 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - } hci_auth_compl_ep; - -#define HCI_EVENT_REMOTE_NAME_REQ_COMPL 0x07 - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote unit address */ - char name[HCI_UNIT_NAME_SIZE]; /* remote unit name */ - } hci_remote_name_req_compl_ep; - -#define HCI_EVENT_ENCRYPTION_CHANGE 0x08 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* Connection handle */ - uint8_t encryption_enable; /* 0x00 - disable */ - } hci_encryption_change_ep; - -#define HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL 0x09 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* Connection handle */ - } hci_change_con_link_key_compl_ep; - -#define HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* Connection handle */ - uint8_t key_flag; /* Key flag */ - } hci_master_link_key_compl_ep; - -#define HCI_EVENT_READ_REMOTE_FEATURES_COMPL 0x0b - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* Connection handle */ - uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ - } hci_read_remote_features_compl_ep; - -#define HCI_EVENT_READ_REMOTE_VER_INFO_COMPL 0x0c - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* Connection handle */ - uint8_t lmp_version; /* LMP version */ - uint16_t manufacturer; /* Hardware manufacturer name */ - uint16_t lmp_subversion; /* LMP sub-version */ - } hci_read_remote_ver_info_compl_ep; - -#define HCI_EVENT_QOS_SETUP_COMPL 0x0d - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t flags; /* reserved for future use */ - uint8_t service_type; /* service type */ - uint32_t token_rate; /* bytes per second */ - uint32_t peak_bandwidth; /* bytes per second */ - uint32_t latency; /* microseconds */ - uint32_t delay_variation; /* microseconds */ - } hci_qos_setup_compl_ep; - -#define HCI_EVENT_COMMAND_COMPL 0x0e - typedef struct { - uint8_t num_cmd_pkts; /* # of HCI command packets */ - uint16_t opcode; /* command OpCode */ - /* command return parameters (if any) */ - } hci_command_compl_ep; - -#define HCI_EVENT_COMMAND_STATUS 0x0f - typedef struct { - uint8_t status; /* 0x00 - pending */ - uint8_t num_cmd_pkts; /* # of HCI command packets */ - uint16_t opcode; /* command OpCode */ - } hci_command_status_ep; - -#define HCI_EVENT_HARDWARE_ERROR 0x10 - typedef struct { - uint8_t hardware_code; /* hardware error code */ - } hci_hardware_error_ep; - -#define HCI_EVENT_FLUSH_OCCUR 0x11 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_flush_occur_ep; - -#define HCI_EVENT_ROLE_CHANGE 0x12 - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* address of remote unit */ - uint8_t role; /* new connection role */ - } hci_role_change_ep; - -#define HCI_EVENT_NUM_COMPL_PKTS 0x13 - typedef struct { - uint8_t num_con_handles; /* # of connection handles */ - /* these are repeated "num_con_handles" times - uint16_t con_handle; --- connection handle(s) - uint16_t compl_pkts; --- # of completed packets */ - } hci_num_compl_pkts_ep; - -#define HCI_EVENT_MODE_CHANGE 0x14 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t unit_mode; /* remote unit mode */ - uint16_t interval; /* interval * 0.625 msec */ - } hci_mode_change_ep; - -#define HCI_EVENT_RETURN_LINK_KEYS 0x15 - typedef struct { - uint8_t num_keys; /* # of keys */ - /* these are repeated "num_keys" times - bdaddr_t bdaddr; --- remote address(es) - uint8_t key[HCI_KEY_SIZE]; --- key(s) */ - } hci_return_link_keys_ep; - -#define HCI_EVENT_PIN_CODE_REQ 0x16 - typedef struct { - bdaddr_t bdaddr; /* remote unit address */ - } hci_pin_code_req_ep; - -#define HCI_EVENT_LINK_KEY_REQ 0x17 - typedef struct { - bdaddr_t bdaddr; /* remote unit address */ - } hci_link_key_req_ep; - -#define HCI_EVENT_LINK_KEY_NOTIFICATION 0x18 - typedef struct { - bdaddr_t bdaddr; /* remote unit address */ - uint8_t key[HCI_KEY_SIZE]; /* link key */ - uint8_t key_type; /* type of the key */ - } hci_link_key_notification_ep; - -#define HCI_EVENT_LOOPBACK_COMMAND 0x19 - typedef hci_cmd_hdr_t hci_loopback_command_ep; - -#define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a - typedef struct { - uint8_t link_type; /* Link type */ - } hci_data_buffer_overflow_ep; - -#define HCI_EVENT_MAX_SLOT_CHANGE 0x1b - typedef struct { - uint16_t con_handle; /* connection handle */ - uint8_t lmp_max_slots; /* Max. # of slots allowed */ - } hci_max_slot_change_ep; - -#define HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* Connection handle */ - uint16_t clock_offset; /* Clock offset */ - } hci_read_clock_offset_compl_ep; - -#define HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint16_t pkt_type; /* packet type */ - } hci_con_pkt_type_changed_ep; - -#define HCI_EVENT_QOS_VIOLATION 0x1e - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_qos_violation_ep; - - /* Page Scan Mode Change Event is deprecated */ -#define HCI_EVENT_PAGE_SCAN_MODE_CHANGE 0x1f - typedef struct { - bdaddr_t bdaddr; /* destination address */ - uint8_t page_scan_mode; /* page scan mode */ - } hci_page_scan_mode_change_ep; - -#define HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20 - typedef struct { - bdaddr_t bdaddr; /* destination address */ - uint8_t page_scan_rep_mode; /* page scan repetition mode */ - } hci_page_scan_rep_mode_change_ep; - -#define HCI_EVENT_FLOW_SPECIFICATION_COMPL 0x21 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t flags; /* reserved */ - uint8_t direction; /* flow direction */ - uint8_t type; /* service type */ - uint32_t token_rate; /* token rate */ - uint32_t bucket_size; /* token bucket size */ - uint32_t peak_bandwidth; /* peak bandwidth */ - uint32_t latency; /* access latency */ - } hci_flow_specification_compl_ep; - -#define HCI_EVENT_RSSI_RESULT 0x22 - typedef struct { - uint8_t num_responses; /* number of responses */ - /* hci_rssi_response[num_responses] -- see below */ - } hci_rssi_result_ep; - - typedef struct { - bdaddr_t bdaddr; /* unit address */ - uint8_t page_scan_rep_mode; /* page scan rep. mode */ - uint8_t blank; /* reserved */ - uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ - uint16_t clock_offset; /* clock offset */ - int8_t rssi; /* rssi */ - } hci_rssi_response; - -#define HCI_EVENT_READ_REMOTE_EXTENDED_FEATURES 0x23 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t page; /* page number */ - uint8_t max; /* max page number */ - uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ - } hci_read_remote_extended_features_ep; - -#define HCI_EVENT_SCO_CON_COMPL 0x2c - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - bdaddr_t bdaddr; /* unit address */ - uint8_t link_type; /* link type */ - uint8_t interval; /* transmission interval */ - uint8_t window; /* retransmission window */ - uint16_t rxlen; /* rx packet length */ - uint16_t txlen; /* tx packet length */ - uint8_t mode; /* air mode */ - } hci_sco_con_compl_ep; - -#define HCI_EVENT_SCO_CON_CHANGED 0x2d - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint8_t interval; /* transmission interval */ - uint8_t window; /* retransmission window */ - uint16_t rxlen; /* rx packet length */ - uint16_t txlen; /* tx packet length */ - } hci_sco_con_changed_ep; - -#define HCI_EVENT_SNIFF_SUBRATING 0x2e - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - uint16_t tx_latency; /* max transmit latency */ - uint16_t rx_latency; /* max receive latency */ - uint16_t remote_timeout; /* remote timeout */ - uint16_t local_timeout; /* local timeout */ - } hci_sniff_subrating_ep; - -#define HCI_EVENT_EXTENDED_RESULT 0x2f - typedef struct { - uint8_t num_responses; /* must be 0x01 */ - bdaddr_t bdaddr; /* remote device address */ - uint8_t page_scan_rep_mode; - uint8_t reserved; - uint8_t uclass[HCI_CLASS_SIZE]; - uint16_t clock_offset; - int8_t rssi; - uint8_t response[240]; /* extended inquiry response */ - } hci_extended_result_ep; - -#define HCI_EVENT_ENCRYPTION_KEY_REFRESH 0x30 - typedef struct { - uint8_t status; /* 0x00 - success */ - uint16_t con_handle; /* connection handle */ - } hci_encryption_key_refresh_ep; - -#define HCI_EVENT_IO_CAPABILITY_REQ 0x31 - typedef struct { - bdaddr_t bdaddr; /* remote device address */ - } hci_io_capability_req_ep; - -#define HCI_EVENT_IO_CAPABILITY_RSP 0x32 - typedef struct { - bdaddr_t bdaddr; /* remote device address */ - uint8_t io_capability; - uint8_t oob_data_present; - uint8_t auth_requirement; - } hci_io_capability_rsp_ep; - -#define HCI_EVENT_USER_CONFIRM_REQ 0x33 - typedef struct { - bdaddr_t bdaddr; /* remote device address */ - uint32_t value; /* 000000 - 999999 */ - } hci_user_confirm_req_ep; - -#define HCI_EVENT_USER_PASSKEY_REQ 0x34 - typedef struct { - bdaddr_t bdaddr; /* remote device address */ - } hci_user_passkey_req_ep; - -#define HCI_EVENT_REMOTE_OOB_DATA_REQ 0x35 - typedef struct { - bdaddr_t bdaddr; /* remote device address */ - } hci_remote_oob_data_req_ep; - -#define HCI_EVENT_SIMPLE_PAIRING_COMPL 0x36 - typedef struct { - uint8_t status; /* 0x00 - success */ - bdaddr_t bdaddr; /* remote device address */ - } hci_simple_pairing_compl_ep; - -#define HCI_EVENT_LINK_SUPERVISION_TO_CHANGED 0x38 - typedef struct { - uint16_t con_handle; /* connection handle */ - uint16_t timeout; /* link supervision timeout */ - } hci_link_supervision_to_changed_ep; - -#define HCI_EVENT_ENHANCED_FLUSH_COMPL 0x39 - typedef struct { - uint16_t con_handle; /* connection handle */ - } hci_enhanced_flush_compl_ep; - -#define HCI_EVENT_USER_PASSKEY_NOTIFICATION 0x3b - typedef struct { - bdaddr_t bdaddr; /* remote device address */ - uint32_t value; /* 000000 - 999999 */ - } hci_user_passkey_notification_ep; - -#define HCI_EVENT_KEYPRESS_NOTIFICATION 0x3c - typedef struct { - bdaddr_t bdaddr; /* remote device address */ - uint8_t notification_type; - } hci_keypress_notification_ep; - -#define HCI_EVENT_REMOTE_FEATURES_NOTIFICATION 0x3d - typedef struct { - bdaddr_t bdaddr; /* remote device address */ - uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ - } hci_remote_features_notification_ep; - -#define HCI_EVENT_BT_LOGO 0xfe - -#define HCI_EVENT_VENDOR 0xff - - /************************************************************************** - ************************************************************************** - ** HCI Socket Definitions - ************************************************************************** - **************************************************************************/ - - /* HCI socket options */ -#define SO_HCI_EVT_FILTER 1 /* get/set event filter */ -#define SO_HCI_PKT_FILTER 2 /* get/set packet filter */ -#define SO_HCI_DIRECTION 3 /* packet direction indicator */ - - /* Control Messages */ -#define SCM_HCI_DIRECTION SO_HCI_DIRECTION - - /* - * HCI socket filter and get/set routines - * - * for ease of use, we filter 256 possible events/packets - */ - struct hci_filter { - uint32_t mask[8]; /* 256 bits */ - }; - - static __inline void - hci_filter_set(uint8_t bit, struct hci_filter *filter) - { - uint8_t off = bit - 1; - - off >>= 5; - filter->mask[off] |= (1 << ((bit - 1) & 0x1f)); - } - - static __inline void - hci_filter_clr(uint8_t bit, struct hci_filter *filter) - { - uint8_t off = bit - 1; - - off >>= 5; - filter->mask[off] &= ~(1 << ((bit - 1) & 0x1f)); - } - - static __inline int - hci_filter_test(uint8_t bit, struct hci_filter *filter) - { - uint8_t off = bit - 1; - - off >>= 5; - return (filter->mask[off] & (1 << ((bit - 1) & 0x1f))); - } - - /* - * HCI socket ioctl's - * - * Apart from GBTINFOA, these are all indexed on the unit name - */ - -#define SIOCGBTINFO _IOWR('b', 5, struct btreq) /* get unit info */ -#define SIOCGBTINFOA _IOWR('b', 6, struct btreq) /* get info by address */ -#define SIOCNBTINFO _IOWR('b', 7, struct btreq) /* next unit info */ - -#define SIOCSBTFLAGS _IOWR('b', 8, struct btreq) /* set unit flags */ -#define SIOCSBTPOLICY _IOWR('b', 9, struct btreq) /* set unit link policy */ -#define SIOCSBTPTYPE _IOWR('b', 10, struct btreq) /* set unit packet type */ - -#define SIOCGBTSTATS _IOWR('b', 11, struct btreq) /* get unit statistics */ -#define SIOCZBTSTATS _IOWR('b', 12, struct btreq) /* zero unit statistics */ - -#define SIOCBTDUMP _IOW('b', 13, struct btreq) /* print debug info */ -#define SIOCSBTSCOMTU _IOWR('b', 17, struct btreq) /* set sco_mtu value */ - - struct bt_stats { - uint32_t err_tx; - uint32_t err_rx; - uint32_t cmd_tx; - uint32_t evt_rx; - uint32_t acl_tx; - uint32_t acl_rx; - uint32_t sco_tx; - uint32_t sco_rx; - uint32_t byte_tx; - uint32_t byte_rx; - }; - - struct btreq { - char btr_name[HCI_DEVNAME_SIZE]; /* device name */ - - union { - struct { - bdaddr_t btri_bdaddr; /* device bdaddr */ - uint16_t btri_flags; /* flags */ - uint16_t btri_num_cmd; /* # of free cmd buffers */ - uint16_t btri_num_acl; /* # of free ACL buffers */ - uint16_t btri_num_sco; /* # of free SCO buffers */ - uint16_t btri_acl_mtu; /* ACL mtu */ - uint16_t btri_sco_mtu; /* SCO mtu */ - uint16_t btri_link_policy; /* Link Policy */ - uint16_t btri_packet_type; /* Packet Type */ - } btri; - struct bt_stats btrs; /* unit stats */ - } btru; - }; - -#define btr_flags btru.btri.btri_flags -#define btr_bdaddr btru.btri.btri_bdaddr -#define btr_num_cmd btru.btri.btri_num_cmd -#define btr_num_acl btru.btri.btri_num_acl -#define btr_num_sco btru.btri.btri_num_sco -#define btr_acl_mtu btru.btri.btri_acl_mtu -#define btr_sco_mtu btru.btri.btri_sco_mtu -#define btr_link_policy btru.btri.btri_link_policy -#define btr_packet_type btru.btri.btri_packet_type -#define btr_stats btru.btrs - - /* hci_unit & btr_flags */ -#define BTF_UP (1<<0) /* unit is up */ -#define BTF_RUNNING (1<<1) /* unit is running */ -#define BTF_XMIT_CMD (1<<2) /* unit is transmitting CMD packets */ -#define BTF_XMIT_ACL (1<<3) /* unit is transmitting ACL packets */ -#define BTF_XMIT_SCO (1<<4) /* unit is transmitting SCO packets */ -#define BTF_XMIT (BTF_XMIT_CMD | BTF_XMIT_ACL | BTF_XMIT_SCO) -#define BTF_INIT_BDADDR (1<<5) /* waiting for bdaddr */ -#define BTF_INIT_BUFFER_SIZE (1<<6) /* waiting for buffer size */ -#define BTF_INIT_FEATURES (1<<7) /* waiting for features */ -#define BTF_POWER_UP_NOOP (1<<8) /* should wait for No-op on power up */ -#define BTF_INIT_COMMANDS (1<<9) /* waiting for supported commands */ - -#define BTF_INIT (BTF_INIT_BDADDR \ - | BTF_INIT_BUFFER_SIZE \ - | BTF_INIT_FEATURES \ - | BTF_INIT_COMMANDS) - - -// ================================================================================== -// own but i want them inside the pragma .... -// we have to clean it btw :) - -struct SCommandMessage -{ - u16 Opcode; - u8 len; -}; - -struct SHCIEventCommand -{ - u8 EventType; - u8 PayloadLength; - u8 PacketIndicator; - u16 Opcode; -}; - -struct SHCIEventStatus -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - u8 PacketIndicator; - u16 Opcode; -}; - -struct SHCIEventInquiryResult -{ - u8 EventType; - u8 PayloadLength; - u8 num_responses; -}; - -struct SHCIEventInquiryComplete -{ - u8 EventType; - u8 PayloadLength; - u8 Status; -}; - -struct SHCIEventReadClockOffsetComplete -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - u16 ConnectionHandle; - u16 ClockOffset; -}; - -struct SHCIEventReadRemoteVerInfo -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - u16 ConnectionHandle; - u8 lmp_version; - u16 manufacturer; - u16 lmp_subversion; -}; - -struct SHCIEventReadRemoteFeatures -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - u16 ConnectionHandle; - u8 features[HCI_FEATURES_SIZE]; -}; - -struct SHCIEventRemoteNameReq -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - bdaddr_t bdaddr; - u8 RemoteName[248]; -}; - -struct SHCIEventRequestConnection -{ - u8 EventType; - u8 PayloadLength; - bdaddr_t bdaddr; - uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ - u8 LinkType; -}; - -struct SHCIEventConnectionComplete -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - u16 Connection_Handle; - bdaddr_t bdaddr; - u8 LinkType; - u8 EncryptionEnabled; -}; - -struct SHCIEventRoleChange -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - bdaddr_t bdaddr; - u8 NewRole; -}; - -struct SHCIEventNumberOfCompletedPackets -{ - u8 EventType; - u8 PayloadLength; - u8 NumberOfHandles; - u16 Connection_Handle; - u16 Number_Of_Completed_Packets; -}; - -struct SHCIEventAuthenticationCompleted -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - u16 Connection_Handle; -}; - - -struct SHCIEventModeChange -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - u16 Connection_Handle; - u8 CurrentMode; - u16 Value; - -}; - -struct SHCIEventDisconnectCompleted -{ - u8 EventType; - u8 PayloadLength; - u8 Status; - u16 Connection_Handle; - u8 Reason; -}; - -struct SHCIEventRequestLinkKey -{ - u8 EventType; - u8 PayloadLength; - bdaddr_t bdaddr; -}; - -struct SHCIEventLinkKeyNotification -{ - u8 EventType; - u8 PayloadLength; - u8 numKeys; - bdaddr_t bdaddr; - u8 LinkKey[16]; -}; - -#ifdef __cplusplus -} -#endif - -#if defined(_MSC_VER) - #pragma pack(pop) -#endif - -#endif /* _NETBT_HCI_H */ +#ifndef _NETBT_HCI_H_ +#define _NETBT_HCI_H_ + +#if defined(_MSC_VER) +#pragma pack(push, 1) +#endif + + +typedef u8 uint8_t; +#ifdef _WIN32 + typedef s8 int8_t; +#endif +typedef u16 uint16_t; +typedef s16 int16_t; +typedef u32 uint32_t; +typedef s32 int32_t; + + +#ifdef __cplusplus +extern "C" { +#endif + + /* + * Bluetooth Address Family Protocol Numbers + */ +#define BTPROTO_HCI 1 +#define BTPROTO_L2CAP 2 +#define BTPROTO_RFCOMM 3 +#define BTPROTO_SCO 4 + +#define BLUETOOTH_BDADDR_SIZE 6 + + typedef struct { + u8 b[BLUETOOTH_BDADDR_SIZE]; + } bdaddr_t; + +#define BDADDR_ANY {0, 0, 0, 0, 0, 0} + + /* $NetBSD: hci.h,v 1.23 2008/03/06 20:56:26 plunky Exp $ */ + + /*- + * Copyright (c) 2005 Iain Hibbert. + * Copyright (c) 2006 Itronix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of Itronix Inc. may not be used to endorse + * or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + /*- + * Copyright (c) 2001 Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: hci.h,v 1.23 2008/03/06 20:56:26 plunky Exp $ + * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $ + */ + + /* + * This file contains everything that applications need to know from + * Host Controller Interface (HCI). Information taken from Bluetooth + * Core Specifications (v1.1, v2.0 and v2.1) + * + * This file can be included by both kernel and userland applications. + * + * NOTE: Here and after Bluetooth device is called a "unit". Bluetooth + * specification refers to both devices and units. They are the + * same thing (I think), so to be consistent word "unit" will be + * used. + */ + + + + /************************************************************************** + ************************************************************************** + ** Common defines and types (HCI) + ************************************************************************** + **************************************************************************/ + +#define HCI_LAP_SIZE 3 /* unit LAP */ +#define HCI_KEY_SIZE 16 /* link key */ +#define HCI_PIN_SIZE 16 /* link PIN */ +#define HCI_EVENT_MASK_SIZE 8 /* event mask */ +#define HCI_CLASS_SIZE 3 /* unit class */ +#define HCI_FEATURES_SIZE 8 /* LMP features */ +#define HCI_UNIT_NAME_SIZE 248 /* unit name size */ +#define HCI_DEVNAME_SIZE 16 /* same as dv_xname */ +#define HCI_COMMANDS_SIZE 64 /* supported commands mask */ + + /* HCI specification */ +#define HCI_SPEC_V10 0x00 /* v1.0 */ +#define HCI_SPEC_V11 0x01 /* v1.1 */ +#define HCI_SPEC_V12 0x02 /* v1.2 */ +#define HCI_SPEC_V20 0x03 /* v2.0 */ +#define HCI_SPEC_V21 0x04 /* v2.1 */ + /* 0x05 - 0xFF - reserved for future use */ + + /* LMP features (and page 0 of extended features) */ + /* ------------------- byte 0 --------------------*/ +#define HCI_LMP_3SLOT 0x01 +#define HCI_LMP_5SLOT 0x02 +#define HCI_LMP_ENCRYPTION 0x04 +#define HCI_LMP_SLOT_OFFSET 0x08 +#define HCI_LMP_TIMIACCURACY 0x10 +#define HCI_LMP_ROLE_SWITCH 0x20 +#define HCI_LMP_HOLD_MODE 0x40 +#define HCI_LMP_SNIFF_MODE 0x80 + /* ------------------- byte 1 --------------------*/ +#define HCI_LMP_PARK_MODE 0x01 +#define HCI_LMP_RSSI 0x02 +#define HCI_LMP_CHANNEL_QUALITY 0x04 +#define HCI_LMP_SCO_LINK 0x08 +#define HCI_LMP_HV2_PKT 0x10 +#define HCI_LMP_HV3_PKT 0x20 +#define HCI_LMP_ULAW_LOG 0x40 +#define HCI_LMP_ALAW_LOG 0x80 + /* ------------------- byte 2 --------------------*/ +#define HCI_LMP_CVSD 0x01 +#define HCI_LMP_PAGISCHEME 0x02 +#define HCI_LMP_POWER_CONTROL 0x04 +#define HCI_LMP_TRANSPARENT_SCO 0x08 +#define HCI_LMP_FLOW_CONTROL_LAG0 0x10 +#define HCI_LMP_FLOW_CONTROL_LAG1 0x20 +#define HCI_LMP_FLOW_CONTROL_LAG2 0x40 +#define HCI_LMP_BC_ENCRYPTION 0x80 + /* ------------------- byte 3 --------------------*/ + /* reserved 0x01 */ +#define HCI_LMP_EDR_ACL_2MBPS 0x02 +#define HCI_LMP_EDR_ACL_3MBPS 0x04 +#define HCI_LMP_ENHANCED_ISCAN 0x08 +#define HCI_LMP_INTERLACED_ISCAN 0x10 +#define HCI_LMP_INTERLACED_PSCAN 0x20 +#define HCI_LMP_RSSI_INQUIRY 0x40 +#define HCI_LMP_EV3_PKT 0x80 + /* ------------------- byte 4 --------------------*/ +#define HCI_LMP_EV4_PKT 0x01 +#define HCI_LMP_EV5_PKT 0x02 + /* reserved 0x04 */ +#define HCI_LMP_AFH_CAPABLE_SLAVE 0x08 +#define HCI_LMP_AFH_CLASS_SLAVE 0x10 + /* reserved 0x20 */ + /* reserved 0x40 */ +#define HCI_LMP_3SLOT_EDR_ACL 0x80 + /* ------------------- byte 5 --------------------*/ +#define HCI_LMP_5SLOT_EDR_ACL 0x01 +#define HCI_LMP_SNIFF_SUBRATING 0x02 +#define HCI_LMP_PAUSE_ENCRYPTION 0x04 +#define HCI_LMP_AFH_CAPABLE_MASTER 0x08 +#define HCI_LMP_AFH_CLASS_MASTER 0x10 +#define HCI_LMP_EDR_eSCO_2MBPS 0x20 +#define HCI_LMP_EDR_eSCO_3MBPS 0x40 +#define HCI_LMP_3SLOT_EDR_eSCO 0x80 + /* ------------------- byte 6 --------------------*/ +#define HCI_LMP_EXTENDED_INQUIRY 0x01 + /* reserved 0x02 */ + /* reserved 0x04 */ +#define HCI_LMP_SIMPLE_PAIRING 0x08 +#define HCI_LMP_ENCAPSULATED_PDU 0x10 +#define HCI_LMP_ERRDATA_REPORTING 0x20 +#define HCI_LMP_NOFLUSH_PB_FLAG 0x40 + /* reserved 0x80 */ + /* ------------------- byte 7 --------------------*/ +#define HCI_LMP_LINK_SUPERVISION_TO 0x01 +#define HCI_LMP_INQ_RSP_TX_POWER 0x02 +#define HCI_LMP_EXTENDED_FEATURES 0x80 + + /* Link types */ +#define HCI_LINK_SCO 0x00 /* Voice */ +#define HCI_LINK_ACL 0x01 /* Data */ +#define HCI_LINK_eSCO 0x02 /* eSCO */ + /* 0x03 - 0xFF - reserved for future use */ + + /* + * ACL/SCO packet type bits are set to enable the + * packet type, except for 2MBPS and 3MBPS when they + * are unset to enable the packet type. + */ + /* ACL Packet types for "Create Connection" */ +#define HCI_PKT_2MBPS_DH1 0x0002 +#define HCI_PKT_3MBPS_DH1 0x0004 +#define HCI_PKT_DM1 0x0008 +#define HCI_PKT_DH1 0x0010 +#define HCI_PKT_2MBPS_DH3 0x0100 +#define HCI_PKT_3MBPS_DH3 0x0200 +#define HCI_PKT_DM3 0x0400 +#define HCI_PKT_DH3 0x0800 +#define HCI_PKT_2MBPS_DH5 0x1000 +#define HCI_PKT_3MBPS_DH5 0x2000 +#define HCI_PKT_DM5 0x4000 +#define HCI_PKT_DH5 0x8000 + + /* SCO Packet types for "Setup Synchronous Connection" */ +#define HCI_PKT_HV1 0x0001 +#define HCI_PKT_HV2 0x0002 +#define HCI_PKT_HV3 0x0004 +#define HCI_PKT_EV3 0x0008 +#define HCI_PKT_EV4 0x0010 +#define HCI_PKT_EV5 0x0020 +#define HCI_PKT_2MBPS_EV3 0x0040 +#define HCI_PKT_3MBPS_EV3 0x0080 +#define HCI_PKT_2MBPS_EV5 0x0100 +#define HCI_PKT_3MBPS_EV5 0x0200 + + /* + * Connection modes/Unit modes + * + * This is confusing. It means that one of the units change its mode + * for the specific connection. For example one connection was put on + * hold (but i could be wrong :) + */ + + /* Page scan modes (are deprecated) */ +#define HCI_MANDATORY_PAGE_SCAN_MODE 0x00 +#define HCI_OPTIONAL_PAGE_SCAN_MODE1 0x01 +#define HCI_OPTIONAL_PAGE_SCAN_MODE2 0x02 +#define HCI_OPTIONAL_PAGE_SCAN_MODE3 0x03 + /* 0x04 - 0xFF - reserved for future use */ + + /* Page scan repetition modes */ +#define HCI_SCAN_REP_MODE0 0x00 +#define HCI_SCAN_REP_MODE1 0x01 +#define HCI_SCAN_REP_MODE2 0x02 + /* 0x03 - 0xFF - reserved for future use */ + + /* Page scan period modes */ +#define HCI_PAGE_SCAN_PERIOD_MODE0 0x00 +#define HCI_PAGE_SCAN_PERIOD_MODE1 0x01 +#define HCI_PAGE_SCAN_PERIOD_MODE2 0x02 + /* 0x03 - 0xFF - reserved for future use */ + + /* Scan enable */ +#define HCI_NO_SCAN_ENABLE 0x00 +#define HCI_INQUIRY_SCAN_ENABLE 0x01 +#define HCI_PAGE_SCAN_ENABLE 0x02 + /* 0x04 - 0xFF - reserved for future use */ + + /* Hold mode activities */ +#define HCI_HOLD_MODE_NO_CHANGE 0x00 +#define HCI_HOLD_MODE_SUSPEND_PAGE_SCAN 0x01 +#define HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN 0x02 +#define HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY 0x04 + /* 0x08 - 0x80 - reserved for future use */ + + /* Connection roles */ +#define HCI_ROLE_MASTER 0x00 +#define HCI_ROLE_SLAVE 0x01 + /* 0x02 - 0xFF - reserved for future use */ + + /* Key flags */ +#define HCI_USE_SEMI_PERMANENT_LINK_KEYS 0x00 +#define HCI_USE_TEMPORARY_LINK_KEY 0x01 + /* 0x02 - 0xFF - reserved for future use */ + + /* Pin types */ +#define HCI_PIN_TYPE_VARIABLE 0x00 +#define HCI_PIN_TYPE_FIXED 0x01 + + /* Link key types */ +#define HCI_LINK_KEY_TYPE_COMBINATION_KEY 0x00 +#define HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY 0x01 +#define HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY 0x02 + /* 0x03 - 0xFF - reserved for future use */ + + /* Encryption modes */ +#define HCI_ENCRYPTION_MODE_NONE 0x00 +#define HCI_ENCRYPTION_MODE_P2P 0x01 +#define HCI_ENCRYPTION_MODE_ALL 0x02 + /* 0x03 - 0xFF - reserved for future use */ + + /* Quality of service types */ +#define HCI_SERVICE_TYPE_NO_TRAFFIC 0x00 +#define HCI_SERVICE_TYPE_BEST_EFFORT 0x01 +#define HCI_SERVICE_TYPE_GUARANTEED 0x02 + /* 0x03 - 0xFF - reserved for future use */ + + /* Link policy settings */ +#define HCI_LINK_POLICY_DISABLE_ALL_LM_MODES 0x0000 +#define HCI_LINK_POLICY_ENABLE_ROLE_SWITCH 0x0001 /* Master/Slave switch */ +#define HCI_LINK_POLICY_ENABLE_HOLD_MODE 0x0002 +#define HCI_LINK_POLICY_ENABLE_SNIFF_MODE 0x0004 +#define HCI_LINK_POLICY_ENABLE_PARK_MODE 0x0008 + /* 0x0010 - 0x8000 - reserved for future use */ + + /* Event masks */ +#define HCI_EVMSK_ALL 0x00000000ffffffff +#define HCI_EVMSK_NONE 0x0000000000000000 +#define HCI_EVMSK_INQUIRY_COMPL 0x0000000000000001 +#define HCI_EVMSK_INQUIRY_RESULT 0x0000000000000002 +#define HCI_EVMSK_CON_COMPL 0x0000000000000004 +#define HCI_EVMSK_CON_REQ 0x0000000000000008 +#define HCI_EVMSK_DISCON_COMPL 0x0000000000000010 +#define HCI_EVMSK_AUTH_COMPL 0x0000000000000020 +#define HCI_EVMSK_REMOTE_NAME_REQ_COMPL 0x0000000000000040 +#define HCI_EVMSK_ENCRYPTION_CHANGE 0x0000000000000080 +#define HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL 0x0000000000000100 +#define HCI_EVMSK_MASTER_LINK_KEY_COMPL 0x0000000000000200 +#define HCI_EVMSK_READ_REMOTE_FEATURES_COMPL 0x0000000000000400 +#define HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL 0x0000000000000800 +#define HCI_EVMSK_QOS_SETUP_COMPL 0x0000000000001000 +#define HCI_EVMSK_COMMAND_COMPL 0x0000000000002000 +#define HCI_EVMSK_COMMAND_STATUS 0x0000000000004000 +#define HCI_EVMSK_HARDWARE_ERROR 0x0000000000008000 +#define HCI_EVMSK_FLUSH_OCCUR 0x0000000000010000 +#define HCI_EVMSK_ROLE_CHANGE 0x0000000000020000 +#define HCI_EVMSK_NUM_COMPL_PKTS 0x0000000000040000 +#define HCI_EVMSK_MODE_CHANGE 0x0000000000080000 +#define HCI_EVMSK_RETURN_LINK_KEYS 0x0000000000100000 +#define HCI_EVMSK_PIN_CODE_REQ 0x0000000000200000 +#define HCI_EVMSK_LINK_KEY_REQ 0x0000000000400000 +#define HCI_EVMSK_LINK_KEY_NOTIFICATION 0x0000000000800000 +#define HCI_EVMSK_LOOPBACK_COMMAND 0x0000000001000000 +#define HCI_EVMSK_DATA_BUFFER_OVERFLOW 0x0000000002000000 +#define HCI_EVMSK_MAX_SLOT_CHANGE 0x0000000004000000 +#define HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE 0x0000000008000000 +#define HCI_EVMSK_CON_PKT_TYPE_CHANGED 0x0000000010000000 +#define HCI_EVMSK_QOS_VIOLATION 0x0000000020000000 +#define HCI_EVMSK_PAGE_SCAN_MODE_CHANGE 0x0000000040000000 +#define HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE 0x0000000080000000 + /* 0x0000000100000000 - 0x8000000000000000 - reserved for future use */ + + /* Filter types */ +#define HCI_FILTER_TYPE_NONE 0x00 +#define HCI_FILTER_TYPE_INQUIRY_RESULT 0x01 +#define HCI_FILTER_TYPE_CON_SETUP 0x02 + /* 0x03 - 0xFF - reserved for future use */ + + /* Filter condition types for HCI_FILTER_TYPE_INQUIRY_RESULT */ +#define HCI_FILTER_COND_INQUIRY_NEW_UNIT 0x00 +#define HCI_FILTER_COND_INQUIRY_UNIT_CLASS 0x01 +#define HCI_FILTER_COND_INQUIRY_BDADDR 0x02 + /* 0x03 - 0xFF - reserved for future use */ + + /* Filter condition types for HCI_FILTER_TYPE_CON_SETUP */ +#define HCI_FILTER_COND_CON_ANY_UNIT 0x00 +#define HCI_FILTER_COND_CON_UNIT_CLASS 0x01 +#define HCI_FILTER_COND_CON_BDADDR 0x02 + /* 0x03 - 0xFF - reserved for future use */ + + /* Xmit level types */ +#define HCI_XMIT_LEVEL_CURRENT 0x00 +#define HCI_XMIT_LEVEL_MAXIMUM 0x01 + /* 0x02 - 0xFF - reserved for future use */ + + /* Host Controller to Host flow control */ +#define HCI_HC2H_FLOW_CONTROL_NONE 0x00 +#define HCI_HC2H_FLOW_CONTROL_ACL 0x01 +#define HCI_HC2H_FLOW_CONTROL_SCO 0x02 +#define HCI_HC2H_FLOW_CONTROL_BOTH 0x03 + /* 0x04 - 0xFF - reserved future use */ + + /* Loopback modes */ +#define HCI_LOOPBACK_NONE 0x00 +#define HCI_LOOPBACK_LOCAL 0x01 +#define HCI_LOOPBACK_REMOTE 0x02 + /* 0x03 - 0xFF - reserved future use */ + + /************************************************************************** + ************************************************************************** + ** Link level defines, headers and types + ************************************************************************** + **************************************************************************/ + + /* + * Macro(s) to combine OpCode and extract OGF (OpCode Group Field) + * and OCF (OpCode Command Field) from OpCode. + */ + +#define HCI_OPCODE(gf,cf) ((((gf) & 0x3f) << 10) | ((cf) & 0x3ff)) +#define HCI_OCF(op) ((op) & 0x3ff) +#define HCI_OGF(op) (((op) >> 10) & 0x3f) + + /* + * Macro(s) to extract/combine connection handle, BC (Broadcast) and + * PB (Packet boundary) flags. + */ + +#define HCI_CON_HANDLE(h) ((h) & 0x0fff) +#define HCI_PB_FLAG(h) (((h) & 0x3000) >> 12) +#define HCI_BC_FLAG(h) (((h) & 0xc000) >> 14) +#define HCI_MK_CON_HANDLE(h, pb, bc) \ + (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) + + /* PB flag values */ + /* 00 - reserved for future use */ +#define HCI_PACKET_FRAGMENT 0x1 +#define HCI_PACKET_START 0x2 + /* 11 - reserved for future use */ + + /* BC flag values */ +#define HCI_POINT2POINT 0x0 /* only Host controller to Host */ +#define HCI_BROADCAST_ACTIVE 0x1 /* both directions */ +#define HCI_BROADCAST_PICONET 0x2 /* both directions */ + /* 11 - reserved for future use */ + + /* HCI command packet header */ + typedef struct { + uint8_t type; /* MUST be 0x01 */ + uint16_t opcode; /* OpCode */ + uint8_t length; /* parameter(s) length in bytes */ + } hci_cmd_hdr_t; + +#define HCI_CMD_PKT 0x01 +#define HCI_CMD_PKT_SIZE (sizeof(hci_cmd_hdr_t) + 0xff) + + /* ACL data packet header */ + typedef struct { + uint8_t type; /* MUST be 0x02 */ + uint16_t con_handle; /* connection handle + PB + BC flags */ + uint16_t length; /* payload length in bytes */ + } hci_acldata_hdr_t; + +#define HCI_ACL_DATA_PKT 0x02 +#define HCI_ACL_PKT_SIZE (sizeof(hci_acldata_hdr_t) + 0xffff) + + /* SCO data packet header */ + typedef struct { + uint8_t type; /* MUST be 0x03 */ + uint16_t con_handle; /* connection handle + reserved bits */ + uint8_t length; /* payload length in bytes */ + } hci_scodata_hdr_t; + +#define HCI_SCO_DATA_PKT 0x03 +#define HCI_SCO_PKT_SIZE (sizeof(hci_scodata_hdr_t) + 0xff) + + /* HCI event packet header */ + typedef struct { + uint8_t type; /* MUST be 0x04 */ + uint8_t event; /* event */ + uint8_t length; /* parameter(s) length in bytes */ + } hci_event_hdr_t; + +#define HCI_EVENT_PKT 0x04 +#define HCI_EVENT_PKT_SIZE (sizeof(hci_event_hdr_t) + 0xff) + + /* HCI status return parameter */ + typedef struct { + uint8_t status; /* 0x00 - success */ + } hci_status_rp; + + /************************************************************************** + ************************************************************************** + ** OGF 0x01 Link control commands and return parameters + ************************************************************************** + **************************************************************************/ + +#define HCI_OGF_LINK_CONTROL 0x01 + +#define HCI_OCF_INQUIRY 0x0001 +#define HCI_CMD_INQUIRY 0x0401 + typedef struct { + uint8_t lap[HCI_LAP_SIZE]; /* LAP */ + uint8_t inquiry_length; /* (N x 1.28) sec */ + uint8_t num_responses; /* Max. # of responses */ + } hci_inquiry_cp; + /* No return parameter(s) */ + +#define HCI_OCF_INQUIRY_CANCEL 0x0002 +#define HCI_CMD_INQUIRY_CANCEL 0x0402 + /* No command parameter(s) */ + typedef hci_status_rp hci_inquiry_cancel_rp; + +#define HCI_OCF_PERIODIC_INQUIRY 0x0003 +#define HCI_CMD_PERIODIC_INQUIRY 0x0403 + typedef struct { + uint16_t max_period_length; /* Max. and min. amount of time */ + uint16_t min_period_length; /* between consecutive inquiries */ + uint8_t lap[HCI_LAP_SIZE]; /* LAP */ + uint8_t inquiry_length; /* (inquiry_length * 1.28) sec */ + uint8_t num_responses; /* Max. # of responses */ + } hci_periodic_inquiry_cp; + + typedef hci_status_rp hci_periodic_inquiry_rp; + +#define HCI_OCF_EXIT_PERIODIC_INQUIRY 0x0004 +#define HCI_CMD_EXIT_PERIODIC_INQUIRY 0x0404 + /* No command parameter(s) */ + typedef hci_status_rp hci_exit_periodic_inquiry_rp; + +#define HCI_OCF_CREATE_CON 0x0005 +#define HCI_CMD_CREATE_CON 0x0405 + typedef struct { + bdaddr_t bdaddr; /* destination address */ + uint16_t pkt_type; /* packet type */ + uint8_t page_scan_rep_mode; /* page scan repetition mode */ + uint8_t page_scan_mode; /* reserved - set to 0x00 */ + uint16_t clock_offset; /* clock offset */ + uint8_t accept_role_switch; /* accept role switch? 0x00 == No */ + } hci_create_con_cp; + /* No return parameter(s) */ + +#define HCI_OCF_DISCONNECT 0x0006 +#define HCI_CMD_DISCONNECT 0x0406 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t reason; /* reason to disconnect */ + } hci_discon_cp; + /* No return parameter(s) */ + + /* Add SCO Connection is deprecated */ +#define HCI_OCF_ADD_SCO_CON 0x0007 +#define HCI_CMD_ADD_SCO_CON 0x0407 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t pkt_type; /* packet type */ + } hci_add_sco_con_cp; + /* No return parameter(s) */ + +#define HCI_OCF_CREATE_CON_CANCEL 0x0008 +#define HCI_CMD_CREATE_CON_CANCEL 0x0408 + typedef struct { + bdaddr_t bdaddr; /* destination address */ + } hci_create_con_cancel_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* destination address */ + } hci_create_con_cancel_rp; + +#define HCI_OCF_ACCEPT_CON 0x0009 +#define HCI_CMD_ACCEPT_CON 0x0409 + typedef struct { + bdaddr_t bdaddr; /* address of unit to be connected */ + uint8_t role; /* connection role */ + } hci_accept_con_cp; + /* No return parameter(s) */ + +#define HCI_OCF_REJECT_CON 0x000a +#define HCI_CMD_REJECT_CON 0x040A + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t reason; /* reason to reject */ + } hci_reject_con_cp; + /* No return parameter(s) */ + +#define HCI_OCF_LINK_KEY_REP 0x000b +#define HCI_CMD_LINK_KEY_REP 0x040B + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t key[HCI_KEY_SIZE]; /* key */ + } hci_link_key_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* unit address */ + } hci_link_key_rep_rp; + +#define HCI_OCF_LINK_KEY_NEG_REP 0x000c +#define HCI_CMD_LINK_KEY_NEG_REP 0x040C + typedef struct { + bdaddr_t bdaddr; /* remote address */ + } hci_link_key_neg_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* unit address */ + } hci_link_key_neg_rep_rp; + +#define HCI_OCF_PIN_CODE_REP 0x000d +#define HCI_CMD_PIN_CODE_REP 0x040D + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t pin_size; /* pin code length (in bytes) */ + uint8_t pin[HCI_PIN_SIZE]; /* pin code */ + } hci_pin_code_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* unit address */ + } hci_pin_code_rep_rp; + +#define HCI_OCF_PIN_CODE_NEG_REP 0x000e +#define HCI_CMD_PIN_CODE_NEG_REP 0x040E + typedef struct { + bdaddr_t bdaddr; /* remote address */ + } hci_pin_code_neg_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* unit address */ + } hci_pin_code_neg_rep_rp; + +#define HCI_OCF_CHANGE_CON_PACKET_TYPE 0x000f +#define HCI_CMD_CHANGE_CON_PACKET_TYPE 0x040F + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t pkt_type; /* packet type */ + } hci_change_con_pkt_type_cp; + /* No return parameter(s) */ + +#define HCI_OCF_AUTH_REQ 0x0011 +#define HCI_CMD_AUTH_REQ 0x0411 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_auth_req_cp; + /* No return parameter(s) */ + +#define HCI_OCF_SET_CON_ENCRYPTION 0x0013 +#define HCI_CMD_SET_CON_ENCRYPTION 0x0413 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t encryption_enable; /* 0x00 - disable, 0x01 - enable */ + } hci_set_con_encryption_cp; + /* No return parameter(s) */ + +#define HCI_OCF_CHANGE_CON_LINK_KEY 0x0015 +#define HCI_CMD_CHANGE_CON_LINK_KEY 0x0415 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_change_con_link_key_cp; + /* No return parameter(s) */ + +#define HCI_OCF_MASTER_LINK_KEY 0x0017 +#define HCI_CMD_MASTER_LINK_KEY 0x0417 + typedef struct { + uint8_t key_flag; /* key flag */ + } hci_master_link_key_cp; + /* No return parameter(s) */ + +#define HCI_OCF_REMOTE_NAME_REQ 0x0019 +#define HCI_CMD_REMOTE_NAME_REQ 0x0419 + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t page_scan_rep_mode; /* page scan repetition mode */ + uint8_t page_scan_mode; /* page scan mode */ + uint16_t clock_offset; /* clock offset */ + } hci_remote_name_req_cp; + /* No return parameter(s) */ + +#define HCI_OCF_REMOTE_NAME_REQ_CANCEL 0x001a +#define HCI_CMD_REMOTE_NAME_REQ_CANCEL 0x041A + typedef struct { + bdaddr_t bdaddr; /* remote address */ + } hci_remote_name_req_cancel_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_remote_name_req_cancel_rp; + +#define HCI_OCF_READ_REMOTE_FEATURES 0x001b +#define HCI_CMD_READ_REMOTE_FEATURES 0x041B + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_remote_features_cp; + /* No return parameter(s) */ + +#define HCI_OCF_READ_REMOTE_EXTENDED_FEATURES 0x001c +#define HCI_CMD_READ_REMOTE_EXTENDED_FEATURES 0x041C + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t page; /* page number */ + } hci_read_remote_extended_features_cp; + /* No return parameter(s) */ + +#define HCI_OCF_READ_REMOTE_VER_INFO 0x001d +#define HCI_CMD_READ_REMOTE_VER_INFO 0x041D + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_remote_ver_info_cp; + /* No return parameter(s) */ + +#define HCI_OCF_READ_CLOCK_OFFSET 0x001f +#define HCI_CMD_READ_CLOCK_OFFSET 0x041F + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_clock_offset_cp; + /* No return parameter(s) */ + +#define HCI_OCF_READ_LMP_HANDLE 0x0020 +#define HCI_CMD_READ_LMP_HANDLE 0x0420 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_lmp_handle_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t lmp_handle; /* LMP handle */ + uint32_t reserved; /* reserved */ + } hci_read_lmp_handle_rp; + +#define HCI_OCF_SETUP_SCO_CON 0x0028 +#define HCI_CMD_SETUP_SCO_CON 0x0428 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint32_t tx_bandwidth; /* transmit bandwidth */ + uint32_t rx_bandwidth; /* receive bandwidth */ + uint16_t latency; /* maximum latency */ + uint16_t voice; /* voice setting */ + uint8_t rt_effort; /* retransmission effort */ + uint16_t pkt_type; /* packet types */ + } hci_setup_sco_con_cp; + /* No return parameter(s) */ + +#define HCI_OCF_ACCEPT_SCO_CON_REQ 0x0029 +#define HCI_CMD_ACCEPT_SCO_CON_REQ 0x0429 + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint32_t tx_bandwidth; /* transmit bandwidth */ + uint32_t rx_bandwidth; /* receive bandwidth */ + uint16_t latency; /* maximum latency */ + uint16_t content; /* voice setting */ + uint8_t rt_effort; /* retransmission effort */ + uint16_t pkt_type; /* packet types */ + } hci_accept_sco_con_req_cp; + /* No return parameter(s) */ + +#define HCI_OCF_REJECT_SCO_CON_REQ 0x002a +#define HCI_CMD_REJECT_SCO_CON_REQ 0x042a + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t reason; /* reject error code */ + } hci_reject_sco_con_req_cp; + /* No return parameter(s) */ + +#define HCI_OCF_IO_CAPABILITY_REP 0x002b +#define HCI_CMD_IO_CAPABILITY_REP 0x042a + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t io_cap; /* IO capability */ + uint8_t oob_data; /* OOB data present */ + uint8_t auth_req; /* auth requirements */ + } hci_io_capability_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_io_capability_rep_rp; + +#define HCI_OCF_USER_CONFIRM_REP 0x002c +#define HCI_CMD_USER_CONFIRM_REP 0x042c + typedef struct { + bdaddr_t bdaddr; /* remote address */ + } hci_user_confirm_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_user_confirm_rep_rp; + +#define HCI_OCF_USER_CONFIRM_NEG_REP 0x002d +#define HCI_CMD_USER_CONFIRM_NEG_REP 0x042d + typedef struct { + bdaddr_t bdaddr; /* remote address */ + } hci_user_confirm_neg_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_user_confirm_neg_rep_rp; + +#define HCI_OCF_USER_PASSKEY_REP 0x002e +#define HCI_CMD_USER_PASSKEY_REP 0x042e + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint32_t value; /* 000000 - 999999 */ + } hci_user_passkey_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_user_passkey_rep_rp; + +#define HCI_OCF_USER_PASSKEY_NEG_REP 0x002f +#define HCI_CMD_USER_PASSKEY_NEG_REP 0x042f + typedef struct { + bdaddr_t bdaddr; /* remote address */ + } hci_user_passkey_neg_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_user_passkey_neg_rep_rp; + +#define HCI_OCF_OOB_DATA_REP 0x0030 +#define HCI_CMD_OOB_DATA_REP 0x0430 + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t c[16]; /* pairing hash */ + uint8_t r[16]; /* pairing randomizer */ + } hci_user_oob_data_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_user_oob_data_rep_rp; + +#define HCI_OCF_OOB_DATA_NEG_REP 0x0033 +#define HCI_CMD_OOB_DATA_NEG_REP 0x0433 + typedef struct { + bdaddr_t bdaddr; /* remote address */ + } hci_user_oob_data_neg_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_user_oob_data_neg_rep_rp; + +#define HCI_OCF_IO_CAPABILITY_NEG_REP 0x0034 +#define HCI_CMD_IO_CAPABILITY_NEG_REP 0x0434 + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t reason; /* error code */ + } hci_io_capability_neg_rep_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_io_capability_neg_rep_rp; + + /************************************************************************** + ************************************************************************** + ** OGF 0x02 Link policy commands and return parameters + ************************************************************************** + **************************************************************************/ + +#define HCI_OGF_LINK_POLICY 0x02 + +#define HCI_OCF_HOLD_MODE 0x0001 +#define HCI_CMD_HOLD_MODE 0x0801 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t max_interval; /* (max_interval * 0.625) msec */ + uint16_t min_interval; /* (max_interval * 0.625) msec */ + } hci_hold_mode_cp; + /* No return parameter(s) */ + +#define HCI_OCF_SNIFF_MODE 0x0003 +#define HCI_CMD_SNIFF_MODE 0x0803 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t max_interval; /* (max_interval * 0.625) msec */ + uint16_t min_interval; /* (max_interval * 0.625) msec */ + uint16_t attempt; /* (2 * attempt - 1) * 0.625 msec */ + uint16_t timeout; /* (2 * attempt - 1) * 0.625 msec */ + } hci_sniff_mode_cp; + /* No return parameter(s) */ + +#define HCI_OCF_EXIT_SNIFF_MODE 0x0004 +#define HCI_CMD_EXIT_SNIFF_MODE 0x0804 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_exit_sniff_mode_cp; + /* No return parameter(s) */ + +#define HCI_OCF_PARK_MODE 0x0005 +#define HCI_CMD_PARK_MODE 0x0805 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t max_interval; /* (max_interval * 0.625) msec */ + uint16_t min_interval; /* (max_interval * 0.625) msec */ + } hci_park_mode_cp; + /* No return parameter(s) */ + +#define HCI_OCF_EXIT_PARK_MODE 0x0006 +#define HCI_CMD_EXIT_PARK_MODE 0x0806 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_exit_park_mode_cp; + /* No return parameter(s) */ + +#define HCI_OCF_QOS_SETUP 0x0007 +#define HCI_CMD_QOS_SETUP 0x0807 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t flags; /* reserved for future use */ + uint8_t service_type; /* service type */ + uint32_t token_rate; /* bytes per second */ + uint32_t peak_bandwidth; /* bytes per second */ + uint32_t latency; /* microseconds */ + uint32_t delay_variation; /* microseconds */ + } hci_qos_setup_cp; + /* No return parameter(s) */ + +#define HCI_OCF_ROLE_DISCOVERY 0x0009 +#define HCI_CMD_ROLE_DISCOVERY 0x0809 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_role_discovery_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t role; /* role for the connection handle */ + } hci_role_discovery_rp; + +#define HCI_OCF_SWITCH_ROLE 0x000b +#define HCI_CMD_SWITCH_ROLE 0x080B + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t role; /* new local role */ + } hci_switch_role_cp; + /* No return parameter(s) */ + +#define HCI_OCF_READ_LINK_POLICY_SETTINGS 0x000c +#define HCI_CMD_READ_LINK_POLICY_SETTINGS 0x080C + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_link_policy_settings_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint16_t settings; /* link policy settings */ + } hci_read_link_policy_settings_rp; + +#define HCI_OCF_WRITE_LINK_POLICY_SETTINGS 0x000d +#define HCI_CMD_WRITE_LINK_POLICY_SETTINGS 0x080D + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t settings; /* link policy settings */ + } hci_write_link_policy_settings_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + } hci_write_link_policy_settings_rp; + +#define HCI_OCF_READ_DEFAULT_LINK_POLICY_SETTINGS 0x000e +#define HCI_CMD_READ_DEFAULT_LINK_POLICY_SETTINGS 0x080E + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t settings; /* link policy settings */ + } hci_read_default_link_policy_settings_rp; + +#define HCI_OCF_WRITE_DEFAULT_LINK_POLICY_SETTINGS 0x000f +#define HCI_CMD_WRITE_DEFAULT_LINK_POLICY_SETTINGS 0x080F + typedef struct { + uint16_t settings; /* link policy settings */ + } hci_write_default_link_policy_settings_cp; + + typedef hci_status_rp hci_write_default_link_policy_settings_rp; + +#define HCI_OCF_FLOW_SPECIFICATION 0x0010 +#define HCI_CMD_FLOW_SPECIFICATION 0x0810 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t flags; /* reserved */ + uint8_t flow_direction; + uint8_t service_type; + uint32_t token_rate; + uint32_t token_bucket; + uint32_t peak_bandwidth; + uint32_t latency; + } hci_flow_specification_cp; + /* No return parameter(s) */ + +#define HCI_OCF_SNIFF_SUBRATING 0x0011 +#define HCI_CMD_SNIFF_SUBRATING 0x0810 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t max_latency; + uint16_t max_timeout; /* max remote timeout */ + uint16_t min_timeout; /* min local timeout */ + } hci_sniff_subrating_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + } hci_sniff_subrating_rp; + + /************************************************************************** + ************************************************************************** + ** OGF 0x03 Host Controller and Baseband commands and return parameters + ************************************************************************** + **************************************************************************/ + +#define HCI_OGF_HC_BASEBAND 0x03 + +#define HCI_OCF_SET_EVENT_MASK 0x0001 +#define HCI_CMD_SET_EVENT_MASK 0x0C01 + typedef struct { + uint8_t event_mask[HCI_EVENT_MASK_SIZE]; /* event_mask */ + } hci_set_event_mask_cp; + + typedef hci_status_rp hci_set_event_mask_rp; + +#define HCI_OCF_RESET 0x0003 +#define HCI_CMD_RESET 0x0C03 + /* No command parameter(s) */ + typedef hci_status_rp hci_reset_rp; + +#define HCI_OCF_SET_EVENT_FILTER 0x0005 +#define HCI_CMD_SET_EVENT_FILTER 0x0C05 + typedef struct { + uint8_t filter_type; /* filter type */ + uint8_t filter_condition_type; /* filter condition type */ + /* variable size condition + uint8_t condition[]; -- conditions */ + } hci_set_event_filter_cp; + + typedef hci_status_rp hci_set_event_filter_rp; + +#define HCI_OCF_FLUSH 0x0008 +#define HCI_CMD_FLUSH 0x0C08 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_flush_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + } hci_flush_rp; + +#define HCI_OCF_READ_PIN_TYPE 0x0009 +#define HCI_CMD_READ_PIN_TYPE 0x0C09 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t pin_type; /* PIN type */ + } hci_read_pin_type_rp; + +#define HCI_OCF_WRITE_PIN_TYPE 0x000a +#define HCI_CMD_WRITE_PIN_TYPE 0x0C0A + typedef struct { + uint8_t pin_type; /* PIN type */ + } hci_write_pin_type_cp; + + typedef hci_status_rp hci_write_pin_type_rp; + +#define HCI_OCF_CREATE_NEW_UNIT_KEY 0x000b +#define HCI_CMD_CREATE_NEW_UNIT_KEY 0x0C0B + /* No command parameter(s) */ + typedef hci_status_rp hci_create_new_unit_key_rp; + +#define HCI_OCF_READ_STORED_LINK_KEY 0x000d +#define HCI_CMD_READ_STORED_LINK_KEY 0x0C0D + typedef struct { + bdaddr_t bdaddr; /* address */ + uint8_t read_all; /* read all keys? 0x01 - yes */ + } hci_read_stored_link_key_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t max_num_keys; /* Max. number of keys */ + uint16_t num_keys_read; /* Number of stored keys */ + } hci_read_stored_link_key_rp; + +#define HCI_OCF_WRITE_STORED_LINK_KEY 0x0011 +#define HCI_CMD_WRITE_STORED_LINK_KEY 0x0C11 + typedef struct { + uint8_t num_keys_write; /* # of keys to write */ + /* these are repeated "num_keys_write" times + bdaddr_t bdaddr; --- remote address(es) + uint8_t key[HCI_KEY_SIZE]; --- key(s) */ + } hci_write_stored_link_key_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t num_keys_written; /* # of keys successfully written */ + } hci_write_stored_link_key_rp; + +#define HCI_OCF_DELETE_STORED_LINK_KEY 0x0012 +#define HCI_CMD_DELETE_STORED_LINK_KEY 0x0C12 + typedef struct { + bdaddr_t bdaddr; /* address */ + uint8_t delete_all; /* delete all keys? 0x01 - yes */ + } hci_delete_stored_link_key_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t num_keys_deleted; /* Number of keys deleted */ + } hci_delete_stored_link_key_rp; + +#define HCI_OCF_WRITE_LOCAL_NAME 0x0013 +#define HCI_CMD_WRITE_LOCAL_NAME 0x0C13 + typedef struct { + char name[HCI_UNIT_NAME_SIZE]; /* new unit name */ + } hci_write_local_name_cp; + + typedef hci_status_rp hci_write_local_name_rp; + +#define HCI_OCF_READ_LOCAL_NAME 0x0014 +#define HCI_CMD_READ_LOCAL_NAME 0x0C14 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + char name[HCI_UNIT_NAME_SIZE]; /* unit name */ + } hci_read_local_name_rp; + +#define HCI_OCF_READ_CON_ACCEPT_TIMEOUT 0x0015 +#define HCI_CMD_READ_CON_ACCEPT_TIMEOUT 0x0C15 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t timeout; /* (timeout * 0.625) msec */ + } hci_read_con_accept_timeout_rp; + +#define HCI_OCF_WRITE_CON_ACCEPT_TIMEOUT 0x0016 +#define HCI_CMD_WRITE_CON_ACCEPT_TIMEOUT 0x0C16 + typedef struct { + uint16_t timeout; /* (timeout * 0.625) msec */ + } hci_write_con_accept_timeout_cp; + + typedef hci_status_rp hci_write_con_accept_timeout_rp; + +#define HCI_OCF_READ_PAGE_TIMEOUT 0x0017 +#define HCI_CMD_READ_PAGE_TIMEOUT 0x0C17 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t timeout; /* (timeout * 0.625) msec */ + } hci_read_page_timeout_rp; + +#define HCI_OCF_WRITE_PAGE_TIMEOUT 0x0018 +#define HCI_CMD_WRITE_PAGE_TIMEOUT 0x0C18 + typedef struct { + uint16_t timeout; /* (timeout * 0.625) msec */ + } hci_write_page_timeout_cp; + + typedef hci_status_rp hci_write_page_timeout_rp; + +#define HCI_OCF_READ_SCAN_ENABLE 0x0019 +#define HCI_CMD_READ_SCAN_ENABLE 0x0C19 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t scan_enable; /* Scan enable */ + } hci_read_scan_enable_rp; + +#define HCI_OCF_WRITE_SCAN_ENABLE 0x001a +#define HCI_CMD_WRITE_SCAN_ENABLE 0x0C1A + typedef struct { + uint8_t scan_enable; /* Scan enable */ + } hci_write_scan_enable_cp; + + typedef hci_status_rp hci_write_scan_enable_rp; + +#define HCI_OCF_READ_PAGE_SCAN_ACTIVITY 0x001b +#define HCI_CMD_READ_PAGE_SCAN_ACTIVITY 0x0C1B + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t page_scan_interval; /* interval * 0.625 msec */ + uint16_t page_scan_window; /* window * 0.625 msec */ + } hci_read_page_scan_activity_rp; + +#define HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY 0x001c +#define HCI_CMD_WRITE_PAGE_SCAN_ACTIVITY 0x0C1C + typedef struct { + uint16_t page_scan_interval; /* interval * 0.625 msec */ + uint16_t page_scan_window; /* window * 0.625 msec */ + } hci_write_page_scan_activity_cp; + + typedef hci_status_rp hci_write_page_scan_activity_rp; + +#define HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY 0x001d +#define HCI_CMD_READ_INQUIRY_SCAN_ACTIVITY 0x0C1D + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t inquiry_scan_interval; /* interval * 0.625 msec */ + uint16_t inquiry_scan_window; /* window * 0.625 msec */ + } hci_read_inquiry_scan_activity_rp; + +#define HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY 0x001e +#define HCI_CMD_WRITE_INQUIRY_SCAN_ACTIVITY 0x0C1E + typedef struct { + uint16_t inquiry_scan_interval; /* interval * 0.625 msec */ + uint16_t inquiry_scan_window; /* window * 0.625 msec */ + } hci_write_inquiry_scan_activity_cp; + + typedef hci_status_rp hci_write_inquiry_scan_activity_rp; + +#define HCI_OCF_READ_AUTH_ENABLE 0x001f +#define HCI_CMD_READ_AUTH_ENABLE 0x0C1F + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t auth_enable; /* 0x01 - enabled */ + } hci_read_auth_enable_rp; + +#define HCI_OCF_WRITE_AUTH_ENABLE 0x0020 +#define HCI_CMD_WRITE_AUTH_ENABLE 0x0C20 + typedef struct { + uint8_t auth_enable; /* 0x01 - enabled */ + } hci_write_auth_enable_cp; + + typedef hci_status_rp hci_write_auth_enable_rp; + + /* Read Encryption Mode is deprecated */ +#define HCI_OCF_READ_ENCRYPTION_MODE 0x0021 +#define HCI_CMD_READ_ENCRYPTION_MODE 0x0C21 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t encryption_mode; /* encryption mode */ + } hci_read_encryption_mode_rp; + + /* Write Encryption Mode is deprecated */ +#define HCI_OCF_WRITE_ENCRYPTION_MODE 0x0022 +#define HCI_CMD_WRITE_ENCRYPTION_MODE 0x0C22 + typedef struct { + uint8_t encryption_mode; /* encryption mode */ + } hci_write_encryption_mode_cp; + + typedef hci_status_rp hci_write_encryption_mode_rp; + +#define HCI_OCF_READ_UNIT_CLASS 0x0023 +#define HCI_CMD_READ_UNIT_CLASS 0x0C23 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ + } hci_read_unit_class_rp; + +#define HCI_OCF_WRITE_UNIT_CLASS 0x0024 +#define HCI_CMD_WRITE_UNIT_CLASS 0x0C24 + typedef struct { + uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ + } hci_write_unit_class_cp; + + typedef hci_status_rp hci_write_unit_class_rp; + +#define HCI_OCF_READ_VOICE_SETTING 0x0025 +#define HCI_CMD_READ_VOICE_SETTING 0x0C25 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t settings; /* voice settings */ + } hci_read_voice_setting_rp; + +#define HCI_OCF_WRITE_VOICE_SETTING 0x0026 +#define HCI_CMD_WRITE_VOICE_SETTING 0x0C26 + typedef struct { + uint16_t settings; /* voice settings */ + } hci_write_voice_setting_cp; + + typedef hci_status_rp hci_write_voice_setting_rp; + +#define HCI_OCF_READ_AUTO_FLUSH_TIMEOUT 0x0027 +#define HCI_CMD_READ_AUTO_FLUSH_TIMEOUT 0x0C27 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_auto_flush_timeout_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */ + } hci_read_auto_flush_timeout_rp; + +#define HCI_OCF_WRITE_AUTO_FLUSH_TIMEOUT 0x0028 +#define HCI_CMD_WRITE_AUTO_FLUSH_TIMEOUT 0x0C28 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t timeout; /* 0x00 - no flush, timeout * 0.625 msec */ + } hci_write_auto_flush_timeout_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + } hci_write_auto_flush_timeout_rp; + +#define HCI_OCF_READ_NUM_BROADCAST_RETRANS 0x0029 +#define HCI_CMD_READ_NUM_BROADCAST_RETRANS 0x0C29 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t counter; /* number of broadcast retransmissions */ + } hci_read_num_broadcast_retrans_rp; + +#define HCI_OCF_WRITE_NUM_BROADCAST_RETRANS 0x002a +#define HCI_CMD_WRITE_NUM_BROADCAST_RETRANS 0x0C2A + typedef struct { + uint8_t counter; /* number of broadcast retransmissions */ + } hci_write_num_broadcast_retrans_cp; + + typedef hci_status_rp hci_write_num_broadcast_retrans_rp; + +#define HCI_OCF_READ_HOLD_MODE_ACTIVITY 0x002b +#define HCI_CMD_READ_HOLD_MODE_ACTIVITY 0x0C2B + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t hold_mode_activity; /* Hold mode activities */ + } hci_read_hold_mode_activity_rp; + +#define HCI_OCF_WRITE_HOLD_MODE_ACTIVITY 0x002c +#define HCI_CMD_WRITE_HOLD_MODE_ACTIVITY 0x0C2C + typedef struct { + uint8_t hold_mode_activity; /* Hold mode activities */ + } hci_write_hold_mode_activity_cp; + + typedef hci_status_rp hci_write_hold_mode_activity_rp; + +#define HCI_OCF_READ_XMIT_LEVEL 0x002d +#define HCI_CMD_READ_XMIT_LEVEL 0x0C2D + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t type; /* Xmit level type */ + } hci_read_xmit_level_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + char level; /* -30 <= level <= 30 dBm */ + } hci_read_xmit_level_rp; + +#define HCI_OCF_READ_SCO_FLOW_CONTROL 0x002e +#define HCI_CMD_READ_SCO_FLOW_CONTROL 0x0C2E + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t flow_control; /* 0x00 - disabled */ + } hci_read_sco_flow_control_rp; + +#define HCI_OCF_WRITE_SCO_FLOW_CONTROL 0x002f +#define HCI_CMD_WRITE_SCO_FLOW_CONTROL 0x0C2F + typedef struct { + uint8_t flow_control; /* 0x00 - disabled */ + } hci_write_sco_flow_control_cp; + + typedef hci_status_rp hci_write_sco_flow_control_rp; + +#define HCI_OCF_HC2H_FLOW_CONTROL 0x0031 +#define HCI_CMD_HC2H_FLOW_CONTROL 0x0C31 + typedef struct { + uint8_t hc2h_flow; /* Host Controller to Host flow control */ + } hci_hc2h_flow_control_cp; + + typedef hci_status_rp hci_h2hc_flow_control_rp; + +#define HCI_OCF_HOST_BUFFER_SIZE 0x0033 +#define HCI_CMD_HOST_BUFFER_SIZE 0x0C33 + typedef struct { + uint16_t max_acl_size; /* Max. size of ACL packet (bytes) */ + uint8_t max_sco_size; /* Max. size of SCO packet (bytes) */ + uint16_t num_acl_pkts; /* Max. number of ACL packets */ + uint16_t num_sco_pkts; /* Max. number of SCO packets */ + } hci_host_buffer_size_cp; + + typedef hci_status_rp hci_host_buffer_size_rp; + +#define HCI_OCF_HOST_NUM_COMPL_PKTS 0x0035 +#define HCI_CMD_HOST_NUM_COMPL_PKTS 0x0C35 + typedef struct { + uint8_t nu_con_handles; /* # of connection handles */ + /* these are repeated "num_con_handles" times + uint16_t con_handle; --- connection handle(s) + uint16_t compl_pkts; --- # of completed packets */ + } hci_host_num_compl_pkts_cp; + /* No return parameter(s) */ + +#define HCI_OCF_READ_LINK_SUPERVISION_TIMEOUT 0x0036 +#define HCI_CMD_READ_LINK_SUPERVISION_TIMEOUT 0x0C36 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_link_supervision_timeout_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint16_t timeout; /* Link supervision timeout * 0.625 msec */ + } hci_read_link_supervision_timeout_rp; + +#define HCI_OCF_WRITE_LINK_SUPERVISION_TIMEOUT 0x0037 +#define HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT 0x0C37 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t timeout; /* Link supervision timeout * 0.625 msec */ + } hci_write_link_supervision_timeout_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + } hci_write_link_supervision_timeout_rp; + +#define HCI_OCF_READ_NUM_SUPPORTED_IAC 0x0038 +#define HCI_CMD_READ_NUM_SUPPORTED_IAC 0x0C38 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t num_iac; /* # of supported IAC during scan */ + } hci_read_num_supported_iac_rp; + +#define HCI_OCF_READ_IAC_LAP 0x0039 +#define HCI_CMD_READ_IAC_LAP 0x0C39 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t num_iac; /* # of IAC */ + /* these are repeated "num_iac" times + uint8_t laps[HCI_LAP_SIZE]; --- LAPs */ + } hci_read_iac_lap_rp; + +#define HCI_OCF_WRITE_IAC_LAP 0x003a +#define HCI_CMD_WRITE_IAC_LAP 0x0C3A + typedef struct { + uint8_t num_iac; /* # of IAC */ + /* these are repeated "num_iac" times + uint8_t laps[HCI_LAP_SIZE]; --- LAPs */ + } hci_write_iac_lap_cp; + + typedef hci_status_rp hci_write_iac_lap_rp; + + /* Read Page Scan Period Mode is deprecated */ +#define HCI_OCF_READ_PAGE_SCAN_PERIOD 0x003b +#define HCI_CMD_READ_PAGE_SCAN_PERIOD 0x0C3B + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t page_scan_period_mode; /* Page scan period mode */ + } hci_read_page_scan_period_rp; + + /* Write Page Scan Period Mode is deprecated */ +#define HCI_OCF_WRITE_PAGE_SCAN_PERIOD 0x003c +#define HCI_CMD_WRITE_PAGE_SCAN_PERIOD 0x0C3C + typedef struct { + uint8_t page_scan_period_mode; /* Page scan period mode */ + } hci_write_page_scan_period_cp; + + typedef hci_status_rp hci_write_page_scan_period_rp; + + /* Read Page Scan Mode is deprecated */ +#define HCI_OCF_READ_PAGE_SCAN 0x003d +#define HCI_CMD_READ_PAGE_SCAN 0x0C3D + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t page_scan_mode; /* Page scan mode */ + } hci_read_page_scan_rp; + + /* Write Page Scan Mode is deprecated */ +#define HCI_OCF_WRITE_PAGE_SCAN 0x003e +#define HCI_CMD_WRITE_PAGE_SCAN 0x0C3E + typedef struct { + uint8_t page_scan_mode; /* Page scan mode */ + } hci_write_page_scan_cp; + + typedef hci_status_rp hci_write_page_scan_rp; + +#define HCI_OCF_SET_AFH_CLASSIFICATION 0x003f +#define HCI_CMD_SET_AFH_CLASSIFICATION 0x0C3F + typedef struct { + uint8_t classification[10]; + } hci_set_afh_classification_cp; + + typedef hci_status_rp hci_set_afh_classification_rp; + +#define HCI_OCF_READ_INQUIRY_SCAN_TYPE 0x0042 +#define HCI_CMD_READ_INQUIRY_SCAN_TYPE 0x0C42 + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t type; /* inquiry scan type */ + } hci_read_inquiry_scan_type_rp; + +#define HCI_OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043 +#define HCI_CMD_WRITE_INQUIRY_SCAN_TYPE 0x0C43 + typedef struct { + uint8_t type; /* inquiry scan type */ + } hci_write_inquiry_scan_type_cp; + + typedef hci_status_rp hci_write_inquiry_scan_type_rp; + +#define HCI_OCF_READ_INQUIRY_MODE 0x0044 +#define HCI_CMD_READ_INQUIRY_MODE 0x0C44 + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t mode; /* inquiry mode */ + } hci_read_inquiry_mode_rp; + +#define HCI_OCF_WRITE_INQUIRY_MODE 0x0045 +#define HCI_CMD_WRITE_INQUIRY_MODE 0x0C45 + typedef struct { + uint8_t mode; /* inquiry mode */ + } hci_write_inquiry_mode_cp; + + typedef hci_status_rp hci_write_inquiry_mode_rp; + +#define HCI_OCF_READ_PAGE_SCAN_TYPE 0x0046 +#define HCI_CMD_READ_PAGE_SCAN_TYPE 0x0C46 + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t type; /* page scan type */ + } hci_read_page_scan_type_rp; + +#define HCI_OCF_WRITE_PAGE_SCAN_TYPE 0x0047 +#define HCI_CMD_WRITE_PAGE_SCAN_TYPE 0x0C47 + typedef struct { + uint8_t type; /* page scan type */ + } hci_write_page_scan_type_cp; + + typedef hci_status_rp hci_write_page_scan_type_rp; + +#define HCI_OCF_READ_AFH_ASSESSMENT 0x0048 +#define HCI_CMD_READ_AFH_ASSESSMENT 0x0C48 + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t mode; /* assessment mode */ + } hci_read_afh_assessment_rp; + +#define HCI_OCF_WRITE_AFH_ASSESSMENT 0x0049 +#define HCI_CMD_WRITE_AFH_ASSESSMENT 0x0C49 + typedef struct { + uint8_t mode; /* assessment mode */ + } hci_write_afh_assessment_cp; + + typedef hci_status_rp hci_write_afh_assessment_rp; + +#define HCI_OCF_READ_EXTENDED_INQUIRY_RSP 0x0051 +#define HCI_CMD_READ_EXTENDED_INQUIRY_RSP 0x0C51 + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t fec_required; + uint8_t response[240]; + } hci_read_extended_inquiry_rsp_rp; + +#define HCI_OCF_WRITE_EXTENDED_INQUIRY_RSP 0x0052 +#define HCI_CMD_WRITE_EXTENDED_INQUIRY_RSP 0x0C52 + typedef struct { + uint8_t fec_required; + uint8_t response[240]; + } hci_write_extended_inquiry_rsp_cp; + + typedef hci_status_rp hci_write_extended_inquiry_rsp_rp; + +#define HCI_OCF_REFRESH_ENCRYPTION_KEY 0x0053 +#define HCI_CMD_REFRESH_ENCRYPTION_KEY 0x0C53 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_refresh_encryption_key_cp; + + typedef hci_status_rp hci_refresh_encryption_key_rp; + +#define HCI_OCF_READ_SIMPLE_PAIRING_MODE 0x0055 +#define HCI_CMD_READ_SIMPLE_PAIRING_MODE 0x0C55 + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t mode; /* simple pairing mode */ + } hci_read_simple_pairing_mode_rp; + +#define HCI_OCF_WRITE_SIMPLE_PAIRING_MODE 0x0056 +#define HCI_CMD_WRITE_SIMPLE_PAIRING_MODE 0x0C56 + typedef struct { + uint8_t mode; /* simple pairing mode */ + } hci_write_simple_pairing_mode_cp; + + typedef hci_status_rp hci_write_simple_pairing_mode_rp; + +#define HCI_OCF_READ_LOCAL_OOB_DATA 0x0057 +#define HCI_CMD_READ_LOCAL_OOB_DATA 0x0C57 + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t c[16]; /* pairing hash */ + uint8_t r[16]; /* pairing randomizer */ + } hci_read_local_oob_data_rp; + +#define HCI_OCF_READ_INQUIRY_RSP_XMIT_POWER 0x0058 +#define HCI_CMD_READ_INQUIRY_RSP_XMIT_POWER 0x0C58 + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + int8_t power; /* TX power */ + } hci_read_inquiry_rsp_xmit_power_rp; + +#define HCI_OCF_WRITE_INQUIRY_RSP_XMIT_POWER 0x0059 +#define HCI_CMD_WRITE_INQUIRY_RSP_XMIT_POWER 0x0C59 + typedef struct { + int8_t power; /* TX power */ + } hci_write_inquiry_rsp_xmit_power_cp; + + typedef hci_status_rp hci_write_inquiry_rsp_xmit_power_rp; + +#define HCI_OCF_READ_DEFAULT_ERRDATA_REPORTING 0x005A +#define HCI_CMD_READ_DEFAULT_ERRDATA_REPORTING 0x0C5A + /* No command parameter(s) */ + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t reporting; /* erroneous data reporting */ + } hci_read_default_errdata_reporting_rp; + +#define HCI_OCF_WRITE_DEFAULT_ERRDATA_REPORTING 0x005B +#define HCI_CMD_WRITE_DEFAULT_ERRDATA_REPORTING 0x0C5B + typedef struct { + uint8_t reporting; /* erroneous data reporting */ + } hci_write_default_errdata_reporting_cp; + + typedef hci_status_rp hci_write_default_errdata_reporting_rp; + +#define HCI_OCF_ENHANCED_FLUSH 0x005F +#define HCI_CMD_ENHANCED_FLUSH 0x0C5F + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t packet_type; + } hci_enhanced_flush_cp; + + /* No response parameter(s) */ + +#define HCI_OCF_SEND_KEYPRESS_NOTIFICATION 0x0060 +#define HCI_CMD_SEND_KEYPRESS_NOTIFICATION 0x0C60 + typedef struct { + bdaddr_t bdaddr; /* remote address */ + uint8_t type; /* notification type */ + } hci_send_keypress_notification_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote address */ + } hci_send_keypress_notification_rp; + + /************************************************************************** + ************************************************************************** + ** OGF 0x04 Informational commands and return parameters + ************************************************************************** + **************************************************************************/ + +#define HCI_OGF_INFO 0x04 + +#define HCI_OCF_READ_LOCAL_VER 0x0001 +#define HCI_CMD_READ_LOCAL_VER 0x1001 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t hci_version; /* HCI version */ + uint16_t hci_revision; /* HCI revision */ + uint8_t lmp_version; /* LMP version */ + uint16_t manufacturer; /* Hardware manufacturer name */ + uint16_t lmp_subversion; /* LMP sub-version */ + } hci_read_local_ver_rp; + +#define HCI_OCF_READ_LOCAL_COMMANDS 0x0002 +#define HCI_CMD_READ_LOCAL_COMMANDS 0x1002 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t commands[HCI_COMMANDS_SIZE]; /* opcode bitmask */ + } hci_read_local_commands_rp; + +#define HCI_OCF_READ_LOCAL_FEATURES 0x0003 +#define HCI_CMD_READ_LOCAL_FEATURES 0x1003 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ + } hci_read_local_features_rp; + +#define HCI_OCF_READ_LOCAL_EXTENDED_FEATURES 0x0004 +#define HCI_CMD_READ_LOCAL_EXTENDED_FEATURES 0x1004 + typedef struct { + uint8_t page; /* page number */ + } hci_read_local_extended_features_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t page; /* page number */ + uint8_t max_page; /* maximum page number */ + uint8_t features[HCI_FEATURES_SIZE]; /* LMP features */ + } hci_read_local_extended_features_rp; + +#define HCI_OCF_READ_BUFFER_SIZE 0x0005 +#define HCI_CMD_READ_BUFFER_SIZE 0x1005 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t max_acl_size; /* Max. size of ACL packet (bytes) */ + uint8_t max_sco_size; /* Max. size of SCO packet (bytes) */ + uint16_t num_acl_pkts; /* Max. number of ACL packets */ + uint16_t num_sco_pkts; /* Max. number of SCO packets */ + } hci_read_buffer_size_rp; + + /* Read Country Code is deprecated */ +#define HCI_OCF_READ_COUNTRY_CODE 0x0007 +#define HCI_CMD_READ_COUNTRY_CODE 0x1007 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t country_code; /* 0x00 - NAM, EUR, JP; 0x01 - France */ + } hci_read_country_code_rp; + +#define HCI_OCF_READ_BDADDR 0x0009 +#define HCI_CMD_READ_BDADDR 0x1009 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* unit address */ + } hci_read_bdaddr_rp; + + /************************************************************************** + ************************************************************************** + ** OGF 0x05 Status commands and return parameters + ************************************************************************** + **************************************************************************/ + +#define HCI_OGF_STATUS 0x05 + +#define HCI_OCF_READ_FAILED_CONTACT_CNTR 0x0001 +#define HCI_CMD_READ_FAILED_CONTACT_CNTR 0x1401 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_failed_contact_cntr_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint16_t counter; /* number of consecutive failed contacts */ + } hci_read_failed_contact_cntr_rp; + +#define HCI_OCF_RESET_FAILED_CONTACT_CNTR 0x0002 +#define HCI_CMD_RESET_FAILED_CONTACT_CNTR 0x1402 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_reset_failed_contact_cntr_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + } hci_reset_failed_contact_cntr_rp; + +#define HCI_OCF_READ_LINK_QUALITY 0x0003 +#define HCI_CMD_READ_LINK_QUALITY 0x1403 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_link_quality_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t quality; /* higher value means better quality */ + } hci_read_link_quality_rp; + +#define HCI_OCF_READ_RSSI 0x0005 +#define HCI_CMD_READ_RSSI 0x1405 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_rssi_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + char rssi; /* -127 <= rssi <= 127 dB */ + } hci_read_rssi_rp; + +#define HCI_OCF_READ_AFH_CHANNEL_MAP 0x0006 +#define HCI_CMD_READ_AFH_CHANNEL_MAP 0x1406 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_read_afh_channel_map_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t mode; /* AFH mode */ + uint8_t map[10]; /* AFH Channel Map */ + } hci_read_afh_channel_map_rp; + +#define HCI_OCF_READ_CLOCK 0x0007 +#define HCI_CMD_READ_CLOCK 0x1407 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t clock; /* which clock */ + } hci_read_clock_cp; + + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint32_t clock; /* clock value */ + uint16_t accuracy; /* clock accuracy */ + } hci_read_clock_rp; + + + /************************************************************************** + ************************************************************************** + ** OGF 0x06 Testing commands and return parameters + ************************************************************************** + **************************************************************************/ + +#define HCI_OGF_TESTING 0x06 + +#define HCI_OCF_READ_LOOPBACK_MODE 0x0001 +#define HCI_CMD_READ_LOOPBACK_MODE 0x1801 + /* No command parameter(s) */ + typedef struct { + uint8_t status; /* 0x00 - success */ + uint8_t lbmode; /* loopback mode */ + } hci_read_loopback_mode_rp; + +#define HCI_OCF_WRITE_LOOPBACK_MODE 0x0002 +#define HCI_CMD_WRITE_LOOPBACK_MODE 0x1802 + typedef struct { + uint8_t lbmode; /* loopback mode */ + } hci_write_loopback_mode_cp; + + typedef hci_status_rp hci_write_loopback_mode_rp; + +#define HCI_OCF_ENABLE_UNIT_UNDER_TEST 0x0003 +#define HCI_CMD_ENABLE_UNIT_UNDER_TEST 0x1803 + /* No command parameter(s) */ + typedef hci_status_rp hci_enable_unit_under_test_rp; + +#define HCI_OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x0004 +#define HCI_CMD_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x1804 + typedef struct { + uint8_t mode; /* simple pairing debug mode */ + } hci_write_simple_pairing_debug_mode_cp; + + typedef hci_status_rp hci_write_simple_pairing_debug_mode_rp; + + /************************************************************************** + ************************************************************************** + ** OGF 0x3e Bluetooth Logo Testing + ** OGF 0x3f Vendor Specific + ************************************************************************** + **************************************************************************/ + +#define HCI_OGF_BT_LOGO 0x3e +#define HCI_OGF_VENDOR 0x3f + + /* Ericsson specific FC */ +#define HCI_CMD_ERICSSON_WRITE_PCM_SETTINGS 0xFC07 +#define HCI_CMD_ERICSSON_SET_UART_BAUD_RATE 0xFC09 +#define HCI_CMD_ERICSSON_SET_SCO_DATA_PATH 0xFC1D + + /* Cambridge Silicon Radio specific FC */ +#define HCI_CMD_CSR_EXTN 0xFC00 + + + /************************************************************************** + ************************************************************************** + ** Events and event parameters + ************************************************************************** + **************************************************************************/ + +#define HCI_EVENT_INQUIRY_COMPL 0x01 + typedef struct { + uint8_t status; /* 0x00 - success */ + } hci_inquiry_compl_ep; + +#define HCI_EVENT_INQUIRY_RESULT 0x02 + typedef struct { + uint8_t num_responses; /* number of responses */ + /* hci_inquiry_response[num_responses] -- see below */ + } hci_inquiry_result_ep; + + typedef struct { + bdaddr_t bdaddr; /* unit address */ + uint8_t page_scan_rep_mode; /* page scan rep. mode */ + uint8_t page_scan_period_mode; /* page scan period mode */ + uint8_t page_scan_mode; /* page scan mode */ + uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ + uint16_t clock_offset; /* clock offset */ + } hci_inquiry_response; + +#define HCI_EVENT_CON_COMPL 0x03 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* Connection handle */ + bdaddr_t bdaddr; /* remote unit address */ + uint8_t link_type; /* Link type */ + uint8_t encryption_mode; /* Encryption mode */ + } hci_con_compl_ep; + +#define HCI_EVENT_CON_REQ 0x04 + typedef struct { + bdaddr_t bdaddr; /* remote unit address */ + uint8_t uclass[HCI_CLASS_SIZE]; /* remote unit class */ + uint8_t link_type; /* link type */ + } hci_con_req_ep; + +#define HCI_EVENT_DISCON_COMPL 0x05 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t reason; /* reason to disconnect */ + } hci_discon_compl_ep; + +#define HCI_EVENT_AUTH_COMPL 0x06 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + } hci_auth_compl_ep; + +#define HCI_EVENT_REMOTE_NAME_REQ_COMPL 0x07 + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote unit address */ + char name[HCI_UNIT_NAME_SIZE]; /* remote unit name */ + } hci_remote_name_req_compl_ep; + +#define HCI_EVENT_ENCRYPTION_CHANGE 0x08 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* Connection handle */ + uint8_t encryption_enable; /* 0x00 - disable */ + } hci_encryption_change_ep; + +#define HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL 0x09 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* Connection handle */ + } hci_change_con_link_key_compl_ep; + +#define HCI_EVENT_MASTER_LINK_KEY_COMPL 0x0a + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* Connection handle */ + uint8_t key_flag; /* Key flag */ + } hci_master_link_key_compl_ep; + +#define HCI_EVENT_READ_REMOTE_FEATURES_COMPL 0x0b + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* Connection handle */ + uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ + } hci_read_remote_features_compl_ep; + +#define HCI_EVENT_READ_REMOTE_VER_INFO_COMPL 0x0c + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* Connection handle */ + uint8_t lmp_version; /* LMP version */ + uint16_t manufacturer; /* Hardware manufacturer name */ + uint16_t lmp_subversion; /* LMP sub-version */ + } hci_read_remote_ver_info_compl_ep; + +#define HCI_EVENT_QOS_SETUP_COMPL 0x0d + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t flags; /* reserved for future use */ + uint8_t service_type; /* service type */ + uint32_t token_rate; /* bytes per second */ + uint32_t peak_bandwidth; /* bytes per second */ + uint32_t latency; /* microseconds */ + uint32_t delay_variation; /* microseconds */ + } hci_qos_setup_compl_ep; + +#define HCI_EVENT_COMMAND_COMPL 0x0e + typedef struct { + uint8_t num_cmd_pkts; /* # of HCI command packets */ + uint16_t opcode; /* command OpCode */ + /* command return parameters (if any) */ + } hci_command_compl_ep; + +#define HCI_EVENT_COMMAND_STATUS 0x0f + typedef struct { + uint8_t status; /* 0x00 - pending */ + uint8_t num_cmd_pkts; /* # of HCI command packets */ + uint16_t opcode; /* command OpCode */ + } hci_command_status_ep; + +#define HCI_EVENT_HARDWARE_ERROR 0x10 + typedef struct { + uint8_t hardware_code; /* hardware error code */ + } hci_hardware_error_ep; + +#define HCI_EVENT_FLUSH_OCCUR 0x11 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_flush_occur_ep; + +#define HCI_EVENT_ROLE_CHANGE 0x12 + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* address of remote unit */ + uint8_t role; /* new connection role */ + } hci_role_change_ep; + +#define HCI_EVENT_NUM_COMPL_PKTS 0x13 + typedef struct { + uint8_t num_con_handles; /* # of connection handles */ + /* these are repeated "num_con_handles" times + uint16_t con_handle; --- connection handle(s) + uint16_t compl_pkts; --- # of completed packets */ + } hci_num_compl_pkts_ep; + +#define HCI_EVENT_MODE_CHANGE 0x14 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t unit_mode; /* remote unit mode */ + uint16_t interval; /* interval * 0.625 msec */ + } hci_mode_change_ep; + +#define HCI_EVENT_RETURN_LINK_KEYS 0x15 + typedef struct { + uint8_t num_keys; /* # of keys */ + /* these are repeated "num_keys" times + bdaddr_t bdaddr; --- remote address(es) + uint8_t key[HCI_KEY_SIZE]; --- key(s) */ + } hci_return_link_keys_ep; + +#define HCI_EVENT_PIN_CODE_REQ 0x16 + typedef struct { + bdaddr_t bdaddr; /* remote unit address */ + } hci_pin_code_req_ep; + +#define HCI_EVENT_LINK_KEY_REQ 0x17 + typedef struct { + bdaddr_t bdaddr; /* remote unit address */ + } hci_link_key_req_ep; + +#define HCI_EVENT_LINK_KEY_NOTIFICATION 0x18 + typedef struct { + bdaddr_t bdaddr; /* remote unit address */ + uint8_t key[HCI_KEY_SIZE]; /* link key */ + uint8_t key_type; /* type of the key */ + } hci_link_key_notification_ep; + +#define HCI_EVENT_LOOPBACK_COMMAND 0x19 + typedef hci_cmd_hdr_t hci_loopback_command_ep; + +#define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1a + typedef struct { + uint8_t link_type; /* Link type */ + } hci_data_buffer_overflow_ep; + +#define HCI_EVENT_MAX_SLOT_CHANGE 0x1b + typedef struct { + uint16_t con_handle; /* connection handle */ + uint8_t lmp_max_slots; /* Max. # of slots allowed */ + } hci_max_slot_change_ep; + +#define HCI_EVENT_READ_CLOCK_OFFSET_COMPL 0x1c + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* Connection handle */ + uint16_t clock_offset; /* Clock offset */ + } hci_read_clock_offset_compl_ep; + +#define HCI_EVENT_CON_PKT_TYPE_CHANGED 0x1d + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint16_t pkt_type; /* packet type */ + } hci_con_pkt_type_changed_ep; + +#define HCI_EVENT_QOS_VIOLATION 0x1e + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_qos_violation_ep; + + /* Page Scan Mode Change Event is deprecated */ +#define HCI_EVENT_PAGE_SCAN_MODE_CHANGE 0x1f + typedef struct { + bdaddr_t bdaddr; /* destination address */ + uint8_t page_scan_mode; /* page scan mode */ + } hci_page_scan_mode_change_ep; + +#define HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE 0x20 + typedef struct { + bdaddr_t bdaddr; /* destination address */ + uint8_t page_scan_rep_mode; /* page scan repetition mode */ + } hci_page_scan_rep_mode_change_ep; + +#define HCI_EVENT_FLOW_SPECIFICATION_COMPL 0x21 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t flags; /* reserved */ + uint8_t direction; /* flow direction */ + uint8_t type; /* service type */ + uint32_t token_rate; /* token rate */ + uint32_t bucket_size; /* token bucket size */ + uint32_t peak_bandwidth; /* peak bandwidth */ + uint32_t latency; /* access latency */ + } hci_flow_specification_compl_ep; + +#define HCI_EVENT_RSSI_RESULT 0x22 + typedef struct { + uint8_t num_responses; /* number of responses */ + /* hci_rssi_response[num_responses] -- see below */ + } hci_rssi_result_ep; + + typedef struct { + bdaddr_t bdaddr; /* unit address */ + uint8_t page_scan_rep_mode; /* page scan rep. mode */ + uint8_t blank; /* reserved */ + uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ + uint16_t clock_offset; /* clock offset */ + int8_t rssi; /* rssi */ + } hci_rssi_response; + +#define HCI_EVENT_READ_REMOTE_EXTENDED_FEATURES 0x23 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t page; /* page number */ + uint8_t max; /* max page number */ + uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ + } hci_read_remote_extended_features_ep; + +#define HCI_EVENT_SCO_CON_COMPL 0x2c + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + bdaddr_t bdaddr; /* unit address */ + uint8_t link_type; /* link type */ + uint8_t interval; /* transmission interval */ + uint8_t window; /* retransmission window */ + uint16_t rxlen; /* rx packet length */ + uint16_t txlen; /* tx packet length */ + uint8_t mode; /* air mode */ + } hci_sco_con_compl_ep; + +#define HCI_EVENT_SCO_CON_CHANGED 0x2d + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint8_t interval; /* transmission interval */ + uint8_t window; /* retransmission window */ + uint16_t rxlen; /* rx packet length */ + uint16_t txlen; /* tx packet length */ + } hci_sco_con_changed_ep; + +#define HCI_EVENT_SNIFF_SUBRATING 0x2e + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + uint16_t tx_latency; /* max transmit latency */ + uint16_t rx_latency; /* max receive latency */ + uint16_t remote_timeout; /* remote timeout */ + uint16_t local_timeout; /* local timeout */ + } hci_sniff_subrating_ep; + +#define HCI_EVENT_EXTENDED_RESULT 0x2f + typedef struct { + uint8_t num_responses; /* must be 0x01 */ + bdaddr_t bdaddr; /* remote device address */ + uint8_t page_scan_rep_mode; + uint8_t reserved; + uint8_t uclass[HCI_CLASS_SIZE]; + uint16_t clock_offset; + int8_t rssi; + uint8_t response[240]; /* extended inquiry response */ + } hci_extended_result_ep; + +#define HCI_EVENT_ENCRYPTION_KEY_REFRESH 0x30 + typedef struct { + uint8_t status; /* 0x00 - success */ + uint16_t con_handle; /* connection handle */ + } hci_encryption_key_refresh_ep; + +#define HCI_EVENT_IO_CAPABILITY_REQ 0x31 + typedef struct { + bdaddr_t bdaddr; /* remote device address */ + } hci_io_capability_req_ep; + +#define HCI_EVENT_IO_CAPABILITY_RSP 0x32 + typedef struct { + bdaddr_t bdaddr; /* remote device address */ + uint8_t io_capability; + uint8_t oob_data_present; + uint8_t auth_requirement; + } hci_io_capability_rsp_ep; + +#define HCI_EVENT_USER_CONFIRM_REQ 0x33 + typedef struct { + bdaddr_t bdaddr; /* remote device address */ + uint32_t value; /* 000000 - 999999 */ + } hci_user_confirm_req_ep; + +#define HCI_EVENT_USER_PASSKEY_REQ 0x34 + typedef struct { + bdaddr_t bdaddr; /* remote device address */ + } hci_user_passkey_req_ep; + +#define HCI_EVENT_REMOTE_OOB_DATA_REQ 0x35 + typedef struct { + bdaddr_t bdaddr; /* remote device address */ + } hci_remote_oob_data_req_ep; + +#define HCI_EVENT_SIMPLE_PAIRING_COMPL 0x36 + typedef struct { + uint8_t status; /* 0x00 - success */ + bdaddr_t bdaddr; /* remote device address */ + } hci_simple_pairing_compl_ep; + +#define HCI_EVENT_LINK_SUPERVISION_TO_CHANGED 0x38 + typedef struct { + uint16_t con_handle; /* connection handle */ + uint16_t timeout; /* link supervision timeout */ + } hci_link_supervision_to_changed_ep; + +#define HCI_EVENT_ENHANCED_FLUSH_COMPL 0x39 + typedef struct { + uint16_t con_handle; /* connection handle */ + } hci_enhanced_flush_compl_ep; + +#define HCI_EVENT_USER_PASSKEY_NOTIFICATION 0x3b + typedef struct { + bdaddr_t bdaddr; /* remote device address */ + uint32_t value; /* 000000 - 999999 */ + } hci_user_passkey_notification_ep; + +#define HCI_EVENT_KEYPRESS_NOTIFICATION 0x3c + typedef struct { + bdaddr_t bdaddr; /* remote device address */ + uint8_t notification_type; + } hci_keypress_notification_ep; + +#define HCI_EVENT_REMOTE_FEATURES_NOTIFICATION 0x3d + typedef struct { + bdaddr_t bdaddr; /* remote device address */ + uint8_t features[HCI_FEATURES_SIZE]; /* LMP features bitmsk*/ + } hci_remote_features_notification_ep; + +#define HCI_EVENT_BT_LOGO 0xfe + +#define HCI_EVENT_VENDOR 0xff + + /************************************************************************** + ************************************************************************** + ** HCI Socket Definitions + ************************************************************************** + **************************************************************************/ + + /* HCI socket options */ +#define SO_HCI_EVT_FILTER 1 /* get/set event filter */ +#define SO_HCI_PKT_FILTER 2 /* get/set packet filter */ +#define SO_HCI_DIRECTION 3 /* packet direction indicator */ + + /* Control Messages */ +#define SCM_HCI_DIRECTION SO_HCI_DIRECTION + + /* + * HCI socket filter and get/set routines + * + * for ease of use, we filter 256 possible events/packets + */ + struct hci_filter { + uint32_t mask[8]; /* 256 bits */ + }; + + static __inline void + hci_filter_set(uint8_t bit, struct hci_filter *filter) + { + uint8_t off = bit - 1; + + off >>= 5; + filter->mask[off] |= (1 << ((bit - 1) & 0x1f)); + } + + static __inline void + hci_filter_clr(uint8_t bit, struct hci_filter *filter) + { + uint8_t off = bit - 1; + + off >>= 5; + filter->mask[off] &= ~(1 << ((bit - 1) & 0x1f)); + } + + static __inline int + hci_filter_test(uint8_t bit, struct hci_filter *filter) + { + uint8_t off = bit - 1; + + off >>= 5; + return (filter->mask[off] & (1 << ((bit - 1) & 0x1f))); + } + + /* + * HCI socket ioctl's + * + * Apart from GBTINFOA, these are all indexed on the unit name + */ + +#define SIOCGBTINFO _IOWR('b', 5, struct btreq) /* get unit info */ +#define SIOCGBTINFOA _IOWR('b', 6, struct btreq) /* get info by address */ +#define SIOCNBTINFO _IOWR('b', 7, struct btreq) /* next unit info */ + +#define SIOCSBTFLAGS _IOWR('b', 8, struct btreq) /* set unit flags */ +#define SIOCSBTPOLICY _IOWR('b', 9, struct btreq) /* set unit link policy */ +#define SIOCSBTPTYPE _IOWR('b', 10, struct btreq) /* set unit packet type */ + +#define SIOCGBTSTATS _IOWR('b', 11, struct btreq) /* get unit statistics */ +#define SIOCZBTSTATS _IOWR('b', 12, struct btreq) /* zero unit statistics */ + +#define SIOCBTDUMP _IOW('b', 13, struct btreq) /* print debug info */ +#define SIOCSBTSCOMTU _IOWR('b', 17, struct btreq) /* set sco_mtu value */ + + struct bt_stats { + uint32_t err_tx; + uint32_t err_rx; + uint32_t cmd_tx; + uint32_t evt_rx; + uint32_t acl_tx; + uint32_t acl_rx; + uint32_t sco_tx; + uint32_t sco_rx; + uint32_t byte_tx; + uint32_t byte_rx; + }; + + struct btreq { + char btr_name[HCI_DEVNAME_SIZE]; /* device name */ + + union { + struct { + bdaddr_t btri_bdaddr; /* device bdaddr */ + uint16_t btri_flags; /* flags */ + uint16_t btri_num_cmd; /* # of free cmd buffers */ + uint16_t btri_num_acl; /* # of free ACL buffers */ + uint16_t btri_num_sco; /* # of free SCO buffers */ + uint16_t btri_acl_mtu; /* ACL mtu */ + uint16_t btri_sco_mtu; /* SCO mtu */ + uint16_t btri_link_policy; /* Link Policy */ + uint16_t btri_packet_type; /* Packet Type */ + } btri; + struct bt_stats btrs; /* unit stats */ + } btru; + }; + +#define btr_flags btru.btri.btri_flags +#define btr_bdaddr btru.btri.btri_bdaddr +#define btr_num_cmd btru.btri.btri_num_cmd +#define btr_num_acl btru.btri.btri_num_acl +#define btr_num_sco btru.btri.btri_num_sco +#define btr_acl_mtu btru.btri.btri_acl_mtu +#define btr_sco_mtu btru.btri.btri_sco_mtu +#define btr_link_policy btru.btri.btri_link_policy +#define btr_packet_type btru.btri.btri_packet_type +#define btr_stats btru.btrs + + /* hci_unit & btr_flags */ +#define BTF_UP (1<<0) /* unit is up */ +#define BTF_RUNNING (1<<1) /* unit is running */ +#define BTF_XMIT_CMD (1<<2) /* unit is transmitting CMD packets */ +#define BTF_XMIT_ACL (1<<3) /* unit is transmitting ACL packets */ +#define BTF_XMIT_SCO (1<<4) /* unit is transmitting SCO packets */ +#define BTF_XMIT (BTF_XMIT_CMD | BTF_XMIT_ACL | BTF_XMIT_SCO) +#define BTF_INIT_BDADDR (1<<5) /* waiting for bdaddr */ +#define BTF_INIT_BUFFER_SIZE (1<<6) /* waiting for buffer size */ +#define BTF_INIT_FEATURES (1<<7) /* waiting for features */ +#define BTF_POWER_UP_NOOP (1<<8) /* should wait for No-op on power up */ +#define BTF_INIT_COMMANDS (1<<9) /* waiting for supported commands */ + +#define BTF_INIT (BTF_INIT_BDADDR \ + | BTF_INIT_BUFFER_SIZE \ + | BTF_INIT_FEATURES \ + | BTF_INIT_COMMANDS) + + +// ================================================================================== +// own but i want them inside the pragma .... +// we have to clean it btw :) + +struct SCommandMessage +{ + u16 Opcode; + u8 len; +}; + +struct SHCIEventCommand +{ + u8 EventType; + u8 PayloadLength; + u8 PacketIndicator; + u16 Opcode; +}; + +struct SHCIEventStatus +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + u8 PacketIndicator; + u16 Opcode; +}; + +struct SHCIEventInquiryResult +{ + u8 EventType; + u8 PayloadLength; + u8 num_responses; +}; + +struct SHCIEventInquiryComplete +{ + u8 EventType; + u8 PayloadLength; + u8 Status; +}; + +struct SHCIEventReadClockOffsetComplete +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + u16 ConnectionHandle; + u16 ClockOffset; +}; + +struct SHCIEventReadRemoteVerInfo +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + u16 ConnectionHandle; + u8 lmp_version; + u16 manufacturer; + u16 lmp_subversion; +}; + +struct SHCIEventReadRemoteFeatures +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + u16 ConnectionHandle; + u8 features[HCI_FEATURES_SIZE]; +}; + +struct SHCIEventRemoteNameReq +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + bdaddr_t bdaddr; + u8 RemoteName[248]; +}; + +struct SHCIEventRequestConnection +{ + u8 EventType; + u8 PayloadLength; + bdaddr_t bdaddr; + uint8_t uclass[HCI_CLASS_SIZE]; /* unit class */ + u8 LinkType; +}; + +struct SHCIEventConnectionComplete +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + u16 Connection_Handle; + bdaddr_t bdaddr; + u8 LinkType; + u8 EncryptionEnabled; +}; + +struct SHCIEventRoleChange +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + bdaddr_t bdaddr; + u8 NewRole; +}; + +struct SHCIEventNumberOfCompletedPackets +{ + u8 EventType; + u8 PayloadLength; + u8 NumberOfHandles; + u16 Connection_Handle; + u16 Number_Of_Completed_Packets; +}; + +struct SHCIEventAuthenticationCompleted +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + u16 Connection_Handle; +}; + + +struct SHCIEventModeChange +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + u16 Connection_Handle; + u8 CurrentMode; + u16 Value; + +}; + +struct SHCIEventDisconnectCompleted +{ + u8 EventType; + u8 PayloadLength; + u8 Status; + u16 Connection_Handle; + u8 Reason; +}; + +struct SHCIEventRequestLinkKey +{ + u8 EventType; + u8 PayloadLength; + bdaddr_t bdaddr; +}; + +struct SHCIEventLinkKeyNotification +{ + u8 EventType; + u8 PayloadLength; + u8 numKeys; + bdaddr_t bdaddr; + u8 LinkKey[16]; +}; + +#ifdef __cplusplus +} +#endif + +#if defined(_MSC_VER) + #pragma pack(pop) +#endif + +#endif /* _NETBT_HCI_H */ diff --git a/Source/Core/Core/Src/IPC_HLE/l2cap.h b/Source/Core/Core/Src/IPC_HLE/l2cap.h index ca23f20f0b..85538abe45 100644 --- a/Source/Core/Core/Src/IPC_HLE/l2cap.h +++ b/Source/Core/Core/Src/IPC_HLE/l2cap.h @@ -218,56 +218,56 @@ struct value_string char* string; }; -static const value_string command_code_vals[] = { - { 0x01, (char *)"Command Reject" }, - { 0x02, (char *)"Connection Request" }, - { 0x03, (char *)"Connection Response" }, - { 0x04, (char *)"Configure Request" }, - { 0x05, (char *)"Configure Response" }, - { 0x06, (char *)"Disconnect Request" }, - { 0x07, (char *)"Disconnect Response" }, - { 0x08, (char *)"Echo Request" }, - { 0x09, (char *)"Echo Response" }, - { 0x0A, (char *)"Information Request" }, - { 0x0B, (char *)"Information Response" }, - { 0, NULL } -}; - - - -static const value_string psm_vals[] = { - { 0x0001, (char *)"SDP" }, - { 0x0003, (char *)"RFCOMM" }, - { 0x0005, (char *)"TCS-BIN" }, - { 0x0007, (char *)"TCS-BIN-CORDLESS" }, - { 0x000F, (char *)"BNEP" }, - { 0x0011, (char *)"HID_CONTROL" }, - { 0x0013, (char *)"HID_INTERRUPT" }, - { 0x0015, (char *)"UPnP" }, - { 0x0017, (char *)"AVCTP" }, - { 0x0019, (char *)"AVDTP" }, - { 0x001D, (char *)"UDI_C-Plane" }, - { 0, NULL } -}; - - -static const value_string result_vals[] = { - { 0x0000, (char *)"Connection successful" }, - { 0x0001, (char *)"Connection pending" }, - { 0x0002, (char *)"Connection Refused - PSM not supported" }, - { 0x0003, (char *)"Connection refused - security block" }, - { 0x0004, (char *)"Connection refused - no resources available" }, - { 0, NULL } -}; - - -static const value_string status_vals[] = { - { 0x0000, (char *)"No further information available" }, - { 0x0001, (char *)"Authentication panding" }, - { 0x0002, (char *)"Authorization pending" }, - { 0, NULL } -}; - +static const value_string command_code_vals[] = { + { 0x01, (char *)"Command Reject" }, + { 0x02, (char *)"Connection Request" }, + { 0x03, (char *)"Connection Response" }, + { 0x04, (char *)"Configure Request" }, + { 0x05, (char *)"Configure Response" }, + { 0x06, (char *)"Disconnect Request" }, + { 0x07, (char *)"Disconnect Response" }, + { 0x08, (char *)"Echo Request" }, + { 0x09, (char *)"Echo Response" }, + { 0x0A, (char *)"Information Request" }, + { 0x0B, (char *)"Information Response" }, + { 0, NULL } +}; + + + +static const value_string psm_vals[] = { + { 0x0001, (char *)"SDP" }, + { 0x0003, (char *)"RFCOMM" }, + { 0x0005, (char *)"TCS-BIN" }, + { 0x0007, (char *)"TCS-BIN-CORDLESS" }, + { 0x000F, (char *)"BNEP" }, + { 0x0011, (char *)"HID_CONTROL" }, + { 0x0013, (char *)"HID_INTERRUPT" }, + { 0x0015, (char *)"UPnP" }, + { 0x0017, (char *)"AVCTP" }, + { 0x0019, (char *)"AVDTP" }, + { 0x001D, (char *)"UDI_C-Plane" }, + { 0, NULL } +}; + + +static const value_string result_vals[] = { + { 0x0000, (char *)"Connection successful" }, + { 0x0001, (char *)"Connection pending" }, + { 0x0002, (char *)"Connection Refused - PSM not supported" }, + { 0x0003, (char *)"Connection refused - security block" }, + { 0x0004, (char *)"Connection refused - no resources available" }, + { 0, NULL } +}; + + +static const value_string status_vals[] = { + { 0x0000, (char *)"No further information available" }, + { 0x0001, (char *)"Authentication panding" }, + { 0x0002, (char *)"Authorization pending" }, + { 0, NULL } +}; + diff --git a/Source/Core/Core/Src/LogManager.h b/Source/Core/Core/Src/LogManager.h index d2a60113fc..df7e646ffc 100644 --- a/Source/Core/Core/Src/LogManager.h +++ b/Source/Core/Core/Src/LogManager.h @@ -1,130 +1,130 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -// Dolphin Logging framework. Needs a good ol' spring cleaning methinks. - -#ifndef _LOGMANAGER_H -#define _LOGMANAGER_H - -#include "Common.h" - -class CLogWindow; - -// should be inside the LogManager ... -struct CDebugger_Log -{ - char m_szName[128]; - char m_szShortName[32]; - char m_szShortName_[32]; // save the unadjusted originals here - char m_szFilename[256]; - bool m_bLogToFile; - bool m_bShowInLog; - bool m_bEnable; - FILE *m_pFile; - - void Init(); - void Shutdown(); - - // constructor - CDebugger_Log(const char* _szShortName, const char* _szName, int a); - - // destructor - ~CDebugger_Log(); -}; - -// make a variable that can be accessed from both LogManager.cpp and LogWindow.cpp -struct CDebugger_LogSettings -{ - int m_iVerbosity; // verbosity level 0 - 2 - bool bResolve; - bool bWriteMaster; - bool bUnify; - - // constructor - CDebugger_LogSettings(); - - // destructor - ~CDebugger_LogSettings(); -}; - -class LogManager -{ - #define MAX_MESSAGES 8000 // the old value was to large - #define MAX_MSGLEN 256 -public: - - // Message - struct SMessage - { - bool m_bInUse; - LogTypes::LOG_TYPE m_type; - int m_verbosity; - char m_szMessage[MAX_MSGLEN]; - int m_dwMsgLen; - - // constructor - SMessage() : - m_bInUse(false) - {} - - // set - void Set(LogTypes::LOG_TYPE _type, int _verbosity, char* _szMessage) - { - strncpy(m_szMessage, _szMessage, MAX_MSGLEN-1); - m_szMessage[MAX_MSGLEN-1] = 0; - m_dwMsgLen = (int)strlen(m_szMessage); - - if (m_dwMsgLen == (MAX_MSGLEN-1)) - { - m_szMessage[m_dwMsgLen-2] = 0xd; - m_szMessage[m_dwMsgLen-1] = 0xa; - } - m_szMessage[m_dwMsgLen] = 0; - - m_type = _type; - m_verbosity = _verbosity; - m_bInUse = true; // turn on this message line - } - // - static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...); - }; -private: - enum LOG_SETTINGS - { - VERBOSITY_LEVELS = 3 - }; - - friend class CDebugger_LogWindow; - friend class CLogWindow; - static SMessage (*m_Messages)[MAX_MESSAGES]; - static int m_nextMessages[VERBOSITY_LEVELS + 1]; - static int m_activeLog; - static bool m_bDirty; - static bool m_bInitialized; - static CDebugger_LogSettings* m_LogSettings; - static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them -public: - static void Init(); - static void Clear(void); - static void Shutdown(); - static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...); -}; - -extern bool IsLoggingActivated(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +// Dolphin Logging framework. Needs a good ol' spring cleaning methinks. + +#ifndef _LOGMANAGER_H +#define _LOGMANAGER_H + +#include "Common.h" + +class CLogWindow; + +// should be inside the LogManager ... +struct CDebugger_Log +{ + char m_szName[128]; + char m_szShortName[32]; + char m_szShortName_[32]; // save the unadjusted originals here + char m_szFilename[256]; + bool m_bLogToFile; + bool m_bShowInLog; + bool m_bEnable; + FILE *m_pFile; + + void Init(); + void Shutdown(); + + // constructor + CDebugger_Log(const char* _szShortName, const char* _szName, int a); + + // destructor + ~CDebugger_Log(); +}; + +// make a variable that can be accessed from both LogManager.cpp and LogWindow.cpp +struct CDebugger_LogSettings +{ + int m_iVerbosity; // verbosity level 0 - 2 + bool bResolve; + bool bWriteMaster; + bool bUnify; + + // constructor + CDebugger_LogSettings(); + + // destructor + ~CDebugger_LogSettings(); +}; + +class LogManager +{ + #define MAX_MESSAGES 8000 // the old value was to large + #define MAX_MSGLEN 256 +public: + + // Message + struct SMessage + { + bool m_bInUse; + LogTypes::LOG_TYPE m_type; + int m_verbosity; + char m_szMessage[MAX_MSGLEN]; + int m_dwMsgLen; + + // constructor + SMessage() : + m_bInUse(false) + {} + + // set + void Set(LogTypes::LOG_TYPE _type, int _verbosity, char* _szMessage) + { + strncpy(m_szMessage, _szMessage, MAX_MSGLEN-1); + m_szMessage[MAX_MSGLEN-1] = 0; + m_dwMsgLen = (int)strlen(m_szMessage); + + if (m_dwMsgLen == (MAX_MSGLEN-1)) + { + m_szMessage[m_dwMsgLen-2] = 0xd; + m_szMessage[m_dwMsgLen-1] = 0xa; + } + m_szMessage[m_dwMsgLen] = 0; + + m_type = _type; + m_verbosity = _verbosity; + m_bInUse = true; // turn on this message line + } + // + static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...); + }; +private: + enum LOG_SETTINGS + { + VERBOSITY_LEVELS = 3 + }; + + friend class CDebugger_LogWindow; + friend class CLogWindow; + static SMessage (*m_Messages)[MAX_MESSAGES]; + static int m_nextMessages[VERBOSITY_LEVELS + 1]; + static int m_activeLog; + static bool m_bDirty; + static bool m_bInitialized; + static CDebugger_LogSettings* m_LogSettings; + static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them +public: + static void Init(); + static void Clear(void); + static void Shutdown(); + static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...); +}; + +extern bool IsLoggingActivated(); + +#endif diff --git a/Source/Core/Core/Src/MemTools.h b/Source/Core/Core/Src/MemTools.h index 93053f56fd..4cee0d8ec6 100644 --- a/Source/Core/Core/Src/MemTools.h +++ b/Source/Core/Core/Src/MemTools.h @@ -1,30 +1,30 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MEMTOOLS_H -#define _MEMTOOLS_H - -#include "Common.h" - - -namespace EMM -{ - typedef u32 EAddr; - void InstallExceptionHandler(); -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MEMTOOLS_H +#define _MEMTOOLS_H + +#include "Common.h" + + +namespace EMM +{ + typedef u32 EAddr; + void InstallExceptionHandler(); +} + +#endif diff --git a/Source/Core/Core/Src/PatchEngine.h b/Source/Core/Core/Src/PatchEngine.h index f01f670365..ee2fc6d9c9 100644 --- a/Source/Core/Core/Src/PatchEngine.h +++ b/Source/Core/Core/Src/PatchEngine.h @@ -1,64 +1,64 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PATCHENGINE_H -#define _PATCHENGINE_H - -#include "IniFile.h" - -namespace PatchEngine -{ - -enum PatchType -{ - PATCH_8BIT, - PATCH_16BIT, - PATCH_32BIT, -}; - -static const char *PatchTypeStrings[] = -{ - "byte", - "word", - "dword", - 0 -}; - -struct PatchEntry -{ - PatchEntry() {} - PatchEntry(PatchType _t, u32 _addr, u32 _value) : type(_t), address(_addr), value(_value) {} - PatchType type; - u32 address; - u32 value; -}; - -struct Patch -{ - std::string name; - std::vector entries; - bool active; -}; - -int GetSpeedhackCycles(u32 addr); -void LoadPatchSection(const char *section, std::vector &patches, IniFile &ini); -void LoadPatches(const char *gameID); -void ApplyFramePatches(); -void ApplyARPatches(); -} // namespace - -#endif //_PATCHENGINE_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PATCHENGINE_H +#define _PATCHENGINE_H + +#include "IniFile.h" + +namespace PatchEngine +{ + +enum PatchType +{ + PATCH_8BIT, + PATCH_16BIT, + PATCH_32BIT, +}; + +static const char *PatchTypeStrings[] = +{ + "byte", + "word", + "dword", + 0 +}; + +struct PatchEntry +{ + PatchEntry() {} + PatchEntry(PatchType _t, u32 _addr, u32 _value) : type(_t), address(_addr), value(_value) {} + PatchType type; + u32 address; + u32 value; +}; + +struct Patch +{ + std::string name; + std::vector entries; + bool active; +}; + +int GetSpeedhackCycles(u32 addr); +void LoadPatchSection(const char *section, std::vector &patches, IniFile &ini); +void LoadPatches(const char *gameID); +void ApplyFramePatches(); +void ApplyARPatches(); +} // namespace + +#endif //_PATCHENGINE_H diff --git a/Source/Core/Core/Src/Plugins/Plugin_DSP.h b/Source/Core/Core/Src/Plugins/Plugin_DSP.h index ae6509eddb..252b70d0cf 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_DSP.h +++ b/Source/Core/Core/Src/Plugins/Plugin_DSP.h @@ -1,61 +1,61 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PLUGIN_DSP_H -#define _PLUGIN_DSP_H - -#include "pluginspecs_dsp.h" - -namespace PluginDSP -{ -bool IsLoaded(); -bool LoadPlugin(const char *_Filename); -void UnloadPlugin(); - -// Function Types -typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); -typedef void (__cdecl* TDllConfig)(HWND); -typedef void (__cdecl* TDllDebugger)(HWND, bool); -typedef void (__cdecl* TDSP_Initialize)(DSPInitialize); -typedef void (__cdecl* TDSP_Shutdown)(); -typedef void (__cdecl* TDSP_WriteMailBox)(BOOL _CPUMailbox, unsigned short); -typedef unsigned short (__cdecl* TDSP_ReadMailBox)(BOOL _CPUMailbox); -typedef unsigned short (__cdecl* TDSP_ReadControlRegister)(); -typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short); -typedef void (__cdecl* TDSP_Update)(int cycles); -typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate); -typedef void (__cdecl* TDSP_DoState)(unsigned char **ptr, int mode); - -// Function Pointers -extern TGetDllInfo GetDllInfo; -extern TDllConfig DllConfig; -extern TDllDebugger DllDebugger; -extern TDSP_Initialize DSP_Initialize; -extern TDSP_Shutdown DSP_Shutdown; -extern TDSP_ReadMailBox DSP_ReadMailboxHigh; -extern TDSP_ReadMailBox DSP_ReadMailboxLow; -extern TDSP_WriteMailBox DSP_WriteMailboxHigh; -extern TDSP_WriteMailBox DSP_WriteMailboxLow; -extern TDSP_ReadControlRegister DSP_ReadControlRegister; -extern TDSP_WriteControlRegister DSP_WriteControlRegister; -extern TDSP_Update DSP_Update; -extern TDSP_SendAIBuffer DSP_SendAIBuffer; -extern TDSP_DoState DSP_DoState; - -} // end of namespace PluginDSP - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PLUGIN_DSP_H +#define _PLUGIN_DSP_H + +#include "pluginspecs_dsp.h" + +namespace PluginDSP +{ +bool IsLoaded(); +bool LoadPlugin(const char *_Filename); +void UnloadPlugin(); + +// Function Types +typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); +typedef void (__cdecl* TDllConfig)(HWND); +typedef void (__cdecl* TDllDebugger)(HWND, bool); +typedef void (__cdecl* TDSP_Initialize)(DSPInitialize); +typedef void (__cdecl* TDSP_Shutdown)(); +typedef void (__cdecl* TDSP_WriteMailBox)(BOOL _CPUMailbox, unsigned short); +typedef unsigned short (__cdecl* TDSP_ReadMailBox)(BOOL _CPUMailbox); +typedef unsigned short (__cdecl* TDSP_ReadControlRegister)(); +typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short); +typedef void (__cdecl* TDSP_Update)(int cycles); +typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate); +typedef void (__cdecl* TDSP_DoState)(unsigned char **ptr, int mode); + +// Function Pointers +extern TGetDllInfo GetDllInfo; +extern TDllConfig DllConfig; +extern TDllDebugger DllDebugger; +extern TDSP_Initialize DSP_Initialize; +extern TDSP_Shutdown DSP_Shutdown; +extern TDSP_ReadMailBox DSP_ReadMailboxHigh; +extern TDSP_ReadMailBox DSP_ReadMailboxLow; +extern TDSP_WriteMailBox DSP_WriteMailboxHigh; +extern TDSP_WriteMailBox DSP_WriteMailboxLow; +extern TDSP_ReadControlRegister DSP_ReadControlRegister; +extern TDSP_WriteControlRegister DSP_WriteControlRegister; +extern TDSP_Update DSP_Update; +extern TDSP_SendAIBuffer DSP_SendAIBuffer; +extern TDSP_DoState DSP_DoState; + +} // end of namespace PluginDSP + +#endif diff --git a/Source/Core/Core/Src/Plugins/Plugin_DVD.h b/Source/Core/Core/Src/Plugins/Plugin_DVD.h index 921c574082..4e9955f524 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_DVD.h +++ b/Source/Core/Core/Src/Plugins/Plugin_DVD.h @@ -1,71 +1,71 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PLUGIN_DVD_H -#define _PLUGIN_DVD_H - -#include "PluginSpecs_DVD.h" - -namespace PluginDVD -{ - -//! IsLoaded -bool IsLoaded(); - -//! LoadPlugin -bool LoadPlugin(const char *_strFilename); - -//! UnloadPlugin -void UnloadPlugin(); - -// -// --- Plugin Functions --- -// - -//! GetDllInfo -void GetDllInfo(PLUGIN_INFO* _PluginInfo) ; - -//! DllConfig -void DllConfig(HWND _hParent); - -//! DVD_Initialize -void DVD_Initialize(SDVDInitialize _DVDInitialize); - -//! DVD_Shutdown -void DVD_Shutdown(); - -//! SetISOFile -void DVD_SetISOFile(const char* _szFilename); - -//! GetISOName -BOOL DVD_GetISOName(TCHAR * _szFilename, int maxlen); - -//! DVDReadToPtr -bool DVD_ReadToPtr(LPBYTE ptr, u64 _dwOffset, u64 _dwLength); - -//! DVD_IsValid -bool DVD_IsValid(); - -//! DVDRead32 -u32 DVD_Read32(u64 _dwOffset); - -//! SaveLoadState -u32 SaveLoadState(char *ptr, BOOL save); - -} // end of namespace PluginDVD - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PLUGIN_DVD_H +#define _PLUGIN_DVD_H + +#include "PluginSpecs_DVD.h" + +namespace PluginDVD +{ + +//! IsLoaded +bool IsLoaded(); + +//! LoadPlugin +bool LoadPlugin(const char *_strFilename); + +//! UnloadPlugin +void UnloadPlugin(); + +// +// --- Plugin Functions --- +// + +//! GetDllInfo +void GetDllInfo(PLUGIN_INFO* _PluginInfo) ; + +//! DllConfig +void DllConfig(HWND _hParent); + +//! DVD_Initialize +void DVD_Initialize(SDVDInitialize _DVDInitialize); + +//! DVD_Shutdown +void DVD_Shutdown(); + +//! SetISOFile +void DVD_SetISOFile(const char* _szFilename); + +//! GetISOName +BOOL DVD_GetISOName(TCHAR * _szFilename, int maxlen); + +//! DVDReadToPtr +bool DVD_ReadToPtr(LPBYTE ptr, u64 _dwOffset, u64 _dwLength); + +//! DVD_IsValid +bool DVD_IsValid(); + +//! DVDRead32 +u32 DVD_Read32(u64 _dwOffset); + +//! SaveLoadState +u32 SaveLoadState(char *ptr, BOOL save); + +} // end of namespace PluginDVD + +#endif diff --git a/Source/Core/Core/Src/Plugins/Plugin_PAD.h b/Source/Core/Core/Src/Plugins/Plugin_PAD.h index 8543f2ee93..d4fc1ca630 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.h +++ b/Source/Core/Core/Src/Plugins/Plugin_PAD.h @@ -1,50 +1,50 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _PLUGIN_DVD -#define _PLUGIN_DVD - -#include - -#include "pluginspecs_pad.h" - -namespace PluginPAD -{ -bool IsLoaded(); -bool LoadPlugin(const char * _Filename); -void UnloadPlugin(); - -// Function Types -typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); -typedef void (__cdecl* TDllConfig)(HWND); -typedef void (__cdecl* TPAD_Initialize)(SPADInitialize); -typedef void (__cdecl* TPAD_Shutdown)(); -typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*); -typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int); -typedef unsigned int (__cdecl* TPAD_GetAttachedPads)(); - -// Function Pointers -extern TGetDllInfo GetDllInfo; -extern TPAD_Shutdown PAD_Shutdown; -extern TDllConfig DllConfig; -extern TPAD_Initialize PAD_Initialize; -extern TPAD_GetStatus PAD_GetStatus; -extern TPAD_Rumble PAD_Rumble; -extern TPAD_GetAttachedPads PAD_GetAttachedPads; - -} // end of namespace PluginPAD - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _PLUGIN_DVD +#define _PLUGIN_DVD + +#include + +#include "pluginspecs_pad.h" + +namespace PluginPAD +{ +bool IsLoaded(); +bool LoadPlugin(const char * _Filename); +void UnloadPlugin(); + +// Function Types +typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); +typedef void (__cdecl* TDllConfig)(HWND); +typedef void (__cdecl* TPAD_Initialize)(SPADInitialize); +typedef void (__cdecl* TPAD_Shutdown)(); +typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*); +typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int); +typedef unsigned int (__cdecl* TPAD_GetAttachedPads)(); + +// Function Pointers +extern TGetDllInfo GetDllInfo; +extern TPAD_Shutdown PAD_Shutdown; +extern TDllConfig DllConfig; +extern TPAD_Initialize PAD_Initialize; +extern TPAD_GetStatus PAD_GetStatus; +extern TPAD_Rumble PAD_Rumble; +extern TPAD_GetAttachedPads PAD_GetAttachedPads; + +} // end of namespace PluginPAD + +#endif diff --git a/Source/Core/Core/Src/Plugins/Plugin_Video.h b/Source/Core/Core/Src/Plugins/Plugin_Video.h index b3c0a18a10..285b6cf65e 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_Video.h +++ b/Source/Core/Core/Src/Plugins/Plugin_Video.h @@ -1,65 +1,65 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PLUGIN_VIDEO_H -#define _PLUGIN_VIDEO_H - -#include "Common.h" - -#include "pluginspecs_video.h" - -#include "ChunkFile.h" - -namespace PluginVideo -{ -bool IsLoaded(); -bool LoadPlugin(const char *_Filename); -void UnloadPlugin(); - -// Function Types -typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); -typedef void (__cdecl* TDllConfig)(HWND); -typedef void (__cdecl* TDllDebugger)(HWND, bool); -typedef void (__cdecl* TVideo_Initialize)(SVideoInitialize*); -typedef void (__cdecl* TVideo_Prepare)(); -typedef void (__cdecl* TVideo_Shutdown)(); -typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32); -typedef void (__cdecl* TVideo_UpdateXFB)(u8*, u32, u32, s32); -typedef BOOL (__cdecl* TVideo_Screenshot)(TCHAR*); -typedef void (__cdecl* TVideo_EnterLoop)(); -typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds); -typedef void (__cdecl* TVideo_DoState)(unsigned char **ptr, int mode); -typedef void (__cdecl* TVideo_Stop)(); - -// Function Pointers -extern TGetDllInfo GetDllInfo; -extern TDllConfig DllConfig; -extern TDllDebugger DllDebugger; -extern TVideo_Initialize Video_Initialize; -extern TVideo_Prepare Video_Prepare; -extern TVideo_Shutdown Video_Shutdown; -extern TVideo_SendFifoData Video_SendFifoData; -extern TVideo_UpdateXFB Video_UpdateXFB; -extern TVideo_Screenshot Video_Screenshot; -extern TVideo_EnterLoop Video_EnterLoop; -extern TVideo_AddMessage Video_AddMessage; -extern TVideo_DoState Video_DoState; -extern TVideo_Stop Video_Stop; - -} // end of namespace PluginVideo - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PLUGIN_VIDEO_H +#define _PLUGIN_VIDEO_H + +#include "Common.h" + +#include "pluginspecs_video.h" + +#include "ChunkFile.h" + +namespace PluginVideo +{ +bool IsLoaded(); +bool LoadPlugin(const char *_Filename); +void UnloadPlugin(); + +// Function Types +typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); +typedef void (__cdecl* TDllConfig)(HWND); +typedef void (__cdecl* TDllDebugger)(HWND, bool); +typedef void (__cdecl* TVideo_Initialize)(SVideoInitialize*); +typedef void (__cdecl* TVideo_Prepare)(); +typedef void (__cdecl* TVideo_Shutdown)(); +typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32); +typedef void (__cdecl* TVideo_UpdateXFB)(u8*, u32, u32, s32); +typedef BOOL (__cdecl* TVideo_Screenshot)(TCHAR*); +typedef void (__cdecl* TVideo_EnterLoop)(); +typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds); +typedef void (__cdecl* TVideo_DoState)(unsigned char **ptr, int mode); +typedef void (__cdecl* TVideo_Stop)(); + +// Function Pointers +extern TGetDllInfo GetDllInfo; +extern TDllConfig DllConfig; +extern TDllDebugger DllDebugger; +extern TVideo_Initialize Video_Initialize; +extern TVideo_Prepare Video_Prepare; +extern TVideo_Shutdown Video_Shutdown; +extern TVideo_SendFifoData Video_SendFifoData; +extern TVideo_UpdateXFB Video_UpdateXFB; +extern TVideo_Screenshot Video_Screenshot; +extern TVideo_EnterLoop Video_EnterLoop; +extern TVideo_AddMessage Video_AddMessage; +extern TVideo_DoState Video_DoState; +extern TVideo_Stop Video_Stop; + +} // end of namespace PluginVideo + +#endif diff --git a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h b/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h index 23653dfb4f..74edc4153b 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h +++ b/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h @@ -1,53 +1,53 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PLUGIN_WIIMOTE_H -#define _PLUGIN_WIIMOTE_H - -#include "pluginspecs_wiimote.h" - -namespace PluginWiimote -{ -bool IsLoaded(); -bool LoadPlugin(const char *_Filename); -void UnloadPlugin(); - -// Function Types -typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); -typedef void (__cdecl* TDllConfig)(HWND); -typedef void (__cdecl* TWiimote_Initialize)(SWiimoteInitialize); -typedef void (__cdecl* TWiimote_Shutdown)(); -typedef void (__cdecl* TWiimote_Update)(); -typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size); -typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size); -typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)(); -typedef void (__cdecl* TWiimote_DoState)(void *ptr, int mode); - -// Function Pointers -extern TGetDllInfo GetDllInfo; -extern TDllConfig DllConfig; -extern TWiimote_Initialize Wiimote_Initialize; -extern TWiimote_Shutdown Wiimote_Shutdown; -extern TWiimote_Output Wiimote_ControlChannel; -extern TWiimote_Input Wiimote_InterruptChannel; -extern TWiimote_Update Wiimote_Update; -extern TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers; -extern TWiimote_DoState Wiimote_DoState; - -} // end of namespace PluginWiimote - -#endif //_PLUGIN_WIIMOTE_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PLUGIN_WIIMOTE_H +#define _PLUGIN_WIIMOTE_H + +#include "pluginspecs_wiimote.h" + +namespace PluginWiimote +{ +bool IsLoaded(); +bool LoadPlugin(const char *_Filename); +void UnloadPlugin(); + +// Function Types +typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); +typedef void (__cdecl* TDllConfig)(HWND); +typedef void (__cdecl* TWiimote_Initialize)(SWiimoteInitialize); +typedef void (__cdecl* TWiimote_Shutdown)(); +typedef void (__cdecl* TWiimote_Update)(); +typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size); +typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size); +typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)(); +typedef void (__cdecl* TWiimote_DoState)(void *ptr, int mode); + +// Function Pointers +extern TGetDllInfo GetDllInfo; +extern TDllConfig DllConfig; +extern TWiimote_Initialize Wiimote_Initialize; +extern TWiimote_Shutdown Wiimote_Shutdown; +extern TWiimote_Output Wiimote_ControlChannel; +extern TWiimote_Input Wiimote_InterruptChannel; +extern TWiimote_Update Wiimote_Update; +extern TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers; +extern TWiimote_DoState Wiimote_DoState; + +} // end of namespace PluginWiimote + +#endif //_PLUGIN_WIIMOTE_H diff --git a/Source/Core/Core/Src/PowerPC/Gekko.h b/Source/Core/Core/Src/PowerPC/Gekko.h index b2431c1f0a..152539cc90 100644 --- a/Source/Core/Core/Src/PowerPC/Gekko.h +++ b/Source/Core/Core/Src/PowerPC/Gekko.h @@ -1,612 +1,612 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// Gekko related unions, structs, ... -// - -#ifndef _GEKKO_H -#define _GEKKO_H - -#include "Common.h" - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// --- Gekko Instruction --- -////////////////////////////////////////////////////////////////////////////////////////////////////// - -union UGeckoInstruction -{ - u32 hex; - - UGeckoInstruction(u32 _hex) { hex = _hex;} - UGeckoInstruction() { hex = 0;} - - struct - { - unsigned Rc : 1; - unsigned SUBOP10: 10; - unsigned RB : 5; - unsigned RA : 5; - unsigned RD : 5; - unsigned OPCD : 6; - }; // changed - struct - { - signed SIMM_16 : 16; - unsigned : 5; - unsigned : 5; - unsigned OPCD_2 : 6; - }; - struct - { - unsigned Rc_2 : 1; - unsigned : 10; - unsigned : 5; - unsigned : 5; - unsigned RS : 5; - unsigned OPCD_3 : 6; - }; - struct - { - unsigned UIMM : 16; - unsigned : 5; - unsigned : 5; - unsigned OPCD_4 : 6; - }; - struct - { - unsigned LK : 1; - unsigned AA : 1; - unsigned LI : 24; - unsigned OPCD_5 : 6; - }; - struct - { - unsigned LK_2 : 1; - unsigned AA_2 : 1; - unsigned BD : 14; - unsigned BI : 5; - unsigned BO : 5; - unsigned OPCD_6 : 6; - }; - struct - { - unsigned LK_3 : 1; - unsigned : 10; - unsigned : 5; - unsigned BI_2 : 5; - unsigned BO_2 : 5; - unsigned OPCD_7 : 6; - }; - struct - { - unsigned : 11; - unsigned RB_2 : 5; - unsigned RA_2 : 5; - unsigned L : 1; - unsigned : 1; - unsigned CRFD : 3; - unsigned OPCD_8 : 6; - }; - struct - { - signed SIMM_16_2 : 16; - unsigned RA_3 : 5; - unsigned L_2 : 1; - unsigned : 1; - unsigned CRFD_2 : 3; - unsigned OPCD_9 : 6; - }; - struct - { - unsigned UIMM_2 : 16; - unsigned RA_4 : 5; - unsigned L_3 : 1; - unsigned dummy2 : 1; - unsigned CRFD_3 : 3; - unsigned OPCD_A : 6; - }; - struct - { - unsigned : 1; - unsigned SUBOP10_2: 10; - unsigned RB_5 : 5; - unsigned RA_5 : 5; - unsigned L_4 : 1; - unsigned dummy3 : 1; - unsigned CRFD_4 : 3; - unsigned OPCD_B : 6; - }; - struct - { - unsigned : 16; - unsigned SR : 4; - unsigned : 1; - unsigned RS_2 : 5; - unsigned OPCD_C : 6; - }; - - // Table 59 - struct - { - unsigned Rc_4 : 1; - unsigned SUBOP5 : 5; - unsigned RC : 5; - unsigned : 5; - unsigned RA_6 : 5; - unsigned RD_2 : 5; - unsigned OPCD_D : 6; - }; - - struct - { unsigned : 10; - unsigned OE : 1; - unsigned SPR : 10; - unsigned : 11; - }; - struct - { - unsigned : 10; - unsigned OE_3 : 1; - unsigned SPRU : 5; - unsigned SPRL : 5; - unsigned : 11; - }; - - // rlwinmx - struct - { - unsigned Rc_3 : 1; - unsigned ME : 5; - unsigned MB : 5; - unsigned SH : 5; - unsigned : 16; - }; - - // crxor - struct - { - unsigned : 11; - unsigned CRBB : 5; - unsigned CRBA : 5; - unsigned CRBD : 5; - unsigned : 6; - }; - - // mftb - struct - { - unsigned : 11; - unsigned TBR : 10; - unsigned : 11; - }; - - struct - { - unsigned : 11; - unsigned TBRU : 5; - unsigned TBRL : 5; - unsigned : 11; - }; - - struct - { - unsigned : 18; - unsigned CRFS : 3; - unsigned : 2; - unsigned CRFD_5 : 3; - unsigned : 6; - }; - - // float - struct - { - unsigned : 12; - unsigned CRM : 8; - unsigned : 1; - unsigned FD : 5; - unsigned : 6; - }; - struct - { - unsigned : 6; - unsigned FC : 5; - unsigned FB : 5; - unsigned FA : 5; - unsigned FS : 5; - unsigned : 6; - }; - struct - { - unsigned OFS : 16; - unsigned : 16; - }; - struct - { - unsigned : 17; - unsigned FM : 8; - unsigned : 7; - }; - - // paired - struct - { - unsigned : 7; - unsigned Ix : 3; - unsigned Wx : 1; - unsigned : 1; - unsigned I : 3; - unsigned W : 1; - unsigned : 16; - }; - - struct - { - signed SIMM_12 : 12; - unsigned : 20; - }; - - struct - { - unsigned dummyX : 11; - unsigned NB : 5; - }; -}; - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// -// --- Gekko Special Registers --- -// -////////////////////////////////////////////////////////////////////////////////////////////////////// - -// GQR Register -union UGQR -{ - u32 Hex; - struct - { - unsigned ST_TYPE : 3; - unsigned : 5; - unsigned ST_SCALE : 6; - unsigned : 2; - unsigned LD_TYPE : 3; - unsigned : 5; - unsigned LD_SCALE : 6; - unsigned : 2; - }; - - UGQR(u32 _hex) { Hex = _hex; } - UGQR() {Hex = 0; } -}; - -// FPU Register -union UFPR -{ - u64 as_u64; - s64 as_s64; - double d; - u32 as_u32[2]; - s32 as_s32[2]; - float f[2]; -}; - -#define XER_CA_MASK 0x20000000 -// XER -union UReg_XER -{ - struct - { - unsigned BYTE_COUNT : 7; - unsigned : 22; - unsigned CA : 1; - unsigned OV : 1; - unsigned SO : 1; - }; - u32 Hex; - - UReg_XER(u32 _hex) { Hex = _hex; } - UReg_XER() { Hex = 0; } -}; - -// Machine State Register -union UReg_MSR -{ - struct - { - unsigned LE : 1; - unsigned RI : 1; - unsigned PM : 1; - unsigned : 1; // res28 - unsigned DR : 1; - unsigned IR : 1; - unsigned IP : 1; - unsigned : 1; // res24 - unsigned FE1 : 1; - unsigned BE : 1; - unsigned SE : 1; - unsigned FE0 : 1; - unsigned MCHECK : 1; - unsigned FP : 1; - unsigned PR : 1; - unsigned EE : 1; - unsigned ILE : 1; - unsigned : 1; // res14 - unsigned POW : 1; - unsigned res : 13; - }; - u32 Hex; - - UReg_MSR(u32 _hex) { Hex = _hex; } - UReg_MSR() { Hex = 0; } -}; - -// Floating Point Status and Control Register -union UReg_FPSCR -{ - struct - { - unsigned RN : 2; - unsigned NI : 1; - unsigned XE : 1; - unsigned ZE : 1; - unsigned UE : 1; - unsigned OE : 1; - unsigned VE : 1; - unsigned VXCVI : 1; - unsigned VXSQRT : 1; - unsigned VXSOFT : 1; - unsigned : 1; - unsigned FPRF : 5; - unsigned FI : 1; - unsigned FR : 1; - unsigned VXVC : 1; - unsigned VXIMZ : 1; - unsigned VXZDZ : 1; - unsigned VXIDI : 1; - unsigned VXISI : 1; - unsigned VXSNAN : 1; - unsigned XX : 1; - unsigned ZX : 1; - unsigned UX : 1; - unsigned OX : 1; - unsigned VX : 1; - unsigned FEX : 1; - unsigned FX : 1; - }; - u32 Hex; - - UReg_FPSCR(u32 _hex) { Hex = _hex; } - UReg_FPSCR() { Hex = 0;} -}; - -// Hardware Implementation-Dependent Register 2 -union UReg_HID2 -{ - struct - { - unsigned : 16; - unsigned DQOMEE : 1; - unsigned DCMEE : 1; - unsigned DNCEE : 1; - unsigned DCHEE : 1; - unsigned DQOERR : 1; - unsigned DCEMERR : 1; - unsigned DNCERR : 1; - unsigned DCHERR : 1; - unsigned DMAQL : 4; - unsigned LCE : 1; - unsigned PSE : 1; - unsigned WPE : 1; - unsigned LSQE : 1; - }; - u32 Hex; - - UReg_HID2(u32 _hex) { Hex = _hex; } - UReg_HID2() { Hex = 0; } -}; - -// SPR1 - Page Table format -union UReg_SPR1 -{ - u32 Hex; - struct - { - unsigned htaborg : 16; - unsigned : 7; - unsigned htabmask : 9; - }; -}; - - - -// Write Pipe Address Register -union UReg_WPAR -{ - struct - { - unsigned BNE : 1; - unsigned : 4; - unsigned GB_ADDR : 27; - }; - u32 Hex; - - UReg_WPAR(u32 _hex) { Hex = _hex; } - UReg_WPAR() { Hex = 0; } -}; - -// Direct Memory Access Upper register -union UReg_DMAU -{ - struct - { - unsigned DMA_LEN_U : 5; - unsigned MEM_ADDR : 27; - }; - u32 Hex; - - UReg_DMAU(u32 _hex) { Hex = _hex; } - UReg_DMAU() { Hex = 0; } -}; - -// Direct Memory Access Lower (DMAL) register -union UReg_DMAL -{ - struct - { - unsigned DMA_F : 1; - unsigned DMA_T : 1; - unsigned DMA_LEN_L : 2; - unsigned DMA_LD : 1; - unsigned LC_ADDR : 27; - }; - u32 Hex; - - UReg_DMAL(u32 _hex) { Hex = _hex; } - UReg_DMAL() { Hex = 0; } -}; - -union UReg_BAT_Up -{ - struct - { - unsigned VP : 1; - unsigned VS : 1; - unsigned BL : 11; - unsigned : 4; - unsigned BEPI : 15; - }; - u32 Hex; - - UReg_BAT_Up(u32 _hex) { Hex = _hex; } - UReg_BAT_Up() { Hex = 0; } -}; - -union UReg_BAT_Lo -{ - struct - { - unsigned PP : 2; - unsigned : 1; - unsigned WIMG : 4; - unsigned : 10; - unsigned BRPN : 15; - }; - u32 Hex; - - UReg_BAT_Lo(u32 _hex) { Hex = _hex; } - UReg_BAT_Lo() { Hex = 0; } -}; - -union UReg_PTE -{ - struct - { - unsigned API : 6; - unsigned H : 1; - unsigned VSID : 24; - unsigned V : 1; - unsigned PP : 2; - unsigned : 1; - unsigned WIMG : 4; - unsigned C : 1; - unsigned R : 1; - unsigned : 3; - unsigned RPN : 20; - - }; - - u64 Hex; - u32 Hex32[2]; -}; - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// -// --- Gekko Types and Defs --- -// -////////////////////////////////////////////////////////////////////////////////////////////////////// - -// quantize types -enum EQuantizeType -{ - QUANTIZE_FLOAT = 0, - QUANTIZE_U8 = 4, - QUANTIZE_U16 = 5, - QUANTIZE_S8 = 6, - QUANTIZE_S16 = 7, -}; - -// branches -enum -{ - BO_DONT_DECREMENT_FLAG = 0x4, -}; - -// Special purpose register indices -enum -{ - SPR_XER = 1, - SPR_LR = 8, - SPR_CTR = 9, - SPR_DSISR = 18, - SPR_DAR = 19, - SPR_DEC = 22, - SPR_SDR = 25, - SPR_SRR0 = 26, - SPR_SRR1 = 27, - SPR_TL = 268, - SPR_TU = 269, - SPR_TL_W = 284, - SPR_TU_W = 285, - SPR_SPRG0 = 272, - SPR_SPRG1 = 273, - SPR_SPRG2 = 274, - SPR_SPRG3 = 275, - SPR_IBAT0U = 528, - SPR_IBAT0L = 529, - SPR_IBAT1U = 530, - SPR_IBAT1L = 531, - SPR_IBAT2U = 532, - SPR_IBAT2L = 533, - SPR_IBAT3L = 534, - SPR_IBAT3U = 535, - SPR_DBAT0U = 536, - SPR_DBAT0L = 537, - SPR_DBAT1U = 538, - SPR_DBAT1L = 539, - SPR_DBAT2U = 540, - SPR_DBAT2L = 541, - SPR_DBAT3L = 542, - SPR_DBAT3U = 543, - SPR_GQR0 = 912, - SPR_HID2 = 920, - SPR_WPAR = 921, - SPR_DMAU = 922, - SPR_DMAL = 923 -}; - -// Exceptions -#define EXCEPTION_DECREMENTER 0x00000001 -#define EXCEPTION_SYSCALL 0x00000002 -#define EXCEPTION_EXTERNAL_INT 0x00000004 -#define EXCEPTION_DSI 0x00000008 -#define EXCEPTION_ISI 0x00000010 -#define EXCEPTION_ALIGNMENT 0x00000020 -#define EXCEPTION_FPU_UNAVAILABLE 0x00000040 - -inline s32 SignExt16(s16 x) {return (s32)(s16)x;} -inline s32 SignExt26(u32 x) {return x & 0x2000000 ? (s32)x | 0xFC000000 : (s32)(x);} - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// Gekko related unions, structs, ... +// + +#ifndef _GEKKO_H +#define _GEKKO_H + +#include "Common.h" + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// --- Gekko Instruction --- +////////////////////////////////////////////////////////////////////////////////////////////////////// + +union UGeckoInstruction +{ + u32 hex; + + UGeckoInstruction(u32 _hex) { hex = _hex;} + UGeckoInstruction() { hex = 0;} + + struct + { + unsigned Rc : 1; + unsigned SUBOP10: 10; + unsigned RB : 5; + unsigned RA : 5; + unsigned RD : 5; + unsigned OPCD : 6; + }; // changed + struct + { + signed SIMM_16 : 16; + unsigned : 5; + unsigned : 5; + unsigned OPCD_2 : 6; + }; + struct + { + unsigned Rc_2 : 1; + unsigned : 10; + unsigned : 5; + unsigned : 5; + unsigned RS : 5; + unsigned OPCD_3 : 6; + }; + struct + { + unsigned UIMM : 16; + unsigned : 5; + unsigned : 5; + unsigned OPCD_4 : 6; + }; + struct + { + unsigned LK : 1; + unsigned AA : 1; + unsigned LI : 24; + unsigned OPCD_5 : 6; + }; + struct + { + unsigned LK_2 : 1; + unsigned AA_2 : 1; + unsigned BD : 14; + unsigned BI : 5; + unsigned BO : 5; + unsigned OPCD_6 : 6; + }; + struct + { + unsigned LK_3 : 1; + unsigned : 10; + unsigned : 5; + unsigned BI_2 : 5; + unsigned BO_2 : 5; + unsigned OPCD_7 : 6; + }; + struct + { + unsigned : 11; + unsigned RB_2 : 5; + unsigned RA_2 : 5; + unsigned L : 1; + unsigned : 1; + unsigned CRFD : 3; + unsigned OPCD_8 : 6; + }; + struct + { + signed SIMM_16_2 : 16; + unsigned RA_3 : 5; + unsigned L_2 : 1; + unsigned : 1; + unsigned CRFD_2 : 3; + unsigned OPCD_9 : 6; + }; + struct + { + unsigned UIMM_2 : 16; + unsigned RA_4 : 5; + unsigned L_3 : 1; + unsigned dummy2 : 1; + unsigned CRFD_3 : 3; + unsigned OPCD_A : 6; + }; + struct + { + unsigned : 1; + unsigned SUBOP10_2: 10; + unsigned RB_5 : 5; + unsigned RA_5 : 5; + unsigned L_4 : 1; + unsigned dummy3 : 1; + unsigned CRFD_4 : 3; + unsigned OPCD_B : 6; + }; + struct + { + unsigned : 16; + unsigned SR : 4; + unsigned : 1; + unsigned RS_2 : 5; + unsigned OPCD_C : 6; + }; + + // Table 59 + struct + { + unsigned Rc_4 : 1; + unsigned SUBOP5 : 5; + unsigned RC : 5; + unsigned : 5; + unsigned RA_6 : 5; + unsigned RD_2 : 5; + unsigned OPCD_D : 6; + }; + + struct + { unsigned : 10; + unsigned OE : 1; + unsigned SPR : 10; + unsigned : 11; + }; + struct + { + unsigned : 10; + unsigned OE_3 : 1; + unsigned SPRU : 5; + unsigned SPRL : 5; + unsigned : 11; + }; + + // rlwinmx + struct + { + unsigned Rc_3 : 1; + unsigned ME : 5; + unsigned MB : 5; + unsigned SH : 5; + unsigned : 16; + }; + + // crxor + struct + { + unsigned : 11; + unsigned CRBB : 5; + unsigned CRBA : 5; + unsigned CRBD : 5; + unsigned : 6; + }; + + // mftb + struct + { + unsigned : 11; + unsigned TBR : 10; + unsigned : 11; + }; + + struct + { + unsigned : 11; + unsigned TBRU : 5; + unsigned TBRL : 5; + unsigned : 11; + }; + + struct + { + unsigned : 18; + unsigned CRFS : 3; + unsigned : 2; + unsigned CRFD_5 : 3; + unsigned : 6; + }; + + // float + struct + { + unsigned : 12; + unsigned CRM : 8; + unsigned : 1; + unsigned FD : 5; + unsigned : 6; + }; + struct + { + unsigned : 6; + unsigned FC : 5; + unsigned FB : 5; + unsigned FA : 5; + unsigned FS : 5; + unsigned : 6; + }; + struct + { + unsigned OFS : 16; + unsigned : 16; + }; + struct + { + unsigned : 17; + unsigned FM : 8; + unsigned : 7; + }; + + // paired + struct + { + unsigned : 7; + unsigned Ix : 3; + unsigned Wx : 1; + unsigned : 1; + unsigned I : 3; + unsigned W : 1; + unsigned : 16; + }; + + struct + { + signed SIMM_12 : 12; + unsigned : 20; + }; + + struct + { + unsigned dummyX : 11; + unsigned NB : 5; + }; +}; + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// +// --- Gekko Special Registers --- +// +////////////////////////////////////////////////////////////////////////////////////////////////////// + +// GQR Register +union UGQR +{ + u32 Hex; + struct + { + unsigned ST_TYPE : 3; + unsigned : 5; + unsigned ST_SCALE : 6; + unsigned : 2; + unsigned LD_TYPE : 3; + unsigned : 5; + unsigned LD_SCALE : 6; + unsigned : 2; + }; + + UGQR(u32 _hex) { Hex = _hex; } + UGQR() {Hex = 0; } +}; + +// FPU Register +union UFPR +{ + u64 as_u64; + s64 as_s64; + double d; + u32 as_u32[2]; + s32 as_s32[2]; + float f[2]; +}; + +#define XER_CA_MASK 0x20000000 +// XER +union UReg_XER +{ + struct + { + unsigned BYTE_COUNT : 7; + unsigned : 22; + unsigned CA : 1; + unsigned OV : 1; + unsigned SO : 1; + }; + u32 Hex; + + UReg_XER(u32 _hex) { Hex = _hex; } + UReg_XER() { Hex = 0; } +}; + +// Machine State Register +union UReg_MSR +{ + struct + { + unsigned LE : 1; + unsigned RI : 1; + unsigned PM : 1; + unsigned : 1; // res28 + unsigned DR : 1; + unsigned IR : 1; + unsigned IP : 1; + unsigned : 1; // res24 + unsigned FE1 : 1; + unsigned BE : 1; + unsigned SE : 1; + unsigned FE0 : 1; + unsigned MCHECK : 1; + unsigned FP : 1; + unsigned PR : 1; + unsigned EE : 1; + unsigned ILE : 1; + unsigned : 1; // res14 + unsigned POW : 1; + unsigned res : 13; + }; + u32 Hex; + + UReg_MSR(u32 _hex) { Hex = _hex; } + UReg_MSR() { Hex = 0; } +}; + +// Floating Point Status and Control Register +union UReg_FPSCR +{ + struct + { + unsigned RN : 2; + unsigned NI : 1; + unsigned XE : 1; + unsigned ZE : 1; + unsigned UE : 1; + unsigned OE : 1; + unsigned VE : 1; + unsigned VXCVI : 1; + unsigned VXSQRT : 1; + unsigned VXSOFT : 1; + unsigned : 1; + unsigned FPRF : 5; + unsigned FI : 1; + unsigned FR : 1; + unsigned VXVC : 1; + unsigned VXIMZ : 1; + unsigned VXZDZ : 1; + unsigned VXIDI : 1; + unsigned VXISI : 1; + unsigned VXSNAN : 1; + unsigned XX : 1; + unsigned ZX : 1; + unsigned UX : 1; + unsigned OX : 1; + unsigned VX : 1; + unsigned FEX : 1; + unsigned FX : 1; + }; + u32 Hex; + + UReg_FPSCR(u32 _hex) { Hex = _hex; } + UReg_FPSCR() { Hex = 0;} +}; + +// Hardware Implementation-Dependent Register 2 +union UReg_HID2 +{ + struct + { + unsigned : 16; + unsigned DQOMEE : 1; + unsigned DCMEE : 1; + unsigned DNCEE : 1; + unsigned DCHEE : 1; + unsigned DQOERR : 1; + unsigned DCEMERR : 1; + unsigned DNCERR : 1; + unsigned DCHERR : 1; + unsigned DMAQL : 4; + unsigned LCE : 1; + unsigned PSE : 1; + unsigned WPE : 1; + unsigned LSQE : 1; + }; + u32 Hex; + + UReg_HID2(u32 _hex) { Hex = _hex; } + UReg_HID2() { Hex = 0; } +}; + +// SPR1 - Page Table format +union UReg_SPR1 +{ + u32 Hex; + struct + { + unsigned htaborg : 16; + unsigned : 7; + unsigned htabmask : 9; + }; +}; + + + +// Write Pipe Address Register +union UReg_WPAR +{ + struct + { + unsigned BNE : 1; + unsigned : 4; + unsigned GB_ADDR : 27; + }; + u32 Hex; + + UReg_WPAR(u32 _hex) { Hex = _hex; } + UReg_WPAR() { Hex = 0; } +}; + +// Direct Memory Access Upper register +union UReg_DMAU +{ + struct + { + unsigned DMA_LEN_U : 5; + unsigned MEM_ADDR : 27; + }; + u32 Hex; + + UReg_DMAU(u32 _hex) { Hex = _hex; } + UReg_DMAU() { Hex = 0; } +}; + +// Direct Memory Access Lower (DMAL) register +union UReg_DMAL +{ + struct + { + unsigned DMA_F : 1; + unsigned DMA_T : 1; + unsigned DMA_LEN_L : 2; + unsigned DMA_LD : 1; + unsigned LC_ADDR : 27; + }; + u32 Hex; + + UReg_DMAL(u32 _hex) { Hex = _hex; } + UReg_DMAL() { Hex = 0; } +}; + +union UReg_BAT_Up +{ + struct + { + unsigned VP : 1; + unsigned VS : 1; + unsigned BL : 11; + unsigned : 4; + unsigned BEPI : 15; + }; + u32 Hex; + + UReg_BAT_Up(u32 _hex) { Hex = _hex; } + UReg_BAT_Up() { Hex = 0; } +}; + +union UReg_BAT_Lo +{ + struct + { + unsigned PP : 2; + unsigned : 1; + unsigned WIMG : 4; + unsigned : 10; + unsigned BRPN : 15; + }; + u32 Hex; + + UReg_BAT_Lo(u32 _hex) { Hex = _hex; } + UReg_BAT_Lo() { Hex = 0; } +}; + +union UReg_PTE +{ + struct + { + unsigned API : 6; + unsigned H : 1; + unsigned VSID : 24; + unsigned V : 1; + unsigned PP : 2; + unsigned : 1; + unsigned WIMG : 4; + unsigned C : 1; + unsigned R : 1; + unsigned : 3; + unsigned RPN : 20; + + }; + + u64 Hex; + u32 Hex32[2]; +}; + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// +// --- Gekko Types and Defs --- +// +////////////////////////////////////////////////////////////////////////////////////////////////////// + +// quantize types +enum EQuantizeType +{ + QUANTIZE_FLOAT = 0, + QUANTIZE_U8 = 4, + QUANTIZE_U16 = 5, + QUANTIZE_S8 = 6, + QUANTIZE_S16 = 7, +}; + +// branches +enum +{ + BO_DONT_DECREMENT_FLAG = 0x4, +}; + +// Special purpose register indices +enum +{ + SPR_XER = 1, + SPR_LR = 8, + SPR_CTR = 9, + SPR_DSISR = 18, + SPR_DAR = 19, + SPR_DEC = 22, + SPR_SDR = 25, + SPR_SRR0 = 26, + SPR_SRR1 = 27, + SPR_TL = 268, + SPR_TU = 269, + SPR_TL_W = 284, + SPR_TU_W = 285, + SPR_SPRG0 = 272, + SPR_SPRG1 = 273, + SPR_SPRG2 = 274, + SPR_SPRG3 = 275, + SPR_IBAT0U = 528, + SPR_IBAT0L = 529, + SPR_IBAT1U = 530, + SPR_IBAT1L = 531, + SPR_IBAT2U = 532, + SPR_IBAT2L = 533, + SPR_IBAT3L = 534, + SPR_IBAT3U = 535, + SPR_DBAT0U = 536, + SPR_DBAT0L = 537, + SPR_DBAT1U = 538, + SPR_DBAT1L = 539, + SPR_DBAT2U = 540, + SPR_DBAT2L = 541, + SPR_DBAT3L = 542, + SPR_DBAT3U = 543, + SPR_GQR0 = 912, + SPR_HID2 = 920, + SPR_WPAR = 921, + SPR_DMAU = 922, + SPR_DMAL = 923 +}; + +// Exceptions +#define EXCEPTION_DECREMENTER 0x00000001 +#define EXCEPTION_SYSCALL 0x00000002 +#define EXCEPTION_EXTERNAL_INT 0x00000004 +#define EXCEPTION_DSI 0x00000008 +#define EXCEPTION_ISI 0x00000010 +#define EXCEPTION_ALIGNMENT 0x00000020 +#define EXCEPTION_FPU_UNAVAILABLE 0x00000040 + +inline s32 SignExt16(s16 x) {return (s32)(s16)x;} +inline s32 SignExt26(u32 x) {return x & 0x2000000 ? (s32)x | 0xFC000000 : (s32)(x);} + +#endif + diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.h b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.h index 7eeb3f176e..de12798b12 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.h +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.h @@ -1,324 +1,324 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _INTERPRETER_H -#define _INTERPRETER_H - -#include "../Gekko.h" -#include "../PowerPC.h" - -namespace Interpreter -{ - void Init(); - void Shutdown(); - void Reset(); - void SingleStep(); - void SingleStepInner(); - void Run(); - - typedef void (*_interpreterInstruction)(UGeckoInstruction instCode); - - _interpreterInstruction GetInstruction(UGeckoInstruction instCode); - - void Log(); - - // pointer to the CPU-Regs to keep the code cleaner - extern u32* m_GPR; - extern bool m_EndBlock; - - void unknown_instruction(UGeckoInstruction _inst); - - // Branch Instructions - void bx(UGeckoInstruction _inst); - void bcx(UGeckoInstruction _inst); - void bcctrx(UGeckoInstruction _inst); - void bclrx(UGeckoInstruction _inst); - void HLEFunction(UGeckoInstruction _inst); - void CompiledBlock(UGeckoInstruction _inst); - - // Syscall Instruction - void sc(UGeckoInstruction _inst); - - // Floating Point Instructions - void faddsx(UGeckoInstruction _inst); - void fdivsx(UGeckoInstruction _inst); - void fmaddsx(UGeckoInstruction _inst); - void fmsubsx(UGeckoInstruction _inst); - void fmulsx(UGeckoInstruction _inst); - void fnmaddsx(UGeckoInstruction _inst); - void fnmsubsx(UGeckoInstruction _inst); - void fresx(UGeckoInstruction _inst); -// void fsqrtsx(UGeckoInstruction _inst); - void fsubsx(UGeckoInstruction _inst); - void fabsx(UGeckoInstruction _inst); - void fcmpo(UGeckoInstruction _inst); - void fcmpu(UGeckoInstruction _inst); - void fctiwx(UGeckoInstruction _inst); - void fctiwzx(UGeckoInstruction _inst); - void fmrx(UGeckoInstruction _inst); - void fnabsx(UGeckoInstruction _inst); - void fnegx(UGeckoInstruction _inst); - void frspx(UGeckoInstruction _inst); - void faddx(UGeckoInstruction _inst); - void fdivx(UGeckoInstruction _inst); - void fmaddx(UGeckoInstruction _inst); - void fmsubx(UGeckoInstruction _inst); - void fmulx(UGeckoInstruction _inst); - void fnmaddx(UGeckoInstruction _inst); - void fnmsubx(UGeckoInstruction _inst); - void frsqrtex(UGeckoInstruction _inst); - void fselx(UGeckoInstruction _inst); - void fsqrtx(UGeckoInstruction _inst); - void fsubx(UGeckoInstruction _inst); - - // Integer Instructions - void addi(UGeckoInstruction _inst); - void addic(UGeckoInstruction _inst); - void addic_rc(UGeckoInstruction _inst); - void addis(UGeckoInstruction _inst); - void andi_rc(UGeckoInstruction _inst); - void andis_rc(UGeckoInstruction _inst); - void cmpi(UGeckoInstruction _inst); - void cmpli(UGeckoInstruction _inst); - void mulli(UGeckoInstruction _inst); - void ori(UGeckoInstruction _inst); - void oris(UGeckoInstruction _inst); - void subfic(UGeckoInstruction _inst); - void twi(UGeckoInstruction _inst); - void xori(UGeckoInstruction _inst); - void xoris(UGeckoInstruction _inst); - void rlwimix(UGeckoInstruction _inst); - void rlwinmx(UGeckoInstruction _inst); - void rlwnmx(UGeckoInstruction _inst); - void andx(UGeckoInstruction _inst); - void andcx(UGeckoInstruction _inst); - void cmp(UGeckoInstruction _inst); - void cmpl(UGeckoInstruction _inst); - void cntlzwx(UGeckoInstruction _inst); - void eqvx(UGeckoInstruction _inst); - void extsbx(UGeckoInstruction _inst); - void extshx(UGeckoInstruction _inst); - void nandx(UGeckoInstruction _inst); - void norx(UGeckoInstruction _inst); - void orx(UGeckoInstruction _inst); - void orcx(UGeckoInstruction _inst); - void slwx(UGeckoInstruction _inst); - void srawx(UGeckoInstruction _inst); - void srawix(UGeckoInstruction _inst); - void srwx(UGeckoInstruction _inst); - void tw(UGeckoInstruction _inst); - void xorx(UGeckoInstruction _inst); - void addx(UGeckoInstruction _inst); - void addcx(UGeckoInstruction _inst); - void addex(UGeckoInstruction _inst); - void addmex(UGeckoInstruction _inst); - void addzex(UGeckoInstruction _inst); - void divwx(UGeckoInstruction _inst); - void divwux(UGeckoInstruction _inst); - void mulhwx(UGeckoInstruction _inst); - void mulhwux(UGeckoInstruction _inst); - void mullwx(UGeckoInstruction _inst); - void negx(UGeckoInstruction _inst); - void subfx(UGeckoInstruction _inst); - void subfcx(UGeckoInstruction _inst); - void subfex(UGeckoInstruction _inst); - void subfmex(UGeckoInstruction _inst); - void subfzex(UGeckoInstruction _inst); - - // Load/Store Instructions - void lbz(UGeckoInstruction _inst); - void lbzu(UGeckoInstruction _inst); - void lfd(UGeckoInstruction _inst); - void lfdu(UGeckoInstruction _inst); - void lfs(UGeckoInstruction _inst); - void lfsu(UGeckoInstruction _inst); - void lha(UGeckoInstruction _inst); - void lhau(UGeckoInstruction _inst); - void lhz(UGeckoInstruction _inst); - void lhzu(UGeckoInstruction _inst); - void lmw(UGeckoInstruction _inst); - void lwz(UGeckoInstruction _inst); - void lwzu(UGeckoInstruction _inst); - void stb(UGeckoInstruction _inst); - void stbu(UGeckoInstruction _inst); - void stfd(UGeckoInstruction _inst); - void stfdu(UGeckoInstruction _inst); - void stfs(UGeckoInstruction _inst); - void stfsu(UGeckoInstruction _inst); - void sth(UGeckoInstruction _inst); - void sthu(UGeckoInstruction _inst); - void stmw(UGeckoInstruction _inst); - void stw(UGeckoInstruction _inst); - void stwu(UGeckoInstruction _inst); - void dcba(UGeckoInstruction _inst); - void dcbf(UGeckoInstruction _inst); - void dcbi(UGeckoInstruction _inst); - void dcbst(UGeckoInstruction _inst); - void dcbt(UGeckoInstruction _inst); - void dcbtst(UGeckoInstruction _inst); - void dcbz(UGeckoInstruction _inst); - void eciwx(UGeckoInstruction _inst); - void ecowx(UGeckoInstruction _inst); - void eieio(UGeckoInstruction _inst); - void icbi(UGeckoInstruction _inst); - void lbzux(UGeckoInstruction _inst); - void lbzx(UGeckoInstruction _inst); - void lfdux(UGeckoInstruction _inst); - void lfdx(UGeckoInstruction _inst); - void lfsux(UGeckoInstruction _inst); - void lfsx(UGeckoInstruction _inst); - void lhaux(UGeckoInstruction _inst); - void lhax(UGeckoInstruction _inst); - void lhbrx(UGeckoInstruction _inst); - void lhzux(UGeckoInstruction _inst); - void lhzx(UGeckoInstruction _inst); - void lswi(UGeckoInstruction _inst); - void lswx(UGeckoInstruction _inst); - void lwarx(UGeckoInstruction _inst); - void lwbrx(UGeckoInstruction _inst); - void lwzux(UGeckoInstruction _inst); - void lwzx(UGeckoInstruction _inst); - void stbux(UGeckoInstruction _inst); - void stbx(UGeckoInstruction _inst); - void stfdux(UGeckoInstruction _inst); - void stfdx(UGeckoInstruction _inst); - void stfiwx(UGeckoInstruction _inst); - void stfsux(UGeckoInstruction _inst); - void stfsx(UGeckoInstruction _inst); - void sthbrx(UGeckoInstruction _inst); - void sthux(UGeckoInstruction _inst); - void sthx(UGeckoInstruction _inst); - void stswi(UGeckoInstruction _inst); - void stswx(UGeckoInstruction _inst); - void stwbrx(UGeckoInstruction _inst); - void stwcxd(UGeckoInstruction _inst); - void stwux(UGeckoInstruction _inst); - void stwx(UGeckoInstruction _inst); - void sync(UGeckoInstruction _inst); - void tlbia(UGeckoInstruction _inst); - void tlbie(UGeckoInstruction _inst); - void tlbsync(UGeckoInstruction _inst); - - // Paired Instructions - void psq_l(UGeckoInstruction _inst); - void psq_lu(UGeckoInstruction _inst); - void psq_st(UGeckoInstruction _inst); - void psq_stu(UGeckoInstruction _inst); - void psq_lx(UGeckoInstruction _inst); - void psq_stx(UGeckoInstruction _inst); - void psq_lux(UGeckoInstruction _inst); - void psq_stux(UGeckoInstruction _inst); - void ps_div(UGeckoInstruction _inst); - void ps_sub(UGeckoInstruction _inst); - void ps_add(UGeckoInstruction _inst); - void ps_sel(UGeckoInstruction _inst); - void ps_res(UGeckoInstruction _inst); - void ps_mul(UGeckoInstruction _inst); - void ps_rsqrte(UGeckoInstruction _inst); - void ps_msub(UGeckoInstruction _inst); - void ps_madd(UGeckoInstruction _inst); - void ps_nmsub(UGeckoInstruction _inst); - void ps_nmadd(UGeckoInstruction _inst); - void ps_neg(UGeckoInstruction _inst); - void ps_mr(UGeckoInstruction _inst); - void ps_nabs(UGeckoInstruction _inst); - void ps_abs(UGeckoInstruction _inst); - void ps_sum0(UGeckoInstruction _inst); - void ps_sum1(UGeckoInstruction _inst); - void ps_muls0(UGeckoInstruction _inst); - void ps_muls1(UGeckoInstruction _inst); - void ps_madds0(UGeckoInstruction _inst); - void ps_madds1(UGeckoInstruction _inst); - void ps_cmpu0(UGeckoInstruction _inst); - void ps_cmpo0(UGeckoInstruction _inst); - void ps_cmpu1(UGeckoInstruction _inst); - void ps_cmpo1(UGeckoInstruction _inst); - void ps_merge00(UGeckoInstruction _inst); - void ps_merge01(UGeckoInstruction _inst); - void ps_merge10(UGeckoInstruction _inst); - void ps_merge11(UGeckoInstruction _inst); - void dcbz_l(UGeckoInstruction _inst); - - // System Registers Instructions - void mcrfs(UGeckoInstruction _inst); - void mffsx(UGeckoInstruction _inst); - void mtfsb0x(UGeckoInstruction _inst); - void mtfsb1x(UGeckoInstruction _inst); - void mtfsfix(UGeckoInstruction _inst); - void mtfsfx(UGeckoInstruction _inst); - void mcrxr(UGeckoInstruction _inst); - void mfcr(UGeckoInstruction _inst); - void mfmsr(UGeckoInstruction _inst); - void mfsr(UGeckoInstruction _inst); - void mfsrin(UGeckoInstruction _inst); - void mtmsr(UGeckoInstruction _inst); - void mtsr(UGeckoInstruction _inst); - void mtsrin(UGeckoInstruction _inst); - void mfspr(UGeckoInstruction _inst); - void mftb(UGeckoInstruction _inst); - void mtcrf(UGeckoInstruction _inst); - void mtspr(UGeckoInstruction _inst); - void crand(UGeckoInstruction _inst); - void crandc(UGeckoInstruction _inst); - void creqv(UGeckoInstruction _inst); - void crnand(UGeckoInstruction _inst); - void crnor(UGeckoInstruction _inst); - void cror(UGeckoInstruction _inst); - void crorc(UGeckoInstruction _inst); - void crxor(UGeckoInstruction _inst); - void mcrf(UGeckoInstruction _inst); - void rfi(UGeckoInstruction _inst); - void rfid(UGeckoInstruction _inst); -// void sync(UGeckoInstruction _inst); - void isync(UGeckoInstruction _inst); - - void RunTable4(UGeckoInstruction _instCode); - void RunTable19(UGeckoInstruction _instCode); - void RunTable31(UGeckoInstruction _instCode); - void RunTable59(UGeckoInstruction _instCode); - void RunTable63(UGeckoInstruction _instCode); - - // flag helper - inline void Helper_UpdateCR0(u32 _uValue); - inline void Helper_UpdateCR1(double _fValue); - inline void Helper_UpdateCR1(float _fValue); - inline void Helper_UpdateCRx(int _x, u32 _uValue); - inline u32 Helper_Carry(u32 _uValue1, u32 _uValue2); - - // address helper - inline u32 Helper_Get_EA (const UGeckoInstruction _inst); - inline u32 Helper_Get_EA_U (const UGeckoInstruction _inst); - inline u32 Helper_Get_EA_X (const UGeckoInstruction _inst); - inline u32 Helper_Get_EA_UX(const UGeckoInstruction _inst); - - // paired helper - float inline Helper_Dequantize(const u32 _Addr, const EQuantizeType _quantizeType, const unsigned int _uScale); - void inline Helper_Quantize (const u32 _Addr, const float _fValue, const EQuantizeType _quantizeType, const unsigned _uScale); - - // other helper - u32 Helper_Mask(int mb, int me); - inline bool IsNAN(double _dValue); - - extern _interpreterInstruction m_opTable[64]; - extern _interpreterInstruction m_opTable4[1024]; - extern _interpreterInstruction m_opTable19[1024]; - extern _interpreterInstruction m_opTable31[1024]; - extern _interpreterInstruction m_opTable59[32]; - extern _interpreterInstruction m_opTable63[1024]; -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _INTERPRETER_H +#define _INTERPRETER_H + +#include "../Gekko.h" +#include "../PowerPC.h" + +namespace Interpreter +{ + void Init(); + void Shutdown(); + void Reset(); + void SingleStep(); + void SingleStepInner(); + void Run(); + + typedef void (*_interpreterInstruction)(UGeckoInstruction instCode); + + _interpreterInstruction GetInstruction(UGeckoInstruction instCode); + + void Log(); + + // pointer to the CPU-Regs to keep the code cleaner + extern u32* m_GPR; + extern bool m_EndBlock; + + void unknown_instruction(UGeckoInstruction _inst); + + // Branch Instructions + void bx(UGeckoInstruction _inst); + void bcx(UGeckoInstruction _inst); + void bcctrx(UGeckoInstruction _inst); + void bclrx(UGeckoInstruction _inst); + void HLEFunction(UGeckoInstruction _inst); + void CompiledBlock(UGeckoInstruction _inst); + + // Syscall Instruction + void sc(UGeckoInstruction _inst); + + // Floating Point Instructions + void faddsx(UGeckoInstruction _inst); + void fdivsx(UGeckoInstruction _inst); + void fmaddsx(UGeckoInstruction _inst); + void fmsubsx(UGeckoInstruction _inst); + void fmulsx(UGeckoInstruction _inst); + void fnmaddsx(UGeckoInstruction _inst); + void fnmsubsx(UGeckoInstruction _inst); + void fresx(UGeckoInstruction _inst); +// void fsqrtsx(UGeckoInstruction _inst); + void fsubsx(UGeckoInstruction _inst); + void fabsx(UGeckoInstruction _inst); + void fcmpo(UGeckoInstruction _inst); + void fcmpu(UGeckoInstruction _inst); + void fctiwx(UGeckoInstruction _inst); + void fctiwzx(UGeckoInstruction _inst); + void fmrx(UGeckoInstruction _inst); + void fnabsx(UGeckoInstruction _inst); + void fnegx(UGeckoInstruction _inst); + void frspx(UGeckoInstruction _inst); + void faddx(UGeckoInstruction _inst); + void fdivx(UGeckoInstruction _inst); + void fmaddx(UGeckoInstruction _inst); + void fmsubx(UGeckoInstruction _inst); + void fmulx(UGeckoInstruction _inst); + void fnmaddx(UGeckoInstruction _inst); + void fnmsubx(UGeckoInstruction _inst); + void frsqrtex(UGeckoInstruction _inst); + void fselx(UGeckoInstruction _inst); + void fsqrtx(UGeckoInstruction _inst); + void fsubx(UGeckoInstruction _inst); + + // Integer Instructions + void addi(UGeckoInstruction _inst); + void addic(UGeckoInstruction _inst); + void addic_rc(UGeckoInstruction _inst); + void addis(UGeckoInstruction _inst); + void andi_rc(UGeckoInstruction _inst); + void andis_rc(UGeckoInstruction _inst); + void cmpi(UGeckoInstruction _inst); + void cmpli(UGeckoInstruction _inst); + void mulli(UGeckoInstruction _inst); + void ori(UGeckoInstruction _inst); + void oris(UGeckoInstruction _inst); + void subfic(UGeckoInstruction _inst); + void twi(UGeckoInstruction _inst); + void xori(UGeckoInstruction _inst); + void xoris(UGeckoInstruction _inst); + void rlwimix(UGeckoInstruction _inst); + void rlwinmx(UGeckoInstruction _inst); + void rlwnmx(UGeckoInstruction _inst); + void andx(UGeckoInstruction _inst); + void andcx(UGeckoInstruction _inst); + void cmp(UGeckoInstruction _inst); + void cmpl(UGeckoInstruction _inst); + void cntlzwx(UGeckoInstruction _inst); + void eqvx(UGeckoInstruction _inst); + void extsbx(UGeckoInstruction _inst); + void extshx(UGeckoInstruction _inst); + void nandx(UGeckoInstruction _inst); + void norx(UGeckoInstruction _inst); + void orx(UGeckoInstruction _inst); + void orcx(UGeckoInstruction _inst); + void slwx(UGeckoInstruction _inst); + void srawx(UGeckoInstruction _inst); + void srawix(UGeckoInstruction _inst); + void srwx(UGeckoInstruction _inst); + void tw(UGeckoInstruction _inst); + void xorx(UGeckoInstruction _inst); + void addx(UGeckoInstruction _inst); + void addcx(UGeckoInstruction _inst); + void addex(UGeckoInstruction _inst); + void addmex(UGeckoInstruction _inst); + void addzex(UGeckoInstruction _inst); + void divwx(UGeckoInstruction _inst); + void divwux(UGeckoInstruction _inst); + void mulhwx(UGeckoInstruction _inst); + void mulhwux(UGeckoInstruction _inst); + void mullwx(UGeckoInstruction _inst); + void negx(UGeckoInstruction _inst); + void subfx(UGeckoInstruction _inst); + void subfcx(UGeckoInstruction _inst); + void subfex(UGeckoInstruction _inst); + void subfmex(UGeckoInstruction _inst); + void subfzex(UGeckoInstruction _inst); + + // Load/Store Instructions + void lbz(UGeckoInstruction _inst); + void lbzu(UGeckoInstruction _inst); + void lfd(UGeckoInstruction _inst); + void lfdu(UGeckoInstruction _inst); + void lfs(UGeckoInstruction _inst); + void lfsu(UGeckoInstruction _inst); + void lha(UGeckoInstruction _inst); + void lhau(UGeckoInstruction _inst); + void lhz(UGeckoInstruction _inst); + void lhzu(UGeckoInstruction _inst); + void lmw(UGeckoInstruction _inst); + void lwz(UGeckoInstruction _inst); + void lwzu(UGeckoInstruction _inst); + void stb(UGeckoInstruction _inst); + void stbu(UGeckoInstruction _inst); + void stfd(UGeckoInstruction _inst); + void stfdu(UGeckoInstruction _inst); + void stfs(UGeckoInstruction _inst); + void stfsu(UGeckoInstruction _inst); + void sth(UGeckoInstruction _inst); + void sthu(UGeckoInstruction _inst); + void stmw(UGeckoInstruction _inst); + void stw(UGeckoInstruction _inst); + void stwu(UGeckoInstruction _inst); + void dcba(UGeckoInstruction _inst); + void dcbf(UGeckoInstruction _inst); + void dcbi(UGeckoInstruction _inst); + void dcbst(UGeckoInstruction _inst); + void dcbt(UGeckoInstruction _inst); + void dcbtst(UGeckoInstruction _inst); + void dcbz(UGeckoInstruction _inst); + void eciwx(UGeckoInstruction _inst); + void ecowx(UGeckoInstruction _inst); + void eieio(UGeckoInstruction _inst); + void icbi(UGeckoInstruction _inst); + void lbzux(UGeckoInstruction _inst); + void lbzx(UGeckoInstruction _inst); + void lfdux(UGeckoInstruction _inst); + void lfdx(UGeckoInstruction _inst); + void lfsux(UGeckoInstruction _inst); + void lfsx(UGeckoInstruction _inst); + void lhaux(UGeckoInstruction _inst); + void lhax(UGeckoInstruction _inst); + void lhbrx(UGeckoInstruction _inst); + void lhzux(UGeckoInstruction _inst); + void lhzx(UGeckoInstruction _inst); + void lswi(UGeckoInstruction _inst); + void lswx(UGeckoInstruction _inst); + void lwarx(UGeckoInstruction _inst); + void lwbrx(UGeckoInstruction _inst); + void lwzux(UGeckoInstruction _inst); + void lwzx(UGeckoInstruction _inst); + void stbux(UGeckoInstruction _inst); + void stbx(UGeckoInstruction _inst); + void stfdux(UGeckoInstruction _inst); + void stfdx(UGeckoInstruction _inst); + void stfiwx(UGeckoInstruction _inst); + void stfsux(UGeckoInstruction _inst); + void stfsx(UGeckoInstruction _inst); + void sthbrx(UGeckoInstruction _inst); + void sthux(UGeckoInstruction _inst); + void sthx(UGeckoInstruction _inst); + void stswi(UGeckoInstruction _inst); + void stswx(UGeckoInstruction _inst); + void stwbrx(UGeckoInstruction _inst); + void stwcxd(UGeckoInstruction _inst); + void stwux(UGeckoInstruction _inst); + void stwx(UGeckoInstruction _inst); + void sync(UGeckoInstruction _inst); + void tlbia(UGeckoInstruction _inst); + void tlbie(UGeckoInstruction _inst); + void tlbsync(UGeckoInstruction _inst); + + // Paired Instructions + void psq_l(UGeckoInstruction _inst); + void psq_lu(UGeckoInstruction _inst); + void psq_st(UGeckoInstruction _inst); + void psq_stu(UGeckoInstruction _inst); + void psq_lx(UGeckoInstruction _inst); + void psq_stx(UGeckoInstruction _inst); + void psq_lux(UGeckoInstruction _inst); + void psq_stux(UGeckoInstruction _inst); + void ps_div(UGeckoInstruction _inst); + void ps_sub(UGeckoInstruction _inst); + void ps_add(UGeckoInstruction _inst); + void ps_sel(UGeckoInstruction _inst); + void ps_res(UGeckoInstruction _inst); + void ps_mul(UGeckoInstruction _inst); + void ps_rsqrte(UGeckoInstruction _inst); + void ps_msub(UGeckoInstruction _inst); + void ps_madd(UGeckoInstruction _inst); + void ps_nmsub(UGeckoInstruction _inst); + void ps_nmadd(UGeckoInstruction _inst); + void ps_neg(UGeckoInstruction _inst); + void ps_mr(UGeckoInstruction _inst); + void ps_nabs(UGeckoInstruction _inst); + void ps_abs(UGeckoInstruction _inst); + void ps_sum0(UGeckoInstruction _inst); + void ps_sum1(UGeckoInstruction _inst); + void ps_muls0(UGeckoInstruction _inst); + void ps_muls1(UGeckoInstruction _inst); + void ps_madds0(UGeckoInstruction _inst); + void ps_madds1(UGeckoInstruction _inst); + void ps_cmpu0(UGeckoInstruction _inst); + void ps_cmpo0(UGeckoInstruction _inst); + void ps_cmpu1(UGeckoInstruction _inst); + void ps_cmpo1(UGeckoInstruction _inst); + void ps_merge00(UGeckoInstruction _inst); + void ps_merge01(UGeckoInstruction _inst); + void ps_merge10(UGeckoInstruction _inst); + void ps_merge11(UGeckoInstruction _inst); + void dcbz_l(UGeckoInstruction _inst); + + // System Registers Instructions + void mcrfs(UGeckoInstruction _inst); + void mffsx(UGeckoInstruction _inst); + void mtfsb0x(UGeckoInstruction _inst); + void mtfsb1x(UGeckoInstruction _inst); + void mtfsfix(UGeckoInstruction _inst); + void mtfsfx(UGeckoInstruction _inst); + void mcrxr(UGeckoInstruction _inst); + void mfcr(UGeckoInstruction _inst); + void mfmsr(UGeckoInstruction _inst); + void mfsr(UGeckoInstruction _inst); + void mfsrin(UGeckoInstruction _inst); + void mtmsr(UGeckoInstruction _inst); + void mtsr(UGeckoInstruction _inst); + void mtsrin(UGeckoInstruction _inst); + void mfspr(UGeckoInstruction _inst); + void mftb(UGeckoInstruction _inst); + void mtcrf(UGeckoInstruction _inst); + void mtspr(UGeckoInstruction _inst); + void crand(UGeckoInstruction _inst); + void crandc(UGeckoInstruction _inst); + void creqv(UGeckoInstruction _inst); + void crnand(UGeckoInstruction _inst); + void crnor(UGeckoInstruction _inst); + void cror(UGeckoInstruction _inst); + void crorc(UGeckoInstruction _inst); + void crxor(UGeckoInstruction _inst); + void mcrf(UGeckoInstruction _inst); + void rfi(UGeckoInstruction _inst); + void rfid(UGeckoInstruction _inst); +// void sync(UGeckoInstruction _inst); + void isync(UGeckoInstruction _inst); + + void RunTable4(UGeckoInstruction _instCode); + void RunTable19(UGeckoInstruction _instCode); + void RunTable31(UGeckoInstruction _instCode); + void RunTable59(UGeckoInstruction _instCode); + void RunTable63(UGeckoInstruction _instCode); + + // flag helper + inline void Helper_UpdateCR0(u32 _uValue); + inline void Helper_UpdateCR1(double _fValue); + inline void Helper_UpdateCR1(float _fValue); + inline void Helper_UpdateCRx(int _x, u32 _uValue); + inline u32 Helper_Carry(u32 _uValue1, u32 _uValue2); + + // address helper + inline u32 Helper_Get_EA (const UGeckoInstruction _inst); + inline u32 Helper_Get_EA_U (const UGeckoInstruction _inst); + inline u32 Helper_Get_EA_X (const UGeckoInstruction _inst); + inline u32 Helper_Get_EA_UX(const UGeckoInstruction _inst); + + // paired helper + float inline Helper_Dequantize(const u32 _Addr, const EQuantizeType _quantizeType, const unsigned int _uScale); + void inline Helper_Quantize (const u32 _Addr, const float _fValue, const EQuantizeType _quantizeType, const unsigned _uScale); + + // other helper + u32 Helper_Mask(int mb, int me); + inline bool IsNAN(double _dValue); + + extern _interpreterInstruction m_opTable[64]; + extern _interpreterInstruction m_opTable4[1024]; + extern _interpreterInstruction m_opTable19[1024]; + extern _interpreterInstruction m_opTable31[1024]; + extern _interpreterInstruction m_opTable59[32]; + extern _interpreterInstruction m_opTable63[1024]; +}; + +#endif diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h index 09439bb1bb..dfd29ff755 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h @@ -1,186 +1,186 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -// ======================== -// See comments in Jit.cpp. -// ======================== - -#ifndef _JIT_H -#define _JIT_H - -#include "../PPCAnalyst.h" -#include "JitCache.h" -#include "x64Emitter.h" - -// Enable or disable JIT off options. All the if() checks in the JIT functions may result in a -// speed drop. However it should barely be noticable as the code is recompiled rarely. -#define JIT_OFF_OPTIONS - -namespace Jit64 -{ - struct JitStats - { - u32 compiledBlocks; - float averageCodeExpansion; - float ratioOpsCompiled; //how many really were compiled, how many became "call interpreter"? - }; - -#define JIT_OPCODE 0 - - struct JitBlock; - const u8* DoJit(u32 emaddress, JitBlock &b); - bool IsInJitCode(const u8 *codePtr); - - struct JitState - { - u32 compilerPC; - u32 blockStart; - int blockSize; - int instructionNumber; - int downcountAmount; - int block_flags; - - bool isLastInstruction; - bool blockSetsQuantizers; - - int fifoBytesThisBlock; - - PPCAnalyst::BlockStats st; - PPCAnalyst::BlockRegStats gpa; - PPCAnalyst::BlockRegStats fpa; - PPCAnalyst::CodeOp *op; - - JitBlock *curBlock; - }; - - struct JitOptions - { - bool optimizeStack; - bool assumeFPLoadFromMem; - bool enableBlocklink; - bool fpAccurateFlags; - bool enableFastMem; - bool optimizeGatherPipe; - bool interpretFPU; - bool fastInterrupts; - }; - - extern JitState js; - extern JitOptions jo; - - void Init(); - - void Default(UGeckoInstruction _inst); - void DoNothing(UGeckoInstruction _inst); - - void WriteExit(u32 destination, int exit_num); - void WriteExitDestInEAX(int exit_num); - void WriteExceptionExit(u32 exception); - void WriteRfiExitDestInEAX(); - - void HLEFunction(UGeckoInstruction _inst); - - void addx(UGeckoInstruction inst); - void orx(UGeckoInstruction inst); - void xorx(UGeckoInstruction inst); - void andx(UGeckoInstruction inst); - void mulli(UGeckoInstruction inst); - void mulhwux(UGeckoInstruction inst); - void mullwx(UGeckoInstruction inst); - void divwux(UGeckoInstruction inst); - void srawix(UGeckoInstruction inst); - void srawx(UGeckoInstruction inst); - void addex(UGeckoInstruction inst); - - void extsbx(UGeckoInstruction inst); - void extshx(UGeckoInstruction inst); - - void sc(UGeckoInstruction _inst); - void rfi(UGeckoInstruction _inst); - - void bx(UGeckoInstruction inst); - void bclrx(UGeckoInstruction _inst); - void bcctrx(UGeckoInstruction _inst); - void bcx(UGeckoInstruction inst); - - void mtspr(UGeckoInstruction inst); - void mfspr(UGeckoInstruction inst); - void mtmsr(UGeckoInstruction inst); - void mfmsr(UGeckoInstruction inst); - void mftb(UGeckoInstruction inst); - void mtcrf(UGeckoInstruction inst); - void mfcr(UGeckoInstruction inst); - - void reg_imm(UGeckoInstruction inst); - - void ps_sel(UGeckoInstruction inst); - void ps_mr(UGeckoInstruction inst); - void ps_sign(UGeckoInstruction inst); //aggregate - void ps_arith(UGeckoInstruction inst); //aggregate - void ps_mergeXX(UGeckoInstruction inst); - void ps_maddXX(UGeckoInstruction inst); - void ps_rsqrte(UGeckoInstruction inst); - void ps_sum(UGeckoInstruction inst); - void ps_muls(UGeckoInstruction inst); - - void fp_arith_s(UGeckoInstruction inst); - - void fcmpx(UGeckoInstruction inst); - void fmrx(UGeckoInstruction inst); - - void cmpli(UGeckoInstruction inst); - void cmpi(UGeckoInstruction inst); - void cmpl(UGeckoInstruction inst); - void cmp(UGeckoInstruction inst); - - void cntlzwx(UGeckoInstruction inst); - - void lfs(UGeckoInstruction inst); - void lfd(UGeckoInstruction inst); - void stfd(UGeckoInstruction inst); - void stfs(UGeckoInstruction inst); - void psq_l(UGeckoInstruction inst); - void psq_st(UGeckoInstruction inst); - - void fmaddXX(UGeckoInstruction inst); - void stX(UGeckoInstruction inst); //stw sth stb - void lXz(UGeckoInstruction inst); - void lha(UGeckoInstruction inst); - void rlwinmx(UGeckoInstruction inst); - void rlwimix(UGeckoInstruction inst); - void rlwnmx(UGeckoInstruction inst); - void negx(UGeckoInstruction inst); - void slwx(UGeckoInstruction inst); - void srwx(UGeckoInstruction inst); - void dcbz(UGeckoInstruction inst); - void lfsx(UGeckoInstruction inst); - - void subfic(UGeckoInstruction inst); - void subfcx(UGeckoInstruction inst); - void subfx(UGeckoInstruction inst); - void subfex(UGeckoInstruction inst); - - void lbzx(UGeckoInstruction inst); - void lwzx(UGeckoInstruction inst); - void lhax(UGeckoInstruction inst); - - void lmw(UGeckoInstruction inst); - void stmw(UGeckoInstruction inst); -} - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +// ======================== +// See comments in Jit.cpp. +// ======================== + +#ifndef _JIT_H +#define _JIT_H + +#include "../PPCAnalyst.h" +#include "JitCache.h" +#include "x64Emitter.h" + +// Enable or disable JIT off options. All the if() checks in the JIT functions may result in a +// speed drop. However it should barely be noticable as the code is recompiled rarely. +#define JIT_OFF_OPTIONS + +namespace Jit64 +{ + struct JitStats + { + u32 compiledBlocks; + float averageCodeExpansion; + float ratioOpsCompiled; //how many really were compiled, how many became "call interpreter"? + }; + +#define JIT_OPCODE 0 + + struct JitBlock; + const u8* DoJit(u32 emaddress, JitBlock &b); + bool IsInJitCode(const u8 *codePtr); + + struct JitState + { + u32 compilerPC; + u32 blockStart; + int blockSize; + int instructionNumber; + int downcountAmount; + int block_flags; + + bool isLastInstruction; + bool blockSetsQuantizers; + + int fifoBytesThisBlock; + + PPCAnalyst::BlockStats st; + PPCAnalyst::BlockRegStats gpa; + PPCAnalyst::BlockRegStats fpa; + PPCAnalyst::CodeOp *op; + + JitBlock *curBlock; + }; + + struct JitOptions + { + bool optimizeStack; + bool assumeFPLoadFromMem; + bool enableBlocklink; + bool fpAccurateFlags; + bool enableFastMem; + bool optimizeGatherPipe; + bool interpretFPU; + bool fastInterrupts; + }; + + extern JitState js; + extern JitOptions jo; + + void Init(); + + void Default(UGeckoInstruction _inst); + void DoNothing(UGeckoInstruction _inst); + + void WriteExit(u32 destination, int exit_num); + void WriteExitDestInEAX(int exit_num); + void WriteExceptionExit(u32 exception); + void WriteRfiExitDestInEAX(); + + void HLEFunction(UGeckoInstruction _inst); + + void addx(UGeckoInstruction inst); + void orx(UGeckoInstruction inst); + void xorx(UGeckoInstruction inst); + void andx(UGeckoInstruction inst); + void mulli(UGeckoInstruction inst); + void mulhwux(UGeckoInstruction inst); + void mullwx(UGeckoInstruction inst); + void divwux(UGeckoInstruction inst); + void srawix(UGeckoInstruction inst); + void srawx(UGeckoInstruction inst); + void addex(UGeckoInstruction inst); + + void extsbx(UGeckoInstruction inst); + void extshx(UGeckoInstruction inst); + + void sc(UGeckoInstruction _inst); + void rfi(UGeckoInstruction _inst); + + void bx(UGeckoInstruction inst); + void bclrx(UGeckoInstruction _inst); + void bcctrx(UGeckoInstruction _inst); + void bcx(UGeckoInstruction inst); + + void mtspr(UGeckoInstruction inst); + void mfspr(UGeckoInstruction inst); + void mtmsr(UGeckoInstruction inst); + void mfmsr(UGeckoInstruction inst); + void mftb(UGeckoInstruction inst); + void mtcrf(UGeckoInstruction inst); + void mfcr(UGeckoInstruction inst); + + void reg_imm(UGeckoInstruction inst); + + void ps_sel(UGeckoInstruction inst); + void ps_mr(UGeckoInstruction inst); + void ps_sign(UGeckoInstruction inst); //aggregate + void ps_arith(UGeckoInstruction inst); //aggregate + void ps_mergeXX(UGeckoInstruction inst); + void ps_maddXX(UGeckoInstruction inst); + void ps_rsqrte(UGeckoInstruction inst); + void ps_sum(UGeckoInstruction inst); + void ps_muls(UGeckoInstruction inst); + + void fp_arith_s(UGeckoInstruction inst); + + void fcmpx(UGeckoInstruction inst); + void fmrx(UGeckoInstruction inst); + + void cmpli(UGeckoInstruction inst); + void cmpi(UGeckoInstruction inst); + void cmpl(UGeckoInstruction inst); + void cmp(UGeckoInstruction inst); + + void cntlzwx(UGeckoInstruction inst); + + void lfs(UGeckoInstruction inst); + void lfd(UGeckoInstruction inst); + void stfd(UGeckoInstruction inst); + void stfs(UGeckoInstruction inst); + void psq_l(UGeckoInstruction inst); + void psq_st(UGeckoInstruction inst); + + void fmaddXX(UGeckoInstruction inst); + void stX(UGeckoInstruction inst); //stw sth stb + void lXz(UGeckoInstruction inst); + void lha(UGeckoInstruction inst); + void rlwinmx(UGeckoInstruction inst); + void rlwimix(UGeckoInstruction inst); + void rlwnmx(UGeckoInstruction inst); + void negx(UGeckoInstruction inst); + void slwx(UGeckoInstruction inst); + void srwx(UGeckoInstruction inst); + void dcbz(UGeckoInstruction inst); + void lfsx(UGeckoInstruction inst); + + void subfic(UGeckoInstruction inst); + void subfcx(UGeckoInstruction inst); + void subfx(UGeckoInstruction inst); + void subfex(UGeckoInstruction inst); + + void lbzx(UGeckoInstruction inst); + void lwzx(UGeckoInstruction inst); + void lhax(UGeckoInstruction inst); + + void lmw(UGeckoInstruction inst); + void stmw(UGeckoInstruction inst); +} + +#endif + diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h index cd9a30ab1e..d0251f83e8 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h @@ -1,50 +1,50 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _JITASM_H -#define _JITASM_H - - -namespace Jit64 -{ - namespace Asm - { - extern const u8 *enterCode; - - extern const u8 *dispatcher; - extern const u8 *dispatcherNoCheck; - extern const u8 *dispatcherPcInEAX; - - extern const u8 *fpException; - extern const u8 *computeRc; - extern const u8 *computeRcFp; - extern const u8 *testExceptions; - extern const u8 *dispatchPcInEAX; - extern const u8 *doTiming; - - extern const u8 *fifoDirectWrite8; - extern const u8 *fifoDirectWrite16; - extern const u8 *fifoDirectWrite32; - extern const u8 *fifoDirectWriteFloat; - extern const u8 *fifoDirectWriteXmm64; - - extern bool compareEnabled; - void Generate(); - } -} - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _JITASM_H +#define _JITASM_H + + +namespace Jit64 +{ + namespace Asm + { + extern const u8 *enterCode; + + extern const u8 *dispatcher; + extern const u8 *dispatcherNoCheck; + extern const u8 *dispatcherPcInEAX; + + extern const u8 *fpException; + extern const u8 *computeRc; + extern const u8 *computeRcFp; + extern const u8 *testExceptions; + extern const u8 *dispatchPcInEAX; + extern const u8 *doTiming; + + extern const u8 *fifoDirectWrite8; + extern const u8 *fifoDirectWrite16; + extern const u8 *fifoDirectWrite32; + extern const u8 *fifoDirectWriteFloat; + extern const u8 *fifoDirectWriteXmm64; + + extern bool compareEnabled; + void Generate(); + } +} + +#endif + diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.h b/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.h index 0c39151e46..649c119511 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitBackpatch.h @@ -1,32 +1,32 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _JITBACKPATCH_H -#define _JITBACKPATCH_H - -#include "Common.h" - -#ifdef _WIN32 -#include -#endif - -namespace Jit64 { -// Returns the new RIP value -u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx); -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _JITBACKPATCH_H +#define _JITBACKPATCH_H + +#include "Common.h" + +#ifdef _WIN32 +#include +#endif + +namespace Jit64 { +// Returns the new RIP value +u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx); +} + +#endif diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitCache.h b/Source/Core/Core/Src/PowerPC/Jit64/JitCache.h index 8a459baae6..8eca449e9d 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitCache.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitCache.h @@ -1,102 +1,102 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _JITCACHE_H -#define _JITCACHE_H - -#include "../Gekko.h" -#ifdef _WIN32 -#include // -> LARGE_INTEGER -#endif - -namespace Jit64 -{ - - typedef void (*CompiledCode)(); - - void unknown_instruction(UGeckoInstruction _inst); - - //Code pointers are stored separately, they will be accessed much more frequently - - enum BlockFlag - { - BLOCK_USE_GQR0 = 0x1, - BLOCK_USE_GQR1 = 0x2, - BLOCK_USE_GQR2 = 0x4, - BLOCK_USE_GQR3 = 0x8, - BLOCK_USE_GQR4 = 0x10, - BLOCK_USE_GQR5 = 0x20, - BLOCK_USE_GQR6 = 0x40, - BLOCK_USE_GQR7 = 0x80, - }; - - // TODO(ector) - optimize this struct for size - struct JitBlock - { - u32 exitAddress[2]; // 0xFFFFFFFF == unknown - u8 *exitPtrs[2]; // to be able to rewrite the exit jump - bool linkStatus[2]; - - u32 originalAddress; - u32 originalFirstOpcode; //to be able to restore - u32 codeSize; - u32 originalSize; - int runCount; // for profiling. -#ifdef _WIN32 - // we don't really need to save start and stop - // TODO (mb2): ticStart and ticStop -> "local var" mean "in block" ... low priority ;) - LARGE_INTEGER ticStart; // for profiling - time. - LARGE_INTEGER ticStop; // for profiling - time. - LARGE_INTEGER ticCounter; // for profiling - time. -#endif - const u8 *checkedEntry; - bool invalid; - int flags; - }; - - void PrintStats(); - - JitBlock *CurBlock(); - JitBlock *GetBlock(int no); - - u32 GetOriginalCode(u32 address); - - void InvalidateCodeRange(u32 address, u32 length); - int GetBlockNumberFromAddress(u32 address); - CompiledCode GetCompiledCode(u32 address); - CompiledCode GetCompiledCodeFromBlock(int blockNumber); - - int GetCodeSize(); - int GetNumBlocks(); - - u8 **GetCodePointers(); - - u8 *Jit(u32 emaddress); - - void DestroyBlocksWithFlag(BlockFlag death_flag); - - void LinkBlocks(); - void ClearCache(); - - void EnterFastRun(); - - void InitCache(); - void ShutdownCache(); - void ResetCache(); -} - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _JITCACHE_H +#define _JITCACHE_H + +#include "../Gekko.h" +#ifdef _WIN32 +#include // -> LARGE_INTEGER +#endif + +namespace Jit64 +{ + + typedef void (*CompiledCode)(); + + void unknown_instruction(UGeckoInstruction _inst); + + //Code pointers are stored separately, they will be accessed much more frequently + + enum BlockFlag + { + BLOCK_USE_GQR0 = 0x1, + BLOCK_USE_GQR1 = 0x2, + BLOCK_USE_GQR2 = 0x4, + BLOCK_USE_GQR3 = 0x8, + BLOCK_USE_GQR4 = 0x10, + BLOCK_USE_GQR5 = 0x20, + BLOCK_USE_GQR6 = 0x40, + BLOCK_USE_GQR7 = 0x80, + }; + + // TODO(ector) - optimize this struct for size + struct JitBlock + { + u32 exitAddress[2]; // 0xFFFFFFFF == unknown + u8 *exitPtrs[2]; // to be able to rewrite the exit jump + bool linkStatus[2]; + + u32 originalAddress; + u32 originalFirstOpcode; //to be able to restore + u32 codeSize; + u32 originalSize; + int runCount; // for profiling. +#ifdef _WIN32 + // we don't really need to save start and stop + // TODO (mb2): ticStart and ticStop -> "local var" mean "in block" ... low priority ;) + LARGE_INTEGER ticStart; // for profiling - time. + LARGE_INTEGER ticStop; // for profiling - time. + LARGE_INTEGER ticCounter; // for profiling - time. +#endif + const u8 *checkedEntry; + bool invalid; + int flags; + }; + + void PrintStats(); + + JitBlock *CurBlock(); + JitBlock *GetBlock(int no); + + u32 GetOriginalCode(u32 address); + + void InvalidateCodeRange(u32 address, u32 length); + int GetBlockNumberFromAddress(u32 address); + CompiledCode GetCompiledCode(u32 address); + CompiledCode GetCompiledCodeFromBlock(int blockNumber); + + int GetCodeSize(); + int GetNumBlocks(); + + u8 **GetCodePointers(); + + u8 *Jit(u32 emaddress); + + void DestroyBlocksWithFlag(BlockFlag death_flag); + + void LinkBlocks(); + void ClearCache(); + + void EnterFastRun(); + + void InitCache(); + void ShutdownCache(); + void ResetCache(); +} + +#endif + diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h b/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h index 84b436c4ac..f02c6b5034 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitCore.h @@ -1,33 +1,33 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _JITCORE_H -#define _JITCORE_H - -namespace Jit64 -{ - namespace Core - { - void Init(); - void Shutdown(); - void Reset(); - void SingleStep(); - void Run(); - }; -} - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _JITCORE_H +#define _JITCORE_H + +namespace Jit64 +{ + namespace Core + { + void Init(); + void Shutdown(); + void Reset(); + void SingleStep(); + void Run(); + }; +} + +#endif + diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h index 28fb7ac96c..6c9ee71a4a 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h @@ -1,150 +1,150 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _JITREGCACHE_H -#define _JITREGCACHE_H - -#include "x64Emitter.h" - -namespace Jit64 -{ - using namespace Gen; - enum FlushMode - { - // FLUSH_ALLNONSTATIC, - FLUSH_ALL - }; - - enum GrabMode - { - M_READ = 1, - M_WRITE = 2, - M_READWRITE = 3, - }; - - //Regcache sketch - struct PPCCachedReg - { - OpArg location; - bool away; //not in source register - }; - - struct X64CachedReg - { - int ppcReg; - bool dirty; - bool free; - }; - - typedef int XReg; - typedef int PReg; - -#ifdef _M_X64 -#define NUMXREGS 16 -#elif _M_IX86 -#define NUMXREGS 8 -#endif - - class RegCache - { - private: - bool locks[32]; - bool saved_locks[32]; - bool saved_xlocks[NUMXREGS]; - protected: - bool xlocks[NUMXREGS]; - PPCCachedReg regs[32]; - X64CachedReg xregs[NUMXREGS]; - - PPCCachedReg saved_regs[32]; - X64CachedReg saved_xregs[NUMXREGS]; - public: - virtual ~RegCache() {} - virtual void Start(PPCAnalyst::BlockRegStats &stats) = 0; - void FlushR(X64Reg reg); - void FlushR(X64Reg reg, X64Reg reg2) {FlushR(reg); FlushR(reg2);} - void FlushLockX(X64Reg reg) { - FlushR(reg); - LockX(reg); - } - void FlushLockX(X64Reg reg1, X64Reg reg2) { - FlushR(reg1); FlushR(reg2); - LockX(reg1); LockX(reg2); - } - virtual void Flush(FlushMode mode); - virtual void Flush(PPCAnalyst::CodeOp *op) {Flush(FLUSH_ALL);} - void SanityCheck() const; - void KillImmediate(int preg); - - virtual const int *GetAllocationOrder(int &count) = 0; - - //TODO - instead of doload, use "read", "write" - //read only will not set dirty flag - virtual void LoadToX64(int preg, bool doLoad = true, bool makeDirty = true) = 0; - virtual void StoreFromX64(int preg) = 0; - - const OpArg &R(int preg) const {return regs[preg].location;} - X64Reg RX(int preg) const - { - if (regs[preg].away && regs[preg].location.IsSimpleReg()) - return regs[preg].location.GetSimpleReg(); - PanicAlert("Not so simple - %i", preg); - return (X64Reg)-1; - } - virtual OpArg GetDefaultLocation(int reg) const = 0; - - void DiscardRegContentsIfCached(int preg); - void Lock(int p1, int p2=0xff, int p3=0xff, int p4=0xff); - void LockX(int x1, int x2=0xff, int x3=0xff, int x4=0xff); - void UnlockAll(); - void UnlockAllX(); - bool IsFreeX(int xreg) const; - - X64Reg GetFreeXReg(); - - void SaveState(); - void LoadState(); - }; - - class GPRRegCache : public RegCache - { - public: - void Start(PPCAnalyst::BlockRegStats &stats); - void LoadToX64(int preg, bool doLoad = true, bool makeDirty = true); - void StoreFromX64(int preg); - OpArg GetDefaultLocation(int reg) const; - const int *GetAllocationOrder(int &count); - void SetImmediate32(int preg, u32 immValue); - }; - - - class FPURegCache : public RegCache - { - public: - void Start(PPCAnalyst::BlockRegStats &stats); - void LoadToX64(int preg, bool doLoad = true, bool makeDirty = true); - void StoreFromX64(int preg); - const int *GetAllocationOrder(int &count); - OpArg GetDefaultLocation(int reg) const; - }; - - extern GPRRegCache gpr; - extern FPURegCache fpr; -} - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _JITREGCACHE_H +#define _JITREGCACHE_H + +#include "x64Emitter.h" + +namespace Jit64 +{ + using namespace Gen; + enum FlushMode + { + // FLUSH_ALLNONSTATIC, + FLUSH_ALL + }; + + enum GrabMode + { + M_READ = 1, + M_WRITE = 2, + M_READWRITE = 3, + }; + + //Regcache sketch + struct PPCCachedReg + { + OpArg location; + bool away; //not in source register + }; + + struct X64CachedReg + { + int ppcReg; + bool dirty; + bool free; + }; + + typedef int XReg; + typedef int PReg; + +#ifdef _M_X64 +#define NUMXREGS 16 +#elif _M_IX86 +#define NUMXREGS 8 +#endif + + class RegCache + { + private: + bool locks[32]; + bool saved_locks[32]; + bool saved_xlocks[NUMXREGS]; + protected: + bool xlocks[NUMXREGS]; + PPCCachedReg regs[32]; + X64CachedReg xregs[NUMXREGS]; + + PPCCachedReg saved_regs[32]; + X64CachedReg saved_xregs[NUMXREGS]; + public: + virtual ~RegCache() {} + virtual void Start(PPCAnalyst::BlockRegStats &stats) = 0; + void FlushR(X64Reg reg); + void FlushR(X64Reg reg, X64Reg reg2) {FlushR(reg); FlushR(reg2);} + void FlushLockX(X64Reg reg) { + FlushR(reg); + LockX(reg); + } + void FlushLockX(X64Reg reg1, X64Reg reg2) { + FlushR(reg1); FlushR(reg2); + LockX(reg1); LockX(reg2); + } + virtual void Flush(FlushMode mode); + virtual void Flush(PPCAnalyst::CodeOp *op) {Flush(FLUSH_ALL);} + void SanityCheck() const; + void KillImmediate(int preg); + + virtual const int *GetAllocationOrder(int &count) = 0; + + //TODO - instead of doload, use "read", "write" + //read only will not set dirty flag + virtual void LoadToX64(int preg, bool doLoad = true, bool makeDirty = true) = 0; + virtual void StoreFromX64(int preg) = 0; + + const OpArg &R(int preg) const {return regs[preg].location;} + X64Reg RX(int preg) const + { + if (regs[preg].away && regs[preg].location.IsSimpleReg()) + return regs[preg].location.GetSimpleReg(); + PanicAlert("Not so simple - %i", preg); + return (X64Reg)-1; + } + virtual OpArg GetDefaultLocation(int reg) const = 0; + + void DiscardRegContentsIfCached(int preg); + void Lock(int p1, int p2=0xff, int p3=0xff, int p4=0xff); + void LockX(int x1, int x2=0xff, int x3=0xff, int x4=0xff); + void UnlockAll(); + void UnlockAllX(); + bool IsFreeX(int xreg) const; + + X64Reg GetFreeXReg(); + + void SaveState(); + void LoadState(); + }; + + class GPRRegCache : public RegCache + { + public: + void Start(PPCAnalyst::BlockRegStats &stats); + void LoadToX64(int preg, bool doLoad = true, bool makeDirty = true); + void StoreFromX64(int preg); + OpArg GetDefaultLocation(int reg) const; + const int *GetAllocationOrder(int &count); + void SetImmediate32(int preg, u32 immValue); + }; + + + class FPURegCache : public RegCache + { + public: + void Start(PPCAnalyst::BlockRegStats &stats); + void LoadToX64(int preg, bool doLoad = true, bool makeDirty = true); + void StoreFromX64(int preg); + const int *GetAllocationOrder(int &count); + OpArg GetDefaultLocation(int reg) const; + }; + + extern GPRRegCache gpr; + extern FPURegCache fpr; +} + +#endif + diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h index 3a590aa39b..b06f749101 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Util.h @@ -1,36 +1,36 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#include "x64Emitter.h" - -namespace Jit64 -{ - -// Memory Load/Store -void UnsafeLoadRegToReg(Gen::X64Reg reg_addr, Gen::X64Reg reg_value, int accessSize, s32 offset = 0, bool signExtend = false); -void UnsafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset = 0); -void SafeLoadRegToEAX(Gen::X64Reg reg, int accessSize, s32 offset, bool signExtend = false); -void SafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset); - -void WriteToConstRamAddress(int accessSize, const Gen::OpArg& arg, u32 address); -void WriteFloatToConstRamAddress(const Gen::X64Reg& xmm_reg, u32 address); - -void ForceSinglePrecisionS(X64Reg xmm); -void ForceSinglePrecisionP(X64Reg xmm); - -} // namespace +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#include "x64Emitter.h" + +namespace Jit64 +{ + +// Memory Load/Store +void UnsafeLoadRegToReg(Gen::X64Reg reg_addr, Gen::X64Reg reg_value, int accessSize, s32 offset = 0, bool signExtend = false); +void UnsafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset = 0); +void SafeLoadRegToEAX(Gen::X64Reg reg, int accessSize, s32 offset, bool signExtend = false); +void SafeWriteRegToReg(Gen::X64Reg reg_value, Gen::X64Reg reg_addr, int accessSize, s32 offset); + +void WriteToConstRamAddress(int accessSize, const Gen::OpArg& arg, u32 address); +void WriteFloatToConstRamAddress(const Gen::X64Reg& xmm_reg, u32 address); + +void ForceSinglePrecisionS(X64Reg xmm); +void ForceSinglePrecisionP(X64Reg xmm); + +} // namespace diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.h b/Source/Core/Core/Src/PowerPC/PPCAnalyst.h index 844d519138..1508d4740c 100644 --- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.h +++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.h @@ -1,95 +1,95 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PPCANALYST_H -#define _PPCANALYST_H - -#include -#include - -#include - -#include "Common.h" -#include "Gekko.h" - -class SymbolDB; -struct Symbol; - -namespace PPCAnalyst -{ - -struct CodeOp //16B -{ - UGeckoInstruction inst; - u32 address; - u32 branchTo; //if 0, not a branch - int branchToIndex; //index of target block - s8 regsOut[2]; - s8 regsIn[3]; - s8 fregOut; - s8 fregsIn[3]; - bool isBranchTarget; - bool wantsCR0; - bool wantsCR1; - bool wantsPS1; - bool outputCR0; - bool outputCR1; - bool outputPS1; - const u8 *x86ptr; -}; - -struct BlockStats -{ - bool isFirstBlockOfFunction; - bool isLastBlockOfFunction; - int numCycles; -}; - -struct BlockRegStats -{ - short firstRead[32]; - short firstWrite[32]; - short lastRead[32]; - short lastWrite[32]; - short numReads[32]; - short numWrites[32]; - - bool any; - bool anyTimer; - - int GetTotalNumAccesses(int reg) {return numReads[reg] + numWrites[reg];} - int GetUseRange(int reg) { - return max(lastRead[reg], lastWrite[reg]) - - min(firstRead[reg], firstWrite[reg]);} -}; - -void Init(); -void Shutdown(); - -void ShuffleUp(CodeOp *code, int first, int last); - -CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, BlockRegStats &fpa); - -void LogFunctionCall(u32 addr); - -void FindFunctions(u32 startAddr, u32 endAddr, SymbolDB *func_db); -bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size = 0); - -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PPCANALYST_H +#define _PPCANALYST_H + +#include +#include + +#include + +#include "Common.h" +#include "Gekko.h" + +class SymbolDB; +struct Symbol; + +namespace PPCAnalyst +{ + +struct CodeOp //16B +{ + UGeckoInstruction inst; + u32 address; + u32 branchTo; //if 0, not a branch + int branchToIndex; //index of target block + s8 regsOut[2]; + s8 regsIn[3]; + s8 fregOut; + s8 fregsIn[3]; + bool isBranchTarget; + bool wantsCR0; + bool wantsCR1; + bool wantsPS1; + bool outputCR0; + bool outputCR1; + bool outputPS1; + const u8 *x86ptr; +}; + +struct BlockStats +{ + bool isFirstBlockOfFunction; + bool isLastBlockOfFunction; + int numCycles; +}; + +struct BlockRegStats +{ + short firstRead[32]; + short firstWrite[32]; + short lastRead[32]; + short lastWrite[32]; + short numReads[32]; + short numWrites[32]; + + bool any; + bool anyTimer; + + int GetTotalNumAccesses(int reg) {return numReads[reg] + numWrites[reg];} + int GetUseRange(int reg) { + return max(lastRead[reg], lastWrite[reg]) - + min(firstRead[reg], firstWrite[reg]);} +}; + +void Init(); +void Shutdown(); + +void ShuffleUp(CodeOp *code, int first, int last); + +CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, BlockRegStats &fpa); + +void LogFunctionCall(u32 addr); + +void FindFunctions(u32 startAddr, u32 endAddr, SymbolDB *func_db); +bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size = 0); + +} // namespace + +#endif + diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.h b/Source/Core/Core/Src/PowerPC/PPCTables.h index 15d7b922dc..c097d22594 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.h +++ b/Source/Core/Core/Src/PowerPC/PPCTables.h @@ -1,101 +1,101 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PPCTABLES_H -#define _PPCTABLES_H - -#include "Gekko.h" -#include "Interpreter/Interpreter.h" - -enum -{ - FL_SET_CR0 = (1<<0), // - FL_SET_CR1 = (1<<1), // - FL_SET_CRn = (1<<2), // - FL_SET_CA = (1<<3), // carry - FL_READ_CA = (1<<4), // carry - FL_RC_BIT = (1<<5), - FL_RC_BIT_F = (1<<6), - FL_ENDBLOCK = (1<<7), - FL_IN_A = (1<<8), - FL_IN_A0 = (1<<9), - FL_IN_B = (1<<10), - FL_IN_C = (1<<11), - FL_IN_AB = FL_IN_A | FL_IN_B, - FL_IN_A0B = FL_IN_A0 | FL_IN_B, - FL_IN_A0BC = FL_IN_A0 | FL_IN_B | FL_IN_C, - FL_OUT_D = (1<<11), - FL_OUT_S = FL_OUT_D, - FL_OUT_A = (1<<12), - FL_OUT_AD = (1<<13), - FL_TIMER = (1<<15), - FL_CHECKEXCEPTIONS = (1<<16), -}; - -enum -{ - OPTYPE_INVALID , - OPTYPE_SUBTABLE, - OPTYPE_INTEGER , - OPTYPE_CR , - OPTYPE_SPR , - OPTYPE_SYSTEM , - OPTYPE_SYSTEMFP, - OPTYPE_LOAD , - OPTYPE_STORE , - OPTYPE_LOADFP , - OPTYPE_STOREFP , - OPTYPE_FPU , - OPTYPE_PS , - OPTYPE_DCACHE , - OPTYPE_ICACHE , - OPTYPE_BRANCH , - OPTYPE_UNKNOWN , -}; - -struct GekkoOPInfo -{ - const char *opname; - int type; - int flags; - int numCyclesMinusOne; - int runCount; - int compileCount; - u32 lastUse; -}; - -GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst); -Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst); - -class PPCTables -{ -public: - typedef void (*_recompilerInstruction) (UGeckoInstruction instCode); - typedef void (*_interpreterInstruction)(UGeckoInstruction instCode); - - static void InitTables(); - static bool IsValidInstruction(UGeckoInstruction _instCode); - static bool UsesFPU(UGeckoInstruction _inst); - - static void CountInstruction(UGeckoInstruction _inst); - static void PrintInstructionRunCounts(); - static void LogCompiledInstructions(); - - static void CompileInstruction(UGeckoInstruction _inst); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PPCTABLES_H +#define _PPCTABLES_H + +#include "Gekko.h" +#include "Interpreter/Interpreter.h" + +enum +{ + FL_SET_CR0 = (1<<0), // + FL_SET_CR1 = (1<<1), // + FL_SET_CRn = (1<<2), // + FL_SET_CA = (1<<3), // carry + FL_READ_CA = (1<<4), // carry + FL_RC_BIT = (1<<5), + FL_RC_BIT_F = (1<<6), + FL_ENDBLOCK = (1<<7), + FL_IN_A = (1<<8), + FL_IN_A0 = (1<<9), + FL_IN_B = (1<<10), + FL_IN_C = (1<<11), + FL_IN_AB = FL_IN_A | FL_IN_B, + FL_IN_A0B = FL_IN_A0 | FL_IN_B, + FL_IN_A0BC = FL_IN_A0 | FL_IN_B | FL_IN_C, + FL_OUT_D = (1<<11), + FL_OUT_S = FL_OUT_D, + FL_OUT_A = (1<<12), + FL_OUT_AD = (1<<13), + FL_TIMER = (1<<15), + FL_CHECKEXCEPTIONS = (1<<16), +}; + +enum +{ + OPTYPE_INVALID , + OPTYPE_SUBTABLE, + OPTYPE_INTEGER , + OPTYPE_CR , + OPTYPE_SPR , + OPTYPE_SYSTEM , + OPTYPE_SYSTEMFP, + OPTYPE_LOAD , + OPTYPE_STORE , + OPTYPE_LOADFP , + OPTYPE_STOREFP , + OPTYPE_FPU , + OPTYPE_PS , + OPTYPE_DCACHE , + OPTYPE_ICACHE , + OPTYPE_BRANCH , + OPTYPE_UNKNOWN , +}; + +struct GekkoOPInfo +{ + const char *opname; + int type; + int flags; + int numCyclesMinusOne; + int runCount; + int compileCount; + u32 lastUse; +}; + +GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst); +Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst); + +class PPCTables +{ +public: + typedef void (*_recompilerInstruction) (UGeckoInstruction instCode); + typedef void (*_interpreterInstruction)(UGeckoInstruction instCode); + + static void InitTables(); + static bool IsValidInstruction(UGeckoInstruction _instCode); + static bool UsesFPU(UGeckoInstruction _inst); + + static void CountInstruction(UGeckoInstruction _inst); + static void PrintInstructionRunCounts(); + static void LogCompiledInstructions(); + + static void CompileInstruction(UGeckoInstruction _inst); +}; + +#endif diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.h b/Source/Core/Core/Src/PowerPC/PowerPC.h index e34ad92bdc..2ac455211f 100644 --- a/Source/Core/Core/Src/PowerPC/PowerPC.h +++ b/Source/Core/Core/Src/PowerPC/PowerPC.h @@ -1,157 +1,157 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _POWERPC_H -#define _POWERPC_H - -#include "Common.h" -#include "Gekko.h" - -class PointerWrap; - -namespace PowerPC -{ - enum CoreMode - { - MODE_INTERPRETER, - MODE_JIT, - }; - - // This contains the entire state of the emulated PowerPC "Gekko" CPU. - struct GC_ALIGNED64(PowerPCState) - { - u32 mojs[128]; // Try to isolate the regs from other variables in the cache. - u32 gpr[32]; // General purpose registers. r1 = stack pointer. - - // The paired singles are strange : PS0 is stored in the full 64 bits of each FPR - // but ps calculations are only done in 32-bit precision, and PS1 is only 32 bits. - // Since we want to use SIMD, SSE2 is the only viable alternative - 2x double. - u64 ps[32][2]; - - u32 pc; // program counter - u32 npc; - - u32 cr; // flags - u32 msr; // machine specific register - u32 fpscr; // floating point flags/status bits - - // Exception management. - u32 Exceptions; - - u32 sr[16]; // Segment registers. Unused. - - u32 DebugCount; - - // special purpose registers - controlls quantizers, DMA, and lots of other misc extensions. - // also for power management, but we don't care about that. - u32 spr[1024]; - }; - - enum CPUState - { - CPU_RUNNING = 0, - CPU_RUNNINGDEBUG = 1, - CPU_STEPPING = 2, - CPU_POWERDOWN = 3, - }; - - extern PowerPCState ppcState; - extern volatile CPUState state; // Execution engines should poll this to know when to exit. - - void Init(); - void Shutdown(); - void DoState(PointerWrap &p); - - void SetMode(CoreMode _coreType); - - void SingleStep(); - void CheckExceptions(); - void RunLoop(); - void Start(); - void Pause(); - void Stop(); - - void OnIdle(u32 _uThreadAddr); -} - -// Easy register access macros. -#define HID2 ((UReg_HID2&)PowerPC::ppcState.spr[SPR_HID2]) -#define DMAU (*(UReg_DMAU*)&PowerPC::ppcState.spr[SPR_DMAU]) -#define DMAL (*(UReg_DMAL*)&PowerPC::ppcState.spr[SPR_DMAL]) -#define XER ((UReg_XER&)PowerPC::ppcState.spr[SPR_XER]) -#define PC PowerPC::ppcState.pc -#define NPC PowerPC::ppcState.npc -#define CR PowerPC::ppcState.cr -#define FPSCR ((UReg_FPSCR&)PowerPC::ppcState.fpscr) -#define MSR PowerPC::ppcState.msr -#define GPR(n) PowerPC::ppcState.gpr[n] - -#define rGPR PowerPC::ppcState.gpr -#define rSPR(i) PowerPC::ppcState.spr[i] -#define LR PowerPC::ppcState.spr[SPR_LR] -#define CTR PowerPC::ppcState.spr[SPR_CTR] -#define rDEC PowerPC::ppcState.spr[SPR_DEC] -#define SRR0 PowerPC::ppcState.spr[SPR_SRR0] -#define SRR1 PowerPC::ppcState.spr[SPR_SRR1] -#define SPRG0 PowerPC::ppcState.spr[SPR_SPRG0] -#define SPRG1 PowerPC::ppcState.spr[SPR_SPRG1] -#define SPRG2 PowerPC::ppcState.spr[SPR_SPRG2] -#define SPRG3 PowerPC::ppcState.spr[SPR_SPRG3] -#define GQR(x) PowerPC::ppcState.spr[SPR_GQR0+x] -#define TL PowerPC::ppcState.spr[SPR_TL] -#define TU PowerPC::ppcState.spr[SPR_TU] - -#define rPS0(i) (*(double*)(&PowerPC::ppcState.ps[i][0])) -#define rPS1(i) (*(double*)(&PowerPC::ppcState.ps[i][1])) - -#define riPS0(i) (*(u64*)(&PowerPC::ppcState.ps[i][0])) -#define riPS1(i) (*(u64*)(&PowerPC::ppcState.ps[i][1])) - - -// Wrappers to make it easier to in the future completely replace the storage of CR and Carry bits -// to something more x86-friendly. These are not used 100% consistently yet - and if we do this, we -// need the corresponding stuff on the JIT side too. - -inline void SetCRField(int cr_field, int value) { - PowerPC::ppcState.cr = (PowerPC::ppcState.cr & (~(0xF0000000 >> (cr_field * 4)))) | (value << ((7 - cr_field) * 4)); -} - -inline u32 GetCRField(int cr_field) { - return (PowerPC::ppcState.cr >> (4 * cr_field)) & 0xF; -} - -inline u32 GetCRBit(int bit) { - return (CR >> (31 - bit)) & 1; -} - -inline void SetCR(u32 new_cr) { - PowerPC::ppcState.cr = new_cr; -} - -inline u32 GetCR() { - return PowerPC::ppcState.cr; -} - -inline void SetCarry(int ca) { - XER.CA = ca; -} - -inline int GetCarry() { - return XER.CA; -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _POWERPC_H +#define _POWERPC_H + +#include "Common.h" +#include "Gekko.h" + +class PointerWrap; + +namespace PowerPC +{ + enum CoreMode + { + MODE_INTERPRETER, + MODE_JIT, + }; + + // This contains the entire state of the emulated PowerPC "Gekko" CPU. + struct GC_ALIGNED64(PowerPCState) + { + u32 mojs[128]; // Try to isolate the regs from other variables in the cache. + u32 gpr[32]; // General purpose registers. r1 = stack pointer. + + // The paired singles are strange : PS0 is stored in the full 64 bits of each FPR + // but ps calculations are only done in 32-bit precision, and PS1 is only 32 bits. + // Since we want to use SIMD, SSE2 is the only viable alternative - 2x double. + u64 ps[32][2]; + + u32 pc; // program counter + u32 npc; + + u32 cr; // flags + u32 msr; // machine specific register + u32 fpscr; // floating point flags/status bits + + // Exception management. + u32 Exceptions; + + u32 sr[16]; // Segment registers. Unused. + + u32 DebugCount; + + // special purpose registers - controlls quantizers, DMA, and lots of other misc extensions. + // also for power management, but we don't care about that. + u32 spr[1024]; + }; + + enum CPUState + { + CPU_RUNNING = 0, + CPU_RUNNINGDEBUG = 1, + CPU_STEPPING = 2, + CPU_POWERDOWN = 3, + }; + + extern PowerPCState ppcState; + extern volatile CPUState state; // Execution engines should poll this to know when to exit. + + void Init(); + void Shutdown(); + void DoState(PointerWrap &p); + + void SetMode(CoreMode _coreType); + + void SingleStep(); + void CheckExceptions(); + void RunLoop(); + void Start(); + void Pause(); + void Stop(); + + void OnIdle(u32 _uThreadAddr); +} + +// Easy register access macros. +#define HID2 ((UReg_HID2&)PowerPC::ppcState.spr[SPR_HID2]) +#define DMAU (*(UReg_DMAU*)&PowerPC::ppcState.spr[SPR_DMAU]) +#define DMAL (*(UReg_DMAL*)&PowerPC::ppcState.spr[SPR_DMAL]) +#define XER ((UReg_XER&)PowerPC::ppcState.spr[SPR_XER]) +#define PC PowerPC::ppcState.pc +#define NPC PowerPC::ppcState.npc +#define CR PowerPC::ppcState.cr +#define FPSCR ((UReg_FPSCR&)PowerPC::ppcState.fpscr) +#define MSR PowerPC::ppcState.msr +#define GPR(n) PowerPC::ppcState.gpr[n] + +#define rGPR PowerPC::ppcState.gpr +#define rSPR(i) PowerPC::ppcState.spr[i] +#define LR PowerPC::ppcState.spr[SPR_LR] +#define CTR PowerPC::ppcState.spr[SPR_CTR] +#define rDEC PowerPC::ppcState.spr[SPR_DEC] +#define SRR0 PowerPC::ppcState.spr[SPR_SRR0] +#define SRR1 PowerPC::ppcState.spr[SPR_SRR1] +#define SPRG0 PowerPC::ppcState.spr[SPR_SPRG0] +#define SPRG1 PowerPC::ppcState.spr[SPR_SPRG1] +#define SPRG2 PowerPC::ppcState.spr[SPR_SPRG2] +#define SPRG3 PowerPC::ppcState.spr[SPR_SPRG3] +#define GQR(x) PowerPC::ppcState.spr[SPR_GQR0+x] +#define TL PowerPC::ppcState.spr[SPR_TL] +#define TU PowerPC::ppcState.spr[SPR_TU] + +#define rPS0(i) (*(double*)(&PowerPC::ppcState.ps[i][0])) +#define rPS1(i) (*(double*)(&PowerPC::ppcState.ps[i][1])) + +#define riPS0(i) (*(u64*)(&PowerPC::ppcState.ps[i][0])) +#define riPS1(i) (*(u64*)(&PowerPC::ppcState.ps[i][1])) + + +// Wrappers to make it easier to in the future completely replace the storage of CR and Carry bits +// to something more x86-friendly. These are not used 100% consistently yet - and if we do this, we +// need the corresponding stuff on the JIT side too. + +inline void SetCRField(int cr_field, int value) { + PowerPC::ppcState.cr = (PowerPC::ppcState.cr & (~(0xF0000000 >> (cr_field * 4)))) | (value << ((7 - cr_field) * 4)); +} + +inline u32 GetCRField(int cr_field) { + return (PowerPC::ppcState.cr >> (4 * cr_field)) & 0xF; +} + +inline u32 GetCRBit(int bit) { + return (CR >> (31 - bit)) & 1; +} + +inline void SetCR(u32 new_cr) { + PowerPC::ppcState.cr = new_cr; +} + +inline u32 GetCR() { + return PowerPC::ppcState.cr; +} + +inline void SetCarry(int ca) { + XER.CA = ca; +} + +inline int GetCarry() { + return XER.CA; +} + +#endif diff --git a/Source/Core/Core/Src/PowerPC/Profiler.h b/Source/Core/Core/Src/PowerPC/Profiler.h index e07a1f1e02..cc466a1757 100644 --- a/Source/Core/Core/Src/PowerPC/Profiler.h +++ b/Source/Core/Core/Src/PowerPC/Profiler.h @@ -1,69 +1,69 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#ifndef _PROFILER_H -#define _PROFILER_H - -#ifdef _WIN32 - -#ifdef _M_IX86 -#define PROFILER_QUERY_PERFORMACE_COUNTER(pt) \ - LEA(32, EAX, M(pt)); PUSH(EAX); \ - CALL(QueryPerformanceCounter) -// TODO: r64 way -// asm write : (u64) dt += t1-t0 -#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) \ - MOV(32, R(EAX), M(pt1.LowPart)); \ - SUB(32, R(EAX), M(pt0.LowPart)); \ - MOV(32, R(ECX), M(pt1.HighPart)); \ - SBB(32, R(ECX), M(pt0.HighPart)); \ - ADD(32, R(EAX), M(pdt.LowPart)); \ - MOV(32, R(EDX), M(pdt.HighPart)); \ - ADC(32, R(EDX), R(ECX)); \ - MOV(32, M(pdt.LowPart), R(EAX)); \ - MOV(32, M(pdt.HighPart), R(EDX)) - -#define PROFILER_VPUSH PUSH(EAX);PUSH(ECX);PUSH(EDX) -#define PROFILER_VPOP POP(EDX);POP(ECX);POP(EAX) - -#else - -#define PROFILER_QUERY_PERFORMACE_COUNTER(pt) -#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) -#define PROFILER_VPUSH -#define PROFILER_VPOP -#endif - -#else -// TODO -#define PROFILER_QUERY_PERFORMACE_COUNTER(pt) -#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) -#define PROFILER_VPUSH -#define PROFILER_VPOP -#endif - - -namespace Profiler -{ -extern bool g_ProfileBlocks; -extern bool g_ProfileInstructions; - -void WriteProfileResults(const char *filename); -} - -#endif // _PROFILER_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#ifndef _PROFILER_H +#define _PROFILER_H + +#ifdef _WIN32 + +#ifdef _M_IX86 +#define PROFILER_QUERY_PERFORMACE_COUNTER(pt) \ + LEA(32, EAX, M(pt)); PUSH(EAX); \ + CALL(QueryPerformanceCounter) +// TODO: r64 way +// asm write : (u64) dt += t1-t0 +#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) \ + MOV(32, R(EAX), M(pt1.LowPart)); \ + SUB(32, R(EAX), M(pt0.LowPart)); \ + MOV(32, R(ECX), M(pt1.HighPart)); \ + SBB(32, R(ECX), M(pt0.HighPart)); \ + ADD(32, R(EAX), M(pdt.LowPart)); \ + MOV(32, R(EDX), M(pdt.HighPart)); \ + ADC(32, R(EDX), R(ECX)); \ + MOV(32, M(pdt.LowPart), R(EAX)); \ + MOV(32, M(pdt.HighPart), R(EDX)) + +#define PROFILER_VPUSH PUSH(EAX);PUSH(ECX);PUSH(EDX) +#define PROFILER_VPOP POP(EDX);POP(ECX);POP(EAX) + +#else + +#define PROFILER_QUERY_PERFORMACE_COUNTER(pt) +#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) +#define PROFILER_VPUSH +#define PROFILER_VPOP +#endif + +#else +// TODO +#define PROFILER_QUERY_PERFORMACE_COUNTER(pt) +#define PROFILER_ADD_DIFF_LARGE_INTEGER(pdt, pt1, pt0) +#define PROFILER_VPUSH +#define PROFILER_VPOP +#endif + + +namespace Profiler +{ +extern bool g_ProfileBlocks; +extern bool g_ProfileInstructions; + +void WriteProfileResults(const char *filename); +} + +#endif // _PROFILER_H diff --git a/Source/Core/Core/Src/PowerPC/SignatureDB.h b/Source/Core/Core/Src/PowerPC/SignatureDB.h index 509b2784e9..2d8a2500d6 100644 --- a/Source/Core/Core/Src/PowerPC/SignatureDB.h +++ b/Source/Core/Core/Src/PowerPC/SignatureDB.h @@ -1,57 +1,57 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include "Common.h" - -#include -#include - -// You're not meant to keep around SignatureDB objects persistently. Use 'em, throw them away. - -class SymbolDB; - -class SignatureDB -{ - struct DBFunc - { - std::string name; - u32 size; - DBFunc() : size(0) - { - } - }; - - // Map from signature to function. We store the DB in this map because it optimizes the - // most common operation - lookup. We don't care about ordering anyway. - typedef std::map FuncDB; - FuncDB database; - -public: - // Returns the hash. - u32 Add(u32 startAddr, u32 size, const char *name); - - bool Load(const char *filename); // Does not clear. Remember to clear first if that's what you want. - bool Save(const char *filename); - void Clean(const char *prefix); - void Clear(); - void List(); - - void Initialize(SymbolDB *func_db, const char *prefix = ""); - void Apply(SymbolDB *func_db); - - static u32 ComputeCodeChecksum(u32 offsetStart, u32 offsetEnd); -}; +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include "Common.h" + +#include +#include + +// You're not meant to keep around SignatureDB objects persistently. Use 'em, throw them away. + +class SymbolDB; + +class SignatureDB +{ + struct DBFunc + { + std::string name; + u32 size; + DBFunc() : size(0) + { + } + }; + + // Map from signature to function. We store the DB in this map because it optimizes the + // most common operation - lookup. We don't care about ordering anyway. + typedef std::map FuncDB; + FuncDB database; + +public: + // Returns the hash. + u32 Add(u32 startAddr, u32 size, const char *name); + + bool Load(const char *filename); // Does not clear. Remember to clear first if that's what you want. + bool Save(const char *filename); + void Clean(const char *prefix); + void Clear(); + void List(); + + void Initialize(SymbolDB *func_db, const char *prefix = ""); + void Apply(SymbolDB *func_db); + + static u32 ComputeCodeChecksum(u32 offsetStart, u32 offsetEnd); +}; diff --git a/Source/Core/Core/Src/PowerPC/SymbolDB.h b/Source/Core/Core/Src/PowerPC/SymbolDB.h index 2d18761e0e..d0452ec526 100644 --- a/Source/Core/Core/Src/PowerPC/SymbolDB.h +++ b/Source/Core/Core/Src/PowerPC/SymbolDB.h @@ -1,131 +1,131 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include "Common.h" - -#include -#include -#include -#include "../Debugger/PPCDebugInterface.h" -#include "../Debugger/DebugInterface.h" - -struct SCall -{ - SCall(u32 a, u32 b) : - function(a), - callAddress(b) - {} - u32 function; - u32 callAddress; -}; - -struct Symbol -{ - enum { - SYMBOL_FUNCTION = 0, - SYMBOL_DATA = 1, - }; - - Symbol() : - hash(0), - address(0), - flags(0), - size(0), - numCalls(0), - type(SYMBOL_FUNCTION), - analyzed(0) - {} - - std::string name; - std::vector callers; //addresses of functions that call this function - std::vector calls; //addresses of functions that are called by this function - u32 hash; //use for HLE function finding - u32 address; - u32 flags; - int size; - int numCalls; - int type; - int index; // only used for coloring the disasm view - int analyzed; -}; - -enum -{ - FFLAG_TIMERINSTRUCTIONS=(1<<0), - FFLAG_LEAF=(1<<1), - FFLAG_ONLYCALLSNICELEAFS=(1<<2), - FFLAG_EVIL=(1<<3), - FFLAG_RFI=(1<<4), - FFLAG_STRAIGHT=(1<<5) -}; - - -// This has functionality overlapping Debugger_Symbolmap. Should merge that stuff in here later. -class SymbolDB -{ -public: - typedef std::map XFuncMap; - typedef std::map XFuncPtrMap; - -private: - XFuncMap functions; - XFuncPtrMap checksumToFunction; - DebugInterface* debugger; - -public: - typedef void (*functionGetterCallback)(Symbol *f); - - SymbolDB(); - ~SymbolDB(); - - Symbol *AddFunction(u32 startAddr); - void AddKnownSymbol(u32 startAddr, u32 size, const char *name, int type = Symbol::SYMBOL_FUNCTION); - - Symbol *GetSymbolFromAddr(u32 addr); - Symbol *GetSymbolFromName(const char *name); - Symbol *GetSymbolFromHash(u32 hash) { - XFuncPtrMap::iterator iter = checksumToFunction.find(hash); - if (iter != checksumToFunction.end()) - return iter->second; - else - return 0; - } - - const XFuncMap &Symbols() const {return functions;} - XFuncMap &AccessSymbols() {return functions;} - - // deprecated - XFuncMap::iterator GetIterator() { return functions.begin(); } - XFuncMap::const_iterator GetConstIterator() { return functions.begin(); } - XFuncMap::iterator End() { return functions.end(); } - - const char *GetDescription(u32 addr); - - void Clear(const char *prefix = ""); - void List(); - void Index(); - void FillInCallers(); - - bool LoadMap(const char *filename); - bool SaveMap(const char *filename, bool WithCodes = false) const; - - void PrintCalls(u32 funcAddr) const; - void PrintCallers(u32 funcAddr) const; - void LogFunctionCall(u32 addr); -}; - -extern SymbolDB g_symbolDB; +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include "Common.h" + +#include +#include +#include +#include "../Debugger/PPCDebugInterface.h" +#include "../Debugger/DebugInterface.h" + +struct SCall +{ + SCall(u32 a, u32 b) : + function(a), + callAddress(b) + {} + u32 function; + u32 callAddress; +}; + +struct Symbol +{ + enum { + SYMBOL_FUNCTION = 0, + SYMBOL_DATA = 1, + }; + + Symbol() : + hash(0), + address(0), + flags(0), + size(0), + numCalls(0), + type(SYMBOL_FUNCTION), + analyzed(0) + {} + + std::string name; + std::vector callers; //addresses of functions that call this function + std::vector calls; //addresses of functions that are called by this function + u32 hash; //use for HLE function finding + u32 address; + u32 flags; + int size; + int numCalls; + int type; + int index; // only used for coloring the disasm view + int analyzed; +}; + +enum +{ + FFLAG_TIMERINSTRUCTIONS=(1<<0), + FFLAG_LEAF=(1<<1), + FFLAG_ONLYCALLSNICELEAFS=(1<<2), + FFLAG_EVIL=(1<<3), + FFLAG_RFI=(1<<4), + FFLAG_STRAIGHT=(1<<5) +}; + + +// This has functionality overlapping Debugger_Symbolmap. Should merge that stuff in here later. +class SymbolDB +{ +public: + typedef std::map XFuncMap; + typedef std::map XFuncPtrMap; + +private: + XFuncMap functions; + XFuncPtrMap checksumToFunction; + DebugInterface* debugger; + +public: + typedef void (*functionGetterCallback)(Symbol *f); + + SymbolDB(); + ~SymbolDB(); + + Symbol *AddFunction(u32 startAddr); + void AddKnownSymbol(u32 startAddr, u32 size, const char *name, int type = Symbol::SYMBOL_FUNCTION); + + Symbol *GetSymbolFromAddr(u32 addr); + Symbol *GetSymbolFromName(const char *name); + Symbol *GetSymbolFromHash(u32 hash) { + XFuncPtrMap::iterator iter = checksumToFunction.find(hash); + if (iter != checksumToFunction.end()) + return iter->second; + else + return 0; + } + + const XFuncMap &Symbols() const {return functions;} + XFuncMap &AccessSymbols() {return functions;} + + // deprecated + XFuncMap::iterator GetIterator() { return functions.begin(); } + XFuncMap::const_iterator GetConstIterator() { return functions.begin(); } + XFuncMap::iterator End() { return functions.end(); } + + const char *GetDescription(u32 addr); + + void Clear(const char *prefix = ""); + void List(); + void Index(); + void FillInCallers(); + + bool LoadMap(const char *filename); + bool SaveMap(const char *filename, bool WithCodes = false) const; + + void PrintCalls(u32 funcAddr) const; + void PrintCallers(u32 funcAddr) const; + void LogFunctionCall(u32 addr); +}; + +extern SymbolDB g_symbolDB; diff --git a/Source/Core/Core/Src/State.h b/Source/Core/Core/Src/State.h index 90d1c17ef0..36bc6c1026 100644 --- a/Source/Core/Core/Src/State.h +++ b/Source/Core/Core/Src/State.h @@ -1,31 +1,31 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -// Emulator state saving support. - -#ifndef _STATE_H -#define _STATE_H - -void State_Init(); -void State_Shutdown(); - -// These don't happen instantly - they get scheduled as events. -// Slots from 0-99. -void State_Save(int slot); -void State_Load(int slot); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +// Emulator state saving support. + +#ifndef _STATE_H +#define _STATE_H + +void State_Init(); +void State_Shutdown(); + +// These don't happen instantly - they get scheduled as events. +// Slots from 0-99. +void State_Save(int slot); +void State_Load(int slot); + +#endif diff --git a/Source/Core/Core/Src/Tracer.h b/Source/Core/Core/Src/Tracer.h index 9ddbe63eaa..65c17fca1a 100644 --- a/Source/Core/Core/Src/Tracer.h +++ b/Source/Core/Core/Src/Tracer.h @@ -1,23 +1,23 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _TRACER_H -#define _TRACER_H - - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _TRACER_H +#define _TRACER_H + + +#endif + diff --git a/Source/Core/Core/Src/VolumeHandler.h b/Source/Core/Core/Src/VolumeHandler.h index 22d398a139..a9359ee037 100644 --- a/Source/Core/Core/Src/VolumeHandler.h +++ b/Source/Core/Core/Src/VolumeHandler.h @@ -1,44 +1,44 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -// Disc volume handler. It's here because Wii discs can consist of multiple volumes. -// GC discs are seen as one big volume. - -#ifndef _VOLUMEHANDLER_H -#define _VOLUMEHANDLER_H - -#include -#include "CommonTypes.h" -#include "Volume.h" - -namespace VolumeHandler -{ - -void SetVolumeName(const std::string& _rFullPath); -void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii); - -u32 Read32(u64 _Offset); -bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength); - -bool IsValid(); -bool IsWii(); - -DiscIO::IVolume *GetVolume(); - -} // namespace - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +// Disc volume handler. It's here because Wii discs can consist of multiple volumes. +// GC discs are seen as one big volume. + +#ifndef _VOLUMEHANDLER_H +#define _VOLUMEHANDLER_H + +#include +#include "CommonTypes.h" +#include "Volume.h" + +namespace VolumeHandler +{ + +void SetVolumeName(const std::string& _rFullPath); +void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii); + +u32 Read32(u64 _Offset); +bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength); + +bool IsValid(); +bool IsWii(); + +DiscIO::IVolume *GetVolume(); + +} // namespace + +#endif diff --git a/Source/Core/Core/Src/stdafx.h b/Source/Core/Core/Src/stdafx.h index 08df0b2bb4..04922bcb2e 100644 --- a/Source/Core/Core/Src/stdafx.h +++ b/Source/Core/Core/Src/stdafx.h @@ -1,25 +1,25 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#define _WIN32_WINNT 0x501 -#ifndef _WIN32_IE -#define _WIN32_IE 0x0500 // Default value is 0x0400 -#endif - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#define _WIN32_WINNT 0x501 +#ifndef _WIN32_IE +#define _WIN32_IE 0x0500 // Default value is 0x0400 +#endif + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers diff --git a/Source/Core/DebuggerWX/Src/BreakPointDlg.h b/Source/Core/DebuggerWX/Src/BreakPointDlg.h index 5f0b974981..10ff40ef65 100644 --- a/Source/Core/DebuggerWX/Src/BreakPointDlg.h +++ b/Source/Core/DebuggerWX/Src/BreakPointDlg.h @@ -1,67 +1,67 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __BREAKPOINTDLG_h__ -#define __BREAKPOINTDLG_h__ - - -#include -#include -#include -#include -#include -#include - -#undef BreakPointDlg_STYLE -#define BreakPointDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - - -class BreakPointDlg : public wxDialog -{ - private: - DECLARE_EVENT_TABLE(); - - public: - BreakPointDlg(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("BreakPoint"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = BreakPointDlg_STYLE); - virtual ~BreakPointDlg(); - - private: - - wxButton *m_pButtonOK; - wxButton *m_pButtonCancel; - wxTextCtrl *m_pEditAddress; - - private: - - enum - { - ID_WXSTATICTEXT1 = 1006, - ID_OK = 1005, - ID_CANCEL = 1004, - ID_ADDRESS = 1003, - ID_WXSTATICBOX1 = 1001, - }; - - private: - - void CreateGUIControls(); - void OnClose(wxCloseEvent& event); - void OnCancel(wxCommandEvent& event); - void OnOK(wxCommandEvent& event); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __BREAKPOINTDLG_h__ +#define __BREAKPOINTDLG_h__ + + +#include +#include +#include +#include +#include +#include + +#undef BreakPointDlg_STYLE +#define BreakPointDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + + +class BreakPointDlg : public wxDialog +{ + private: + DECLARE_EVENT_TABLE(); + + public: + BreakPointDlg(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("BreakPoint"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = BreakPointDlg_STYLE); + virtual ~BreakPointDlg(); + + private: + + wxButton *m_pButtonOK; + wxButton *m_pButtonCancel; + wxTextCtrl *m_pEditAddress; + + private: + + enum + { + ID_WXSTATICTEXT1 = 1006, + ID_OK = 1005, + ID_CANCEL = 1004, + ID_ADDRESS = 1003, + ID_WXSTATICBOX1 = 1001, + }; + + private: + + void CreateGUIControls(); + void OnClose(wxCloseEvent& event); + void OnCancel(wxCommandEvent& event); + void OnOK(wxCommandEvent& event); +}; + +#endif diff --git a/Source/Core/DebuggerWX/Src/BreakpointView.h b/Source/Core/DebuggerWX/Src/BreakpointView.h index 5a44d87c89..4a8add915b 100644 --- a/Source/Core/DebuggerWX/Src/BreakpointView.h +++ b/Source/Core/DebuggerWX/Src/BreakpointView.h @@ -1,41 +1,41 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __BREAKPOINTVIEW_h__ -#define __BREAKPOINTVIEW_h__ - -#include - -#include "Common.h" - -class CBreakPointView - : public wxListCtrl -{ - public: - - CBreakPointView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); - - void Update(); - - void DeleteCurrentSelection(); - - private: - - DECLARE_EVENT_TABLE() -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __BREAKPOINTVIEW_h__ +#define __BREAKPOINTVIEW_h__ + +#include + +#include "Common.h" + +class CBreakPointView + : public wxListCtrl +{ + public: + + CBreakPointView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); + + void Update(); + + void DeleteCurrentSelection(); + + private: + + DECLARE_EVENT_TABLE() +}; + +#endif diff --git a/Source/Core/DebuggerWX/Src/BreakpointWindow.h b/Source/Core/DebuggerWX/Src/BreakpointWindow.h index 27870dd811..c4c421fa92 100644 --- a/Source/Core/DebuggerWX/Src/BreakpointWindow.h +++ b/Source/Core/DebuggerWX/Src/BreakpointWindow.h @@ -1,93 +1,93 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __BREAKPOINTWINDOW_h__ -#define __BREAKPOINTWINDOW_h__ - -class CBreakPointView; -class CCodeWindow; -class wxListEvent; -class IniFile; - -#undef BREAKPOINT_WINDOW_STYLE -#define BREAKPOINT_WINDOW_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxRESIZE_BORDER - -class CBreakPointWindow - : public wxFrame -{ - private: - - DECLARE_EVENT_TABLE(); - - public: - - CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Breakpoints"), - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(400, 250), - long style = BREAKPOINT_WINDOW_STYLE); - - virtual ~CBreakPointWindow(); - - void NotifyUpdate(); - - void Save(IniFile& _IniFile) const; - void Load(IniFile& _IniFile); - - - private: - - enum - { - ID_TOOLBAR = 500, - ID_BPS = 1002, - IDM_DELETE, - IDM_CLEAR, - IDM_ADD_BREAKPOINT, - IDM_ADD_BREAKPOINTMANY, - IDM_ADD_MEMORYCHECK, - IDM_ADD_MEMORYCHECKMANY - }; - - enum - { - Toolbar_Delete, - Toolbar_Add_BreakPoint, - Toolbar_Add_Memcheck, - Bitmaps_max - }; - - CBreakPointView* m_BreakPointListView; - CCodeWindow* m_pCodeWindow; - - wxBitmap m_Bitmaps[Bitmaps_max]; - - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); - - void RecreateToolbar(); - void PopulateToolbar(wxToolBar* toolBar); - void InitBitmaps(); - - void OnDelete(wxCommandEvent& event); - void OnClear(wxCommandEvent& event); - void OnAddBreakPoint(wxCommandEvent& event); - void OnAddBreakPointMany(wxCommandEvent& event); - void OnAddMemoryCheck(wxCommandEvent& event); - void OnAddMemoryCheckMany(wxCommandEvent& event); - void OnActivated(wxListEvent& event); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __BREAKPOINTWINDOW_h__ +#define __BREAKPOINTWINDOW_h__ + +class CBreakPointView; +class CCodeWindow; +class wxListEvent; +class IniFile; + +#undef BREAKPOINT_WINDOW_STYLE +#define BREAKPOINT_WINDOW_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxRESIZE_BORDER + +class CBreakPointWindow + : public wxFrame +{ + private: + + DECLARE_EVENT_TABLE(); + + public: + + CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Breakpoints"), + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(400, 250), + long style = BREAKPOINT_WINDOW_STYLE); + + virtual ~CBreakPointWindow(); + + void NotifyUpdate(); + + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + + + private: + + enum + { + ID_TOOLBAR = 500, + ID_BPS = 1002, + IDM_DELETE, + IDM_CLEAR, + IDM_ADD_BREAKPOINT, + IDM_ADD_BREAKPOINTMANY, + IDM_ADD_MEMORYCHECK, + IDM_ADD_MEMORYCHECKMANY + }; + + enum + { + Toolbar_Delete, + Toolbar_Add_BreakPoint, + Toolbar_Add_Memcheck, + Bitmaps_max + }; + + CBreakPointView* m_BreakPointListView; + CCodeWindow* m_pCodeWindow; + + wxBitmap m_Bitmaps[Bitmaps_max]; + + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); + + void RecreateToolbar(); + void PopulateToolbar(wxToolBar* toolBar); + void InitBitmaps(); + + void OnDelete(wxCommandEvent& event); + void OnClear(wxCommandEvent& event); + void OnAddBreakPoint(wxCommandEvent& event); + void OnAddBreakPointMany(wxCommandEvent& event); + void OnAddMemoryCheck(wxCommandEvent& event); + void OnAddMemoryCheckMany(wxCommandEvent& event); + void OnActivated(wxListEvent& event); +}; + +#endif diff --git a/Source/Core/DebuggerWX/Src/CodeView.h b/Source/Core/DebuggerWX/Src/CodeView.h index c270ad1fdb..cac3b0902d 100644 --- a/Source/Core/DebuggerWX/Src/CodeView.h +++ b/Source/Core/DebuggerWX/Src/CodeView.h @@ -1,90 +1,90 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef CODEVIEW_H_ -#define CODEVIEW_H_ - -#include "Debugger.h" -#include "Common.h" -#include "Debugger/DebugInterface.h" - -#include -#include - -DECLARE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE, -1); - -class CCodeView - : public wxControl -{ - public: - CCodeView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize); - wxSize DoGetBestSize() const; - void OnPaint(wxPaintEvent& event); - void OnErase(wxEraseEvent& event); - void OnMouseDown(wxMouseEvent& event); - void OnMouseMove(wxMouseEvent& event); - void OnMouseUpL(wxMouseEvent& event); - void OnMouseUpR(wxMouseEvent& event); - void OnPopupMenu(wxCommandEvent& event); - - u32 GetSelection() {return(selection);} - - struct BlrStruct // for IDM_INSERTBLR - { - u32 Address; - u32 OldValue; - }; - std::vector BlrList; - - void Center(u32 addr) - { - curAddress = addr; - selection = addr; - redraw(); - } - - private: - - void RaiseEvent(); - int YToAddress(int y); - - u32 AddrToBranch(u32 addr); - - void redraw() {Refresh();} - - - DebugInterface* debugger; - - int curAddress; - int align; - int rowHeight; - - u32 selection; - u32 oldSelection; - bool selectionChanged; - bool selecting; - bool hasFocus; - bool showHex; - - int lx, ly; - void _MoveTo(int x, int y) {lx = x; ly = y;} - void _LineTo(wxPaintDC &dc, int x, int y); - - DECLARE_EVENT_TABLE() -}; - -#endif /*CODEVIEW_H_*/ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef CODEVIEW_H_ +#define CODEVIEW_H_ + +#include "Debugger.h" +#include "Common.h" +#include "Debugger/DebugInterface.h" + +#include +#include + +DECLARE_EVENT_TYPE(wxEVT_CODEVIEW_CHANGE, -1); + +class CCodeView + : public wxControl +{ + public: + CCodeView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize); + wxSize DoGetBestSize() const; + void OnPaint(wxPaintEvent& event); + void OnErase(wxEraseEvent& event); + void OnMouseDown(wxMouseEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnMouseUpL(wxMouseEvent& event); + void OnMouseUpR(wxMouseEvent& event); + void OnPopupMenu(wxCommandEvent& event); + + u32 GetSelection() {return(selection);} + + struct BlrStruct // for IDM_INSERTBLR + { + u32 Address; + u32 OldValue; + }; + std::vector BlrList; + + void Center(u32 addr) + { + curAddress = addr; + selection = addr; + redraw(); + } + + private: + + void RaiseEvent(); + int YToAddress(int y); + + u32 AddrToBranch(u32 addr); + + void redraw() {Refresh();} + + + DebugInterface* debugger; + + int curAddress; + int align; + int rowHeight; + + u32 selection; + u32 oldSelection; + bool selectionChanged; + bool selecting; + bool hasFocus; + bool showHex; + + int lx, ly; + void _MoveTo(int x, int y) {lx = x; ly = y;} + void _LineTo(wxPaintDC &dc, int x, int y); + + DECLARE_EVENT_TABLE() +}; + +#endif /*CODEVIEW_H_*/ diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h index 6c7b631a1b..5d8e4ffb0f 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.h +++ b/Source/Core/DebuggerWX/Src/CodeWindow.h @@ -1,207 +1,207 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#ifndef CODEWINDOW_H_ -#define CODEWINDOW_H_ - -#include -#include -#include -#include "Debugger.h" -#include "CodeView.h" -#include "Thread.h" - -#include "CoreParameter.h" - -class CRegisterWindow; -class CLogWindow; -class CBreakPointWindow; -class CMemoryWindow; -class CJitWindow; -class CCodeView; -class IniFile; - -class CCodeWindow - : public wxFrame -{ - public: - - CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, - wxWindowID id = wxID_ANY, - const wxString& title = _T("Dolphin-Debugger"), - const wxPoint& pos = wxPoint(950, 100), - const wxSize& size = wxSize(400, 500), - long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); - - ~CCodeWindow(); - - void Load_(IniFile &file); - void Load(IniFile &file); - void Save(IniFile &file) const; - - void Update(); - void NotifyMapLoaded(); - - - bool UseInterpreter(); - bool AutomaticStart(); - bool UseDualCore(); - void JumpToAddress(u32 _Address); - - private: - - enum - { - ID_TOOLBAR = 500, - IDM_CODEVIEW, - IDM_DEBUG_GO, - IDM_STEP, - IDM_STEPOVER, - IDM_SKIP, - IDM_SETPC, - IDM_GOTOPC, - IDM_ADDRBOX, - IDM_CALLSTACKLIST, - IDM_CALLERSLIST, - IDM_CALLSLIST, - IDM_SYMBOLLIST, - IDM_INTERPRETER, - IDM_AUTOMATICSTART, - - IDM_JITUNLIMITED, IDM_JITOFF, // jit - IDM_JITLSOFF, IDM_JITLSLXZOFF, IDM_JITLSLWZOFF, IDM_JITLSLBZXOFF, - IDM_JITLSPOFF, IDM_JITLSFOFF, - IDM_JITIOFF, - IDM_JITFPOFF, - IDM_JITPOFF, - IDM_JITSROFF, - - IDM_DUALCORE, - IDM_LOGWINDOW, - IDM_REGISTERWINDOW, - IDM_BREAKPOINTWINDOW, - IDM_MEMORYWINDOW, - IDM_SOUNDWINDOW, // sound - IDM_VIDEOWINDOW, // video - IDM_JITWINDOW, // jit - IDM_SCANFUNCTIONS, - IDM_LOGINSTRUCTIONS, - IDM_LOADMAPFILE, - IDM_SAVEMAPFILE, IDM_SAVEMAPFILEWITHCODES, - IDM_CLEARSYMBOLS, - IDM_CLEANSYMBOLS, - IDM_CREATESIGNATUREFILE, - IDM_USESIGNATUREFILE, - IDM_USESYMBOLFILE, - IDM_PATCHHLEFUNCTIONS, - IDM_CLEARCODECACHE, - IDM_PROFILEBLOCKS, - IDM_WRITEPROFILE, - }; - - enum - { - Toolbar_DebugGo, - Toolbar_Pause, - Toolbar_Step, - Toolbar_StepOver, - Toolbar_Skip, - Toolbar_GotoPC, - Toolbar_SetPC, - Bitmaps_max - }; - - // Settings - bool bLogWindow; - bool bRegisterWindow; - bool bBreakpointWindow; - bool bMemoryWindow; - bool bJitWindow; - bool bSoundWindow; - bool bVideoWindow; - bool bAutomaticStart; - - // sub dialogs - CLogWindow* m_LogWindow; - CRegisterWindow* m_RegisterWindow; - CBreakPointWindow* m_BreakpointWindow; - CMemoryWindow* m_MemoryWindow; - CJitWindow* m_JitWindow; - - wxMenuItem* jitunlimited, *jitoff; - wxMenuItem* jitlsoff, *jitlslxzoff, *jitlslwzoff, *jitlslbzxoff; - wxMenuItem* jitlspoff; - wxMenuItem* jitlsfoff; - wxMenuItem* jitfpoff; - wxMenuItem* jitioff; - wxMenuItem* jitpoff; - wxMenuItem* jitsroff; - - CCodeView* codeview; - wxListBox* callstack; - wxListBox* symbols; - wxListBox* callers; - wxListBox* calls; - Common::Event sync_event; - - wxBitmap m_Bitmaps[Bitmaps_max]; - - DECLARE_EVENT_TABLE() - - void OnSymbolListChange(wxCommandEvent& event); - void OnSymbolListContextMenu(wxContextMenuEvent& event); - void OnCallstackListChange(wxCommandEvent& event); - void OnCallersListChange(wxCommandEvent& event); - void OnCallsListChange(wxCommandEvent& event); - void OnCodeStep(wxCommandEvent& event); - void OnCodeViewChange(wxCommandEvent &event); - - void SingleCPUStep(); - - void OnAddrBoxChange(wxCommandEvent& event); - - void OnToggleRegisterWindow(wxCommandEvent& event); - void OnToggleBreakPointWindow(wxCommandEvent& event); - void OnToggleLogWindow(wxCommandEvent& event); - void OnToggleMemoryWindow(wxCommandEvent& event); - void OnToggleJitWindow(wxCommandEvent& event); - void OnToggleSoundWindow(wxCommandEvent& event); - void OnToggleVideoWindow(wxCommandEvent& event); - - void OnHostMessage(wxCommandEvent& event); - void OnSymbolsMenu(wxCommandEvent& event); - void OnJitMenu(wxCommandEvent& event); - void OnProfilerMenu(wxCommandEvent& event); - - void OnInterpreter(wxCommandEvent& event); // cpu mode menu - void OnAutomaticStart(wxCommandEvent& event); - void OnJITOff(wxCommandEvent& event); - - void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter); - - void UpdateButtonStates(); - void UpdateLists(); - - void RecreateToolbar(); - void PopulateToolbar(wxToolBar* toolBar); - void InitBitmaps(); - void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter); - void OnKeyDown(wxKeyEvent& event); -}; - -#endif /*CODEWINDOW_*/ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#ifndef CODEWINDOW_H_ +#define CODEWINDOW_H_ + +#include +#include +#include +#include "Debugger.h" +#include "CodeView.h" +#include "Thread.h" + +#include "CoreParameter.h" + +class CRegisterWindow; +class CLogWindow; +class CBreakPointWindow; +class CMemoryWindow; +class CJitWindow; +class CCodeView; +class IniFile; + +class CCodeWindow + : public wxFrame +{ + public: + + CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& title = _T("Dolphin-Debugger"), + const wxPoint& pos = wxPoint(950, 100), + const wxSize& size = wxSize(400, 500), + long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); + + ~CCodeWindow(); + + void Load_(IniFile &file); + void Load(IniFile &file); + void Save(IniFile &file) const; + + void Update(); + void NotifyMapLoaded(); + + + bool UseInterpreter(); + bool AutomaticStart(); + bool UseDualCore(); + void JumpToAddress(u32 _Address); + + private: + + enum + { + ID_TOOLBAR = 500, + IDM_CODEVIEW, + IDM_DEBUG_GO, + IDM_STEP, + IDM_STEPOVER, + IDM_SKIP, + IDM_SETPC, + IDM_GOTOPC, + IDM_ADDRBOX, + IDM_CALLSTACKLIST, + IDM_CALLERSLIST, + IDM_CALLSLIST, + IDM_SYMBOLLIST, + IDM_INTERPRETER, + IDM_AUTOMATICSTART, + + IDM_JITUNLIMITED, IDM_JITOFF, // jit + IDM_JITLSOFF, IDM_JITLSLXZOFF, IDM_JITLSLWZOFF, IDM_JITLSLBZXOFF, + IDM_JITLSPOFF, IDM_JITLSFOFF, + IDM_JITIOFF, + IDM_JITFPOFF, + IDM_JITPOFF, + IDM_JITSROFF, + + IDM_DUALCORE, + IDM_LOGWINDOW, + IDM_REGISTERWINDOW, + IDM_BREAKPOINTWINDOW, + IDM_MEMORYWINDOW, + IDM_SOUNDWINDOW, // sound + IDM_VIDEOWINDOW, // video + IDM_JITWINDOW, // jit + IDM_SCANFUNCTIONS, + IDM_LOGINSTRUCTIONS, + IDM_LOADMAPFILE, + IDM_SAVEMAPFILE, IDM_SAVEMAPFILEWITHCODES, + IDM_CLEARSYMBOLS, + IDM_CLEANSYMBOLS, + IDM_CREATESIGNATUREFILE, + IDM_USESIGNATUREFILE, + IDM_USESYMBOLFILE, + IDM_PATCHHLEFUNCTIONS, + IDM_CLEARCODECACHE, + IDM_PROFILEBLOCKS, + IDM_WRITEPROFILE, + }; + + enum + { + Toolbar_DebugGo, + Toolbar_Pause, + Toolbar_Step, + Toolbar_StepOver, + Toolbar_Skip, + Toolbar_GotoPC, + Toolbar_SetPC, + Bitmaps_max + }; + + // Settings + bool bLogWindow; + bool bRegisterWindow; + bool bBreakpointWindow; + bool bMemoryWindow; + bool bJitWindow; + bool bSoundWindow; + bool bVideoWindow; + bool bAutomaticStart; + + // sub dialogs + CLogWindow* m_LogWindow; + CRegisterWindow* m_RegisterWindow; + CBreakPointWindow* m_BreakpointWindow; + CMemoryWindow* m_MemoryWindow; + CJitWindow* m_JitWindow; + + wxMenuItem* jitunlimited, *jitoff; + wxMenuItem* jitlsoff, *jitlslxzoff, *jitlslwzoff, *jitlslbzxoff; + wxMenuItem* jitlspoff; + wxMenuItem* jitlsfoff; + wxMenuItem* jitfpoff; + wxMenuItem* jitioff; + wxMenuItem* jitpoff; + wxMenuItem* jitsroff; + + CCodeView* codeview; + wxListBox* callstack; + wxListBox* symbols; + wxListBox* callers; + wxListBox* calls; + Common::Event sync_event; + + wxBitmap m_Bitmaps[Bitmaps_max]; + + DECLARE_EVENT_TABLE() + + void OnSymbolListChange(wxCommandEvent& event); + void OnSymbolListContextMenu(wxContextMenuEvent& event); + void OnCallstackListChange(wxCommandEvent& event); + void OnCallersListChange(wxCommandEvent& event); + void OnCallsListChange(wxCommandEvent& event); + void OnCodeStep(wxCommandEvent& event); + void OnCodeViewChange(wxCommandEvent &event); + + void SingleCPUStep(); + + void OnAddrBoxChange(wxCommandEvent& event); + + void OnToggleRegisterWindow(wxCommandEvent& event); + void OnToggleBreakPointWindow(wxCommandEvent& event); + void OnToggleLogWindow(wxCommandEvent& event); + void OnToggleMemoryWindow(wxCommandEvent& event); + void OnToggleJitWindow(wxCommandEvent& event); + void OnToggleSoundWindow(wxCommandEvent& event); + void OnToggleVideoWindow(wxCommandEvent& event); + + void OnHostMessage(wxCommandEvent& event); + void OnSymbolsMenu(wxCommandEvent& event); + void OnJitMenu(wxCommandEvent& event); + void OnProfilerMenu(wxCommandEvent& event); + + void OnInterpreter(wxCommandEvent& event); // cpu mode menu + void OnAutomaticStart(wxCommandEvent& event); + void OnJITOff(wxCommandEvent& event); + + void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter); + + void UpdateButtonStates(); + void UpdateLists(); + + void RecreateToolbar(); + void PopulateToolbar(wxToolBar* toolBar); + void InitBitmaps(); + void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter); + void OnKeyDown(wxKeyEvent& event); +}; + +#endif /*CODEWINDOW_*/ diff --git a/Source/Core/DebuggerWX/Src/Debugger.h b/Source/Core/DebuggerWX/Src/Debugger.h index dcc71e40af..df65d5f460 100644 --- a/Source/Core/DebuggerWX/Src/Debugger.h +++ b/Source/Core/DebuggerWX/Src/Debugger.h @@ -1,45 +1,45 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DEBUGGER_H -#define _DEBUGGER_H - -enum -{ - IDM_LOG, - IDM_UPDATELOG, - IDM_CLEARLOG, - IDM_LOGCHECKS, - IDM_OPTIONS, - IDM_ENABLEALL, - IDM_RADIO0, - IDM_SUBMITCMD = 300, -}; - -#define wxUSE_XPM_IN_MSW 1 -#define USE_XPM_BITMAPS 1 - -#include - -// define this to use XPMs everywhere (by default, BMPs are used under Win) -// BMPs use less space, but aren't compiled into the executable on other platforms - -#if USE_XPM_BITMAPS && defined (__WXMSW__) && !wxUSE_XPM_IN_MSW -#error You need to enable XPM support to use XPM bitmaps with toolbar! -#endif // USE_XPM_BITMAPS - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DEBUGGER_H +#define _DEBUGGER_H + +enum +{ + IDM_LOG, + IDM_UPDATELOG, + IDM_CLEARLOG, + IDM_LOGCHECKS, + IDM_OPTIONS, + IDM_ENABLEALL, + IDM_RADIO0, + IDM_SUBMITCMD = 300, +}; + +#define wxUSE_XPM_IN_MSW 1 +#define USE_XPM_BITMAPS 1 + +#include + +// define this to use XPMs everywhere (by default, BMPs are used under Win) +// BMPs use less space, but aren't compiled into the executable on other platforms + +#if USE_XPM_BITMAPS && defined (__WXMSW__) && !wxUSE_XPM_IN_MSW +#error You need to enable XPM support to use XPM bitmaps with toolbar! +#endif // USE_XPM_BITMAPS + +#endif diff --git a/Source/Core/DebuggerWX/Src/JitWindow.h b/Source/Core/DebuggerWX/Src/JitWindow.h index 7da51a3f08..77bef6c2d7 100644 --- a/Source/Core/DebuggerWX/Src/JitWindow.h +++ b/Source/Core/DebuggerWX/Src/JitWindow.h @@ -1,81 +1,81 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef JITWINDOW_H_ -#define JITWINDOW_H_ - -#include - -#include -#include -#include -#include -#include "Debugger.h" -#include "MemoryView.h" -#include "Thread.h" -#include "IniFile.h" - -#include "CoreParameter.h" - - -class JitBlockList : public wxListCtrl -{ - std::vector block_ranking; -public: - JitBlockList(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); - void Init(); - void Update(); -}; - - -class CJitWindow : public wxFrame -{ -public: - CJitWindow(wxWindow* parent, - wxWindowID id = wxID_ANY, - const wxString& title = _T("JIT block viewer"), - const wxPoint& pos = wxPoint(950, 100), - const wxSize& size = wxSize(400, 500), - long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); - - ~CJitWindow(); - - void Save(IniFile& _IniFile) const; - void Load(IniFile& _IniFile); - - static void ViewAddr(u32 em_address); - void Update(); - -private: - void OnRefresh(wxCommandEvent& /*event*/); - void Compare(u32 em_address); - - JitBlockList* block_list; - wxButton* button_refresh; - wxTextCtrl* ppc_box; - wxTextCtrl* x86_box; - wxListBox* top_instructions; - - DECLARE_EVENT_TABLE() - - void OnSymbolListChange(wxCommandEvent& event); - void OnCallstackListChange(wxCommandEvent& event); - void OnAddrBoxChange(wxCommandEvent& event); - void OnHostMessage(wxCommandEvent& event); -}; - -#endif /*MEMORYWINDOW_*/ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef JITWINDOW_H_ +#define JITWINDOW_H_ + +#include + +#include +#include +#include +#include +#include "Debugger.h" +#include "MemoryView.h" +#include "Thread.h" +#include "IniFile.h" + +#include "CoreParameter.h" + + +class JitBlockList : public wxListCtrl +{ + std::vector block_ranking; +public: + JitBlockList(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); + void Init(); + void Update(); +}; + + +class CJitWindow : public wxFrame +{ +public: + CJitWindow(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& title = _T("JIT block viewer"), + const wxPoint& pos = wxPoint(950, 100), + const wxSize& size = wxSize(400, 500), + long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); + + ~CJitWindow(); + + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + + static void ViewAddr(u32 em_address); + void Update(); + +private: + void OnRefresh(wxCommandEvent& /*event*/); + void Compare(u32 em_address); + + JitBlockList* block_list; + wxButton* button_refresh; + wxTextCtrl* ppc_box; + wxTextCtrl* x86_box; + wxListBox* top_instructions; + + DECLARE_EVENT_TABLE() + + void OnSymbolListChange(wxCommandEvent& event); + void OnCallstackListChange(wxCommandEvent& event); + void OnAddrBoxChange(wxCommandEvent& event); + void OnHostMessage(wxCommandEvent& event); +}; + +#endif /*MEMORYWINDOW_*/ diff --git a/Source/Core/DebuggerWX/Src/LogWindow.h b/Source/Core/DebuggerWX/Src/LogWindow.h index e05c377fbd..55a445852f 100644 --- a/Source/Core/DebuggerWX/Src/LogWindow.h +++ b/Source/Core/DebuggerWX/Src/LogWindow.h @@ -1,61 +1,61 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef LOGWINDOW_H_ -#define LOGWINDOW_H_ - -class wxTextCtrl; -class wxCheckListBox; -class IniFile; - -class CLogWindow - : public wxDialog -{ - public: - - CLogWindow(wxWindow* parent); - void NotifyUpdate(); - - void Save(IniFile& _IniFile) const; - void Load(IniFile& _IniFile); - - private: - - enum { LogBufferSize = 8 * 1024 * 1024}; - char m_logBuffer[LogBufferSize]; - wxTextCtrl* m_log, * m_cmdline; - wxCheckListBox* m_checks; - wxCheckListBox* m_options; - wxRadioBox *m_RadioBox[1]; // radio boxes - bool m_bCheckDirty; - bool bOnlyUnique; - - DECLARE_EVENT_TABLE() - - void OnSubmit(wxCommandEvent& event); - void OnUpdateLog(wxCommandEvent& event); - void OnOptionsCheck(wxCommandEvent& event); - void OnLogCheck(wxCommandEvent& event); - void OnRadioChange(wxCommandEvent& event); // verbosity buttons - void OnClear(wxCommandEvent& event); - void OnEnableAll(wxCommandEvent& event); - - void UpdateChecks(); - void UpdateLog(); -}; - -#endif /*LOGWINDOW_H_*/ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef LOGWINDOW_H_ +#define LOGWINDOW_H_ + +class wxTextCtrl; +class wxCheckListBox; +class IniFile; + +class CLogWindow + : public wxDialog +{ + public: + + CLogWindow(wxWindow* parent); + void NotifyUpdate(); + + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + + private: + + enum { LogBufferSize = 8 * 1024 * 1024}; + char m_logBuffer[LogBufferSize]; + wxTextCtrl* m_log, * m_cmdline; + wxCheckListBox* m_checks; + wxCheckListBox* m_options; + wxRadioBox *m_RadioBox[1]; // radio boxes + bool m_bCheckDirty; + bool bOnlyUnique; + + DECLARE_EVENT_TABLE() + + void OnSubmit(wxCommandEvent& event); + void OnUpdateLog(wxCommandEvent& event); + void OnOptionsCheck(wxCommandEvent& event); + void OnLogCheck(wxCommandEvent& event); + void OnRadioChange(wxCommandEvent& event); // verbosity buttons + void OnClear(wxCommandEvent& event); + void OnEnableAll(wxCommandEvent& event); + + void UpdateChecks(); + void UpdateLog(); +}; + +#endif /*LOGWINDOW_H_*/ diff --git a/Source/Core/DebuggerWX/Src/MemoryCheckDlg.h b/Source/Core/DebuggerWX/Src/MemoryCheckDlg.h index b0b3a86222..4837d1f991 100644 --- a/Source/Core/DebuggerWX/Src/MemoryCheckDlg.h +++ b/Source/Core/DebuggerWX/Src/MemoryCheckDlg.h @@ -1,73 +1,73 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __MEMORYCHECKDLG_h__ -#define __MEMORYCHECKDLG_h__ - -#include -#include -#include -#include -#include -#include -#include - -#undef MemoryCheckDlg_STYLE -#define MemoryCheckDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxSTAY_ON_TOP | wxDIALOG_NO_PARENT | wxCLOSE_BOX - -class MemoryCheckDlg : public wxDialog -{ - private: - DECLARE_EVENT_TABLE(); - - public: - MemoryCheckDlg(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Memory Check"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MemoryCheckDlg_STYLE); - virtual ~MemoryCheckDlg(); - - private: - - wxButton* m_pButtonCancel; - wxButton* m_pButtonOK; - wxCheckBox* m_pReadFlag; - wxCheckBox* m_pWriteFlag; - wxTextCtrl* m_pEditEndAddress; - wxTextCtrl* m_pEditStartAddress; - - private: - - enum - { - ID_CANCEL = 1016, - ID_OK = 1015, - ID_READ_FLAG = 1014, - ID_WRITE_FLAG = 1013, - ID_WXSTATICBOX2 = 1012, - ID_EDIT_END_ADDRESS = 1011, - ID_WXSTATICTEXT2 = 1010, - ID_WXSTATICTEXT1 = 1009, - ID_EDIT_START_ADDR = 1008, - ID_WXSTATICBOX1 = 1007, - }; - - private: - void OnClose(wxCloseEvent& event); - void OnOK(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - void CreateGUIControls(); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __MEMORYCHECKDLG_h__ +#define __MEMORYCHECKDLG_h__ + +#include +#include +#include +#include +#include +#include +#include + +#undef MemoryCheckDlg_STYLE +#define MemoryCheckDlg_STYLE wxCAPTION | wxSYSTEM_MENU | wxSTAY_ON_TOP | wxDIALOG_NO_PARENT | wxCLOSE_BOX + +class MemoryCheckDlg : public wxDialog +{ + private: + DECLARE_EVENT_TABLE(); + + public: + MemoryCheckDlg(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Memory Check"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MemoryCheckDlg_STYLE); + virtual ~MemoryCheckDlg(); + + private: + + wxButton* m_pButtonCancel; + wxButton* m_pButtonOK; + wxCheckBox* m_pReadFlag; + wxCheckBox* m_pWriteFlag; + wxTextCtrl* m_pEditEndAddress; + wxTextCtrl* m_pEditStartAddress; + + private: + + enum + { + ID_CANCEL = 1016, + ID_OK = 1015, + ID_READ_FLAG = 1014, + ID_WRITE_FLAG = 1013, + ID_WXSTATICBOX2 = 1012, + ID_EDIT_END_ADDRESS = 1011, + ID_WXSTATICTEXT2 = 1010, + ID_WXSTATICTEXT1 = 1009, + ID_EDIT_START_ADDR = 1008, + ID_WXSTATICBOX1 = 1007, + }; + + private: + void OnClose(wxCloseEvent& event); + void OnOK(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + void CreateGUIControls(); +}; + +#endif diff --git a/Source/Core/DebuggerWX/Src/MemoryView.h b/Source/Core/DebuggerWX/Src/MemoryView.h index 63733801af..3579114d29 100644 --- a/Source/Core/DebuggerWX/Src/MemoryView.h +++ b/Source/Core/DebuggerWX/Src/MemoryView.h @@ -1,77 +1,77 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef MEMORYVIEW_H_ -#define MEMORYVIEW_H_ - -#include "Debugger.h" -#include "Common.h" -#include "Debugger/DebugInterface.h" - -#include - -class CMemoryView - : public wxControl -{ - public: - - CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize); - wxSize DoGetBestSize() const; - void OnPaint(wxPaintEvent& event); - void OnErase(wxEraseEvent& event); - void OnMouseDown(wxMouseEvent& event); - void OnMouseMove(wxMouseEvent& event); - void OnMouseUpL(wxMouseEvent& event); - void OnMouseUpR(wxMouseEvent& event); - void OnPopupMenu(wxCommandEvent& event); - - - u32 GetSelection() {return(selection);} - - - void Center(u32 addr) - { - curAddress = addr; - redraw(); - } - - - private: - - int YToAddress(int y); - - - void redraw() {Refresh();} - - - DebugInterface* debugger; - - int curAddress; - int align; - int rowHeight; - - u32 selection; - u32 oldSelection; - bool selectionChanged; - bool selecting; - bool hasFocus; - bool showHex; - - DECLARE_EVENT_TABLE() -}; - -#endif /*MEMORYVIEW_H_*/ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef MEMORYVIEW_H_ +#define MEMORYVIEW_H_ + +#include "Debugger.h" +#include "Common.h" +#include "Debugger/DebugInterface.h" + +#include + +class CMemoryView + : public wxControl +{ + public: + + CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize); + wxSize DoGetBestSize() const; + void OnPaint(wxPaintEvent& event); + void OnErase(wxEraseEvent& event); + void OnMouseDown(wxMouseEvent& event); + void OnMouseMove(wxMouseEvent& event); + void OnMouseUpL(wxMouseEvent& event); + void OnMouseUpR(wxMouseEvent& event); + void OnPopupMenu(wxCommandEvent& event); + + + u32 GetSelection() {return(selection);} + + + void Center(u32 addr) + { + curAddress = addr; + redraw(); + } + + + private: + + int YToAddress(int y); + + + void redraw() {Refresh();} + + + DebugInterface* debugger; + + int curAddress; + int align; + int rowHeight; + + u32 selection; + u32 oldSelection; + bool selectionChanged; + bool selecting; + bool hasFocus; + bool showHex; + + DECLARE_EVENT_TABLE() +}; + +#endif /*MEMORYVIEW_H_*/ diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.h b/Source/Core/DebuggerWX/Src/MemoryWindow.h index 28c707e155..fb19e171ed 100644 --- a/Source/Core/DebuggerWX/Src/MemoryWindow.h +++ b/Source/Core/DebuggerWX/Src/MemoryWindow.h @@ -1,74 +1,74 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef MEMORYWINDOW_H_ -#define MEMORYWINDOW_H_ - -#include -#include -#include -#include "Debugger.h" -#include "MemoryView.h" -#include "Thread.h" -#include "StringUtil.h" - -#include "CoreParameter.h" - -class CRegisterWindow; -class CLogWindow; -class CBreakPointWindow; - -class CMemoryWindow - : public wxFrame -{ - public: - - CMemoryWindow(wxWindow* parent, - wxWindowID id = wxID_ANY, - const wxString& title = _T("Dolphin-Memory"), - const wxPoint& pos = wxPoint(950, 100), - const wxSize& size = wxSize(400, 500), - long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); - - ~CMemoryWindow(); - - void Save(IniFile& _IniFile) const; - void Load(IniFile& _IniFile); - - void Update(); - void NotifyMapLoaded(); - - void JumpToAddress(u32 _Address); - - private: - CMemoryView* memview; - wxListBox* symbols; - - wxButton* buttonGo; - wxTextCtrl* addrbox; - wxTextCtrl* valbox; - - DECLARE_EVENT_TABLE() - - void OnSymbolListChange(wxCommandEvent& event); - void OnCallstackListChange(wxCommandEvent& event); - void OnAddrBoxChange(wxCommandEvent& event); - void OnHostMessage(wxCommandEvent& event); - void SetMemoryValue(wxCommandEvent& event); -}; - -#endif /*MEMORYWINDOW_*/ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef MEMORYWINDOW_H_ +#define MEMORYWINDOW_H_ + +#include +#include +#include +#include "Debugger.h" +#include "MemoryView.h" +#include "Thread.h" +#include "StringUtil.h" + +#include "CoreParameter.h" + +class CRegisterWindow; +class CLogWindow; +class CBreakPointWindow; + +class CMemoryWindow + : public wxFrame +{ + public: + + CMemoryWindow(wxWindow* parent, + wxWindowID id = wxID_ANY, + const wxString& title = _T("Dolphin-Memory"), + const wxPoint& pos = wxPoint(950, 100), + const wxSize& size = wxSize(400, 500), + long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); + + ~CMemoryWindow(); + + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + + void Update(); + void NotifyMapLoaded(); + + void JumpToAddress(u32 _Address); + + private: + CMemoryView* memview; + wxListBox* symbols; + + wxButton* buttonGo; + wxTextCtrl* addrbox; + wxTextCtrl* valbox; + + DECLARE_EVENT_TABLE() + + void OnSymbolListChange(wxCommandEvent& event); + void OnCallstackListChange(wxCommandEvent& event); + void OnAddrBoxChange(wxCommandEvent& event); + void OnHostMessage(wxCommandEvent& event); + void SetMemoryValue(wxCommandEvent& event); +}; + +#endif /*MEMORYWINDOW_*/ diff --git a/Source/Core/DebuggerWX/Src/RegisterView.h b/Source/Core/DebuggerWX/Src/RegisterView.h index 768f52b353..b3bfe9bccd 100644 --- a/Source/Core/DebuggerWX/Src/RegisterView.h +++ b/Source/Core/DebuggerWX/Src/RegisterView.h @@ -1,47 +1,47 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __REGISTERVIEW_h__ -#define __REGISTERVIEW_h__ - -#include - -#include "Common.h" - -class CRegisterView - : public wxListCtrl -{ - public: - - CRegisterView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); - - void Update(); - void Refresh(); - - - private: - - DECLARE_EVENT_TABLE() - - u32 m_CachedRegs[32]; - bool m_CachedRegHasChanged[32]; - #ifdef _WIN32 - virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem); - #endif -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __REGISTERVIEW_h__ +#define __REGISTERVIEW_h__ + +#include + +#include "Common.h" + +class CRegisterView + : public wxListCtrl +{ + public: + + CRegisterView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); + + void Update(); + void Refresh(); + + + private: + + DECLARE_EVENT_TABLE() + + u32 m_CachedRegs[32]; + bool m_CachedRegHasChanged[32]; + #ifdef _WIN32 + virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem); + #endif +}; + +#endif diff --git a/Source/Core/DebuggerWX/Src/RegisterWindow.h b/Source/Core/DebuggerWX/Src/RegisterWindow.h index 0e66c68af4..b34c6a1f3e 100644 --- a/Source/Core/DebuggerWX/Src/RegisterWindow.h +++ b/Source/Core/DebuggerWX/Src/RegisterWindow.h @@ -1,58 +1,58 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __REGISTERWINDOW_h__ -#define __REGISTERWINDOW_h__ - -class CRegisterView; -class IniFile; - -#undef RegisterWindow_STYLE -#define RegisterWindow_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX - -class CRegisterWindow - : public wxDialog -{ - private: - - DECLARE_EVENT_TABLE(); - - public: - - CRegisterWindow(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Registers"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = RegisterWindow_STYLE); - virtual ~CRegisterWindow(); - - void Save(IniFile& _IniFile) const; - void Load(IniFile& _IniFile); - - void NotifyUpdate(); - - - private: - - enum - { - ID_GPR = 1002 - }; - - CRegisterView* m_GPRListView; - void OnRefresh(wxCommandEvent& WXUNUSED (event)); - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __REGISTERWINDOW_h__ +#define __REGISTERWINDOW_h__ + +class CRegisterView; +class IniFile; + +#undef RegisterWindow_STYLE +#define RegisterWindow_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX + +class CRegisterWindow + : public wxDialog +{ + private: + + DECLARE_EVENT_TABLE(); + + public: + + CRegisterWindow(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Registers"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = RegisterWindow_STYLE); + virtual ~CRegisterWindow(); + + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + + void NotifyUpdate(); + + + private: + + enum + { + ID_GPR = 1002 + }; + + CRegisterView* m_GPRListView; + void OnRefresh(wxCommandEvent& WXUNUSED (event)); + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); +}; + +#endif diff --git a/Source/Core/DiscIO/Src/BannerLoader.h b/Source/Core/DiscIO/Src/BannerLoader.h index a5be1939ab..33a2e207a8 100644 --- a/Source/Core/DiscIO/Src/BannerLoader.h +++ b/Source/Core/DiscIO/Src/BannerLoader.h @@ -1,57 +1,57 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BANNER_LOADER_H_ -#define _BANNER_LOADER_H_ - -#include "Filesystem.h" - -namespace DiscIO -{ -class IBannerLoader -{ - public: - - IBannerLoader() - {} - - - virtual ~IBannerLoader() - {} - - - virtual bool IsValid() = 0; - - virtual bool GetBanner(u32* _pBannerImage) = 0; - - virtual bool GetName(std::string& _rName, int language) = 0; - - virtual bool GetCompany(std::string& _rCompany) = 0; - - virtual bool GetDescription(std::string& _rDescription) = 0; - - - protected: - - bool CopyToStringAndCheck(std::string& _rDestination, const char* _src); -}; - -IBannerLoader* CreateBannerLoader(DiscIO::IFileSystem& _rFileSystem); -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BANNER_LOADER_H_ +#define _BANNER_LOADER_H_ + +#include "Filesystem.h" + +namespace DiscIO +{ +class IBannerLoader +{ + public: + + IBannerLoader() + {} + + + virtual ~IBannerLoader() + {} + + + virtual bool IsValid() = 0; + + virtual bool GetBanner(u32* _pBannerImage) = 0; + + virtual bool GetName(std::string& _rName, int language) = 0; + + virtual bool GetCompany(std::string& _rCompany) = 0; + + virtual bool GetDescription(std::string& _rDescription) = 0; + + + protected: + + bool CopyToStringAndCheck(std::string& _rDestination, const char* _src); +}; + +IBannerLoader* CreateBannerLoader(DiscIO::IFileSystem& _rFileSystem); +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.h b/Source/Core/DiscIO/Src/BannerLoaderGC.h index 7c1264ee45..1639338fa4 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderGC.h +++ b/Source/Core/DiscIO/Src/BannerLoaderGC.h @@ -1,97 +1,97 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BANNER_LOADER_GC_H_ -#define _BANNER_LOADER_GC_H_ - -#include "BannerLoader.h" - -namespace DiscIO -{ -class CBannerLoaderGC - : public IBannerLoader -{ - public: - - CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem); - - virtual ~CBannerLoaderGC(); - - virtual bool IsValid(); - - virtual bool GetBanner(u32* _pBannerImage); - - virtual bool GetName(std::string& _rName, int language); - - virtual bool GetCompany(std::string& _rCompany); - - virtual bool GetDescription(std::string& _rDescription); - - - private: - - enum - { - DVD_BANNER_WIDTH = 96, - DVD_BANNER_HEIGHT = 32 - }; - - // Banner Comment - struct DVDBannerComment - { - char shortTitle[32]; // Short game title shown in IPL menu - char shortMaker[32]; // Short developer, publisher names shown in IPL menu - char longTitle[64]; // Long game title shown in IPL game start screen - char longMaker[64]; // Long developer, publisher names shown in IPL game start screen - char comment[128]; // Game description shown in IPL game start screen in two lines. - }; - - // "opening.bnr" file format for JP/US console - struct DVDBanner - { - u32 id; // 'BNR1' - u32 padding[7]; - u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image - DVDBannerComment comment; - }; - - // "opening.bnr" file format for EU console - struct DVDBanner2 - { - u32 id; // 'BNR2' - u32 padding[7]; - u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image - DVDBannerComment comment[6]; // Comments in six languages - }; - - - // for banner decoding - int lut3to8[8]; - int lut4to8[16]; - int lut5to8[32]; - - u8* m_pBannerFile; - - bool m_IsValid; - - u32 decode5A3(u16 val); - void decode5A3image(u32* dst, u16* src, int width, int height); -}; -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BANNER_LOADER_GC_H_ +#define _BANNER_LOADER_GC_H_ + +#include "BannerLoader.h" + +namespace DiscIO +{ +class CBannerLoaderGC + : public IBannerLoader +{ + public: + + CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem); + + virtual ~CBannerLoaderGC(); + + virtual bool IsValid(); + + virtual bool GetBanner(u32* _pBannerImage); + + virtual bool GetName(std::string& _rName, int language); + + virtual bool GetCompany(std::string& _rCompany); + + virtual bool GetDescription(std::string& _rDescription); + + + private: + + enum + { + DVD_BANNER_WIDTH = 96, + DVD_BANNER_HEIGHT = 32 + }; + + // Banner Comment + struct DVDBannerComment + { + char shortTitle[32]; // Short game title shown in IPL menu + char shortMaker[32]; // Short developer, publisher names shown in IPL menu + char longTitle[64]; // Long game title shown in IPL game start screen + char longMaker[64]; // Long developer, publisher names shown in IPL game start screen + char comment[128]; // Game description shown in IPL game start screen in two lines. + }; + + // "opening.bnr" file format for JP/US console + struct DVDBanner + { + u32 id; // 'BNR1' + u32 padding[7]; + u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image + DVDBannerComment comment; + }; + + // "opening.bnr" file format for EU console + struct DVDBanner2 + { + u32 id; // 'BNR2' + u32 padding[7]; + u16 image[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; // RGB5A3 96x32 texture image + DVDBannerComment comment[6]; // Comments in six languages + }; + + + // for banner decoding + int lut3to8[8]; + int lut4to8[16]; + int lut5to8[32]; + + u8* m_pBannerFile; + + bool m_IsValid; + + u32 decode5A3(u16 val); + void decode5A3image(u32* dst, u16* src, int width, int height); +}; +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.h b/Source/Core/DiscIO/Src/BannerLoaderWii.h index 48efa2b875..277f0f55ac 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderWii.h +++ b/Source/Core/DiscIO/Src/BannerLoaderWii.h @@ -1,82 +1,82 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BANNER_LOADER_WII_H_ -#define _BANNER_LOADER_WII_H_ - -#include "BannerLoader.h" - -namespace DiscIO -{ -class CBannerLoaderWii - : public IBannerLoader -{ - public: - - CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem); - - virtual ~CBannerLoaderWii(); - - virtual bool IsValid(); - - virtual bool GetBanner(u32* _pBannerImage); - - virtual bool GetName(std::string& _rName, int language); - - virtual bool GetCompany(std::string& _rCompany); - - virtual bool GetDescription(std::string& _rDescription); - - - private: - - #define WII_BANNER_TEXTURE_SIZE (192 * 64 * 2) - #define WII_BANNER_ICON_SIZE ( 48 * 48 * 2) - #define WII_BANNER_COMMENT_SIZE 32 - - struct SWiiBanner - { - u32 ID; - - u32 m_Flag; - u16 m_Speed; - u8 m_Unknown[22]; - - u16 m_Comment[2][WII_BANNER_COMMENT_SIZE]; - u8 m_BannerTexture[WII_BANNER_TEXTURE_SIZE]; - u8 m_IconTexture[8][WII_BANNER_ICON_SIZE]; - } ; - - // for banner decoding - int lut3to8[8]; - int lut4to8[16]; - int lut5to8[32]; - - u8* m_pBannerFile; - - bool m_IsValid; - - void InitLUTTable(); - u32 decode5A3(u16 val); - void decode5A3image(u32* dst, u16* src, int width, int height); - - std::string StupidWideCharToString(u16* _pSrc, size_t _max); -}; -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BANNER_LOADER_WII_H_ +#define _BANNER_LOADER_WII_H_ + +#include "BannerLoader.h" + +namespace DiscIO +{ +class CBannerLoaderWii + : public IBannerLoader +{ + public: + + CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem); + + virtual ~CBannerLoaderWii(); + + virtual bool IsValid(); + + virtual bool GetBanner(u32* _pBannerImage); + + virtual bool GetName(std::string& _rName, int language); + + virtual bool GetCompany(std::string& _rCompany); + + virtual bool GetDescription(std::string& _rDescription); + + + private: + + #define WII_BANNER_TEXTURE_SIZE (192 * 64 * 2) + #define WII_BANNER_ICON_SIZE ( 48 * 48 * 2) + #define WII_BANNER_COMMENT_SIZE 32 + + struct SWiiBanner + { + u32 ID; + + u32 m_Flag; + u16 m_Speed; + u8 m_Unknown[22]; + + u16 m_Comment[2][WII_BANNER_COMMENT_SIZE]; + u8 m_BannerTexture[WII_BANNER_TEXTURE_SIZE]; + u8 m_IconTexture[8][WII_BANNER_ICON_SIZE]; + } ; + + // for banner decoding + int lut3to8[8]; + int lut4to8[16]; + int lut5to8[32]; + + u8* m_pBannerFile; + + bool m_IsValid; + + void InitLUTTable(); + u32 decode5A3(u16 val); + void decode5A3image(u32* dst, u16* src, int width, int height); + + std::string StupidWideCharToString(u16* _pSrc, size_t _max); +}; +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/Blob.h b/Source/Core/DiscIO/Src/Blob.h index c5104b1355..1722173d5a 100644 --- a/Source/Core/DiscIO/Src/Blob.h +++ b/Source/Core/DiscIO/Src/Blob.h @@ -1,82 +1,82 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BLOB_H -#define _BLOB_H - -// BLOB - -// Blobs in Dolphin are read only Binary Large OBjects. For example, a typical DVD image. -// Often, you may want to store these things in a highly compressed format, but still -// allow random access. Or you may store them on an odd device, like raw on a DVD. - -// Always read your BLOBs using an interface returned by CreateBlobReader(). It will -// detect whether the file is a compressed blob, or just a big hunk of data, and -// automatically do the right thing. - -#include "Common.h" - -namespace DiscIO -{ - -class IBlobReader -{ -public: - virtual ~IBlobReader() {} - - virtual u64 GetRawSize() const = 0; - virtual u64 GetDataSize() const = 0; - virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0; - -protected: - IBlobReader() {} -}; - - -// Provides caching and split-operation-to-block-operations facilities. -// Used for compressed blob reading and direct drive reading. -class SectorReader : public IBlobReader -{ -private: - virtual void GetBlock(u64 block_num, u8 *out) = 0; - enum { CACHE_SIZE = 32 }; - int m_blocksize; - u8* cache[CACHE_SIZE]; - u64 cache_tags[CACHE_SIZE]; - int cache_age[CACHE_SIZE]; -protected: - void SetSectorSize(int blocksize); -public: - ~SectorReader(); - const u8 *GetBlockData(u64 block_num); - bool Read(u64 offset, u64 size, u8* out_ptr); -}; - -// Factory function - examines the path to choose the right type of IBlobReader, and returns one. -IBlobReader* CreateBlobReader(const char* filename); - -typedef void (*CompressCB)(const char* text, float percent, void* arg); - -bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type = 0, int sector_size = 16384, - CompressCB callback = 0, void* arg = 0); -bool DecompressBlobToFile(const char* infile, const char* outfile, - CompressCB callback = 0, void* arg = 0); - -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BLOB_H +#define _BLOB_H + +// BLOB + +// Blobs in Dolphin are read only Binary Large OBjects. For example, a typical DVD image. +// Often, you may want to store these things in a highly compressed format, but still +// allow random access. Or you may store them on an odd device, like raw on a DVD. + +// Always read your BLOBs using an interface returned by CreateBlobReader(). It will +// detect whether the file is a compressed blob, or just a big hunk of data, and +// automatically do the right thing. + +#include "Common.h" + +namespace DiscIO +{ + +class IBlobReader +{ +public: + virtual ~IBlobReader() {} + + virtual u64 GetRawSize() const = 0; + virtual u64 GetDataSize() const = 0; + virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0; + +protected: + IBlobReader() {} +}; + + +// Provides caching and split-operation-to-block-operations facilities. +// Used for compressed blob reading and direct drive reading. +class SectorReader : public IBlobReader +{ +private: + virtual void GetBlock(u64 block_num, u8 *out) = 0; + enum { CACHE_SIZE = 32 }; + int m_blocksize; + u8* cache[CACHE_SIZE]; + u64 cache_tags[CACHE_SIZE]; + int cache_age[CACHE_SIZE]; +protected: + void SetSectorSize(int blocksize); +public: + ~SectorReader(); + const u8 *GetBlockData(u64 block_num); + bool Read(u64 offset, u64 size, u8* out_ptr); +}; + +// Factory function - examines the path to choose the right type of IBlobReader, and returns one. +IBlobReader* CreateBlobReader(const char* filename); + +typedef void (*CompressCB)(const char* text, float percent, void* arg); + +bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type = 0, int sector_size = 16384, + CompressCB callback = 0, void* arg = 0); +bool DecompressBlobToFile(const char* infile, const char* outfile, + CompressCB callback = 0, void* arg = 0); + +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/CompressedBlob.h b/Source/Core/DiscIO/Src/CompressedBlob.h index 1b953cbc42..d4714834d0 100644 --- a/Source/Core/DiscIO/Src/CompressedBlob.h +++ b/Source/Core/DiscIO/Src/CompressedBlob.h @@ -1,83 +1,83 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -// WARNING Code not big-endian safe. - -// To create new compressed BLOBs, use CompressFileToBlob. - -// File format -// * Header -// * [Block Pointers interleaved with block hashes (hash of decompressed data)] -// * [Data] - -#ifndef COMPRESSED_BLOB_H_ -#define COMPRESSED_BLOB_H_ - -#include -#include "Blob.h" - -namespace DiscIO -{ - -bool IsCompressedBlob(const char* filename); - -const u32 kBlobCookie = 0xB10BC001; - -// A blob file structure: -// BlobHeader -// u64 offsetsToBlocks[n], top bit specifies whether the block is compressed, or not. -// compressed data - -// Blocks that won't compress to less than 97% of the original size are stored as-is. -struct CompressedBlobHeader // 32 bytes -{ - u32 magic_cookie; //0xB10BB10B - u32 sub_type; // gc image, whatever - u64 compressed_data_size; - u64 data_size; - u32 block_size; - u32 num_blocks; -}; - -class CompressedBlobReader : public SectorReader -{ -private: - CompressedBlobHeader header; - u64 *block_pointers; - u32 *hashes; - int data_offset; - FILE *file; - u64 file_size; - u8 *zlib_buffer; - int zlib_buffer_size; - - CompressedBlobReader(const char *filename); - -public: - static CompressedBlobReader* Create(const char *filename); - ~CompressedBlobReader(); - const CompressedBlobHeader &GetHeader() const { return header; } - u64 GetDataSize() const { return header.data_size; } - u64 GetRawSize() const { return file_size; } - u64 GetBlockCompressedSize(u64 block_num) const; - void GetBlock(u64 block_num, u8 *out_ptr); -}; - -} // namespace - -#endif // COMPRESSED_BLOB_H_ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +// WARNING Code not big-endian safe. + +// To create new compressed BLOBs, use CompressFileToBlob. + +// File format +// * Header +// * [Block Pointers interleaved with block hashes (hash of decompressed data)] +// * [Data] + +#ifndef COMPRESSED_BLOB_H_ +#define COMPRESSED_BLOB_H_ + +#include +#include "Blob.h" + +namespace DiscIO +{ + +bool IsCompressedBlob(const char* filename); + +const u32 kBlobCookie = 0xB10BC001; + +// A blob file structure: +// BlobHeader +// u64 offsetsToBlocks[n], top bit specifies whether the block is compressed, or not. +// compressed data + +// Blocks that won't compress to less than 97% of the original size are stored as-is. +struct CompressedBlobHeader // 32 bytes +{ + u32 magic_cookie; //0xB10BB10B + u32 sub_type; // gc image, whatever + u64 compressed_data_size; + u64 data_size; + u32 block_size; + u32 num_blocks; +}; + +class CompressedBlobReader : public SectorReader +{ +private: + CompressedBlobHeader header; + u64 *block_pointers; + u32 *hashes; + int data_offset; + FILE *file; + u64 file_size; + u8 *zlib_buffer; + int zlib_buffer_size; + + CompressedBlobReader(const char *filename); + +public: + static CompressedBlobReader* Create(const char *filename); + ~CompressedBlobReader(); + const CompressedBlobHeader &GetHeader() const { return header; } + u64 GetDataSize() const { return header.data_size; } + u64 GetRawSize() const { return file_size; } + u64 GetBlockCompressedSize(u64 block_num) const; + void GetBlock(u64 block_num, u8 *out_ptr); +}; + +} // namespace + +#endif // COMPRESSED_BLOB_H_ diff --git a/Source/Core/DiscIO/Src/DriveBlob.h b/Source/Core/DiscIO/Src/DriveBlob.h index 89de954e21..46154fe2fd 100644 --- a/Source/Core/DiscIO/Src/DriveBlob.h +++ b/Source/Core/DiscIO/Src/DriveBlob.h @@ -1,60 +1,60 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DRIVE_BLOB_H -#define _DRIVE_BLOB_H - -#include "Blob.h" - -#ifdef _WIN32 -#include -#endif - -namespace DiscIO -{ - -#ifdef _WIN32 -class DriveReader : public SectorReader -{ - HANDLE hDisc; - -private: - DriveReader(const char *drive) { - /* - char path[MAX_PATH]; - strncpy(path, drive, 3); - path[2] = 0; - sprintf(path, "\\\\.\\%s", drive); - hDisc = CreateFile(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - SetSectorSize(2048); - */ - } - -public: - static DriveReader *Create(const char *drive) { - return NULL;// new DriveReader(drive); - } - -}; - -#endif - - - -} // namespace - -#endif // _DRIVE_BLOB_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DRIVE_BLOB_H +#define _DRIVE_BLOB_H + +#include "Blob.h" + +#ifdef _WIN32 +#include +#endif + +namespace DiscIO +{ + +#ifdef _WIN32 +class DriveReader : public SectorReader +{ + HANDLE hDisc; + +private: + DriveReader(const char *drive) { + /* + char path[MAX_PATH]; + strncpy(path, drive, 3); + path[2] = 0; + sprintf(path, "\\\\.\\%s", drive); + hDisc = CreateFile(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + SetSectorSize(2048); + */ + } + +public: + static DriveReader *Create(const char *drive) { + return NULL;// new DriveReader(drive); + } + +}; + +#endif + + + +} // namespace + +#endif // _DRIVE_BLOB_H diff --git a/Source/Core/DiscIO/Src/FileBlob.h b/Source/Core/DiscIO/Src/FileBlob.h index f704608ba1..e7888d31d1 100644 --- a/Source/Core/DiscIO/Src/FileBlob.h +++ b/Source/Core/DiscIO/Src/FileBlob.h @@ -1,53 +1,53 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _FILE_BLOB_H -#define _FILE_BLOB_H - -#include "Blob.h" - -#ifdef _WIN32 -#include -#else -#include -#endif - -namespace DiscIO -{ - -class PlainFileReader : public IBlobReader -{ -#ifdef _WIN32 - HANDLE hFile; - PlainFileReader(HANDLE hFile_); -#else - FILE* file_; - PlainFileReader(FILE* file__); -#endif - s64 size; - -public: - static PlainFileReader* Create(const char* filename); - ~PlainFileReader(); - u64 GetDataSize() const { return size; } - u64 GetRawSize() const { return size; } - bool Read(u64 offset, u64 nbytes, u8* out_ptr); -}; - -} // namespace - -#endif // _FILE_BLOB_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _FILE_BLOB_H +#define _FILE_BLOB_H + +#include "Blob.h" + +#ifdef _WIN32 +#include +#else +#include +#endif + +namespace DiscIO +{ + +class PlainFileReader : public IBlobReader +{ +#ifdef _WIN32 + HANDLE hFile; + PlainFileReader(HANDLE hFile_); +#else + FILE* file_; + PlainFileReader(FILE* file__); +#endif + s64 size; + +public: + static PlainFileReader* Create(const char* filename); + ~PlainFileReader(); + u64 GetDataSize() const { return size; } + u64 GetRawSize() const { return size; } + bool Read(u64 offset, u64 nbytes, u8* out_ptr); +}; + +} // namespace + +#endif // _FILE_BLOB_H diff --git a/Source/Core/DiscIO/Src/FileHandlerARC.h b/Source/Core/DiscIO/Src/FileHandlerARC.h index 0dccc0ce5f..b58acb958d 100644 --- a/Source/Core/DiscIO/Src/FileHandlerARC.h +++ b/Source/Core/DiscIO/Src/FileHandlerARC.h @@ -1,66 +1,66 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _ARC_FILE_H -#define _ARC_FILE_H - -#include -#include - -#include "Common.h" -#include "Filesystem.h" - -namespace DiscIO -{ -class CARCFile -{ - public: - - CARCFile(const u8* _pBuffer, size_t _BufferSize); - - virtual ~CARCFile(); - - bool IsInitialized(); - - size_t GetFileSize(const std::string& _rFullPath); - - size_t ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize); - - bool ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename); - - bool ExportAllFiles(const std::string& _rFullPath); - - - private: - - u8* m_pBuffer; - - bool m_Initialized; - - typedef std::vectorCFileInfoVector; - CFileInfoVector m_FileInfoVector; - - bool ParseBuffer(); - - size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, const char* _szNameTable); - - const SFileInfo* FindFileInfo(std::string _rFullPath) const; -}; -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _ARC_FILE_H +#define _ARC_FILE_H + +#include +#include + +#include "Common.h" +#include "Filesystem.h" + +namespace DiscIO +{ +class CARCFile +{ + public: + + CARCFile(const u8* _pBuffer, size_t _BufferSize); + + virtual ~CARCFile(); + + bool IsInitialized(); + + size_t GetFileSize(const std::string& _rFullPath); + + size_t ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize); + + bool ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename); + + bool ExportAllFiles(const std::string& _rFullPath); + + + private: + + u8* m_pBuffer; + + bool m_Initialized; + + typedef std::vectorCFileInfoVector; + CFileInfoVector m_FileInfoVector; + + bool ParseBuffer(); + + size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, const char* _szNameTable); + + const SFileInfo* FindFileInfo(std::string _rFullPath) const; +}; +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/FileSystemGCWii.h b/Source/Core/DiscIO/Src/FileSystemGCWii.h index ababa05b86..3cb1359c01 100644 --- a/Source/Core/DiscIO/Src/FileSystemGCWii.h +++ b/Source/Core/DiscIO/Src/FileSystemGCWii.h @@ -1,57 +1,57 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _FILESYSTEM_GC_WII_H -#define _FILESYSTEM_GC_WII_H - -#include - -#include "Filesystem.h" - -namespace DiscIO -{ - -class CFileSystemGCWii : public IFileSystem -{ -public: - CFileSystemGCWii(const IVolume *_rVolume); - virtual ~CFileSystemGCWii(); - virtual bool IsInitialized() const; - virtual u64 GetFileSize(const char* _rFullPath) const; - virtual const char* GetFileName(u64 _Address) const; - virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const; - virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const; - virtual bool ExportAllFiles(const char* _rFullPath) const; - - -private: - std::vector m_FileInfoVector; - - bool m_Initialized; - u32 m_OffsetShift; // WII offsets are all shifted - u32 Read32(u64 _Offset) const; - virtual size_t GetFileList(std::vector &_rFilenames) const; - void GetStringFromOffset(u64 _Offset, char* Filename) const; - const SFileInfo* FindFileInfo(const char* _rFullPath) const; - bool InitFileSystem(); - size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, u64 _NameTableOffset); -}; - -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _FILESYSTEM_GC_WII_H +#define _FILESYSTEM_GC_WII_H + +#include + +#include "Filesystem.h" + +namespace DiscIO +{ + +class CFileSystemGCWii : public IFileSystem +{ +public: + CFileSystemGCWii(const IVolume *_rVolume); + virtual ~CFileSystemGCWii(); + virtual bool IsInitialized() const; + virtual u64 GetFileSize(const char* _rFullPath) const; + virtual const char* GetFileName(u64 _Address) const; + virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const; + virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const; + virtual bool ExportAllFiles(const char* _rFullPath) const; + + +private: + std::vector m_FileInfoVector; + + bool m_Initialized; + u32 m_OffsetShift; // WII offsets are all shifted + u32 Read32(u64 _Offset) const; + virtual size_t GetFileList(std::vector &_rFilenames) const; + void GetStringFromOffset(u64 _Offset, char* Filename) const; + const SFileInfo* FindFileInfo(const char* _rFullPath) const; + bool InitFileSystem(); + size_t BuildFilenames(const size_t _FirstIndex, const size_t _LastIndex, const char* _szDirectory, u64 _NameTableOffset); +}; + +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/Filesystem.h b/Source/Core/DiscIO/Src/Filesystem.h index aabccfba98..b8be5649a8 100644 --- a/Source/Core/DiscIO/Src/Filesystem.h +++ b/Source/Core/DiscIO/Src/Filesystem.h @@ -1,69 +1,69 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _FILESYSTEM_H -#define _FILESYSTEM_H - -#include "Volume.h" - -namespace DiscIO -{ - -// file info of an FST entry -struct SFileInfo -{ - u64 m_NameOffset; - u64 m_Offset; - u64 m_FileSize; - char m_FullPath[512]; - - bool IsDirectory() const { return (m_NameOffset & 0xFF000000) != 0 ? true : false; } - - SFileInfo() : m_NameOffset(0), m_Offset(0), m_FileSize(0) { - memset(m_FullPath, 0, sizeof(m_FullPath)); - } - - SFileInfo(const SFileInfo &rhs) : m_NameOffset(rhs.m_NameOffset), - m_Offset(rhs.m_Offset), m_FileSize(rhs.m_FileSize) { - strcpy(m_FullPath, rhs.m_FullPath); - } -}; - -class IFileSystem -{ -public: - IFileSystem(const IVolume *_rVolume); - - virtual ~IFileSystem(); - virtual bool IsInitialized() const = 0; - virtual size_t GetFileList(std::vector &_rFilenames) const = 0; - virtual u64 GetFileSize(const char* _rFullPath) const = 0; - virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const = 0; - virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const = 0; - virtual bool ExportAllFiles(const char* _rFullPath) const = 0; - virtual const char* GetFileName(u64 _Address) const = 0; - - virtual const IVolume *GetVolume() const { return m_rVolume; } -protected: - const IVolume *m_rVolume; -}; - -IFileSystem* CreateFileSystem(const IVolume *_rVolume); - -} // namespace - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _FILESYSTEM_H +#define _FILESYSTEM_H + +#include "Volume.h" + +namespace DiscIO +{ + +// file info of an FST entry +struct SFileInfo +{ + u64 m_NameOffset; + u64 m_Offset; + u64 m_FileSize; + char m_FullPath[512]; + + bool IsDirectory() const { return (m_NameOffset & 0xFF000000) != 0 ? true : false; } + + SFileInfo() : m_NameOffset(0), m_Offset(0), m_FileSize(0) { + memset(m_FullPath, 0, sizeof(m_FullPath)); + } + + SFileInfo(const SFileInfo &rhs) : m_NameOffset(rhs.m_NameOffset), + m_Offset(rhs.m_Offset), m_FileSize(rhs.m_FileSize) { + strcpy(m_FullPath, rhs.m_FullPath); + } +}; + +class IFileSystem +{ +public: + IFileSystem(const IVolume *_rVolume); + + virtual ~IFileSystem(); + virtual bool IsInitialized() const = 0; + virtual size_t GetFileList(std::vector &_rFilenames) const = 0; + virtual u64 GetFileSize(const char* _rFullPath) const = 0; + virtual u64 ReadFile(const char* _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) const = 0; + virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename) const = 0; + virtual bool ExportAllFiles(const char* _rFullPath) const = 0; + virtual const char* GetFileName(u64 _Address) const = 0; + + virtual const IVolume *GetVolume() const { return m_rVolume; } +protected: + const IVolume *m_rVolume; +}; + +IFileSystem* CreateFileSystem(const IVolume *_rVolume); + +} // namespace + +#endif diff --git a/Source/Core/DiscIO/Src/Volume.h b/Source/Core/DiscIO/Src/Volume.h index 0fe201b8ba..1f3852a5be 100644 --- a/Source/Core/DiscIO/Src/Volume.h +++ b/Source/Core/DiscIO/Src/Volume.h @@ -1,64 +1,64 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VOLUME_H -#define _VOLUME_H - -#include -#include - -#include "Common.h" - -namespace DiscIO -{ -class IVolume -{ - public: - - IVolume() - {} - - - virtual ~IVolume() - {} - - - virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0; - virtual std::string GetUniqueID() const = 0; - virtual std::string GetMakerID() const = 0; - virtual std::string GetName() const = 0; - virtual u32 GetFSTSize() const = 0; - virtual std::string GetApploaderDate() const = 0; - - - enum ECountry - { - COUNTRY_EUROPE = 0, - COUNTRY_FRANCE = 1, - COUNTRY_USA = 2, - COUNTRY_JAP, - COUNTRY_UNKNOWN, - NUMBER_OF_COUNTRIES - }; - - virtual ECountry GetCountry() const = 0; - virtual u64 GetSize() const = 0; -}; -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VOLUME_H +#define _VOLUME_H + +#include +#include + +#include "Common.h" + +namespace DiscIO +{ +class IVolume +{ + public: + + IVolume() + {} + + + virtual ~IVolume() + {} + + + virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0; + virtual std::string GetUniqueID() const = 0; + virtual std::string GetMakerID() const = 0; + virtual std::string GetName() const = 0; + virtual u32 GetFSTSize() const = 0; + virtual std::string GetApploaderDate() const = 0; + + + enum ECountry + { + COUNTRY_EUROPE = 0, + COUNTRY_FRANCE = 1, + COUNTRY_USA = 2, + COUNTRY_JAP, + COUNTRY_UNKNOWN, + NUMBER_OF_COUNTRIES + }; + + virtual ECountry GetCountry() const = 0; + virtual u64 GetSize() const = 0; +}; +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/VolumeCreator.h b/Source/Core/DiscIO/Src/VolumeCreator.h index cd67706dec..6366bb1811 100644 --- a/Source/Core/DiscIO/Src/VolumeCreator.h +++ b/Source/Core/DiscIO/Src/VolumeCreator.h @@ -1,31 +1,31 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VOLUME_CREATOR_H -#define _VOLUME_CREATOR_H - -#include "Volume.h" - -namespace DiscIO -{ -IVolume* CreateVolumeFromFilename(const std::string& _rFilename); -IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii); -bool IsVolumeWiiDisc(const IVolume *_rVolume); -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VOLUME_CREATOR_H +#define _VOLUME_CREATOR_H + +#include "Volume.h" + +namespace DiscIO +{ +IVolume* CreateVolumeFromFilename(const std::string& _rFilename); +IVolume* CreateVolumeFromDirectory(const std::string& _rDirectory, bool _bIsWii); +bool IsVolumeWiiDisc(const IVolume *_rVolume); +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/VolumeDirectory.h b/Source/Core/DiscIO/Src/VolumeDirectory.h index 1466b77b43..1cc0931031 100644 --- a/Source/Core/DiscIO/Src/VolumeDirectory.h +++ b/Source/Core/DiscIO/Src/VolumeDirectory.h @@ -1,106 +1,106 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "Volume.h" -#include "Common.h" -#include "FileUtil.h" -#include -#include - -// -// --- this volume type is used for reading files directly from the hard drive --- -// - -namespace DiscIO -{ - -class CVolumeDirectory - : public IVolume -{ - public: - - CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii); - - ~CVolumeDirectory(); - - static bool IsValidDirectory(const std::string& _rDirectory); - - bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const; - - std::string GetUniqueID() const; - void SetUniqueID(std::string _ID); - - std::string GetMakerID() const; - - std::string GetName() const; - void SetName(std::string); - - u32 GetFSTSize() const; - - std::string GetApploaderDate() const; - - ECountry GetCountry() const; - - u64 GetSize() const; - - void BuildFST(); - - private: - static std::string ExtractDirectoryName(const std::string& _rDirectory); - - void SetDiskTypeWii(); - void SetDiskTypeGC(); - - // writing to read buffer - void WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _Src, - u64& _Address, u64& _Length, u8*& _pBuffer) const; - - void PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const; - - void Write32(u32 data, u32 offset, u8* buffer); - - // FST creation - void WriteEntryData(u32& entryOffset, u8 type, u32 nameOffset, u64 dataOffset, u32 length); - void WriteEntryName(u32& nameOffset, const std::string& name); - void WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum); - - // returns number of entries found in _Directory - u32 AddDirectoryEntries(const std::string& _Directory, File::FSTEntry& parentEntry); - - std::string m_rootDirectory; - - std::map m_virtualDisk; - - u32 m_totalNameSize; - - // gc has no shift, wii has 2 bit shift - u32 m_addressShift; - - // first address on disk containing file data - u64 m_dataStartAddress; - - u64 m_fstNameOffset; - - u64 m_fstSize; - - u8* m_FSTData; - u8* m_diskHeader; -}; - -} // namespace +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "Volume.h" +#include "Common.h" +#include "FileUtil.h" +#include +#include + +// +// --- this volume type is used for reading files directly from the hard drive --- +// + +namespace DiscIO +{ + +class CVolumeDirectory + : public IVolume +{ + public: + + CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii); + + ~CVolumeDirectory(); + + static bool IsValidDirectory(const std::string& _rDirectory); + + bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const; + + std::string GetUniqueID() const; + void SetUniqueID(std::string _ID); + + std::string GetMakerID() const; + + std::string GetName() const; + void SetName(std::string); + + u32 GetFSTSize() const; + + std::string GetApploaderDate() const; + + ECountry GetCountry() const; + + u64 GetSize() const; + + void BuildFST(); + + private: + static std::string ExtractDirectoryName(const std::string& _rDirectory); + + void SetDiskTypeWii(); + void SetDiskTypeGC(); + + // writing to read buffer + void WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _Src, + u64& _Address, u64& _Length, u8*& _pBuffer) const; + + void PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const; + + void Write32(u32 data, u32 offset, u8* buffer); + + // FST creation + void WriteEntryData(u32& entryOffset, u8 type, u32 nameOffset, u64 dataOffset, u32 length); + void WriteEntryName(u32& nameOffset, const std::string& name); + void WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum); + + // returns number of entries found in _Directory + u32 AddDirectoryEntries(const std::string& _Directory, File::FSTEntry& parentEntry); + + std::string m_rootDirectory; + + std::map m_virtualDisk; + + u32 m_totalNameSize; + + // gc has no shift, wii has 2 bit shift + u32 m_addressShift; + + // first address on disk containing file data + u64 m_dataStartAddress; + + u64 m_fstNameOffset; + + u64 m_fstSize; + + u8* m_FSTData; + u8* m_diskHeader; +}; + +} // namespace diff --git a/Source/Core/DiscIO/Src/VolumeGC.h b/Source/Core/DiscIO/Src/VolumeGC.h index e4f3b2f1fc..33452c39f7 100644 --- a/Source/Core/DiscIO/Src/VolumeGC.h +++ b/Source/Core/DiscIO/Src/VolumeGC.h @@ -1,45 +1,45 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "Volume.h" -#include "Blob.h" - -// --- this volume type is used for GC disc images --- - -namespace DiscIO -{ -class CVolumeGC : public IVolume -{ -public: - CVolumeGC(IBlobReader* _pReader); - ~CVolumeGC(); - bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const; - std::string GetUniqueID() const; - std::string GetMakerID() const; - std::string GetName() const; - u32 GetFSTSize() const; - std::string GetApploaderDate() const; - ECountry GetCountry() const; - u64 GetSize() const; - -private: - IBlobReader* m_pReader; -}; - -} // namespace +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "Volume.h" +#include "Blob.h" + +// --- this volume type is used for GC disc images --- + +namespace DiscIO +{ +class CVolumeGC : public IVolume +{ +public: + CVolumeGC(IBlobReader* _pReader); + ~CVolumeGC(); + bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const; + std::string GetUniqueID() const; + std::string GetMakerID() const; + std::string GetName() const; + u32 GetFSTSize() const; + std::string GetApploaderDate() const; + ECountry GetCountry() const; + u64 GetSize() const; + +private: + IBlobReader* m_pReader; +}; + +} // namespace diff --git a/Source/Core/DiscIO/Src/VolumeWiiCrypted.h b/Source/Core/DiscIO/Src/VolumeWiiCrypted.h index 4d2aa0ab90..696d609114 100644 --- a/Source/Core/DiscIO/Src/VolumeWiiCrypted.h +++ b/Source/Core/DiscIO/Src/VolumeWiiCrypted.h @@ -1,58 +1,58 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VOLUME_WII_CRYPTED -#define _VOLUME_WII_CRYPTED - -#include "Volume.h" -#include "Blob.h" -#include "AES/aes.h" - -// --- this volume type is used for encrypted Wii images --- - -namespace DiscIO -{ -class CVolumeWiiCrypted : public IVolume -{ -public: - CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey); - ~CVolumeWiiCrypted(); - bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const; - std::string GetUniqueID() const; - std::string GetMakerID() const; - std::string GetName() const; - u32 GetFSTSize() const; - std::string GetApploaderDate() const; - ECountry GetCountry() const; - u64 GetSize() const; - -private: - IBlobReader* m_pReader; - - u8* m_pBuffer; - AES_KEY m_AES_KEY; - - u64 m_VolumeOffset; - - mutable u64 m_LastDecryptedBlockOffset; - mutable unsigned char m_LastDecryptedBlock[0x8000]; -}; - -} // namespace - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VOLUME_WII_CRYPTED +#define _VOLUME_WII_CRYPTED + +#include "Volume.h" +#include "Blob.h" +#include "AES/aes.h" + +// --- this volume type is used for encrypted Wii images --- + +namespace DiscIO +{ +class CVolumeWiiCrypted : public IVolume +{ +public: + CVolumeWiiCrypted(IBlobReader* _pReader, u64 _VolumeOffset, const unsigned char* _pVolumeKey); + ~CVolumeWiiCrypted(); + bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const; + std::string GetUniqueID() const; + std::string GetMakerID() const; + std::string GetName() const; + u32 GetFSTSize() const; + std::string GetApploaderDate() const; + ECountry GetCountry() const; + u64 GetSize() const; + +private: + IBlobReader* m_pReader; + + u8* m_pBuffer; + AES_KEY m_AES_KEY; + + u64 m_VolumeOffset; + + mutable u64 m_LastDecryptedBlockOffset; + mutable unsigned char m_LastDecryptedBlock[0x8000]; +}; + +} // namespace + +#endif + diff --git a/Source/Core/DiscIO/Src/stdafx.h b/Source/Core/DiscIO/Src/stdafx.h index 531bd7ef53..2949974115 100644 --- a/Source/Core/DiscIO/Src/stdafx.h +++ b/Source/Core/DiscIO/Src/stdafx.h @@ -1,30 +1,30 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#define _CRT_SECURE_NO_DEPRECATE -#define _SCL_SECURE_NO_DEPRECATE - - -// TODO: reference additional headers your program requires here +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#define _CRT_SECURE_NO_DEPRECATE +#define _SCL_SECURE_NO_DEPRECATE + + +// TODO: reference additional headers your program requires here diff --git a/Source/Core/DolphinWX/Src/AboutDolphin.h b/Source/Core/DolphinWX/Src/AboutDolphin.h index 10eff52c66..a50d49f260 100644 --- a/Source/Core/DolphinWX/Src/AboutDolphin.h +++ b/Source/Core/DolphinWX/Src/AboutDolphin.h @@ -1,62 +1,62 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifndef _ABOUTDOLPHIN_H_ -#define _ABOUTDOLPHIN_H_ - -#include -#include -#include -#include -#include -#include -#include - -#undef ABOUTDOLPHIN_STYLE -#define ABOUTDOLPHIN_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - -class AboutDolphin : public wxDialog -{ - public: - AboutDolphin(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About Dolphin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ABOUTDOLPHIN_STYLE); - virtual ~AboutDolphin(); - void CloseClick(wxCommandEvent& event); - - private: - DECLARE_EVENT_TABLE(); - - wxBoxSizer *sMain; - wxBoxSizer *sButtons; - wxBoxSizer *sMainHor; - wxBoxSizer *sInfo; - - wxButton *m_Close; - wxStaticText *Message; - wxBitmap *DolphinLogo; - wxStaticBitmap *sbDolphinLogo; - - enum - { - ID_CLOSE = 1000, - ID_LOGO, - ID_MESSAGE - }; - - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); -}; - -#endif //_ABOUTDOLPHIN_H_ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifndef _ABOUTDOLPHIN_H_ +#define _ABOUTDOLPHIN_H_ + +#include +#include +#include +#include +#include +#include +#include + +#undef ABOUTDOLPHIN_STYLE +#define ABOUTDOLPHIN_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + +class AboutDolphin : public wxDialog +{ + public: + AboutDolphin(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About Dolphin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ABOUTDOLPHIN_STYLE); + virtual ~AboutDolphin(); + void CloseClick(wxCommandEvent& event); + + private: + DECLARE_EVENT_TABLE(); + + wxBoxSizer *sMain; + wxBoxSizer *sButtons; + wxBoxSizer *sMainHor; + wxBoxSizer *sInfo; + + wxButton *m_Close; + wxStaticText *Message; + wxBitmap *DolphinLogo; + wxStaticBitmap *sbDolphinLogo; + + enum + { + ID_CLOSE = 1000, + ID_LOGO, + ID_MESSAGE + }; + + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); +}; + +#endif //_ABOUTDOLPHIN_H_ diff --git a/Source/Core/DolphinWX/Src/BootManager.h b/Source/Core/DolphinWX/Src/BootManager.h index cd2efd5608..a672222d39 100644 --- a/Source/Core/DolphinWX/Src/BootManager.h +++ b/Source/Core/DolphinWX/Src/BootManager.h @@ -1,32 +1,32 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BOOTMANAGER_H -#define _BOOTMANAGER_H - -#include - -class GameListItem; - -namespace BootManager -{ -bool BootCore(const std::string& _rFilename); - -void Stop(); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BOOTMANAGER_H +#define _BOOTMANAGER_H + +#include + +class GameListItem; + +namespace BootManager +{ +bool BootCore(const std::string& _rFilename); + +void Stop(); +}; + +#endif diff --git a/Source/Core/DolphinWX/Src/CheatsWindow.h b/Source/Core/DolphinWX/Src/CheatsWindow.h index 52085aa763..d6cce3d511 100644 --- a/Source/Core/DolphinWX/Src/CheatsWindow.h +++ b/Source/Core/DolphinWX/Src/CheatsWindow.h @@ -1,119 +1,119 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __CHEATSWINDOW_H__ -#define __CHEATSWINDOW_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ActionReplay.h" - -#include "Filesystem.h" -#include "IniFile.h" - -#undef wxCHEATSWINDOW_STYLE -#define wxCHEATSWINDOW_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE - -class wxCheatsWindow : public wxFrame -{ - public: - - wxCheatsWindow(wxFrame* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); - - virtual ~wxCheatsWindow(); - - protected: - - struct ARCodeIndex { - u32 uiIndex; - size_t index; - }; - - // Event Table - DECLARE_EVENT_TABLE(); - - // --- GUI Controls --- - wxGridBagSizer* m_Sizer_TabCheats; - - wxNotebook *m_Notebook_Main; - - wxPanel *m_Tab_Cheats; - wxPanel *m_Tab_Log; - - wxButton *m_Button_Close; - wxButton *m_Button_ApplyCodes; - - wxStaticText *m_Label_Codename; - wxStaticText *m_Label_NumCodes; - - wxCheckListBox *m_CheckListBox_CheatsList; - - wxListBox *m_ListBox_CodesList; - - wxStaticBox *m_GroupBox_Info; - - wxArrayString m_CheatStringList; - - std::vector indexList; - - // GUI IDs - enum - { - ID_NOTEBOOK_MAIN, - ID_TAB_CHEATS, - ID_TAB_LOG, - ID_BUTTON_CLOSE, - ID_CHECKLISTBOX_CHEATSLIST, - ID_LABEL_CODENAME, - ID_GROUPBOX_INFO, - ID_BUTTON_APPLYCODES, - ID_LABEL_NUMCODES, - ID_LISTBOX_CODESLIST - }; - - void Init_ChildControls(); - - void Load_ARCodes(); - - // --- Wx Events Handlers --- - // $ Window - void OnEvent_Window_Resize(wxSizeEvent& event); - void OnEvent_Window_Close(wxCloseEvent& event); - - // $ Close Button - void OnEvent_ButtonClose_Press(wxCommandEvent& event); - - // $ Cheats List - void OnEvent_CheatsList_ItemSelected(wxCommandEvent& event); - void OnEvent_CheatsList_ItemToggled(wxCommandEvent& event); - - // $ Update Active Codes Button - void OnEvent_ButtonUpdateCodes_Press(wxCommandEvent& event); -}; - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __CHEATSWINDOW_H__ +#define __CHEATSWINDOW_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ActionReplay.h" + +#include "Filesystem.h" +#include "IniFile.h" + +#undef wxCHEATSWINDOW_STYLE +#define wxCHEATSWINDOW_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE + +class wxCheatsWindow : public wxFrame +{ + public: + + wxCheatsWindow(wxFrame* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); + + virtual ~wxCheatsWindow(); + + protected: + + struct ARCodeIndex { + u32 uiIndex; + size_t index; + }; + + // Event Table + DECLARE_EVENT_TABLE(); + + // --- GUI Controls --- + wxGridBagSizer* m_Sizer_TabCheats; + + wxNotebook *m_Notebook_Main; + + wxPanel *m_Tab_Cheats; + wxPanel *m_Tab_Log; + + wxButton *m_Button_Close; + wxButton *m_Button_ApplyCodes; + + wxStaticText *m_Label_Codename; + wxStaticText *m_Label_NumCodes; + + wxCheckListBox *m_CheckListBox_CheatsList; + + wxListBox *m_ListBox_CodesList; + + wxStaticBox *m_GroupBox_Info; + + wxArrayString m_CheatStringList; + + std::vector indexList; + + // GUI IDs + enum + { + ID_NOTEBOOK_MAIN, + ID_TAB_CHEATS, + ID_TAB_LOG, + ID_BUTTON_CLOSE, + ID_CHECKLISTBOX_CHEATSLIST, + ID_LABEL_CODENAME, + ID_GROUPBOX_INFO, + ID_BUTTON_APPLYCODES, + ID_LABEL_NUMCODES, + ID_LISTBOX_CODESLIST + }; + + void Init_ChildControls(); + + void Load_ARCodes(); + + // --- Wx Events Handlers --- + // $ Window + void OnEvent_Window_Resize(wxSizeEvent& event); + void OnEvent_Window_Close(wxCloseEvent& event); + + // $ Close Button + void OnEvent_ButtonClose_Press(wxCommandEvent& event); + + // $ Cheats List + void OnEvent_CheatsList_ItemSelected(wxCommandEvent& event); + void OnEvent_CheatsList_ItemToggled(wxCommandEvent& event); + + // $ Update Active Codes Button + void OnEvent_ButtonUpdateCodes_Press(wxCommandEvent& event); +}; + #endif \ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/Config.h b/Source/Core/DolphinWX/Src/Config.h index 7e8e804256..9fc360b6db 100644 --- a/Source/Core/DolphinWX/Src/Config.h +++ b/Source/Core/DolphinWX/Src/Config.h @@ -1,64 +1,64 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _CONFIG_H -#define _CONFIG_H - -#include -#include - -#include "Boot/Boot.h" - -struct SConfig -{ - // hard coded default plugins ... - std::string m_DefaultGFXPlugin; - std::string m_DefaultDSPPlugin; - std::string m_DefaultPADPlugin; - std::string m_DefaultWiiMotePlugin; - - // name of the last used filename - std::string m_LastFilename; - - // gcm folder - std::vectorm_ISOFolder; - - SCoreStartupParameter m_LocalCoreStartupParameter; - - // save settings - void SaveSettings(); - - - // load settings - void LoadSettings(); - - - static SConfig& GetInstance() {return(m_Instance);} - - - private: - - // constructor - SConfig(); - - // destructor - ~SConfig(); - - static SConfig m_Instance; -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _CONFIG_H +#define _CONFIG_H + +#include +#include + +#include "Boot/Boot.h" + +struct SConfig +{ + // hard coded default plugins ... + std::string m_DefaultGFXPlugin; + std::string m_DefaultDSPPlugin; + std::string m_DefaultPADPlugin; + std::string m_DefaultWiiMotePlugin; + + // name of the last used filename + std::string m_LastFilename; + + // gcm folder + std::vectorm_ISOFolder; + + SCoreStartupParameter m_LocalCoreStartupParameter; + + // save settings + void SaveSettings(); + + + // load settings + void LoadSettings(); + + + static SConfig& GetInstance() {return(m_Instance);} + + + private: + + // constructor + SConfig(); + + // destructor + ~SConfig(); + + static SConfig m_Instance; +}; + +#endif diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index 13790fb4f5..b9d2e848f8 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -1,256 +1,256 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __CONFIG_MAIN_h__ -#define __CONFIG_MAIN_h__ - -#include -#include -#include -#include -//#include -#include "Config.h" - -#undef CONFIG_MAIN_STYLE -#define CONFIG_MAIN_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - -class CConfigMain - : public wxDialog -{ - public: - - CConfigMain(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Dolphin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = CONFIG_MAIN_STYLE); - virtual ~CConfigMain(); - void CloseClick(wxCommandEvent& event); - void OnSelectionChanged(wxCommandEvent& event); - void OnConfig(wxCommandEvent& event); - - bool bRefreshList; - - private: - - DECLARE_EVENT_TABLE(); - - wxBoxSizer* sGeneral; - wxStaticBoxSizer* sbBasic; - wxStaticBoxSizer* sbAdvanced; - wxBoxSizer* sGamecube; - wxStaticBoxSizer* sbGamecubeIPLSettings; - wxGridBagSizer* sGamecubeIPLSettings; - wxBoxSizer* sWii; - wxStaticBoxSizer* sbWiimoteSettings; - wxGridBagSizer* sWiimoteSettings; - wxStaticBoxSizer* sbWiiIPLSettings; - wxGridBagSizer* sWiiIPLSettings; - wxBoxSizer* sPaths; - wxStaticBoxSizer* sbISOPaths; - wxBoxSizer* sISOButtons; - wxGridBagSizer* sOtherPaths; - wxBoxSizer* sPlugins; - wxStaticBoxSizer* sbGraphicsPlugin; - wxStaticBoxSizer* sbDSPPlugin; - wxStaticBoxSizer* sbPadPlugin; - wxStaticBoxSizer* sbWiimotePlugin; - - wxNotebook *Notebook; - wxPanel *GeneralPage; - wxPanel *GamecubePage; - wxPanel *WiiPage; - wxPanel *PathsPage; - wxPanel *PluginPage; - - wxButton* m_Close; - - wxCheckBox* AllwaysHLEBIOS; - wxCheckBox* UseDynaRec; - wxCheckBox* UseDualCore; - wxCheckBox* LockThreads; - wxCheckBox* OptimizeQuantizers; - wxCheckBox* SkipIdle; - wxCheckBox* EnableCheats; - wxArrayString arrayStringFor_GCSystemLang; - wxStaticText* GCSystemLangText; - wxChoice* GCSystemLang; - - FILE* pStream; - u8 m_SYSCONF[0x4000]; - bool m_bSysconfOK; - std::string FullSYSCONFPath; - - enum - { - BT_DINF = 0x0044, - BT_SENS = 0x04AF, - BT_BAR = 0x04E1, - BT_SPKV = 0x151A, - BT_MOT = 0x1807 - }; - enum - { - IPL_AR = 0x04D9, - IPL_SSV = 0x04EA, - IPL_LNG = 0x04F3, - IPL_PGS = 0x17CC, - IPL_E60 = 0x17D5 - }; - /* Some offsets in SYSCONF: (taken from ector's SYSCONF) - Note: offset is where the actual data starts, not where the type or name begins - offset length name comment - 0x0044 0x460 BT.DINF List of Wiimotes "synced" to the system - 0x158B ? BT.CDIF ? -- Starts with 0x0204 followed by 0x210 of 0x00 - 0x04AF 4 BT.SENS Wiimote sensitivity setting - 0x04E1 1 BT.BAR Sensor bar position (0:bottom) - 0x151A 1 BT.SPKV Wiimote speaker volume - 0x1807 1 BT.MOT Wiimote motor on/off - - 0x17F3 2 IPL.IDL Shutdown mode and idle LED mode - 0x17C3 1 IPL.UPT Update Type - 0x04BB 0x16 IPL.NIK Console Nickname - 0x04D9 1 IPL.AR Aspect ratio setting. 0: 4:3 1: 16:9 - 0x04EA 1 IPL.SSV Screen Saver off/on (burn-in reduction) - 0x04F3 1 IPL.LNG System Language, see conf.c for some values - 0x04FD 0x1007 IPL.SADR "Simple Address" Contains some region info - 0x150E 4 IPL.CB Counter Bias -- difference between RTC and local time, in seconds - 0x1522 0x50 IPL.PC Parental Control password/setting - 0x17B1 1 IPL.CD Config Done flag -- has initial setup been performed? - 0x17BA 1 IPL.CD2 Config2 Done flag -- has network setup been performed? - 0x17FF 1 IPL.EULA EULA Done flag -- has EULA been acknowledged? - 0x17CC 1 IPL.PGS Use Progressive Scan - 0x17D5 1 IPL.E60 Use EuRGB60 (PAL6) - ? 1 IPL.SND Sound setting - 0x17DD 1 IPL.DH Display Offset (Horiz) - 0x179A 4 IPL.INC "Installed Channel App Count" - ? ? IPL.ARN ? - 0x17A7 4 IPL.FRC "Free Channel App Count" - - ? ? DEV.BTM ? - ? ? DEV.VIM ? - ? ? DEV.CTC ? - ? ? DEV.DSM ? - ? ? DVD.CNF ? - 0x1582 ? WWW.RST WWW Restriction - ? ? NET.CNF ? - ? ? NET.CFG ? - 0x1576 4 NET.CTPC Net Content Restrictions ("Content Parental Control"?) - 0x17E7 4 NET.WCFG WC24 Configuration flags - */ - wxArrayString arrayStringFor_WiiSensBarPos; - wxStaticText* WiiSensBarPosText; - wxChoice* WiiSensBarPos; - wxCheckBox* WiiScreenSaver; - wxCheckBox* WiiProgressiveScan; - wxCheckBox* WiiEuRGB60; - wxArrayString arrayStringFor_WiiAspectRatio; - wxStaticText* WiiAspectRatioText; - wxChoice* WiiAspectRatio; - wxArrayString arrayStringFor_WiiSystemLang; - wxStaticText* WiiSystemLangText; - wxChoice* WiiSystemLang; - - wxArrayString arrayStringFor_ISOPaths; - wxListBox* ISOPaths; - wxButton* AddISOPath; - wxButton* RemoveISOPath; - wxStaticText* DefaultISOText; - wxFilePickerCtrl* DefaultISO; - wxStaticText* DVDRootText; - wxDirPickerCtrl* DVDRoot; - - wxStaticText* PADText; - wxButton* PADConfig; - wxChoice* PADSelection; - wxButton* DSPConfig; - wxStaticText* DSPText; - wxChoice* DSPSelection; - wxButton* GraphicConfig; - wxStaticText* GraphicText; - wxChoice* GraphicSelection; - wxButton* WiimoteConfig; - wxStaticText* WiimoteText; - wxChoice* WiimoteSelection; - - enum - { - ID_NOTEBOOK = 1000, - ID_GENERALPAGE, - ID_GAMECUBEPAGE, - ID_WIIPAGE, - ID_PATHSPAGE, - ID_PLUGINPAGE, - ID_CLOSE, - ID_ALLWAYS_HLEBIOS, - ID_USEDYNAREC, - ID_USEDUALCORE, - ID_LOCKTHREADS, - ID_OPTIMIZEQUANTIZERS, - ID_IDLESKIP, - ID_ENABLECHEATS, - ID_ENABLEISOCACHE, - ID_GC_SRAM_LNG_TEXT, - ID_GC_SRAM_LNG, - ID_WII_BT_BAR_TEXT, - ID_WII_BT_BAR, - ID_WII_IPL_SSV, - ID_WII_IPL_PGS, - ID_WII_IPL_E60, - ID_WII_IPL_AR_TEXT, - ID_WII_IPL_AR, - ID_WII_IPL_LNG_TEXT, - ID_WII_IPL_LNG, - ID_ISOPATHS, - ID_ADDISOPATH, - ID_REMOVEISOPATH, - ID_DEFAULTISO_TEXT, - ID_DEFAULTISO, - ID_DVDROOT_TEXT, - ID_DVDROOT, - ID_WIIMOTE_ABOUT, - ID_WIIMOTE_CONFIG, - ID_WIIMOTE_TEXT, - ID_WIIMOTE_CB, - ID_PAD_TEXT, - ID_PAD_ABOUT , - ID_PAD_CONFIG, - ID_PAD_CB, - ID_DSP_ABOUT, - ID_DSP_CONFIG, - ID_DSP_TEXT, - ID_DSP_CB, - ID_GRAPHIC_ABOUT, - ID_GRAPHIC_CONFIG, - ID_GRAPHIC_TEXT, - ID_GRAPHIC_CB - }; - - void CreateGUIControls(); - void OnClose(wxCloseEvent& event); - void CoreSettingsChanged(wxCommandEvent& event); - void GCSettingsChanged(wxCommandEvent& event); - void WiiSettingsChanged(wxCommandEvent& event); - void ISOPathsSelectionChanged(wxCommandEvent& event); - void AddRemoveISOPaths(wxCommandEvent& event); - void DefaultISOChanged(wxFileDirPickerEvent& event); - void DVDRootChanged(wxFileDirPickerEvent& event); - - void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename); - - void CallConfig(wxChoice* _pChoice); - - bool GetFilename(wxChoice* _pChoice, std::string& _rFilename); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __CONFIG_MAIN_h__ +#define __CONFIG_MAIN_h__ + +#include +#include +#include +#include +//#include +#include "Config.h" + +#undef CONFIG_MAIN_STYLE +#define CONFIG_MAIN_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + +class CConfigMain + : public wxDialog +{ + public: + + CConfigMain(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Dolphin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = CONFIG_MAIN_STYLE); + virtual ~CConfigMain(); + void CloseClick(wxCommandEvent& event); + void OnSelectionChanged(wxCommandEvent& event); + void OnConfig(wxCommandEvent& event); + + bool bRefreshList; + + private: + + DECLARE_EVENT_TABLE(); + + wxBoxSizer* sGeneral; + wxStaticBoxSizer* sbBasic; + wxStaticBoxSizer* sbAdvanced; + wxBoxSizer* sGamecube; + wxStaticBoxSizer* sbGamecubeIPLSettings; + wxGridBagSizer* sGamecubeIPLSettings; + wxBoxSizer* sWii; + wxStaticBoxSizer* sbWiimoteSettings; + wxGridBagSizer* sWiimoteSettings; + wxStaticBoxSizer* sbWiiIPLSettings; + wxGridBagSizer* sWiiIPLSettings; + wxBoxSizer* sPaths; + wxStaticBoxSizer* sbISOPaths; + wxBoxSizer* sISOButtons; + wxGridBagSizer* sOtherPaths; + wxBoxSizer* sPlugins; + wxStaticBoxSizer* sbGraphicsPlugin; + wxStaticBoxSizer* sbDSPPlugin; + wxStaticBoxSizer* sbPadPlugin; + wxStaticBoxSizer* sbWiimotePlugin; + + wxNotebook *Notebook; + wxPanel *GeneralPage; + wxPanel *GamecubePage; + wxPanel *WiiPage; + wxPanel *PathsPage; + wxPanel *PluginPage; + + wxButton* m_Close; + + wxCheckBox* AllwaysHLEBIOS; + wxCheckBox* UseDynaRec; + wxCheckBox* UseDualCore; + wxCheckBox* LockThreads; + wxCheckBox* OptimizeQuantizers; + wxCheckBox* SkipIdle; + wxCheckBox* EnableCheats; + wxArrayString arrayStringFor_GCSystemLang; + wxStaticText* GCSystemLangText; + wxChoice* GCSystemLang; + + FILE* pStream; + u8 m_SYSCONF[0x4000]; + bool m_bSysconfOK; + std::string FullSYSCONFPath; + + enum + { + BT_DINF = 0x0044, + BT_SENS = 0x04AF, + BT_BAR = 0x04E1, + BT_SPKV = 0x151A, + BT_MOT = 0x1807 + }; + enum + { + IPL_AR = 0x04D9, + IPL_SSV = 0x04EA, + IPL_LNG = 0x04F3, + IPL_PGS = 0x17CC, + IPL_E60 = 0x17D5 + }; + /* Some offsets in SYSCONF: (taken from ector's SYSCONF) + Note: offset is where the actual data starts, not where the type or name begins + offset length name comment + 0x0044 0x460 BT.DINF List of Wiimotes "synced" to the system + 0x158B ? BT.CDIF ? -- Starts with 0x0204 followed by 0x210 of 0x00 + 0x04AF 4 BT.SENS Wiimote sensitivity setting + 0x04E1 1 BT.BAR Sensor bar position (0:bottom) + 0x151A 1 BT.SPKV Wiimote speaker volume + 0x1807 1 BT.MOT Wiimote motor on/off + + 0x17F3 2 IPL.IDL Shutdown mode and idle LED mode + 0x17C3 1 IPL.UPT Update Type + 0x04BB 0x16 IPL.NIK Console Nickname + 0x04D9 1 IPL.AR Aspect ratio setting. 0: 4:3 1: 16:9 + 0x04EA 1 IPL.SSV Screen Saver off/on (burn-in reduction) + 0x04F3 1 IPL.LNG System Language, see conf.c for some values + 0x04FD 0x1007 IPL.SADR "Simple Address" Contains some region info + 0x150E 4 IPL.CB Counter Bias -- difference between RTC and local time, in seconds + 0x1522 0x50 IPL.PC Parental Control password/setting + 0x17B1 1 IPL.CD Config Done flag -- has initial setup been performed? + 0x17BA 1 IPL.CD2 Config2 Done flag -- has network setup been performed? + 0x17FF 1 IPL.EULA EULA Done flag -- has EULA been acknowledged? + 0x17CC 1 IPL.PGS Use Progressive Scan + 0x17D5 1 IPL.E60 Use EuRGB60 (PAL6) + ? 1 IPL.SND Sound setting + 0x17DD 1 IPL.DH Display Offset (Horiz) + 0x179A 4 IPL.INC "Installed Channel App Count" + ? ? IPL.ARN ? + 0x17A7 4 IPL.FRC "Free Channel App Count" + + ? ? DEV.BTM ? + ? ? DEV.VIM ? + ? ? DEV.CTC ? + ? ? DEV.DSM ? + ? ? DVD.CNF ? + 0x1582 ? WWW.RST WWW Restriction + ? ? NET.CNF ? + ? ? NET.CFG ? + 0x1576 4 NET.CTPC Net Content Restrictions ("Content Parental Control"?) + 0x17E7 4 NET.WCFG WC24 Configuration flags + */ + wxArrayString arrayStringFor_WiiSensBarPos; + wxStaticText* WiiSensBarPosText; + wxChoice* WiiSensBarPos; + wxCheckBox* WiiScreenSaver; + wxCheckBox* WiiProgressiveScan; + wxCheckBox* WiiEuRGB60; + wxArrayString arrayStringFor_WiiAspectRatio; + wxStaticText* WiiAspectRatioText; + wxChoice* WiiAspectRatio; + wxArrayString arrayStringFor_WiiSystemLang; + wxStaticText* WiiSystemLangText; + wxChoice* WiiSystemLang; + + wxArrayString arrayStringFor_ISOPaths; + wxListBox* ISOPaths; + wxButton* AddISOPath; + wxButton* RemoveISOPath; + wxStaticText* DefaultISOText; + wxFilePickerCtrl* DefaultISO; + wxStaticText* DVDRootText; + wxDirPickerCtrl* DVDRoot; + + wxStaticText* PADText; + wxButton* PADConfig; + wxChoice* PADSelection; + wxButton* DSPConfig; + wxStaticText* DSPText; + wxChoice* DSPSelection; + wxButton* GraphicConfig; + wxStaticText* GraphicText; + wxChoice* GraphicSelection; + wxButton* WiimoteConfig; + wxStaticText* WiimoteText; + wxChoice* WiimoteSelection; + + enum + { + ID_NOTEBOOK = 1000, + ID_GENERALPAGE, + ID_GAMECUBEPAGE, + ID_WIIPAGE, + ID_PATHSPAGE, + ID_PLUGINPAGE, + ID_CLOSE, + ID_ALLWAYS_HLEBIOS, + ID_USEDYNAREC, + ID_USEDUALCORE, + ID_LOCKTHREADS, + ID_OPTIMIZEQUANTIZERS, + ID_IDLESKIP, + ID_ENABLECHEATS, + ID_ENABLEISOCACHE, + ID_GC_SRAM_LNG_TEXT, + ID_GC_SRAM_LNG, + ID_WII_BT_BAR_TEXT, + ID_WII_BT_BAR, + ID_WII_IPL_SSV, + ID_WII_IPL_PGS, + ID_WII_IPL_E60, + ID_WII_IPL_AR_TEXT, + ID_WII_IPL_AR, + ID_WII_IPL_LNG_TEXT, + ID_WII_IPL_LNG, + ID_ISOPATHS, + ID_ADDISOPATH, + ID_REMOVEISOPATH, + ID_DEFAULTISO_TEXT, + ID_DEFAULTISO, + ID_DVDROOT_TEXT, + ID_DVDROOT, + ID_WIIMOTE_ABOUT, + ID_WIIMOTE_CONFIG, + ID_WIIMOTE_TEXT, + ID_WIIMOTE_CB, + ID_PAD_TEXT, + ID_PAD_ABOUT , + ID_PAD_CONFIG, + ID_PAD_CB, + ID_DSP_ABOUT, + ID_DSP_CONFIG, + ID_DSP_TEXT, + ID_DSP_CB, + ID_GRAPHIC_ABOUT, + ID_GRAPHIC_CONFIG, + ID_GRAPHIC_TEXT, + ID_GRAPHIC_CB + }; + + void CreateGUIControls(); + void OnClose(wxCloseEvent& event); + void CoreSettingsChanged(wxCommandEvent& event); + void GCSettingsChanged(wxCommandEvent& event); + void WiiSettingsChanged(wxCommandEvent& event); + void ISOPathsSelectionChanged(wxCommandEvent& event); + void AddRemoveISOPaths(wxCommandEvent& event); + void DefaultISOChanged(wxFileDirPickerEvent& event); + void DVDRootChanged(wxFileDirPickerEvent& event); + + void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename); + + void CallConfig(wxChoice* _pChoice); + + bool GetFilename(wxChoice* _pChoice, std::string& _rFilename); +}; + +#endif diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 64324fd969..cfc9954fa5 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -1,109 +1,109 @@ -#ifndef __FRAME_H_ -#define __FRAME_H_ - -#include -#include -class CGameListCtrl; -class CFrame : public wxFrame -{ - public: - - CFrame(wxFrame* parent, - wxWindowID id = wxID_ANY, - const wxString& title = _T("Dolphin"), - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE); - - void* GetRenderHandle() {return(m_Panel->GetHandle());} - - - private: - - wxBoxSizer* sizerPanel; - CGameListCtrl* m_GameListCtrl; - wxPanel* m_Panel; - - enum EBitmaps - { - Toolbar_FileOpen, - Toolbar_Refresh, - Toolbar_Browse, - Toolbar_Play, - Toolbar_Play_Dis, - Toolbar_Stop, - Toolbar_Stop_Dis, - Toolbar_Pause, - Toolbar_PluginOptions, - Toolbar_PluginOptions_Dis, - Toolbar_PluginGFX, - Toolbar_PluginDSP, - Toolbar_PluginPAD, - Toolbar_FullScreen, - Toolbar_Help, - Bitmaps_Max - }; - - wxBitmap m_Bitmaps[Bitmaps_Max]; - wxBitmap m_BitmapsMenu[Bitmaps_Max]; - - void InitBitmaps(); - void PopulateToolbar(wxToolBar* toolBar); - void RecreateToolbar(); - void CreateMenu(); - -#ifdef _WIN32 - // Override window proc for tricks like screensaver disabling - WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); -#endif - // event handler - void OnQuit(wxCommandEvent& event); - void OnHelp(wxCommandEvent& event); - void OnRefresh(wxCommandEvent& event); - void OnConfigMain(wxCommandEvent& event); - void OnPluginGFX(wxCommandEvent& event); - void OnPluginDSP(wxCommandEvent& event); - void OnPluginPAD(wxCommandEvent& event); - void OnPluginWiimote(wxCommandEvent& event); - void OnOpen(wxCommandEvent& event); - void OnPlay(wxCommandEvent& event); - void OnStop(wxCommandEvent& event); - void OnBrowse(wxCommandEvent& event); - void OnMemcard(wxCommandEvent& event); - void OnShow_CheatsWindow(wxCommandEvent& event); - void OnToggleFullscreen(wxCommandEvent& event); - void OnToggleDualCore(wxCommandEvent& event); - void OnToggleSkipIdle(wxCommandEvent& event); - void OnToggleThrottle(wxCommandEvent& event); - void OnToggleToolbar(wxCommandEvent& event); - void OnToggleStatusbar(wxCommandEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnHostMessage(wxCommandEvent& event); - void OnLoadState(wxCommandEvent& event); - void OnSaveState(wxCommandEvent& event); - void OnClose(wxCloseEvent &event); - - wxStatusBar* m_pStatusBar; - wxMenuBar* m_pMenuBar; - - wxMenuItem* m_pMenuItemPlay; - wxMenuItem* m_pMenuItemStop; - wxMenuItem* m_pPluginOptions; - - wxMenuItem* m_pMenuItemLoad; - wxMenuItem* m_pMenuItemSave; - - wxToolBarToolBase* m_pToolPlay; - - wxBusyInfo* m_pBootProcessDialog; - - void UpdateGUI(); - - - // old function that could be cool - - DECLARE_EVENT_TABLE(); -}; - -#endif // __FRAME_H_ - +#ifndef __FRAME_H_ +#define __FRAME_H_ + +#include +#include +class CGameListCtrl; +class CFrame : public wxFrame +{ + public: + + CFrame(wxFrame* parent, + wxWindowID id = wxID_ANY, + const wxString& title = _T("Dolphin"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE); + + void* GetRenderHandle() {return(m_Panel->GetHandle());} + + + private: + + wxBoxSizer* sizerPanel; + CGameListCtrl* m_GameListCtrl; + wxPanel* m_Panel; + + enum EBitmaps + { + Toolbar_FileOpen, + Toolbar_Refresh, + Toolbar_Browse, + Toolbar_Play, + Toolbar_Play_Dis, + Toolbar_Stop, + Toolbar_Stop_Dis, + Toolbar_Pause, + Toolbar_PluginOptions, + Toolbar_PluginOptions_Dis, + Toolbar_PluginGFX, + Toolbar_PluginDSP, + Toolbar_PluginPAD, + Toolbar_FullScreen, + Toolbar_Help, + Bitmaps_Max + }; + + wxBitmap m_Bitmaps[Bitmaps_Max]; + wxBitmap m_BitmapsMenu[Bitmaps_Max]; + + void InitBitmaps(); + void PopulateToolbar(wxToolBar* toolBar); + void RecreateToolbar(); + void CreateMenu(); + +#ifdef _WIN32 + // Override window proc for tricks like screensaver disabling + WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); +#endif + // event handler + void OnQuit(wxCommandEvent& event); + void OnHelp(wxCommandEvent& event); + void OnRefresh(wxCommandEvent& event); + void OnConfigMain(wxCommandEvent& event); + void OnPluginGFX(wxCommandEvent& event); + void OnPluginDSP(wxCommandEvent& event); + void OnPluginPAD(wxCommandEvent& event); + void OnPluginWiimote(wxCommandEvent& event); + void OnOpen(wxCommandEvent& event); + void OnPlay(wxCommandEvent& event); + void OnStop(wxCommandEvent& event); + void OnBrowse(wxCommandEvent& event); + void OnMemcard(wxCommandEvent& event); + void OnShow_CheatsWindow(wxCommandEvent& event); + void OnToggleFullscreen(wxCommandEvent& event); + void OnToggleDualCore(wxCommandEvent& event); + void OnToggleSkipIdle(wxCommandEvent& event); + void OnToggleThrottle(wxCommandEvent& event); + void OnToggleToolbar(wxCommandEvent& event); + void OnToggleStatusbar(wxCommandEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnHostMessage(wxCommandEvent& event); + void OnLoadState(wxCommandEvent& event); + void OnSaveState(wxCommandEvent& event); + void OnClose(wxCloseEvent &event); + + wxStatusBar* m_pStatusBar; + wxMenuBar* m_pMenuBar; + + wxMenuItem* m_pMenuItemPlay; + wxMenuItem* m_pMenuItemStop; + wxMenuItem* m_pPluginOptions; + + wxMenuItem* m_pMenuItemLoad; + wxMenuItem* m_pMenuItemSave; + + wxToolBarToolBase* m_pToolPlay; + + wxBusyInfo* m_pBootProcessDialog; + + void UpdateGUI(); + + + // old function that could be cool + + DECLARE_EVENT_TABLE(); +}; + +#endif // __FRAME_H_ + diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.h b/Source/Core/DolphinWX/Src/GameListCtrl.h index a6b7835935..bc2649edb2 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.h +++ b/Source/Core/DolphinWX/Src/GameListCtrl.h @@ -1,97 +1,97 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __GAMELIST_CTRL_H_ -#define __GAMELIST_CTRL_H_ - -#include - -#include - -#include "ISOFile.h" - -class CGameListCtrl : public wxListCtrl -{ -public: - - CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); - ~CGameListCtrl(); - - void Update(); - void BrowseForDirectory(); - const GameListItem *GetSelectedISO(); - const GameListItem *GetISO(int index) const; - - enum - { - COLUMN_BANNER = 0, - COLUMN_TITLE, - COLUMN_COMPANY, - COLUMN_NOTES, - COLUMN_COUNTRY, - COLUMN_SIZE, - COLUMN_EMULATION_STATE, - NUMBER_OF_COLUMN - }; - -private: - - std::vector m_FlagImageIndex; - std::vector m_ISOFiles; - - int last_column; - int last_sort; - - void InitBitmaps(); - void InsertItemInReportView(long _Index); - void SetBackgroundColor(); - void ScanForISOs(); - - DECLARE_EVENT_TABLE() - - // events - void OnRightClick(wxMouseEvent& event); - void OnColumnClick(wxListEvent& event); - void OnColBeginDrag(wxListEvent& event); - void OnActivated(wxListEvent& event); - void OnSize(wxSizeEvent& event); - void OnProperties(wxCommandEvent& event); - void OnOpenContainingFolder(wxCommandEvent& event); - void OnSetDefaultGCM(wxCommandEvent& event); - void OnDeleteGCM(wxCommandEvent& event); - void OnCompressGCM(wxCommandEvent& event); - void OnMultiCompressGCM(wxCommandEvent& event); - void OnMultiDecompressGCM(wxCommandEvent& event); - - #ifdef _WIN32 - virtual bool MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem); - #endif - - void CompressSelection(bool _compress); - void AutomaticColumnWidth(); - void UnselectAll(); - - static size_t m_currentItem; - static std::string m_currentFilename; - static size_t m_numberItem; - static void CompressCB(const char* text, float percent, void* arg); - static void MultiCompressCB(const char* text, float percent, void* arg); -}; - - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __GAMELIST_CTRL_H_ +#define __GAMELIST_CTRL_H_ + +#include + +#include + +#include "ISOFile.h" + +class CGameListCtrl : public wxListCtrl +{ +public: + + CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); + ~CGameListCtrl(); + + void Update(); + void BrowseForDirectory(); + const GameListItem *GetSelectedISO(); + const GameListItem *GetISO(int index) const; + + enum + { + COLUMN_BANNER = 0, + COLUMN_TITLE, + COLUMN_COMPANY, + COLUMN_NOTES, + COLUMN_COUNTRY, + COLUMN_SIZE, + COLUMN_EMULATION_STATE, + NUMBER_OF_COLUMN + }; + +private: + + std::vector m_FlagImageIndex; + std::vector m_ISOFiles; + + int last_column; + int last_sort; + + void InitBitmaps(); + void InsertItemInReportView(long _Index); + void SetBackgroundColor(); + void ScanForISOs(); + + DECLARE_EVENT_TABLE() + + // events + void OnRightClick(wxMouseEvent& event); + void OnColumnClick(wxListEvent& event); + void OnColBeginDrag(wxListEvent& event); + void OnActivated(wxListEvent& event); + void OnSize(wxSizeEvent& event); + void OnProperties(wxCommandEvent& event); + void OnOpenContainingFolder(wxCommandEvent& event); + void OnSetDefaultGCM(wxCommandEvent& event); + void OnDeleteGCM(wxCommandEvent& event); + void OnCompressGCM(wxCommandEvent& event); + void OnMultiCompressGCM(wxCommandEvent& event); + void OnMultiDecompressGCM(wxCommandEvent& event); + + #ifdef _WIN32 + virtual bool MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem); + #endif + + void CompressSelection(bool _compress); + void AutomaticColumnWidth(); + void UnselectAll(); + + static size_t m_currentItem; + static std::string m_currentFilename; + static size_t m_numberItem; + static void CompressCB(const char* text, float percent, void* arg); + static void MultiCompressCB(const char* text, float percent, void* arg); +}; + + +#endif + diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index db80cf7f3b..a6a4011339 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -1,132 +1,132 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _GLOBALS_H -#define _GLOBALS_H - -#include "Common.h" -enum -{ - IDM_LOADSTATE = 200, - IDM_SAVESTATE, - IDM_SAVESLOT1, - IDM_SAVESLOT2, - IDM_SAVESLOT3, - IDM_SAVESLOT4, - IDM_SAVESLOT5, - IDM_SAVESLOT6, - IDM_SAVESLOT7, - IDM_SAVESLOT8, - IDM_SAVESLOT9, - IDM_SAVESLOT10, - IDM_LOADSLOT1, - IDM_LOADSLOT2, - IDM_LOADSLOT3, - IDM_LOADSLOT4, - IDM_LOADSLOT5, - IDM_LOADSLOT6, - IDM_LOADSLOT7, - IDM_LOADSLOT8, - IDM_LOADSLOT9, - IDM_LOADSLOT10, - IDM_PLAY, - IDM_STOP, - IDM_BROWSE, - IDM_MEMCARD, - IDM_CHEATS, - IDM_PROPERTIES, - IDM_OPENCONTAININGFOLDER, - IDM_SETDEFAULTGCM, - IDM_DELETEGCM, - IDM_COMPRESSGCM, - IDM_MULTICOMPRESSGCM, - IDM_MULTIDECOMPRESSGCM, - IDM_CONFIG_MAIN, - IDM_CONFIG_GFX_PLUGIN, - IDM_CONFIG_DSP_PLUGIN, - IDM_CONFIG_PAD_PLUGIN, - IDM_CONFIG_WIIMOTE_PLUGIN, - IDM_TOGGLE_FULLSCREEN, - IDM_TOGGLE_DUALCORE, - IDM_TOGGLE_SKIPIDLE, - IDM_TOGGLE_TOOLBAR, - IDM_TOGGLE_STATUSBAR, - IDM_NOTIFYMAPLOADED, - IDM_UPDATELOGDISPLAY, - IDM_UPDATEDISASMDIALOG, - IDM_UPDATEGUI, - IDM_UPDATESTATUSBAR, - IDM_UPDATEBREAKPOINTS, - IDM_HOST_MESSAGE, - IDM_BOOTING_STARTED, - IDM_BOOTING_ENDED, - IDM_HELPABOUT, - IDM_HELPWEBSITE, - IDM_HELPGOOGLECODE, - ID_TOOLBAR = 500, - LIST_CTRL = 1000 -}; - -#define wxUSE_XPM_IN_MSW 1 -#define USE_XPM_BITMAPS 1 - -// For compilers that support precompilation, includes . -//#include - -//#ifndef WX_PRECOMP -#if defined(HAVE_WX) && HAVE_WX -#include -//#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// define this to use XPMs everywhere (by default, BMPs are used under Win) -// BMPs use less space, but aren't compiled into the executable on other platforms - -#if USE_XPM_BITMAPS && defined (__WXMSW__) && !wxUSE_XPM_IN_MSW -#error You need to enable XPM support to use XPM bitmaps with toolbar! -#endif // USE_XPM_BITMAPS - - -// -// custom message macro -// - -#define EVT_HOST_COMMAND(id, fn) \ - DECLARE_EVENT_TABLE_ENTRY(\ - wxEVT_HOST_COMMAND, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent(wxCommandEventFunction, &fn), \ - (wxObject*) NULL \ - ), - -extern const wxEventType wxEVT_HOST_COMMAND; -#endif -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _GLOBALS_H +#define _GLOBALS_H + +#include "Common.h" +enum +{ + IDM_LOADSTATE = 200, + IDM_SAVESTATE, + IDM_SAVESLOT1, + IDM_SAVESLOT2, + IDM_SAVESLOT3, + IDM_SAVESLOT4, + IDM_SAVESLOT5, + IDM_SAVESLOT6, + IDM_SAVESLOT7, + IDM_SAVESLOT8, + IDM_SAVESLOT9, + IDM_SAVESLOT10, + IDM_LOADSLOT1, + IDM_LOADSLOT2, + IDM_LOADSLOT3, + IDM_LOADSLOT4, + IDM_LOADSLOT5, + IDM_LOADSLOT6, + IDM_LOADSLOT7, + IDM_LOADSLOT8, + IDM_LOADSLOT9, + IDM_LOADSLOT10, + IDM_PLAY, + IDM_STOP, + IDM_BROWSE, + IDM_MEMCARD, + IDM_CHEATS, + IDM_PROPERTIES, + IDM_OPENCONTAININGFOLDER, + IDM_SETDEFAULTGCM, + IDM_DELETEGCM, + IDM_COMPRESSGCM, + IDM_MULTICOMPRESSGCM, + IDM_MULTIDECOMPRESSGCM, + IDM_CONFIG_MAIN, + IDM_CONFIG_GFX_PLUGIN, + IDM_CONFIG_DSP_PLUGIN, + IDM_CONFIG_PAD_PLUGIN, + IDM_CONFIG_WIIMOTE_PLUGIN, + IDM_TOGGLE_FULLSCREEN, + IDM_TOGGLE_DUALCORE, + IDM_TOGGLE_SKIPIDLE, + IDM_TOGGLE_TOOLBAR, + IDM_TOGGLE_STATUSBAR, + IDM_NOTIFYMAPLOADED, + IDM_UPDATELOGDISPLAY, + IDM_UPDATEDISASMDIALOG, + IDM_UPDATEGUI, + IDM_UPDATESTATUSBAR, + IDM_UPDATEBREAKPOINTS, + IDM_HOST_MESSAGE, + IDM_BOOTING_STARTED, + IDM_BOOTING_ENDED, + IDM_HELPABOUT, + IDM_HELPWEBSITE, + IDM_HELPGOOGLECODE, + ID_TOOLBAR = 500, + LIST_CTRL = 1000 +}; + +#define wxUSE_XPM_IN_MSW 1 +#define USE_XPM_BITMAPS 1 + +// For compilers that support precompilation, includes . +//#include + +//#ifndef WX_PRECOMP +#if defined(HAVE_WX) && HAVE_WX +#include +//#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// define this to use XPMs everywhere (by default, BMPs are used under Win) +// BMPs use less space, but aren't compiled into the executable on other platforms + +#if USE_XPM_BITMAPS && defined (__WXMSW__) && !wxUSE_XPM_IN_MSW +#error You need to enable XPM support to use XPM bitmaps with toolbar! +#endif // USE_XPM_BITMAPS + + +// +// custom message macro +// + +#define EVT_HOST_COMMAND(id, fn) \ + DECLARE_EVENT_TABLE_ENTRY(\ + wxEVT_HOST_COMMAND, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent(wxCommandEventFunction, &fn), \ + (wxObject*) NULL \ + ), + +extern const wxEventType wxEVT_HOST_COMMAND; +#endif +#endif diff --git a/Source/Core/DolphinWX/Src/ISOFile.h b/Source/Core/DolphinWX/Src/ISOFile.h index 038ad87828..ca7f8dab7f 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.h +++ b/Source/Core/DolphinWX/Src/ISOFile.h @@ -1,74 +1,74 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __ISOFILE_H_ -#define __ISOFILE_H_ - -#include "Volume.h" - -class PointerWrap; -class GameListItem -{ -public: - GameListItem(const std::string& _rFileName); - ~GameListItem(); - - bool IsValid() const {return m_Valid;} - const std::string& GetFileName() const {return m_FileName;} - const std::string& GetName() const {return m_Name;} - const std::string& GetCompany() const {return m_Company;} - const std::string& GetDescription() const {return m_Description;} - const std::string& GetUniqueID() const {return m_UniqueID;} - DiscIO::IVolume::ECountry GetCountry() const {return m_Country;} - bool IsCompressed() const {return m_BlobCompressed;} - u64 GetFileSize() const {return m_FileSize;} - u64 GetVolumeSize() const {return m_VolumeSize;} -#if defined(HAVE_WX) && HAVE_WX - const wxImage& GetImage() const {return m_Image;} -#endif - - void DoState(PointerWrap &p); - -private: - std::string m_FileName; - std::string m_Name; - std::string m_Company; - std::string m_Description; - std::string m_UniqueID; - - u64 m_FileSize; - u64 m_VolumeSize; - - DiscIO::IVolume::ECountry m_Country; - -#if defined(HAVE_WX) && HAVE_WX - wxImage m_Image; -#endif - bool m_Valid; - bool m_BlobCompressed; - u8* m_pImage; - u32 m_ImageSize; - - bool LoadFromCache(); - void SaveToCache(); - - - std::string CreateCacheFilename(); -}; - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __ISOFILE_H_ +#define __ISOFILE_H_ + +#include "Volume.h" + +class PointerWrap; +class GameListItem +{ +public: + GameListItem(const std::string& _rFileName); + ~GameListItem(); + + bool IsValid() const {return m_Valid;} + const std::string& GetFileName() const {return m_FileName;} + const std::string& GetName() const {return m_Name;} + const std::string& GetCompany() const {return m_Company;} + const std::string& GetDescription() const {return m_Description;} + const std::string& GetUniqueID() const {return m_UniqueID;} + DiscIO::IVolume::ECountry GetCountry() const {return m_Country;} + bool IsCompressed() const {return m_BlobCompressed;} + u64 GetFileSize() const {return m_FileSize;} + u64 GetVolumeSize() const {return m_VolumeSize;} +#if defined(HAVE_WX) && HAVE_WX + const wxImage& GetImage() const {return m_Image;} +#endif + + void DoState(PointerWrap &p); + +private: + std::string m_FileName; + std::string m_Name; + std::string m_Company; + std::string m_Description; + std::string m_UniqueID; + + u64 m_FileSize; + u64 m_VolumeSize; + + DiscIO::IVolume::ECountry m_Country; + +#if defined(HAVE_WX) && HAVE_WX + wxImage m_Image; +#endif + bool m_Valid; + bool m_BlobCompressed; + u8* m_pImage; + u32 m_ImageSize; + + bool LoadFromCache(); + void SaveToCache(); + + + std::string CreateCacheFilename(); +}; + + +#endif diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 5ec026718a..ff499539c7 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -1,229 +1,229 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __ISOPROPERTIES_h__ -#define __ISOPROPERTIES_h__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Filesystem.h" -#include "IniFile.h" -#include "PatchEngine.h" - -#undef ISOPROPERTIES_STYLE -#define ISOPROPERTIES_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - -class CISOProperties : public wxDialog -{ - public: - - CISOProperties(const std::string fileName, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ISOPROPERTIES_STYLE); - virtual ~CISOProperties(); - - bool bRefreshList; - - private: - - DECLARE_EVENT_TABLE(); - - wxStaticBoxSizer *sbCoreOverrides; - wxBoxSizer *sCoreOverrides; - wxBoxSizer *sEmuState; - wxStaticBoxSizer *sbPatches; - wxBoxSizer *sPatches; - wxBoxSizer *sPatchButtons; - wxStaticBoxSizer *sbCheats; - wxBoxSizer *sCheats; - wxBoxSizer *sCheatButtons; - wxStaticBoxSizer *sbISODetails; - wxGridBagSizer *sISODetails; - wxStaticBoxSizer *sbBannerDetails; - wxGridBagSizer *sBannerDetails; - wxStaticBoxSizer *sbTreectrl; - - wxButton *m_Close; - - wxNotebook *m_Notebook; - wxPanel *m_GameConfig; - wxNotebook *m_GameConfig_Notebook; - wxPanel *m_PatchPage; - wxPanel *m_CheatPage; - wxPanel *m_Information; - wxPanel *m_Filesystem; - - wxStaticText *OverrideText; - wxCheckBox *UseDualCore; - wxCheckBox *SkipIdle; - wxCheckBox *OptimizeQuantizers; - wxCheckBox *EnableProgressiveScan, *EnableWideScreen; // Wii - - wxButton *EditConfig; - wxStaticText *EmuStateText; - wxArrayString arrayStringFor_EmuState; - wxChoice *EmuState; - wxArrayString arrayStringFor_Patches; - wxCheckListBox *Patches; - wxButton *EditPatch; - wxButton *AddPatch; - wxButton *RemovePatch; - wxArrayString arrayStringFor_Cheats; - wxCheckListBox *Cheats; - wxButton *EditCheat; - wxButton *AddCheat; - wxButton *RemoveCheat; - wxArrayString arrayStringFor_Speedhacks; - wxCheckListBox *Speedhacks; - wxButton *EditSpeedhack; - wxButton *AddSpeedhack; - wxButton *RemoveSpeedhack; - - wxStaticText *m_NameText; - wxStaticText *m_GameIDText; - wxStaticText *m_CountryText; - wxStaticText *m_MakerIDText; - wxStaticText *m_DateText; - wxStaticText *m_FSTText; - wxStaticText *m_VersionText; - wxStaticText *m_LangText; - wxStaticText *m_ShortText; - wxStaticText *m_LongText; - wxStaticText *m_MakerText; - wxStaticText *m_CommentText; - wxStaticText *m_BannerText; - wxTextCtrl *m_Name; - wxTextCtrl *m_GameID; - wxTextCtrl *m_Country; - wxTextCtrl *m_MakerID; - wxTextCtrl *m_Date; - wxTextCtrl *m_FST; - wxTextCtrl *m_Version; - wxArrayString arrayStringFor_Lang; - wxChoice *m_Lang; - wxTextCtrl *m_ShortName; - wxTextCtrl *m_LongName; - wxTextCtrl *m_Maker; - wxTextCtrl *m_Comment; - wxStaticBitmap *m_Banner; - - wxTreeCtrl *m_Treectrl; - wxTreeItemId RootId; - - enum - { - ID_CLOSE = 1000, - ID_TREECTRL, - - ID_NOTEBOOK, - ID_GAMECONFIG, - ID_GAMECONFIG_NOTEBOOK, - ID_PATCH_PAGE, - ID_ARCODE_PAGE, - ID_SPEEDHACK_PAGE, - ID_INFORMATION, - ID_FILESYSTEM, - - ID_OVERRIDE_TEXT, - ID_USEDUALCORE, - ID_IDLESKIP, - ID_ENABLEPROGRESSIVESCAN, - ID_ENABLEWIDESCREEN, - ID_OPTIMIZEQUANTIZERS, - ID_EDITCONFIG, - ID_EMUSTATE_TEXT, - ID_EMUSTATE, - ID_PATCHES_LIST, - ID_EDITPATCH, - ID_ADDPATCH, - ID_REMOVEPATCH, - ID_CHEATS_LIST, - ID_EDITCHEAT, - ID_ADDCHEAT, - ID_REMOVECHEAT, - - ID_NAME_TEXT, - ID_GAMEID_TEXT, - ID_COUNTRY_TEXT, - ID_MAKERID_TEXT, - ID_DATE_TEXT, - ID_FST_TEXT, - ID_VERSION_TEXT, - ID_LANG_TEXT, - ID_SHORTNAME_TEXT, - ID_LONGNAME_TEXT, - ID_MAKER_TEXT, - ID_COMMENT_TEXT, - ID_BANNER_TEXT, - - ID_NAME, - ID_GAMEID, - ID_COUNTRY, - ID_MAKERID, - ID_DATE, - ID_FST, - ID_VERSION, - ID_LANG, - ID_SHORTNAME, - ID_LONGNAME, - ID_MAKER, - ID_COMMENT, - ID_BANNER, - IDM_EXTRACTDIR, - IDM_EXTRACTFILE, - IDM_BNRSAVEAS - }; - - void CreateGUIControls(); - void OnClose(wxCloseEvent& event); - void OnCloseClick(wxCommandEvent& event); - void OnEditConfig(wxCommandEvent& event); - void ListSelectionChanged(wxCommandEvent& event); - void PatchButtonClicked(wxCommandEvent& event); - void ActionReplayButtonClicked(wxCommandEvent& event); - void RightClickOnBanner(wxMouseEvent& event); - void OnBannerImageSave(wxCommandEvent& event); - void OnRightClickOnTree(wxTreeEvent& event); - void OnExtractFile(wxCommandEvent& event); - void OnExtractDir(wxCommandEvent& event); - void SetRefresh(wxCommandEvent& event); - - std::vector Our_Files; - typedef std::vector::iterator fileIter; - - void CreateDirectoryTree(wxTreeItemId& parent,fileIter& begin, - fileIter& end, - fileIter& iterPos, char *directory); - - IniFile GameIni; - std::string GameIniFile; - - void LoadGameConfig(); - bool SaveGameConfig(); - void PatchList_Load(); - void PatchList_Save(); - void ActionReplayList_Load(); - void ActionReplayList_Save(); -}; -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __ISOPROPERTIES_h__ +#define __ISOPROPERTIES_h__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Filesystem.h" +#include "IniFile.h" +#include "PatchEngine.h" + +#undef ISOPROPERTIES_STYLE +#define ISOPROPERTIES_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + +class CISOProperties : public wxDialog +{ + public: + + CISOProperties(const std::string fileName, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ISOPROPERTIES_STYLE); + virtual ~CISOProperties(); + + bool bRefreshList; + + private: + + DECLARE_EVENT_TABLE(); + + wxStaticBoxSizer *sbCoreOverrides; + wxBoxSizer *sCoreOverrides; + wxBoxSizer *sEmuState; + wxStaticBoxSizer *sbPatches; + wxBoxSizer *sPatches; + wxBoxSizer *sPatchButtons; + wxStaticBoxSizer *sbCheats; + wxBoxSizer *sCheats; + wxBoxSizer *sCheatButtons; + wxStaticBoxSizer *sbISODetails; + wxGridBagSizer *sISODetails; + wxStaticBoxSizer *sbBannerDetails; + wxGridBagSizer *sBannerDetails; + wxStaticBoxSizer *sbTreectrl; + + wxButton *m_Close; + + wxNotebook *m_Notebook; + wxPanel *m_GameConfig; + wxNotebook *m_GameConfig_Notebook; + wxPanel *m_PatchPage; + wxPanel *m_CheatPage; + wxPanel *m_Information; + wxPanel *m_Filesystem; + + wxStaticText *OverrideText; + wxCheckBox *UseDualCore; + wxCheckBox *SkipIdle; + wxCheckBox *OptimizeQuantizers; + wxCheckBox *EnableProgressiveScan, *EnableWideScreen; // Wii + + wxButton *EditConfig; + wxStaticText *EmuStateText; + wxArrayString arrayStringFor_EmuState; + wxChoice *EmuState; + wxArrayString arrayStringFor_Patches; + wxCheckListBox *Patches; + wxButton *EditPatch; + wxButton *AddPatch; + wxButton *RemovePatch; + wxArrayString arrayStringFor_Cheats; + wxCheckListBox *Cheats; + wxButton *EditCheat; + wxButton *AddCheat; + wxButton *RemoveCheat; + wxArrayString arrayStringFor_Speedhacks; + wxCheckListBox *Speedhacks; + wxButton *EditSpeedhack; + wxButton *AddSpeedhack; + wxButton *RemoveSpeedhack; + + wxStaticText *m_NameText; + wxStaticText *m_GameIDText; + wxStaticText *m_CountryText; + wxStaticText *m_MakerIDText; + wxStaticText *m_DateText; + wxStaticText *m_FSTText; + wxStaticText *m_VersionText; + wxStaticText *m_LangText; + wxStaticText *m_ShortText; + wxStaticText *m_LongText; + wxStaticText *m_MakerText; + wxStaticText *m_CommentText; + wxStaticText *m_BannerText; + wxTextCtrl *m_Name; + wxTextCtrl *m_GameID; + wxTextCtrl *m_Country; + wxTextCtrl *m_MakerID; + wxTextCtrl *m_Date; + wxTextCtrl *m_FST; + wxTextCtrl *m_Version; + wxArrayString arrayStringFor_Lang; + wxChoice *m_Lang; + wxTextCtrl *m_ShortName; + wxTextCtrl *m_LongName; + wxTextCtrl *m_Maker; + wxTextCtrl *m_Comment; + wxStaticBitmap *m_Banner; + + wxTreeCtrl *m_Treectrl; + wxTreeItemId RootId; + + enum + { + ID_CLOSE = 1000, + ID_TREECTRL, + + ID_NOTEBOOK, + ID_GAMECONFIG, + ID_GAMECONFIG_NOTEBOOK, + ID_PATCH_PAGE, + ID_ARCODE_PAGE, + ID_SPEEDHACK_PAGE, + ID_INFORMATION, + ID_FILESYSTEM, + + ID_OVERRIDE_TEXT, + ID_USEDUALCORE, + ID_IDLESKIP, + ID_ENABLEPROGRESSIVESCAN, + ID_ENABLEWIDESCREEN, + ID_OPTIMIZEQUANTIZERS, + ID_EDITCONFIG, + ID_EMUSTATE_TEXT, + ID_EMUSTATE, + ID_PATCHES_LIST, + ID_EDITPATCH, + ID_ADDPATCH, + ID_REMOVEPATCH, + ID_CHEATS_LIST, + ID_EDITCHEAT, + ID_ADDCHEAT, + ID_REMOVECHEAT, + + ID_NAME_TEXT, + ID_GAMEID_TEXT, + ID_COUNTRY_TEXT, + ID_MAKERID_TEXT, + ID_DATE_TEXT, + ID_FST_TEXT, + ID_VERSION_TEXT, + ID_LANG_TEXT, + ID_SHORTNAME_TEXT, + ID_LONGNAME_TEXT, + ID_MAKER_TEXT, + ID_COMMENT_TEXT, + ID_BANNER_TEXT, + + ID_NAME, + ID_GAMEID, + ID_COUNTRY, + ID_MAKERID, + ID_DATE, + ID_FST, + ID_VERSION, + ID_LANG, + ID_SHORTNAME, + ID_LONGNAME, + ID_MAKER, + ID_COMMENT, + ID_BANNER, + IDM_EXTRACTDIR, + IDM_EXTRACTFILE, + IDM_BNRSAVEAS + }; + + void CreateGUIControls(); + void OnClose(wxCloseEvent& event); + void OnCloseClick(wxCommandEvent& event); + void OnEditConfig(wxCommandEvent& event); + void ListSelectionChanged(wxCommandEvent& event); + void PatchButtonClicked(wxCommandEvent& event); + void ActionReplayButtonClicked(wxCommandEvent& event); + void RightClickOnBanner(wxMouseEvent& event); + void OnBannerImageSave(wxCommandEvent& event); + void OnRightClickOnTree(wxTreeEvent& event); + void OnExtractFile(wxCommandEvent& event); + void OnExtractDir(wxCommandEvent& event); + void SetRefresh(wxCommandEvent& event); + + std::vector Our_Files; + typedef std::vector::iterator fileIter; + + void CreateDirectoryTree(wxTreeItemId& parent,fileIter& begin, + fileIter& end, + fileIter& iterPos, char *directory); + + IniFile GameIni; + std::string GameIniFile; + + void LoadGameConfig(); + bool SaveGameConfig(); + void PatchList_Load(); + void PatchList_Save(); + void ActionReplayList_Load(); + void ActionReplayList_Save(); +}; +#endif diff --git a/Source/Core/DolphinWX/Src/Main.h b/Source/Core/DolphinWX/Src/Main.h index 6b2659752b..fe3f4457c0 100644 --- a/Source/Core/DolphinWX/Src/Main.h +++ b/Source/Core/DolphinWX/Src/Main.h @@ -1,32 +1,32 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __MAIN_H_ -#define __MAIN_H_ - -// Define a new application -class DolphinApp - : public wxApp -{ - public: - - bool OnInit(); - void OnEndSession(); -}; - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __MAIN_H_ +#define __MAIN_H_ + +// Define a new application +class DolphinApp + : public wxApp +{ + public: + + bool OnInit(); + void OnEndSession(); +}; + + +#endif diff --git a/Source/Core/DolphinWX/Src/MemcardManager.h b/Source/Core/DolphinWX/Src/MemcardManager.h index 2b864bf5d0..163a84e5ee 100644 --- a/Source/Core/DolphinWX/Src/MemcardManager.h +++ b/Source/Core/DolphinWX/Src/MemcardManager.h @@ -1,122 +1,122 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __MEMCARD_MANAGER_h__ -#define __MEMCARD_MANAGER_h__ - -#include -#include -#include -#include -#include -#include - -#include "MemoryCards/GCMemcard.h" -#undef MEMCARD_MANAGER_STYLE -#define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER | wxMAXIMIZE_BOX -#define ITEMSPERPAGE 16 -#define MAXPAGES (128 / ITEMSPERPAGE) - 1 - -class CMemcardManager - : public wxDialog -{ - public: - - CMemcardManager(wxWindow *parent, wxWindowID id = 1, const wxString& title = wxT("Memory Card Manager WARNING-Make backups before using, should be fixed but could mangle stuff!"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MEMCARD_MANAGER_STYLE); - virtual ~CMemcardManager(); - - private: - - DECLARE_EVENT_TABLE(); - - int page0, - page1; - - wxBoxSizer *sMain; - wxBoxSizer *sPagesLeft; - wxBoxSizer *sPagesRight; - wxStaticText *t_StatusLeft; - wxStaticText *t_StatusRight; - wxButton *m_CopyToLeft; - wxButton *m_CopyToRight; - wxButton *m_FixChecksumLeft; - wxButton *m_FixChecksumRight; - wxButton *m_SaveImportLeft; - wxButton *m_SaveExportLeft; - wxButton *m_SaveImportRight; - wxButton *m_SaveExportRight; - wxButton *m_ConvertToGci; - wxButton *m_DeleteLeft; - wxButton *m_DeleteRight; - wxButton *m_Memcard1PrevPage; - wxButton *m_Memcard1NextPage; - wxButton *m_Memcard2PrevPage; - wxButton *m_Memcard2NextPage; - wxStaticBoxSizer *sMemcard1; - wxStaticBoxSizer *sMemcard2; - wxFilePickerCtrl *m_Memcard1Path; - wxFilePickerCtrl *m_Memcard2Path; - - wxListCtrl *m_MemcardList[2]; - - enum - { - ID_COPYTORIGHT = 1000, - ID_COPYTOLEFT, - ID_FIXCHECKSUMRIGHT, - ID_FIXCHECKSUMLEFT, - ID_DELETERIGHT, - ID_DELETELEFT, - ID_MEMCARD1PATH, - ID_MEMCARD2PATH, - ID_MEMCARD1NEXTPAGE, - ID_MEMCARD1PREVPAGE, - ID_MEMCARD2NEXTPAGE, - ID_MEMCARD2PREVPAGE, - ID_SAVEEXPORTRIGHT, - ID_SAVEEXPORTLEFT, - ID_SAVEIMPORTRIGHT, - ID_SAVEIMPORTLEFT, - ID_CONVERTTOGCI, - ID_MEMCARD1LIST, - ID_MEMCARD2LIST, - ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values - }; - - enum - { - COLUMN_BANNER = 0, - COLUMN_TITLE, - COLUMN_COMMENT, - COLUMN_ICON, - COLUMN_BLOCKS, - COLUMN_FIRSTBLOCK, - NUMBER_OF_COLUMN - }; - - GCMemcard *memoryCard[2]; - - void CreateGUIControls(); - void OnClose(wxCloseEvent& event); - void CopyDeleteClick(wxCommandEvent& event); - bool ReloadMemcard(const char *fileName, int card, int page); - void OnPageChange(wxCommandEvent& event); - void OnPathChange(wxFileDirPickerEvent& event); - bool ReadError(GCMemcard *memcard); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __MEMCARD_MANAGER_h__ +#define __MEMCARD_MANAGER_h__ + +#include +#include +#include +#include +#include +#include + +#include "MemoryCards/GCMemcard.h" +#undef MEMCARD_MANAGER_STYLE +#define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER | wxMAXIMIZE_BOX +#define ITEMSPERPAGE 16 +#define MAXPAGES (128 / ITEMSPERPAGE) - 1 + +class CMemcardManager + : public wxDialog +{ + public: + + CMemcardManager(wxWindow *parent, wxWindowID id = 1, const wxString& title = wxT("Memory Card Manager WARNING-Make backups before using, should be fixed but could mangle stuff!"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MEMCARD_MANAGER_STYLE); + virtual ~CMemcardManager(); + + private: + + DECLARE_EVENT_TABLE(); + + int page0, + page1; + + wxBoxSizer *sMain; + wxBoxSizer *sPagesLeft; + wxBoxSizer *sPagesRight; + wxStaticText *t_StatusLeft; + wxStaticText *t_StatusRight; + wxButton *m_CopyToLeft; + wxButton *m_CopyToRight; + wxButton *m_FixChecksumLeft; + wxButton *m_FixChecksumRight; + wxButton *m_SaveImportLeft; + wxButton *m_SaveExportLeft; + wxButton *m_SaveImportRight; + wxButton *m_SaveExportRight; + wxButton *m_ConvertToGci; + wxButton *m_DeleteLeft; + wxButton *m_DeleteRight; + wxButton *m_Memcard1PrevPage; + wxButton *m_Memcard1NextPage; + wxButton *m_Memcard2PrevPage; + wxButton *m_Memcard2NextPage; + wxStaticBoxSizer *sMemcard1; + wxStaticBoxSizer *sMemcard2; + wxFilePickerCtrl *m_Memcard1Path; + wxFilePickerCtrl *m_Memcard2Path; + + wxListCtrl *m_MemcardList[2]; + + enum + { + ID_COPYTORIGHT = 1000, + ID_COPYTOLEFT, + ID_FIXCHECKSUMRIGHT, + ID_FIXCHECKSUMLEFT, + ID_DELETERIGHT, + ID_DELETELEFT, + ID_MEMCARD1PATH, + ID_MEMCARD2PATH, + ID_MEMCARD1NEXTPAGE, + ID_MEMCARD1PREVPAGE, + ID_MEMCARD2NEXTPAGE, + ID_MEMCARD2PREVPAGE, + ID_SAVEEXPORTRIGHT, + ID_SAVEEXPORTLEFT, + ID_SAVEIMPORTRIGHT, + ID_SAVEIMPORTLEFT, + ID_CONVERTTOGCI, + ID_MEMCARD1LIST, + ID_MEMCARD2LIST, + ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values + }; + + enum + { + COLUMN_BANNER = 0, + COLUMN_TITLE, + COLUMN_COMMENT, + COLUMN_ICON, + COLUMN_BLOCKS, + COLUMN_FIRSTBLOCK, + NUMBER_OF_COLUMN + }; + + GCMemcard *memoryCard[2]; + + void CreateGUIControls(); + void OnClose(wxCloseEvent& event); + void CopyDeleteClick(wxCommandEvent& event); + bool ReloadMemcard(const char *fileName, int card, int page); + void OnPageChange(wxCommandEvent& event); + void OnPathChange(wxFileDirPickerEvent& event); + bool ReadError(GCMemcard *memcard); +}; + +#endif diff --git a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.h b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.h index c66c25dec8..61d7f06749 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.h +++ b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.h @@ -1,218 +1,218 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "Common.h" -#include "StringUtil.h" - -enum -{ - LENGTHFAIL = -4, - GCSFAIL, - SAVFAIL, - OPENFAIL, - GCI, - HDR_READ_ERROR, - DIR_READ_ERROR, - DIR_BAK_READ_ERROR, - BAT_READ_ERROR, - BAT_BAK_READ_ERROR, - HDR_CSUM_FAIL, - DIR_CSUM_FAIL, - BAT_CSUM_FAIL, - DATA_READ_FAIL, - HDR_SIZE_FFFF, - NOTRAWORGCP, - SAV = 0x80, - GCS = 0x110, - OUTOFBLOCKS, - OUTOFDIRENTRIES, - NOMEMCARD, - NOFILE, - TITLEPRESENT, - SUCCESS = 0x2000, - FAIL, - MAXBLOCK = 0x2049 -}; - -class GCMemcard -{ -private: - void* mcdFile; - - u32 mc_data_size; - u8* mc_data; - - void calc_checksumsBE(u16 *buf, u32 num, u16 *c1, u16 *c2); - -#pragma pack(push,1) - struct OSTime { - u32 low; - u32 high; - }; - - struct Header { //Offset Size Description - u8 Unk1[12]; //0x0000 12 ? - OSTime fmtTime; //0x000c 8 time of format (OSTime value) - u8 SramBias[4]; //0x0014 4 sram bias at time of format - u8 Unk2[8]; //0x0018 8 ? almost always 0 or 1 - u8 Pad1[2]; //0x0020 2 padding zeroes - u8 Size[2]; //0x0022 2 size of memcard in Mbits - u8 Encoding[2]; //0x0024 2 encoding (ASCII or japanese) - u8 Unused1[468]; //0x0026 468 unused (0xff) - u8 UpdateCounter[2];//0x01fa 2 update Counter (?, probably unused) - u8 CheckSum1[2]; //0x01fc 2 Checksum 1 (?) - u8 CheckSum2[2]; //0x01fe 2 Checksum 2 (?) - u8 Unused2[7680]; //0x0200 0x1e00 unused (0xff) - } hdr; - - struct DEntry { - u8 Gamecode[4]; //0x00 0x04 Gamecode - u8 Markercode[2]; //0x04 0x02 Makercode - u8 Unused1; //0x06 0x01 reserved/unused (always 0xff, has no effect) - u8 BIFlags; //0x07 0x01 banner gfx format and icon animation (Image Key) - // bit(s) description - // 2 Icon Animation 0: forward 1: ping-pong - // 1 [--0: No Banner 1: Banner present--] WRONG! YAGCD LIES! - // 0 [--Banner Color 0: RGB5A3 1: CI8--] WRONG! YAGCD LIES! - // bits 0 and 1: image format - // 00 no banner - // 01 CI8 banner - // 01 RGB5A3 banner - // 11 ? maybe ==01? haven't seen it - // - u8 Filename[32]; //0x08 0x20 filename - u8 ModTime[4]; //0x28 0x04 Time of file's last modification in seconds since 12am, January 1st, 2000 - u8 ImageOffset[4]; //0x2c 0x04 image data offset - u8 IconFmt[2]; //0x30 0x02 icon gfx format (2bits per icon) - // bits Description - // 00 no icon - // 01 CI8 with a shared color palette after the last frame - // 10 RGB5A3 - // 11 CI8 with a unique color palette after itself - // - u8 AnimSpeed[2]; //0x32 0x02 animation speed (2bits per icon) (*1) - // bits Description - // 00 no icon - // 01 Icon lasts for 4 frames - // 10 Icon lasts for 8 frames - // 11 Icon lasts for 12 frames - // - u8 Permissions; //0x34 0x01 file-permissions - // bit permission Description - // 4 no move File cannot be moved by the IPL - // 3 no copy File cannot be copied by the IPL - // 2 public Can be read by any game - // - u8 CopyCounter; //0x35 0x01 copy counter (*2) - u8 FirstBlock[2]; //0x36 0x02 block no of first block of file (0 == offset 0) - u8 BlockCount[2]; //0x38 0x02 file-length (number of blocks in file) - u8 Unused2[2]; //0x3a 0x02 reserved/unused (always 0xffff, has no effect) - u8 CommentsAddr[4]; //0x3c 0x04 Address of the two comments within the file data (*3) - }; - - struct Directory { - DEntry Dir[127]; //0x0000 Directory Entries (max 127) - u8 Padding[0x3a]; - u8 UpdateCounter[2];//0x1ffa 2 update Counter - u8 CheckSum1[2]; //0x1ffc 2 Checksum 1 - u8 CheckSum2[2]; //0x1ffe 2 Checksum 2 - } dir, dir_backup; - - struct BlockAlloc { - u8 CheckSum1[2]; //0x0000 2 Checksum 1 - u8 CheckSum2[2]; //0x0002 2 Checksum 2 - u8 UpdateCounter[2];//0x0004 2 update Counter - u8 FreeBlocks[2]; //0x0006 2 free Blocks - u8 LastAllocated[2];//0x0008 2 last allocated Block - u16 Map[0xFFB]; //0x000a 0x1ff8 Map of allocated Blocks - } bat,bat_backup; -#pragma pack(pop) - -public: - bool fail[12]; - - // constructor - GCMemcard(const char* fileName); - - // destructor - ~GCMemcard(); - - bool IsOpen(); - - u32 TestChecksums(); - bool FixChecksums(); - - // get number of file entries in the directory - u32 GetNumFiles(); - - // Returns true if title already on memcard - bool TitlePresent(DEntry d); - - // read directory entry - bool GetFileInfo(u32 index, DEntry& data); - - // buffer needs to be a char[32] or bigger - bool GetFileName(u32 index, char* buffer); - - // get file length in blocks - u16 GetFileSize(u32 index); - - // get first block for file - u16 GetFirstBlock(u32 index); - - // get the free blocks from bat - u16 GetFreeBlocks(void); - - // buffer needs to be a char[32] or bigger - bool GetComment1(u32 index, char* buffer); - - // buffer needs to be a char[32] or bigger - bool GetComment2(u32 index, char* buffer); - - // assumes there's enough space in buffer - // old determines if function uses old or new method of copying data - // some functions only work with old way, some only work with new way - // TODO: find a function that works for all calls or split into 2 functions - u32 GetFileData(u32 index, u8* buffer, bool old); - - // delete a file from the directory - u32 RemoveFile(u32 index); - - // adds the file to the directory and copies its contents - // if remove > 0 it will pad bat.map with 0's sifeof remove - u32 ImportFile(DEntry& direntry, u8* contents, int remove); - - // reads a save from another memcard, and imports the data into this memcard - u32 CopyFrom(GCMemcard& source, u32 index); - - // writes a .gci file to disk containing index - u32 ExportGci(u32 index, const char* fileName); - - // reads a .gci/.gcs/.sav file and calls ImportFile or saves out a gci file - s32 ImportGci(const char* fileName, std::string fileName2); - - // reads the banner image - bool ReadBannerRGBA8(u32 index, u32* buffer); - - // reads the animation frames - u32 ReadAnimRGBA8(u32 index, u32* buffer, u8 *delays); - - bool Save(); - -}; +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "Common.h" +#include "StringUtil.h" + +enum +{ + LENGTHFAIL = -4, + GCSFAIL, + SAVFAIL, + OPENFAIL, + GCI, + HDR_READ_ERROR, + DIR_READ_ERROR, + DIR_BAK_READ_ERROR, + BAT_READ_ERROR, + BAT_BAK_READ_ERROR, + HDR_CSUM_FAIL, + DIR_CSUM_FAIL, + BAT_CSUM_FAIL, + DATA_READ_FAIL, + HDR_SIZE_FFFF, + NOTRAWORGCP, + SAV = 0x80, + GCS = 0x110, + OUTOFBLOCKS, + OUTOFDIRENTRIES, + NOMEMCARD, + NOFILE, + TITLEPRESENT, + SUCCESS = 0x2000, + FAIL, + MAXBLOCK = 0x2049 +}; + +class GCMemcard +{ +private: + void* mcdFile; + + u32 mc_data_size; + u8* mc_data; + + void calc_checksumsBE(u16 *buf, u32 num, u16 *c1, u16 *c2); + +#pragma pack(push,1) + struct OSTime { + u32 low; + u32 high; + }; + + struct Header { //Offset Size Description + u8 Unk1[12]; //0x0000 12 ? + OSTime fmtTime; //0x000c 8 time of format (OSTime value) + u8 SramBias[4]; //0x0014 4 sram bias at time of format + u8 Unk2[8]; //0x0018 8 ? almost always 0 or 1 + u8 Pad1[2]; //0x0020 2 padding zeroes + u8 Size[2]; //0x0022 2 size of memcard in Mbits + u8 Encoding[2]; //0x0024 2 encoding (ASCII or japanese) + u8 Unused1[468]; //0x0026 468 unused (0xff) + u8 UpdateCounter[2];//0x01fa 2 update Counter (?, probably unused) + u8 CheckSum1[2]; //0x01fc 2 Checksum 1 (?) + u8 CheckSum2[2]; //0x01fe 2 Checksum 2 (?) + u8 Unused2[7680]; //0x0200 0x1e00 unused (0xff) + } hdr; + + struct DEntry { + u8 Gamecode[4]; //0x00 0x04 Gamecode + u8 Markercode[2]; //0x04 0x02 Makercode + u8 Unused1; //0x06 0x01 reserved/unused (always 0xff, has no effect) + u8 BIFlags; //0x07 0x01 banner gfx format and icon animation (Image Key) + // bit(s) description + // 2 Icon Animation 0: forward 1: ping-pong + // 1 [--0: No Banner 1: Banner present--] WRONG! YAGCD LIES! + // 0 [--Banner Color 0: RGB5A3 1: CI8--] WRONG! YAGCD LIES! + // bits 0 and 1: image format + // 00 no banner + // 01 CI8 banner + // 01 RGB5A3 banner + // 11 ? maybe ==01? haven't seen it + // + u8 Filename[32]; //0x08 0x20 filename + u8 ModTime[4]; //0x28 0x04 Time of file's last modification in seconds since 12am, January 1st, 2000 + u8 ImageOffset[4]; //0x2c 0x04 image data offset + u8 IconFmt[2]; //0x30 0x02 icon gfx format (2bits per icon) + // bits Description + // 00 no icon + // 01 CI8 with a shared color palette after the last frame + // 10 RGB5A3 + // 11 CI8 with a unique color palette after itself + // + u8 AnimSpeed[2]; //0x32 0x02 animation speed (2bits per icon) (*1) + // bits Description + // 00 no icon + // 01 Icon lasts for 4 frames + // 10 Icon lasts for 8 frames + // 11 Icon lasts for 12 frames + // + u8 Permissions; //0x34 0x01 file-permissions + // bit permission Description + // 4 no move File cannot be moved by the IPL + // 3 no copy File cannot be copied by the IPL + // 2 public Can be read by any game + // + u8 CopyCounter; //0x35 0x01 copy counter (*2) + u8 FirstBlock[2]; //0x36 0x02 block no of first block of file (0 == offset 0) + u8 BlockCount[2]; //0x38 0x02 file-length (number of blocks in file) + u8 Unused2[2]; //0x3a 0x02 reserved/unused (always 0xffff, has no effect) + u8 CommentsAddr[4]; //0x3c 0x04 Address of the two comments within the file data (*3) + }; + + struct Directory { + DEntry Dir[127]; //0x0000 Directory Entries (max 127) + u8 Padding[0x3a]; + u8 UpdateCounter[2];//0x1ffa 2 update Counter + u8 CheckSum1[2]; //0x1ffc 2 Checksum 1 + u8 CheckSum2[2]; //0x1ffe 2 Checksum 2 + } dir, dir_backup; + + struct BlockAlloc { + u8 CheckSum1[2]; //0x0000 2 Checksum 1 + u8 CheckSum2[2]; //0x0002 2 Checksum 2 + u8 UpdateCounter[2];//0x0004 2 update Counter + u8 FreeBlocks[2]; //0x0006 2 free Blocks + u8 LastAllocated[2];//0x0008 2 last allocated Block + u16 Map[0xFFB]; //0x000a 0x1ff8 Map of allocated Blocks + } bat,bat_backup; +#pragma pack(pop) + +public: + bool fail[12]; + + // constructor + GCMemcard(const char* fileName); + + // destructor + ~GCMemcard(); + + bool IsOpen(); + + u32 TestChecksums(); + bool FixChecksums(); + + // get number of file entries in the directory + u32 GetNumFiles(); + + // Returns true if title already on memcard + bool TitlePresent(DEntry d); + + // read directory entry + bool GetFileInfo(u32 index, DEntry& data); + + // buffer needs to be a char[32] or bigger + bool GetFileName(u32 index, char* buffer); + + // get file length in blocks + u16 GetFileSize(u32 index); + + // get first block for file + u16 GetFirstBlock(u32 index); + + // get the free blocks from bat + u16 GetFreeBlocks(void); + + // buffer needs to be a char[32] or bigger + bool GetComment1(u32 index, char* buffer); + + // buffer needs to be a char[32] or bigger + bool GetComment2(u32 index, char* buffer); + + // assumes there's enough space in buffer + // old determines if function uses old or new method of copying data + // some functions only work with old way, some only work with new way + // TODO: find a function that works for all calls or split into 2 functions + u32 GetFileData(u32 index, u8* buffer, bool old); + + // delete a file from the directory + u32 RemoveFile(u32 index); + + // adds the file to the directory and copies its contents + // if remove > 0 it will pad bat.map with 0's sifeof remove + u32 ImportFile(DEntry& direntry, u8* contents, int remove); + + // reads a save from another memcard, and imports the data into this memcard + u32 CopyFrom(GCMemcard& source, u32 index); + + // writes a .gci file to disk containing index + u32 ExportGci(u32 index, const char* fileName); + + // reads a .gci/.gcs/.sav file and calls ImportFile or saves out a gci file + s32 ImportGci(const char* fileName, std::string fileName2); + + // reads the banner image + bool ReadBannerRGBA8(u32 index, u32* buffer); + + // reads the animation frames + u32 ReadAnimRGBA8(u32 index, u32* buffer, u8 *delays); + + bool Save(); + +}; diff --git a/Source/Core/DolphinWX/Src/PatchAddEdit.h b/Source/Core/DolphinWX/Src/PatchAddEdit.h index 11a4001f50..6d4eb9c30b 100644 --- a/Source/Core/DolphinWX/Src/PatchAddEdit.h +++ b/Source/Core/DolphinWX/Src/PatchAddEdit.h @@ -1,58 +1,58 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __PATCH_ADDEDIT_h__ -#define __PATCH_ADDEDIT_h__ - -#include -#include -#include "ISOProperties.h" - -class CPatchAddEdit : public wxDialog -{ - public: - CPatchAddEdit(int _selection, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Edit Patch"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(300, -1), long style = wxDEFAULT_DIALOG_STYLE); - virtual ~CPatchAddEdit(); - - private: - DECLARE_EVENT_TABLE(); - - wxTextCtrl *EditPatchName; - wxTextCtrl *EditPatchOffset; - wxRadioBox *EditPatchType; - wxTextCtrl *EditPatchValue; - wxSpinButton *EntrySelection; - - enum { - ID_EDITPATCH_NAME_TEXT = 4500, - ID_EDITPATCH_NAME, - ID_EDITPATCH_OFFSET_TEXT, - ID_EDITPATCH_OFFSET, - ID_ENTRY_SELECT, - ID_EDITPATCH_TYPE, - ID_EDITPATCH_VALUE_TEXT, - ID_EDITPATCH_VALUE - }; - - void CreateGUIControls(int selection); - void OnClose(wxCloseEvent& event); - void ChangeEntry(wxSpinEvent& event); - - int selection; - -}; -#endif // __PATCH_ADDEDIT_h__ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __PATCH_ADDEDIT_h__ +#define __PATCH_ADDEDIT_h__ + +#include +#include +#include "ISOProperties.h" + +class CPatchAddEdit : public wxDialog +{ + public: + CPatchAddEdit(int _selection, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Edit Patch"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(300, -1), long style = wxDEFAULT_DIALOG_STYLE); + virtual ~CPatchAddEdit(); + + private: + DECLARE_EVENT_TABLE(); + + wxTextCtrl *EditPatchName; + wxTextCtrl *EditPatchOffset; + wxRadioBox *EditPatchType; + wxTextCtrl *EditPatchValue; + wxSpinButton *EntrySelection; + + enum { + ID_EDITPATCH_NAME_TEXT = 4500, + ID_EDITPATCH_NAME, + ID_EDITPATCH_OFFSET_TEXT, + ID_EDITPATCH_OFFSET, + ID_ENTRY_SELECT, + ID_EDITPATCH_TYPE, + ID_EDITPATCH_VALUE_TEXT, + ID_EDITPATCH_VALUE + }; + + void CreateGUIControls(int selection); + void OnClose(wxCloseEvent& event); + void ChangeEntry(wxSpinEvent& event); + + int selection; + +}; +#endif // __PATCH_ADDEDIT_h__ diff --git a/Source/Core/DolphinWX/Src/PluginManager.h b/Source/Core/DolphinWX/Src/PluginManager.h index 27b650d81f..cc867747d0 100644 --- a/Source/Core/DolphinWX/Src/PluginManager.h +++ b/Source/Core/DolphinWX/Src/PluginManager.h @@ -1,59 +1,59 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __PLUGIN_MANAGER_H_ -#define __PLUGIN_MANAGER_H_ - -#include "Plugin.h" - -class CPluginInfo -{ -public: - CPluginInfo(const char *_rFileName); - bool IsValid() const {return(m_Valid);} - const PLUGIN_INFO& GetPluginInfo() const {return(m_PluginInfo);} - const std::string& GetFileName() const {return(m_FileName);} - -private: - PLUGIN_INFO m_PluginInfo; - std::string m_FileName; - bool m_Valid; -}; - -typedef std::vectorCPluginInfos; - -class CPluginManager -{ -public: - static CPluginManager& GetInstance() {return(m_Instance);} - void ScanForPlugins(wxWindow* _wxWindow); - void OpenConfig(void* _Parent, const char *_rFilename); - void OpenDebug(void* _Parent, const char *_rFilename, bool Type, bool Show); - const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);} - -private: - static CPluginManager m_Instance; - bool m_Initialized; - - CPluginInfos m_PluginInfos; - - CPluginManager(); - ~CPluginManager(); -}; - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __PLUGIN_MANAGER_H_ +#define __PLUGIN_MANAGER_H_ + +#include "Plugin.h" + +class CPluginInfo +{ +public: + CPluginInfo(const char *_rFileName); + bool IsValid() const {return(m_Valid);} + const PLUGIN_INFO& GetPluginInfo() const {return(m_PluginInfo);} + const std::string& GetFileName() const {return(m_FileName);} + +private: + PLUGIN_INFO m_PluginInfo; + std::string m_FileName; + bool m_Valid; +}; + +typedef std::vectorCPluginInfos; + +class CPluginManager +{ +public: + static CPluginManager& GetInstance() {return(m_Instance);} + void ScanForPlugins(wxWindow* _wxWindow); + void OpenConfig(void* _Parent, const char *_rFilename); + void OpenDebug(void* _Parent, const char *_rFilename, bool Type, bool Show); + const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);} + +private: + static CPluginManager m_Instance; + bool m_Initialized; + + CPluginInfos m_PluginInfos; + + CPluginManager(); + ~CPluginManager(); +}; + + +#endif diff --git a/Source/Core/DolphinWX/Src/stdafx.h b/Source/Core/DolphinWX/Src/stdafx.h index 78628c0281..fd5beae06d 100644 --- a/Source/Core/DolphinWX/Src/stdafx.h +++ b/Source/Core/DolphinWX/Src/stdafx.h @@ -1,50 +1,50 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __STDAFX_H_ -#define __STDAFX_H_ - -#ifdef _WIN32 - -// Change these values to use different versions -#define WINVER 0x0400 -#define _WIN32_WINNT 0x0501 -#define _WIN32_IE 0x0500 -#define _RICHEDIT_VER 0x0100 - - -#if defined _M_IX86 - -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") - -#elif defined _M_IA64 - -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") - -#elif defined _M_X64 - -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") - -#else - -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") - -#endif - -#endif - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __STDAFX_H_ +#define __STDAFX_H_ + +#ifdef _WIN32 + +// Change these values to use different versions +#define WINVER 0x0400 +#define _WIN32_WINNT 0x0501 +#define _WIN32_IE 0x0500 +#define _RICHEDIT_VER 0x0100 + + +#if defined _M_IX86 + +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") + +#elif defined _M_IA64 + +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") + +#elif defined _M_X64 + +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") + +#else + +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") + +#endif + +#endif + +#endif diff --git a/Source/Core/DolphinWX/resource.h b/Source/Core/DolphinWX/resource.h index c43f12c2f2..2032a4efd9 100644 --- a/Source/Core/DolphinWX/resource.h +++ b/Source/Core/DolphinWX/resource.h @@ -1,16 +1,16 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by DolphinWX.rc -// -#define IDI_ICON1 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by DolphinWX.rc +// +#define IDI_ICON1 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Source/Core/VideoCommon/Src/BPMemory.h b/Source/Core/VideoCommon/Src/BPMemory.h index 06c48d9351..de2e68ef88 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.h +++ b/Source/Core/VideoCommon/Src/BPMemory.h @@ -1,840 +1,840 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BPMEMORY_H -#define _BPMEMORY_H - -#include "Common.h" - -#pragma pack(4) - -#define BPMEM_GENMODE 0x00 -#define BPMEM_IND_MTX 0x06 -#define BPMEM_RAS1_SS0 0x25 // ind tex coord scale 0 -#define BPMEM_RAS1_SS1 0x26 // ind tex coord scale 1 -#define BPMEM_ZMODE 0x40 -#define BPMEM_BLENDMODE 0x41 -#define BPMEM_CONSTANTALPHA 0x42 -#define BPMEM_ALPHACOMPARE 0xF3 -#define BPMEM_LINEPTWIDTH 0x22 -#define BPMEM_TEXINVALIDATE 0x66 -#define BPMEM_SCISSORTL 0x20 -#define BPMEM_SCISSORBR 0x21 -#define BPMEM_SCISSOROFFSET 0x59 -#define BPMEM_CLEARBBOX1 0x55 // let's hope not many games use bboxes.. -#define BPMEM_CLEARBBOX2 0x56 // TODO(ector): add something that watches bboxes -#define BPMEM_TEXMODE0_1 0x80 -#define BPMEM_TEXMODE0_2 0xA0 -#define BPMEM_FOGRANGE 0xE8 -#define BPMEM_FOGPARAM0 0xEE -#define BPMEM_FOGBMAGNITUDE 0xEF -#define BPMEM_FOGBEXPONENT 0xF0 -#define BPMEM_FOGPARAM3 0xF1 -#define BPMEM_FOGCOLOR 0xF2 -#define BPMEM_ZTEX1 0xF4 -#define BPMEM_ZTEX2 0xF5 -#define BPMEM_DRAWDONE 0x45 - -#define BPMEM_PE_TOKEN_ID 0x47 -#define BPMEM_PE_TOKEN_INT_ID 0x48 - -////////////////////////////////////////////////////////////////////////// -// Tev/combiner things -////////////////////////////////////////////////////////////////////////// - -#define TEVOP_ADD 0 -#define TEVOP_SUB 1 -#define TEVCMP_R8_GT 8 -#define TEVCMP_R8_EQ 9 -#define TEVCMP_GR16_GT 10 -#define TEVCMP_GR16_EQ 11 -#define TEVCMP_BGR24_GT 12 -#define TEVCMP_BGR24_EQ 13 -#define TEVCMP_RGB8_GT 14 -#define TEVCMP_RGB8_EQ 15 -#define TEVCMP_A8_GT 14 -#define TEVCMP_A8_EQ 15 - -#define TEVCOLORARG_CPREV 0 -#define TEVCOLORARG_APREV 1 -#define TEVCOLORARG_C0 2 -#define TEVCOLORARG_A0 3 -#define TEVCOLORARG_C1 4 -#define TEVCOLORARG_A1 5 -#define TEVCOLORARG_C2 6 -#define TEVCOLORARG_A2 7 -#define TEVCOLORARG_TEXC 8 -#define TEVCOLORARG_TEXA 9 -#define TEVCOLORARG_RASC 10 -#define TEVCOLORARG_RASA 11 -#define TEVCOLORARG_ONE 12 -#define TEVCOLORARG_HALF 13 -#define TEVCOLORARG_KONST 14 -#define TEVCOLORARG_ZERO 15 - -#define TEVALPHAARG_APREV 0 -#define TEVALPHAARG_A0 1 -#define TEVALPHAARG_A1 2 -#define TEVALPHAARG_A2 3 -#define TEVALPHAARG_TEXA 4 -#define TEVALPHAARG_RASA 5 -#define TEVALPHAARG_KONST 6 -#define TEVALPHAARG_ZERO 7 - -#define ALPHACMP_NEVER 0 -#define ALPHACMP_LESS 1 -#define ALPHACMP_EQUAL 2 -#define ALPHACMP_LEQUAL 3 -#define ALPHACMP_GREATER 4 -#define ALPHACMP_NEQUAL 5 -#define ALPHACMP_GEQUAL 6 -#define ALPHACMP_ALWAYS 7 - -enum Compare -{ - COMPARE_NEVER = 0, - COMPARE_LESS, - COMPARE_EQUAL, - COMPARE_LEQUAL, - COMPARE_GREATER, - COMPARE_NEQUAL, - COMPARE_GEQUAL, - COMPARE_ALWAYS -}; - -#define ZTEXTURE_DISABLE 0 -#define ZTEXTURE_ADD 1 -#define ZTEXTURE_REPLACE 2 - -enum TevBias -{ - TB_ZERO = 0, - TB_ADDHALF = 1, - TB_SUBHALF = 2, - TB_COMPARE = 3, -}; - -enum AlphaOp -{ - ALPHAOP_AND = 0, - ALPHAOP_OR, - ALPHAOP_XOR, - ALPHAOP_XNOR, -}; - -union IND_MTXA -{ - struct - { - signed ma : 11; - signed mb : 11; - unsigned s0 : 2; // bits 0-1 of scale factor - unsigned rid : 8; - }; - u32 hex; -}; - -union IND_MTXB -{ - struct - { - signed mc : 11; - signed md : 11; - unsigned s1 : 2; // bits 2-3 of scale factor - unsigned rid : 8; - }; - u32 hex; -}; - -union IND_MTXC -{ - struct - { - signed me : 11; - signed mf : 11; - unsigned s2 : 2; // bits 4-5 of scale factor - unsigned rid : 8; - }; - u32 hex; -}; - -struct IND_MTX -{ - IND_MTXA col0; - IND_MTXB col1; - IND_MTXC col2; -}; - -union IND_IMASK -{ - struct - { - unsigned mask : 24; - unsigned rid : 8; - }; - u32 hex; -}; - -#define TEVSELCC_CPREV 0 -#define TEVSELCC_APREV 1 -#define TEVSELCC_C0 2 -#define TEVSELCC_A0 3 -#define TEVSELCC_C1 4 -#define TEVSELCC_A1 5 -#define TEVSELCC_C2 6 -#define TEVSELCC_A2 7 -#define TEVSELCC_TEXC 8 -#define TEVSELCC_TEXA 9 -#define TEVSELCC_RASC 10 -#define TEVSELCC_RASA 11 -#define TEVSELCC_ONE 12 -#define TEVSELCC_HALF 13 -#define TEVSELCC_KONST 14 -#define TEVSELCC_ZERO 15 - -#define TEVSELCA_APREV 0 -#define TEVSELCA_A0 1 -#define TEVSELCA_A1 2 -#define TEVSELCA_A2 3 -#define TEVSELCA_TEXA 4 -#define TEVSELCA_RASA 5 -#define TEVSELCA_KONST 6 -#define TEVSELCA_ZERO 7 - -struct TevStageCombiner -{ - union ColorCombiner - { - struct //abc=8bit,d=10bit - { - unsigned d : 4; // TEVSELCC_X - unsigned c : 4; // TEVSELCC_X - unsigned b : 4; // TEVSELCC_X - unsigned a : 4; // TEVSELCC_X - - unsigned bias : 2; - unsigned op : 1; - unsigned clamp : 1; - - unsigned shift : 2; - unsigned dest : 2; //1,2,3 - - }; - u32 hex; - }; - union AlphaCombiner - { - struct - { - unsigned rswap : 2; - unsigned tswap : 2; - unsigned d : 3; // TEVSELCA_ - unsigned c : 3; // TEVSELCA_ - unsigned b : 3; // TEVSELCA_ - unsigned a : 3; // TEVSELCA_ - - unsigned bias : 2; //GXTevBias - unsigned op : 1; - unsigned clamp : 1; - - unsigned shift : 2; - unsigned dest : 2; //1,2,3 - }; - u32 hex; - }; - - ColorCombiner colorC; - AlphaCombiner alphaC; -}; - -#define ITF_8 0 -#define ITF_5 1 -#define ITF_4 2 -#define ITF_3 3 - -#define ITB_NONE 0 -#define ITB_S 1 -#define ITB_T 2 -#define ITB_ST 3 -#define ITB_U 4 -#define ITB_SU 5 -#define ITB_TU 6 -#define ITB_STU 7 - -#define ITBA_OFF 0 -#define ITBA_S 1 -#define ITBA_T 2 -#define ITBA_U 3 - -#define ITW_OFF 0 -#define ITW_256 1 -#define ITW_128 2 -#define ITW_64 3 -#define ITW_32 4 -#define ITW_16 5 -#define ITW_0 6 - -// several discoveries: -// GXSetTevIndBumpST(tevstage, indstage, matrixind) -// if( matrix == 2 ) realmat = 6; // 10 -// else if( matrix == 3 ) realmat = 7; // 11 -// else if( matrix == 1 ) realmat = 5; // 9 -// GXSetTevIndirect(tevstage, indstage, 0, 3, realmat, 6, 6, 0, 0, 0) -// GXSetTevIndirect(tevstage+1, indstage, 0, 3, realmat+4, 6, 6, 1, 0, 0) -// GXSetTevIndirect(tevstage+2, indstage, 0, 0, 0, 0, 0, 1, 0, 0) - -union TevStageIndirect -{ - // if mid, sw, tw, and addprev are 0, then no indirect stage is used, mask = 0x17fe00 - struct - { - unsigned bt : 2; // indirect tex stage ID - unsigned fmt : 2; // format: ITF_X - unsigned bias : 3; // ITB_X - unsigned bs : 2; // ITBA_X, indicates which coordinate will become the 'bump alpha' - unsigned mid : 4; // matrix id to multiply offsets with - unsigned sw : 3; // ITW_X, wrapping factor for S of regular coord - unsigned tw : 3; // ITW_X, wrapping factor for T of regular coord - unsigned lb_utclod : 1; // use modified or unmodified texture coordinates for LOD computation - unsigned fb_addprev : 1; // 1 if the texture coordinate results from the previous TEV stage should be added - unsigned pad0 : 3; - unsigned rid : 8; - }; - struct - { - u32 hex : 21; - u32 unused : 11; - }; - - bool IsActive() { return (hex&0x17fe00)!=0; } -}; - -union TwoTevStageOrders -{ - struct - { - unsigned texmap0 : 3; // indirect tex stage texmap - unsigned texcoord0 : 3; - unsigned enable0 : 1; // 1 if should read from texture - unsigned colorchan0 : 3; // RAS1_CC_X - - unsigned pad0 : 2; - - unsigned texmap1 : 3; - unsigned texcoord1 : 3; - unsigned enable1 : 1; // 1 if should read from texture - unsigned colorchan1 : 3; // RAS1_CC_X - - unsigned pad1 : 2; - unsigned rid : 8; - }; - u32 hex; - int getTexMap(int i){return i?texmap1:texmap0;} - int getTexCoord(int i){return i?texcoord1:texcoord0;} - int getEnable(int i){return i?enable1:enable0;} - int getColorChan(int i){return i?colorchan1:colorchan0;} -}; - -union TEXSCALE -{ - struct - { - unsigned ss0 : 4; // indirect tex stage 0, 2^(-ss0) - unsigned ts0 : 4; // indirect tex stage 0 - unsigned ss1 : 4; // indirect tex stage 1 - unsigned ts1 : 4; // indirect tex stage 1 - unsigned pad : 8; - unsigned rid : 8; - }; - u32 hex; - - float getScaleS(int i){return 1.0f/(float)(1<<(i?ss1:ss0));} - float getScaleT(int i){return 1.0f/(float)(1<<(i?ts1:ts0));} -}; - -union RAS1_IREF -{ - struct - { - unsigned bi0 : 3; // indirect tex stage 0 ntexmap - unsigned bc0 : 3; // indirect tex stage 0 ntexcoord - unsigned bi1 : 3; - unsigned bc1 : 3; - unsigned bi2 : 3; - unsigned bc3 : 3; - unsigned bi4 : 3; - unsigned bc4 : 3; - unsigned rid : 8; - }; - u32 hex; - - u32 getTexCoord(int i) { return (hex>>(6*i+3))&3; } - u32 getTexMap(int i) { return (hex>>(6*i))&3; } -}; - -////////////////////////////////////////////////////////////////////////// -// Texture structs -////////////////////////////////////////////////////////////////////////// -union TexMode0 -{ - struct - { - unsigned wrap_s : 2; - unsigned wrap_t : 2; - unsigned mag_filter : 1; - unsigned min_filter : 3; - unsigned diag_lod : 1; - signed lod_bias : 10; - unsigned max_aniso : 2; - unsigned lod_clamp : 1; - }; - u32 hex; -}; -union TexMode1 -{ - struct - { - unsigned min_lod : 8; - unsigned max_lod : 8; - }; - u32 hex; -}; -union TexImage0 -{ - struct - { - unsigned width : 10; //actually w-1 - unsigned height : 10; //actually h-1 - unsigned format : 4; - }; - u32 hex; -}; -union TexImage1 -{ - struct - { - unsigned tmem_offset : 15; // we ignore texture caching for now, we do it ourselves - unsigned cache_width : 3; - unsigned cache_height : 3; - unsigned image_type : 1; - }; - u32 hex; -}; - -union TexImage2 -{ - struct - { - unsigned tmem_offset : 15; // we ignore texture caching for now, we do it ourselves - unsigned cache_width : 3; - unsigned cache_height : 3; - }; - u32 hex; -}; - -union TexImage3 -{ - struct - { - unsigned image_base: 24; //address in memory >> 5 (was 20 for GC) - }; - u32 hex; -}; -union TexTLUT -{ - struct - { - unsigned tmem_offset : 10; - unsigned tlut_format : 2; - }; - u32 hex; -}; - -union ZTex1 -{ - struct - { - unsigned bias : 24; - }; - u32 hex; -}; - -union ZTex2 -{ - struct - { - unsigned type : 2; // TEV_Z_TYPE_X - unsigned op : 2; // GXZTexOp - }; - u32 hex; -}; - -// Z-texture types (formats) -#define TEV_ZTEX_TYPE_U8 0 -#define TEV_ZTEX_TYPE_U16 1 -#define TEV_ZTEX_TYPE_U24 2 - -#define TEV_ZTEX_DISABLE 0 -#define TEV_ZTEX_ADD 1 -#define TEV_ZTEX_REPLACE 2 - - -struct FourTexUnits -{ - TexMode0 texMode0[4]; - TexMode1 texMode1[4]; - TexImage0 texImage0[4]; - TexImage1 texImage1[4]; - TexImage2 texImage2[4]; - TexImage3 texImage3[4]; - TexTLUT texTlut[4]; - u32 unknown[4]; -}; - - -////////////////////////////////////////////////////////////////////////// -// Geometry/other structs -////////////////////////////////////////////////////////////////////////// -union GenMode -{ - struct - { - unsigned numtexgens : 4; // 0xF - unsigned numcolchans : 5; // 0x1E0 - unsigned ms_en : 1; // 0x200 - unsigned numtevstages : 4; // 0x3C00 - unsigned cullmode : 2; // 0xC000 - unsigned numindstages : 3; // 0x30000 - unsigned zfreeze : 5; //0x3C0000 - }; - u32 hex; -}; - -union LPSize -{ - struct - { - unsigned linesize : 8; // in 1/6th pixels - unsigned pointsize : 8; // in 1/6th pixels - unsigned lineoff : 3; - unsigned pointoff : 3; - unsigned lineaspect : 1; - unsigned padding : 1; - }; - u32 hex; -}; - - -union X12Y12 -{ - struct - { - unsigned y : 12; - unsigned x : 12; - }; - u32 hex; -}; -union X10Y10 -{ - struct - { - unsigned x : 10; - unsigned y : 10; - }; - u32 hex; -}; - -////////////////////////////////////////////////////////////////////////// -// Framebuffer/pixel stuff (incl fog) -////////////////////////////////////////////////////////////////////////// -union BlendMode -{ - struct - { - unsigned blendenable : 1; - unsigned logicopenable : 1; - unsigned dither : 1; - unsigned colorupdate : 1; - unsigned alphaupdate : 1; - unsigned dstfactor : 3; //BLEND_ONE, BLEND_INV_SRc etc - unsigned srcfactor : 3; - unsigned subtract : 1; - unsigned logicmode : 4; - }; - u32 hex; -}; - - -union FogParam0 -{ - struct - { - unsigned mantissa : 11; - unsigned exponent : 8; - unsigned sign : 1; - }; - - float GetA() { - union { u32 i; float f; } dummy; - dummy.i = ((u32)sign<<31)|((u32)exponent<<23)|((u32)mantissa<<12); - return dummy.f; - } - - u32 hex; -}; - -union FogParam3 -{ - struct - { - unsigned c_mant : 11; - unsigned c_exp : 8; - unsigned c_sign : 1; - unsigned proj : 1; // 0 - perspective, 1 - orthographic - unsigned fsel : 3; // 0 - off, 2 - linear, 4 - exp, 5 - exp2, 6 - backward exp, 7 - backward exp2 - }; - - // amount to subtract from eyespacez after range adjustment - float GetC() { - union { u32 i; float f; } dummy; - dummy.i = ((u32)c_sign << 31) | ((u32)c_exp << 23) | ((u32)c_mant << 12); - return dummy.f; - } - - u32 hex; -}; - -// final eq: ze = A/(B_MAG - (Zs>>B_SHF)); -struct FogParams -{ - FogParam0 a; - u32 b_magnitude; - u32 b_shift; // b's exp + 1? - FogParam3 c_proj_fsel; - u32 color; //0:b 8:g 16:r - nice! -}; - -union ZMode -{ - struct - { - unsigned testenable : 1; - unsigned func : 3; - unsigned updateenable : 1; //size? - }; - u32 hex; -}; - -union ConstantAlpha -{ - struct - { - unsigned alpha : 8; - unsigned enable : 1; - }; - u32 hex; -}; - -#define PIXELFMT_RGB8_Z24 0 -#define PIXELFMT_RGBA6_Z24 1 -#define PIXELFMT_RGB565_Z16 2 -#define PIXELFMT_Z24 3 -#define PIXELFMT_Y8 4 -#define PIXELFMT_U8 5 -#define PIXELFMT_V8 6 -#define PIXELFMT_YUV420 7 - -union PE_CONTROL -{ - struct - { - unsigned pixel_format : 3; // PIXELFMT_X - unsigned zformat : 3; // 0 - linear, 1 - near, 2 - mid, 3 - far - unsigned zcomploc : 1; // 1: before tex stage - unsigned unused : 17; - unsigned rid : 8; - }; - u32 hex; -}; - -////////////////////////////////////////////////////////////////////////// -// Texture coordinate stuff -////////////////////////////////////////////////////////////////////////// -union TCInfo -{ - struct - { - unsigned scale_minus_1 : 16; - unsigned range_bias : 1; - unsigned cylindric_wrap : 1; - }; - u32 hex; -}; -struct TCoordInfo -{ - TCInfo s; - TCInfo t; -}; - - -union ColReg -{ - u32 hex; - struct - { - signed a : 11; - unsigned : 1; - signed b : 11; - unsigned type : 1; - }; -}; - -struct TevReg -{ - ColReg low; - ColReg high; -}; - -union TevKSel -{ - struct { - unsigned swap1 : 2; - unsigned swap2 : 2; - unsigned kcsel0 : 5; - unsigned kasel0 : 5; - unsigned kcsel1 : 5; - unsigned kasel1 : 5; - }; - u32 hex; - - int getKC(int i) {return i?kcsel1:kcsel0;} - int getKA(int i) {return i?kasel1:kasel0;} -}; - -union AlphaFunc -{ - struct - { - unsigned ref0 : 8; - unsigned ref1 : 8; - unsigned comp0 : 3; - unsigned comp1 : 3; - unsigned logic : 2; - }; - u32 hex; -}; - -union UPE_Copy -{ - u32 Hex; - struct - { - unsigned clamp0 : 1; - unsigned clamp1 : 1; - unsigned : 1; - unsigned target_pixel_format : 4; // realformat is (fmt/2)+((fmt&1)*8).... for some reason the msb is the lsb - unsigned gamma : 2; - unsigned half_scale : 1; // real size should be 2x smaller (run a gauss filter?) - unsigned scale_something : 1; - unsigned clear : 1; - unsigned frame_to_field : 2; - unsigned copy_to_xfb : 1; - unsigned intensity_fmt : 1; // if set, is an intensity format (I4,I8,IA4,IA8) - unsigned : 16; // seems to set everything to 1s when target pixel format is invalid - }; -}; - -////////////////////////////////////////////////////////////////////////// -// All of BP memory -////////////////////////////////////////////////////////////////////////// - -struct BPMemory -{ - GenMode genMode; - u32 display_copy_filter[4]; //01-04 - u32 unknown; //05 - // indirect matrices (set by GXSetIndTexMtx, selected by TevStageIndirect::mid) - // abc form a 2x3 offset matrix, there's 3 such matrices - // the 3 offset matrices can either be indirect type, S-type, or T-type - // 6bit scale factor s is distributed across IND_MTXA/B/C. - // before using matrices scale by 2^-(s-17) - IND_MTX indmtx[3];//06-0e GXSetIndTexMtx, 2x3 matrices - IND_IMASK imask;//0f - TevStageIndirect tevind[16];//10 GXSetTevIndirect - X12Y12 scissorTL; //20 - X12Y12 scissorBR; //21 - LPSize lineptwidth; //22 line and point width - u32 sucounter; //23 - u32 rascounter; //24 - TEXSCALE texscale[2]; //25-26 GXSetIndTexCoordScale - RAS1_IREF tevindref; //27 GXSetIndTexOrder - TwoTevStageOrders tevorders[8]; //28-2F - TCoordInfo texcoords[8]; //0x30 s,t,s,t,s,t,s,t... - ZMode zmode; //40 - BlendMode blendmode; //41 - ConstantAlpha dstalpha; //42 - PE_CONTROL zcontrol; //43 GXSetZCompLoc, GXPixModeSync - u32 fieldmask; //44 - u32 drawdone; //45, bit1=1 if end of list - u32 unknown5; //46 clock? - u32 petoken; //47 - u32 petokenint; //48 - X10Y10 copyTexSrcXY; //49 - X10Y10 copyTexSrcWH; //4a - u32 copyTexDest; //4b// 4b == CopyAddress (GXDispCopy and GXTexCopy use it) - u32 unknown6; //4c - u32 copyMipMapStrideChannels; // 4d usually set to 4 when dest is single channel, 8 when dest is 2 channel, 16 when dest is RGBA - // also, doubles whenever mipmap box filter option is set (excent on RGBA). Probably to do with number of bytes to look at when smoothing - u32 dispcopyyscale; //4e - u32 clearcolorAR; //4f - u32 clearcolorGB; //50 - u32 clearZValue; //51 - u32 triggerEFBCopy; //52 - u32 copyfilter[2]; //53,54 - u32 boundbox0;//55 - u32 boundbox1;//56 - u32 unknown7[2];//57,58 - X10Y10 scissorOffset; //59 - u32 unknown8[10]; //5a,5b,5c,5d, 5e,5f,60,61, 62, 63 (GXTexModeSync), 0x60-0x63 have to do with preloaded textures? - u32 tlutXferSrc; //64 - u32 tlutXferDest; //65 - u32 texinvalidate;//66 - u32 metric; //67 - u32 fieldmode;//68 - u32 unknown10[7];//69-6F - u32 unknown11[16];//70-7F - FourTexUnits tex[2]; //80-bf - TevStageCombiner combiners[16]; //0xC0-0xDF - TevReg tevregs[4]; //0xE0 - u32 fogRangeAdj; //0xE8 - u32 unknown15[3]; //0xe9,0xea,0xeb - fog related - u32 tev_range_adj_c; //0xec - screenx center for range adjustment, range adjustment enable - u32 tev_range_adj_k; //0xed - specifies range adjustment function = sqrt(x*x+k*k)/k - FogParams fog; //0xEE,0xEF,0xF0,0xF1,0xF2 - AlphaFunc alphaFunc; //0xF3 - ZTex1 ztex1; //0xf4,0xf5 - ZTex2 ztex2; - TevKSel tevksel[8];//0xf6,0xf7,f8,f9,fa,fb,fc,fd - u32 bpMask; //0xFE - u32 unknown18; //ff -}; - -#pragma pack() - -extern BPMemory bpmem; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BPMEMORY_H +#define _BPMEMORY_H + +#include "Common.h" + +#pragma pack(4) + +#define BPMEM_GENMODE 0x00 +#define BPMEM_IND_MTX 0x06 +#define BPMEM_RAS1_SS0 0x25 // ind tex coord scale 0 +#define BPMEM_RAS1_SS1 0x26 // ind tex coord scale 1 +#define BPMEM_ZMODE 0x40 +#define BPMEM_BLENDMODE 0x41 +#define BPMEM_CONSTANTALPHA 0x42 +#define BPMEM_ALPHACOMPARE 0xF3 +#define BPMEM_LINEPTWIDTH 0x22 +#define BPMEM_TEXINVALIDATE 0x66 +#define BPMEM_SCISSORTL 0x20 +#define BPMEM_SCISSORBR 0x21 +#define BPMEM_SCISSOROFFSET 0x59 +#define BPMEM_CLEARBBOX1 0x55 // let's hope not many games use bboxes.. +#define BPMEM_CLEARBBOX2 0x56 // TODO(ector): add something that watches bboxes +#define BPMEM_TEXMODE0_1 0x80 +#define BPMEM_TEXMODE0_2 0xA0 +#define BPMEM_FOGRANGE 0xE8 +#define BPMEM_FOGPARAM0 0xEE +#define BPMEM_FOGBMAGNITUDE 0xEF +#define BPMEM_FOGBEXPONENT 0xF0 +#define BPMEM_FOGPARAM3 0xF1 +#define BPMEM_FOGCOLOR 0xF2 +#define BPMEM_ZTEX1 0xF4 +#define BPMEM_ZTEX2 0xF5 +#define BPMEM_DRAWDONE 0x45 + +#define BPMEM_PE_TOKEN_ID 0x47 +#define BPMEM_PE_TOKEN_INT_ID 0x48 + +////////////////////////////////////////////////////////////////////////// +// Tev/combiner things +////////////////////////////////////////////////////////////////////////// + +#define TEVOP_ADD 0 +#define TEVOP_SUB 1 +#define TEVCMP_R8_GT 8 +#define TEVCMP_R8_EQ 9 +#define TEVCMP_GR16_GT 10 +#define TEVCMP_GR16_EQ 11 +#define TEVCMP_BGR24_GT 12 +#define TEVCMP_BGR24_EQ 13 +#define TEVCMP_RGB8_GT 14 +#define TEVCMP_RGB8_EQ 15 +#define TEVCMP_A8_GT 14 +#define TEVCMP_A8_EQ 15 + +#define TEVCOLORARG_CPREV 0 +#define TEVCOLORARG_APREV 1 +#define TEVCOLORARG_C0 2 +#define TEVCOLORARG_A0 3 +#define TEVCOLORARG_C1 4 +#define TEVCOLORARG_A1 5 +#define TEVCOLORARG_C2 6 +#define TEVCOLORARG_A2 7 +#define TEVCOLORARG_TEXC 8 +#define TEVCOLORARG_TEXA 9 +#define TEVCOLORARG_RASC 10 +#define TEVCOLORARG_RASA 11 +#define TEVCOLORARG_ONE 12 +#define TEVCOLORARG_HALF 13 +#define TEVCOLORARG_KONST 14 +#define TEVCOLORARG_ZERO 15 + +#define TEVALPHAARG_APREV 0 +#define TEVALPHAARG_A0 1 +#define TEVALPHAARG_A1 2 +#define TEVALPHAARG_A2 3 +#define TEVALPHAARG_TEXA 4 +#define TEVALPHAARG_RASA 5 +#define TEVALPHAARG_KONST 6 +#define TEVALPHAARG_ZERO 7 + +#define ALPHACMP_NEVER 0 +#define ALPHACMP_LESS 1 +#define ALPHACMP_EQUAL 2 +#define ALPHACMP_LEQUAL 3 +#define ALPHACMP_GREATER 4 +#define ALPHACMP_NEQUAL 5 +#define ALPHACMP_GEQUAL 6 +#define ALPHACMP_ALWAYS 7 + +enum Compare +{ + COMPARE_NEVER = 0, + COMPARE_LESS, + COMPARE_EQUAL, + COMPARE_LEQUAL, + COMPARE_GREATER, + COMPARE_NEQUAL, + COMPARE_GEQUAL, + COMPARE_ALWAYS +}; + +#define ZTEXTURE_DISABLE 0 +#define ZTEXTURE_ADD 1 +#define ZTEXTURE_REPLACE 2 + +enum TevBias +{ + TB_ZERO = 0, + TB_ADDHALF = 1, + TB_SUBHALF = 2, + TB_COMPARE = 3, +}; + +enum AlphaOp +{ + ALPHAOP_AND = 0, + ALPHAOP_OR, + ALPHAOP_XOR, + ALPHAOP_XNOR, +}; + +union IND_MTXA +{ + struct + { + signed ma : 11; + signed mb : 11; + unsigned s0 : 2; // bits 0-1 of scale factor + unsigned rid : 8; + }; + u32 hex; +}; + +union IND_MTXB +{ + struct + { + signed mc : 11; + signed md : 11; + unsigned s1 : 2; // bits 2-3 of scale factor + unsigned rid : 8; + }; + u32 hex; +}; + +union IND_MTXC +{ + struct + { + signed me : 11; + signed mf : 11; + unsigned s2 : 2; // bits 4-5 of scale factor + unsigned rid : 8; + }; + u32 hex; +}; + +struct IND_MTX +{ + IND_MTXA col0; + IND_MTXB col1; + IND_MTXC col2; +}; + +union IND_IMASK +{ + struct + { + unsigned mask : 24; + unsigned rid : 8; + }; + u32 hex; +}; + +#define TEVSELCC_CPREV 0 +#define TEVSELCC_APREV 1 +#define TEVSELCC_C0 2 +#define TEVSELCC_A0 3 +#define TEVSELCC_C1 4 +#define TEVSELCC_A1 5 +#define TEVSELCC_C2 6 +#define TEVSELCC_A2 7 +#define TEVSELCC_TEXC 8 +#define TEVSELCC_TEXA 9 +#define TEVSELCC_RASC 10 +#define TEVSELCC_RASA 11 +#define TEVSELCC_ONE 12 +#define TEVSELCC_HALF 13 +#define TEVSELCC_KONST 14 +#define TEVSELCC_ZERO 15 + +#define TEVSELCA_APREV 0 +#define TEVSELCA_A0 1 +#define TEVSELCA_A1 2 +#define TEVSELCA_A2 3 +#define TEVSELCA_TEXA 4 +#define TEVSELCA_RASA 5 +#define TEVSELCA_KONST 6 +#define TEVSELCA_ZERO 7 + +struct TevStageCombiner +{ + union ColorCombiner + { + struct //abc=8bit,d=10bit + { + unsigned d : 4; // TEVSELCC_X + unsigned c : 4; // TEVSELCC_X + unsigned b : 4; // TEVSELCC_X + unsigned a : 4; // TEVSELCC_X + + unsigned bias : 2; + unsigned op : 1; + unsigned clamp : 1; + + unsigned shift : 2; + unsigned dest : 2; //1,2,3 + + }; + u32 hex; + }; + union AlphaCombiner + { + struct + { + unsigned rswap : 2; + unsigned tswap : 2; + unsigned d : 3; // TEVSELCA_ + unsigned c : 3; // TEVSELCA_ + unsigned b : 3; // TEVSELCA_ + unsigned a : 3; // TEVSELCA_ + + unsigned bias : 2; //GXTevBias + unsigned op : 1; + unsigned clamp : 1; + + unsigned shift : 2; + unsigned dest : 2; //1,2,3 + }; + u32 hex; + }; + + ColorCombiner colorC; + AlphaCombiner alphaC; +}; + +#define ITF_8 0 +#define ITF_5 1 +#define ITF_4 2 +#define ITF_3 3 + +#define ITB_NONE 0 +#define ITB_S 1 +#define ITB_T 2 +#define ITB_ST 3 +#define ITB_U 4 +#define ITB_SU 5 +#define ITB_TU 6 +#define ITB_STU 7 + +#define ITBA_OFF 0 +#define ITBA_S 1 +#define ITBA_T 2 +#define ITBA_U 3 + +#define ITW_OFF 0 +#define ITW_256 1 +#define ITW_128 2 +#define ITW_64 3 +#define ITW_32 4 +#define ITW_16 5 +#define ITW_0 6 + +// several discoveries: +// GXSetTevIndBumpST(tevstage, indstage, matrixind) +// if( matrix == 2 ) realmat = 6; // 10 +// else if( matrix == 3 ) realmat = 7; // 11 +// else if( matrix == 1 ) realmat = 5; // 9 +// GXSetTevIndirect(tevstage, indstage, 0, 3, realmat, 6, 6, 0, 0, 0) +// GXSetTevIndirect(tevstage+1, indstage, 0, 3, realmat+4, 6, 6, 1, 0, 0) +// GXSetTevIndirect(tevstage+2, indstage, 0, 0, 0, 0, 0, 1, 0, 0) + +union TevStageIndirect +{ + // if mid, sw, tw, and addprev are 0, then no indirect stage is used, mask = 0x17fe00 + struct + { + unsigned bt : 2; // indirect tex stage ID + unsigned fmt : 2; // format: ITF_X + unsigned bias : 3; // ITB_X + unsigned bs : 2; // ITBA_X, indicates which coordinate will become the 'bump alpha' + unsigned mid : 4; // matrix id to multiply offsets with + unsigned sw : 3; // ITW_X, wrapping factor for S of regular coord + unsigned tw : 3; // ITW_X, wrapping factor for T of regular coord + unsigned lb_utclod : 1; // use modified or unmodified texture coordinates for LOD computation + unsigned fb_addprev : 1; // 1 if the texture coordinate results from the previous TEV stage should be added + unsigned pad0 : 3; + unsigned rid : 8; + }; + struct + { + u32 hex : 21; + u32 unused : 11; + }; + + bool IsActive() { return (hex&0x17fe00)!=0; } +}; + +union TwoTevStageOrders +{ + struct + { + unsigned texmap0 : 3; // indirect tex stage texmap + unsigned texcoord0 : 3; + unsigned enable0 : 1; // 1 if should read from texture + unsigned colorchan0 : 3; // RAS1_CC_X + + unsigned pad0 : 2; + + unsigned texmap1 : 3; + unsigned texcoord1 : 3; + unsigned enable1 : 1; // 1 if should read from texture + unsigned colorchan1 : 3; // RAS1_CC_X + + unsigned pad1 : 2; + unsigned rid : 8; + }; + u32 hex; + int getTexMap(int i){return i?texmap1:texmap0;} + int getTexCoord(int i){return i?texcoord1:texcoord0;} + int getEnable(int i){return i?enable1:enable0;} + int getColorChan(int i){return i?colorchan1:colorchan0;} +}; + +union TEXSCALE +{ + struct + { + unsigned ss0 : 4; // indirect tex stage 0, 2^(-ss0) + unsigned ts0 : 4; // indirect tex stage 0 + unsigned ss1 : 4; // indirect tex stage 1 + unsigned ts1 : 4; // indirect tex stage 1 + unsigned pad : 8; + unsigned rid : 8; + }; + u32 hex; + + float getScaleS(int i){return 1.0f/(float)(1<<(i?ss1:ss0));} + float getScaleT(int i){return 1.0f/(float)(1<<(i?ts1:ts0));} +}; + +union RAS1_IREF +{ + struct + { + unsigned bi0 : 3; // indirect tex stage 0 ntexmap + unsigned bc0 : 3; // indirect tex stage 0 ntexcoord + unsigned bi1 : 3; + unsigned bc1 : 3; + unsigned bi2 : 3; + unsigned bc3 : 3; + unsigned bi4 : 3; + unsigned bc4 : 3; + unsigned rid : 8; + }; + u32 hex; + + u32 getTexCoord(int i) { return (hex>>(6*i+3))&3; } + u32 getTexMap(int i) { return (hex>>(6*i))&3; } +}; + +////////////////////////////////////////////////////////////////////////// +// Texture structs +////////////////////////////////////////////////////////////////////////// +union TexMode0 +{ + struct + { + unsigned wrap_s : 2; + unsigned wrap_t : 2; + unsigned mag_filter : 1; + unsigned min_filter : 3; + unsigned diag_lod : 1; + signed lod_bias : 10; + unsigned max_aniso : 2; + unsigned lod_clamp : 1; + }; + u32 hex; +}; +union TexMode1 +{ + struct + { + unsigned min_lod : 8; + unsigned max_lod : 8; + }; + u32 hex; +}; +union TexImage0 +{ + struct + { + unsigned width : 10; //actually w-1 + unsigned height : 10; //actually h-1 + unsigned format : 4; + }; + u32 hex; +}; +union TexImage1 +{ + struct + { + unsigned tmem_offset : 15; // we ignore texture caching for now, we do it ourselves + unsigned cache_width : 3; + unsigned cache_height : 3; + unsigned image_type : 1; + }; + u32 hex; +}; + +union TexImage2 +{ + struct + { + unsigned tmem_offset : 15; // we ignore texture caching for now, we do it ourselves + unsigned cache_width : 3; + unsigned cache_height : 3; + }; + u32 hex; +}; + +union TexImage3 +{ + struct + { + unsigned image_base: 24; //address in memory >> 5 (was 20 for GC) + }; + u32 hex; +}; +union TexTLUT +{ + struct + { + unsigned tmem_offset : 10; + unsigned tlut_format : 2; + }; + u32 hex; +}; + +union ZTex1 +{ + struct + { + unsigned bias : 24; + }; + u32 hex; +}; + +union ZTex2 +{ + struct + { + unsigned type : 2; // TEV_Z_TYPE_X + unsigned op : 2; // GXZTexOp + }; + u32 hex; +}; + +// Z-texture types (formats) +#define TEV_ZTEX_TYPE_U8 0 +#define TEV_ZTEX_TYPE_U16 1 +#define TEV_ZTEX_TYPE_U24 2 + +#define TEV_ZTEX_DISABLE 0 +#define TEV_ZTEX_ADD 1 +#define TEV_ZTEX_REPLACE 2 + + +struct FourTexUnits +{ + TexMode0 texMode0[4]; + TexMode1 texMode1[4]; + TexImage0 texImage0[4]; + TexImage1 texImage1[4]; + TexImage2 texImage2[4]; + TexImage3 texImage3[4]; + TexTLUT texTlut[4]; + u32 unknown[4]; +}; + + +////////////////////////////////////////////////////////////////////////// +// Geometry/other structs +////////////////////////////////////////////////////////////////////////// +union GenMode +{ + struct + { + unsigned numtexgens : 4; // 0xF + unsigned numcolchans : 5; // 0x1E0 + unsigned ms_en : 1; // 0x200 + unsigned numtevstages : 4; // 0x3C00 + unsigned cullmode : 2; // 0xC000 + unsigned numindstages : 3; // 0x30000 + unsigned zfreeze : 5; //0x3C0000 + }; + u32 hex; +}; + +union LPSize +{ + struct + { + unsigned linesize : 8; // in 1/6th pixels + unsigned pointsize : 8; // in 1/6th pixels + unsigned lineoff : 3; + unsigned pointoff : 3; + unsigned lineaspect : 1; + unsigned padding : 1; + }; + u32 hex; +}; + + +union X12Y12 +{ + struct + { + unsigned y : 12; + unsigned x : 12; + }; + u32 hex; +}; +union X10Y10 +{ + struct + { + unsigned x : 10; + unsigned y : 10; + }; + u32 hex; +}; + +////////////////////////////////////////////////////////////////////////// +// Framebuffer/pixel stuff (incl fog) +////////////////////////////////////////////////////////////////////////// +union BlendMode +{ + struct + { + unsigned blendenable : 1; + unsigned logicopenable : 1; + unsigned dither : 1; + unsigned colorupdate : 1; + unsigned alphaupdate : 1; + unsigned dstfactor : 3; //BLEND_ONE, BLEND_INV_SRc etc + unsigned srcfactor : 3; + unsigned subtract : 1; + unsigned logicmode : 4; + }; + u32 hex; +}; + + +union FogParam0 +{ + struct + { + unsigned mantissa : 11; + unsigned exponent : 8; + unsigned sign : 1; + }; + + float GetA() { + union { u32 i; float f; } dummy; + dummy.i = ((u32)sign<<31)|((u32)exponent<<23)|((u32)mantissa<<12); + return dummy.f; + } + + u32 hex; +}; + +union FogParam3 +{ + struct + { + unsigned c_mant : 11; + unsigned c_exp : 8; + unsigned c_sign : 1; + unsigned proj : 1; // 0 - perspective, 1 - orthographic + unsigned fsel : 3; // 0 - off, 2 - linear, 4 - exp, 5 - exp2, 6 - backward exp, 7 - backward exp2 + }; + + // amount to subtract from eyespacez after range adjustment + float GetC() { + union { u32 i; float f; } dummy; + dummy.i = ((u32)c_sign << 31) | ((u32)c_exp << 23) | ((u32)c_mant << 12); + return dummy.f; + } + + u32 hex; +}; + +// final eq: ze = A/(B_MAG - (Zs>>B_SHF)); +struct FogParams +{ + FogParam0 a; + u32 b_magnitude; + u32 b_shift; // b's exp + 1? + FogParam3 c_proj_fsel; + u32 color; //0:b 8:g 16:r - nice! +}; + +union ZMode +{ + struct + { + unsigned testenable : 1; + unsigned func : 3; + unsigned updateenable : 1; //size? + }; + u32 hex; +}; + +union ConstantAlpha +{ + struct + { + unsigned alpha : 8; + unsigned enable : 1; + }; + u32 hex; +}; + +#define PIXELFMT_RGB8_Z24 0 +#define PIXELFMT_RGBA6_Z24 1 +#define PIXELFMT_RGB565_Z16 2 +#define PIXELFMT_Z24 3 +#define PIXELFMT_Y8 4 +#define PIXELFMT_U8 5 +#define PIXELFMT_V8 6 +#define PIXELFMT_YUV420 7 + +union PE_CONTROL +{ + struct + { + unsigned pixel_format : 3; // PIXELFMT_X + unsigned zformat : 3; // 0 - linear, 1 - near, 2 - mid, 3 - far + unsigned zcomploc : 1; // 1: before tex stage + unsigned unused : 17; + unsigned rid : 8; + }; + u32 hex; +}; + +////////////////////////////////////////////////////////////////////////// +// Texture coordinate stuff +////////////////////////////////////////////////////////////////////////// +union TCInfo +{ + struct + { + unsigned scale_minus_1 : 16; + unsigned range_bias : 1; + unsigned cylindric_wrap : 1; + }; + u32 hex; +}; +struct TCoordInfo +{ + TCInfo s; + TCInfo t; +}; + + +union ColReg +{ + u32 hex; + struct + { + signed a : 11; + unsigned : 1; + signed b : 11; + unsigned type : 1; + }; +}; + +struct TevReg +{ + ColReg low; + ColReg high; +}; + +union TevKSel +{ + struct { + unsigned swap1 : 2; + unsigned swap2 : 2; + unsigned kcsel0 : 5; + unsigned kasel0 : 5; + unsigned kcsel1 : 5; + unsigned kasel1 : 5; + }; + u32 hex; + + int getKC(int i) {return i?kcsel1:kcsel0;} + int getKA(int i) {return i?kasel1:kasel0;} +}; + +union AlphaFunc +{ + struct + { + unsigned ref0 : 8; + unsigned ref1 : 8; + unsigned comp0 : 3; + unsigned comp1 : 3; + unsigned logic : 2; + }; + u32 hex; +}; + +union UPE_Copy +{ + u32 Hex; + struct + { + unsigned clamp0 : 1; + unsigned clamp1 : 1; + unsigned : 1; + unsigned target_pixel_format : 4; // realformat is (fmt/2)+((fmt&1)*8).... for some reason the msb is the lsb + unsigned gamma : 2; + unsigned half_scale : 1; // real size should be 2x smaller (run a gauss filter?) + unsigned scale_something : 1; + unsigned clear : 1; + unsigned frame_to_field : 2; + unsigned copy_to_xfb : 1; + unsigned intensity_fmt : 1; // if set, is an intensity format (I4,I8,IA4,IA8) + unsigned : 16; // seems to set everything to 1s when target pixel format is invalid + }; +}; + +////////////////////////////////////////////////////////////////////////// +// All of BP memory +////////////////////////////////////////////////////////////////////////// + +struct BPMemory +{ + GenMode genMode; + u32 display_copy_filter[4]; //01-04 + u32 unknown; //05 + // indirect matrices (set by GXSetIndTexMtx, selected by TevStageIndirect::mid) + // abc form a 2x3 offset matrix, there's 3 such matrices + // the 3 offset matrices can either be indirect type, S-type, or T-type + // 6bit scale factor s is distributed across IND_MTXA/B/C. + // before using matrices scale by 2^-(s-17) + IND_MTX indmtx[3];//06-0e GXSetIndTexMtx, 2x3 matrices + IND_IMASK imask;//0f + TevStageIndirect tevind[16];//10 GXSetTevIndirect + X12Y12 scissorTL; //20 + X12Y12 scissorBR; //21 + LPSize lineptwidth; //22 line and point width + u32 sucounter; //23 + u32 rascounter; //24 + TEXSCALE texscale[2]; //25-26 GXSetIndTexCoordScale + RAS1_IREF tevindref; //27 GXSetIndTexOrder + TwoTevStageOrders tevorders[8]; //28-2F + TCoordInfo texcoords[8]; //0x30 s,t,s,t,s,t,s,t... + ZMode zmode; //40 + BlendMode blendmode; //41 + ConstantAlpha dstalpha; //42 + PE_CONTROL zcontrol; //43 GXSetZCompLoc, GXPixModeSync + u32 fieldmask; //44 + u32 drawdone; //45, bit1=1 if end of list + u32 unknown5; //46 clock? + u32 petoken; //47 + u32 petokenint; //48 + X10Y10 copyTexSrcXY; //49 + X10Y10 copyTexSrcWH; //4a + u32 copyTexDest; //4b// 4b == CopyAddress (GXDispCopy and GXTexCopy use it) + u32 unknown6; //4c + u32 copyMipMapStrideChannels; // 4d usually set to 4 when dest is single channel, 8 when dest is 2 channel, 16 when dest is RGBA + // also, doubles whenever mipmap box filter option is set (excent on RGBA). Probably to do with number of bytes to look at when smoothing + u32 dispcopyyscale; //4e + u32 clearcolorAR; //4f + u32 clearcolorGB; //50 + u32 clearZValue; //51 + u32 triggerEFBCopy; //52 + u32 copyfilter[2]; //53,54 + u32 boundbox0;//55 + u32 boundbox1;//56 + u32 unknown7[2];//57,58 + X10Y10 scissorOffset; //59 + u32 unknown8[10]; //5a,5b,5c,5d, 5e,5f,60,61, 62, 63 (GXTexModeSync), 0x60-0x63 have to do with preloaded textures? + u32 tlutXferSrc; //64 + u32 tlutXferDest; //65 + u32 texinvalidate;//66 + u32 metric; //67 + u32 fieldmode;//68 + u32 unknown10[7];//69-6F + u32 unknown11[16];//70-7F + FourTexUnits tex[2]; //80-bf + TevStageCombiner combiners[16]; //0xC0-0xDF + TevReg tevregs[4]; //0xE0 + u32 fogRangeAdj; //0xE8 + u32 unknown15[3]; //0xe9,0xea,0xeb - fog related + u32 tev_range_adj_c; //0xec - screenx center for range adjustment, range adjustment enable + u32 tev_range_adj_k; //0xed - specifies range adjustment function = sqrt(x*x+k*k)/k + FogParams fog; //0xEE,0xEF,0xF0,0xF1,0xF2 + AlphaFunc alphaFunc; //0xF3 + ZTex1 ztex1; //0xf4,0xf5 + ZTex2 ztex2; + TevKSel tevksel[8];//0xf6,0xf7,f8,f9,fa,fb,fc,fd + u32 bpMask; //0xFE + u32 unknown18; //ff +}; + +#pragma pack() + +extern BPMemory bpmem; + +#endif diff --git a/Source/Core/VideoCommon/Src/CPMemory.h b/Source/Core/VideoCommon/Src/CPMemory.h index 9557984ecf..17d1998847 100644 --- a/Source/Core/VideoCommon/Src/CPMemory.h +++ b/Source/Core/VideoCommon/Src/CPMemory.h @@ -1,261 +1,261 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _CPMEMORY_H -#define _CPMEMORY_H - -#include "Common.h" - -// Vertex array numbers -enum -{ - ARRAY_POSITION = 0, - ARRAY_NORMAL = 1, - ARRAY_COLOR = 2, - ARRAY_COLOR2 = 3, - ARRAY_TEXCOORD0 = 4, -}; - -// Vertex components -enum -{ - NOT_PRESENT = 0, - DIRECT = 1, - INDEX8 = 2, - INDEX16 = 3, -}; - -enum -{ - FORMAT_UBYTE = 0, // 2 Cmp - FORMAT_BYTE = 1, // 3 Cmp - FORMAT_USHORT = 2, - FORMAT_SHORT = 3, - FORMAT_FLOAT = 4, -}; - -enum -{ - FORMAT_16B_565 = 0, // NA - FORMAT_24B_888 = 1, - FORMAT_32B_888x = 2, - FORMAT_16B_4444 = 3, - FORMAT_24B_6666 = 4, - FORMAT_32B_8888 = 5, -}; - -enum -{ - VAT_0_FRACBITS = 0x3e0001f0, - VAT_1_FRACBITS = 0x07c3e1f0, - VAT_2_FRACBITS = 0xf87c3e1f, -}; - -#pragma pack(4) -union TVtxDesc -{ - u64 Hex; - struct - { - // 0: not present - // 1: present - unsigned PosMatIdx : 1; - unsigned Tex0MatIdx : 1; - unsigned Tex1MatIdx : 1; - unsigned Tex2MatIdx : 1; - unsigned Tex3MatIdx : 1; - unsigned Tex4MatIdx : 1; - unsigned Tex5MatIdx : 1; - unsigned Tex6MatIdx : 1; - unsigned Tex7MatIdx : 1; - - // 00: not present - // 01: direct - // 10: 8 bit index - // 11: 16 bit index - unsigned Position : 2; - unsigned Normal : 2; - unsigned Color0 : 2; - unsigned Color1 : 2; - unsigned Tex0Coord : 2; - unsigned Tex1Coord : 2; - unsigned Tex2Coord : 2; - unsigned Tex3Coord : 2; - unsigned Tex4Coord : 2; - unsigned Tex5Coord : 2; - unsigned Tex6Coord : 2; - unsigned Tex7Coord : 2; - unsigned :31; - }; - struct { - u32 Hex0, Hex1; - }; -}; - -union UVAT_group0 -{ - u32 Hex; - struct - { - // 0:8 - unsigned PosElements : 1; - unsigned PosFormat : 3; - unsigned PosFrac : 5; - // 9:12 - unsigned NormalElements : 1; - unsigned NormalFormat : 3; - // 13:16 - unsigned Color0Elements : 1; - unsigned Color0Comp : 3; - // 17:20 - unsigned Color1Elements : 1; - unsigned Color1Comp : 3; - // 21:29 - unsigned Tex0CoordElements : 1; - unsigned Tex0CoordFormat : 3; - unsigned Tex0Frac : 5; - // 30:31 - unsigned ByteDequant: 1; - unsigned NormalIndex3: 1; - }; -}; - -union UVAT_group1 -{ - u32 Hex; - struct - { - // 0:8 - unsigned Tex1CoordElements : 1; - unsigned Tex1CoordFormat : 3; - unsigned Tex1Frac : 5; - // 9:17 - unsigned Tex2CoordElements : 1; - unsigned Tex2CoordFormat : 3; - unsigned Tex2Frac : 5; - // 18:26 - unsigned Tex3CoordElements : 1; - unsigned Tex3CoordFormat : 3; - unsigned Tex3Frac : 5; - // 27:30 - unsigned Tex4CoordElements : 1; - unsigned Tex4CoordFormat : 3; - // - unsigned : 1; - }; -}; - -union UVAT_group2 -{ - u32 Hex; - struct - { - // 0:4 - unsigned Tex4Frac : 5; - // 5:13 - unsigned Tex5CoordElements : 1; - unsigned Tex5CoordFormat : 3; - unsigned Tex5Frac : 5; - // 14:22 - unsigned Tex6CoordElements : 1; - unsigned Tex6CoordFormat : 3; - unsigned Tex6Frac : 5; - // 23:31 - unsigned Tex7CoordElements : 1; - unsigned Tex7CoordFormat : 3; - unsigned Tex7Frac : 5; - }; -}; - -struct ColorAttr -{ - u8 Elements; - u8 Comp; -}; - -struct TexAttr -{ - u8 Elements; - u8 Format; - u8 Frac; -}; - -struct TVtxAttr -{ - u8 PosElements; - u8 PosFormat; - u8 PosFrac; - u8 NormalElements; - u8 NormalFormat; - ColorAttr color[2]; - TexAttr texCoord[8]; - u8 ByteDequant; - u8 NormalIndex3; -}; - -// Matrix indices -union TMatrixIndexA -{ - struct - { - unsigned PosNormalMtxIdx : 6; - unsigned Tex0MtxIdx : 6; - unsigned Tex1MtxIdx : 6; - unsigned Tex2MtxIdx : 6; - unsigned Tex3MtxIdx : 6; - }; - struct - { - u32 Hex : 30; - u32 unused : 2; - }; -}; - -union TMatrixIndexB -{ - struct - { - unsigned Tex4MtxIdx : 6; - unsigned Tex5MtxIdx : 6; - unsigned Tex6MtxIdx : 6; - unsigned Tex7MtxIdx : 6; - }; - struct - { - u32 Hex : 24; - u32 unused : 8; - }; -}; - -#pragma pack() - -extern u32 arraybases[16]; -extern u32 arraystrides[16]; -extern TMatrixIndexA MatrixIndexA; -extern TMatrixIndexB MatrixIndexB; - -struct VAT -{ - UVAT_group0 g0; - UVAT_group1 g1; - UVAT_group2 g2; -}; - -extern TVtxDesc g_VtxDesc; -extern VAT g_VtxAttr[8]; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _CPMEMORY_H +#define _CPMEMORY_H + +#include "Common.h" + +// Vertex array numbers +enum +{ + ARRAY_POSITION = 0, + ARRAY_NORMAL = 1, + ARRAY_COLOR = 2, + ARRAY_COLOR2 = 3, + ARRAY_TEXCOORD0 = 4, +}; + +// Vertex components +enum +{ + NOT_PRESENT = 0, + DIRECT = 1, + INDEX8 = 2, + INDEX16 = 3, +}; + +enum +{ + FORMAT_UBYTE = 0, // 2 Cmp + FORMAT_BYTE = 1, // 3 Cmp + FORMAT_USHORT = 2, + FORMAT_SHORT = 3, + FORMAT_FLOAT = 4, +}; + +enum +{ + FORMAT_16B_565 = 0, // NA + FORMAT_24B_888 = 1, + FORMAT_32B_888x = 2, + FORMAT_16B_4444 = 3, + FORMAT_24B_6666 = 4, + FORMAT_32B_8888 = 5, +}; + +enum +{ + VAT_0_FRACBITS = 0x3e0001f0, + VAT_1_FRACBITS = 0x07c3e1f0, + VAT_2_FRACBITS = 0xf87c3e1f, +}; + +#pragma pack(4) +union TVtxDesc +{ + u64 Hex; + struct + { + // 0: not present + // 1: present + unsigned PosMatIdx : 1; + unsigned Tex0MatIdx : 1; + unsigned Tex1MatIdx : 1; + unsigned Tex2MatIdx : 1; + unsigned Tex3MatIdx : 1; + unsigned Tex4MatIdx : 1; + unsigned Tex5MatIdx : 1; + unsigned Tex6MatIdx : 1; + unsigned Tex7MatIdx : 1; + + // 00: not present + // 01: direct + // 10: 8 bit index + // 11: 16 bit index + unsigned Position : 2; + unsigned Normal : 2; + unsigned Color0 : 2; + unsigned Color1 : 2; + unsigned Tex0Coord : 2; + unsigned Tex1Coord : 2; + unsigned Tex2Coord : 2; + unsigned Tex3Coord : 2; + unsigned Tex4Coord : 2; + unsigned Tex5Coord : 2; + unsigned Tex6Coord : 2; + unsigned Tex7Coord : 2; + unsigned :31; + }; + struct { + u32 Hex0, Hex1; + }; +}; + +union UVAT_group0 +{ + u32 Hex; + struct + { + // 0:8 + unsigned PosElements : 1; + unsigned PosFormat : 3; + unsigned PosFrac : 5; + // 9:12 + unsigned NormalElements : 1; + unsigned NormalFormat : 3; + // 13:16 + unsigned Color0Elements : 1; + unsigned Color0Comp : 3; + // 17:20 + unsigned Color1Elements : 1; + unsigned Color1Comp : 3; + // 21:29 + unsigned Tex0CoordElements : 1; + unsigned Tex0CoordFormat : 3; + unsigned Tex0Frac : 5; + // 30:31 + unsigned ByteDequant: 1; + unsigned NormalIndex3: 1; + }; +}; + +union UVAT_group1 +{ + u32 Hex; + struct + { + // 0:8 + unsigned Tex1CoordElements : 1; + unsigned Tex1CoordFormat : 3; + unsigned Tex1Frac : 5; + // 9:17 + unsigned Tex2CoordElements : 1; + unsigned Tex2CoordFormat : 3; + unsigned Tex2Frac : 5; + // 18:26 + unsigned Tex3CoordElements : 1; + unsigned Tex3CoordFormat : 3; + unsigned Tex3Frac : 5; + // 27:30 + unsigned Tex4CoordElements : 1; + unsigned Tex4CoordFormat : 3; + // + unsigned : 1; + }; +}; + +union UVAT_group2 +{ + u32 Hex; + struct + { + // 0:4 + unsigned Tex4Frac : 5; + // 5:13 + unsigned Tex5CoordElements : 1; + unsigned Tex5CoordFormat : 3; + unsigned Tex5Frac : 5; + // 14:22 + unsigned Tex6CoordElements : 1; + unsigned Tex6CoordFormat : 3; + unsigned Tex6Frac : 5; + // 23:31 + unsigned Tex7CoordElements : 1; + unsigned Tex7CoordFormat : 3; + unsigned Tex7Frac : 5; + }; +}; + +struct ColorAttr +{ + u8 Elements; + u8 Comp; +}; + +struct TexAttr +{ + u8 Elements; + u8 Format; + u8 Frac; +}; + +struct TVtxAttr +{ + u8 PosElements; + u8 PosFormat; + u8 PosFrac; + u8 NormalElements; + u8 NormalFormat; + ColorAttr color[2]; + TexAttr texCoord[8]; + u8 ByteDequant; + u8 NormalIndex3; +}; + +// Matrix indices +union TMatrixIndexA +{ + struct + { + unsigned PosNormalMtxIdx : 6; + unsigned Tex0MtxIdx : 6; + unsigned Tex1MtxIdx : 6; + unsigned Tex2MtxIdx : 6; + unsigned Tex3MtxIdx : 6; + }; + struct + { + u32 Hex : 30; + u32 unused : 2; + }; +}; + +union TMatrixIndexB +{ + struct + { + unsigned Tex4MtxIdx : 6; + unsigned Tex5MtxIdx : 6; + unsigned Tex6MtxIdx : 6; + unsigned Tex7MtxIdx : 6; + }; + struct + { + u32 Hex : 24; + u32 unused : 8; + }; +}; + +#pragma pack() + +extern u32 arraybases[16]; +extern u32 arraystrides[16]; +extern TMatrixIndexA MatrixIndexA; +extern TMatrixIndexB MatrixIndexB; + +struct VAT +{ + UVAT_group0 g0; + UVAT_group1 g1; + UVAT_group2 g2; +}; + +extern TVtxDesc g_VtxDesc; +extern VAT g_VtxAttr[8]; + +#endif diff --git a/Source/Core/VideoCommon/Src/DataReader.h b/Source/Core/VideoCommon/Src/DataReader.h index 3f465a46e5..af604fafb3 100644 --- a/Source/Core/VideoCommon/Src/DataReader.h +++ b/Source/Core/VideoCommon/Src/DataReader.h @@ -1,76 +1,76 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DATAREADER_H -#define _DATAREADER_H - -extern u8* g_pVideoData; - -inline u8 DataPeek8(u32 _uOffset) -{ - return g_pVideoData[_uOffset]; -} - -inline u16 DataPeek16(u32 _uOffset) -{ - return Common::swap16(*(u16*)&g_pVideoData[_uOffset]); -} - -inline u32 DataPeek32(u32 _uOffset) -{ - return Common::swap32(*(u32*)&g_pVideoData[_uOffset]); -} - -inline u8 DataReadU8() -{ - return *g_pVideoData++; -} - -inline u16 DataReadU16() -{ - u16 tmp = Common::swap16(*(u16*)g_pVideoData); - g_pVideoData += 2; - return tmp; -} - -inline u32 DataReadU32() -{ - u32 tmp = Common::swap32(*(u32*)g_pVideoData); - g_pVideoData += 4; - return tmp; -} - -inline float DataReadF32() -{ - union {u32 i; float f;} temp; - temp.i = Common::swap32(*(u32*)g_pVideoData); - g_pVideoData += 4; - float tmp = temp.f; - return tmp; -} - -inline u8* DataGetPosition() -{ - return g_pVideoData; -} - -inline void DataSkip(u32 skip) -{ - g_pVideoData += skip; -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DATAREADER_H +#define _DATAREADER_H + +extern u8* g_pVideoData; + +inline u8 DataPeek8(u32 _uOffset) +{ + return g_pVideoData[_uOffset]; +} + +inline u16 DataPeek16(u32 _uOffset) +{ + return Common::swap16(*(u16*)&g_pVideoData[_uOffset]); +} + +inline u32 DataPeek32(u32 _uOffset) +{ + return Common::swap32(*(u32*)&g_pVideoData[_uOffset]); +} + +inline u8 DataReadU8() +{ + return *g_pVideoData++; +} + +inline u16 DataReadU16() +{ + u16 tmp = Common::swap16(*(u16*)g_pVideoData); + g_pVideoData += 2; + return tmp; +} + +inline u32 DataReadU32() +{ + u32 tmp = Common::swap32(*(u32*)g_pVideoData); + g_pVideoData += 4; + return tmp; +} + +inline float DataReadF32() +{ + union {u32 i; float f;} temp; + temp.i = Common::swap32(*(u32*)g_pVideoData); + g_pVideoData += 4; + float tmp = temp.f; + return tmp; +} + +inline u8* DataGetPosition() +{ + return g_pVideoData; +} + +inline void DataSkip(u32 skip) +{ + g_pVideoData += skip; +} + +#endif diff --git a/Source/Core/VideoCommon/Src/Fifo.h b/Source/Core/VideoCommon/Src/Fifo.h index 33c900b774..77b35be83a 100644 --- a/Source/Core/VideoCommon/Src/Fifo.h +++ b/Source/Core/VideoCommon/Src/Fifo.h @@ -1,35 +1,35 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _FIFO_H -#define _FIFO_H - -#include "pluginspecs_video.h" - -#include "Common.h" -#include "ChunkFile.h" - -#define FIFO_SIZE (1024*1024) - -void Fifo_Init(); -void Fifo_Shutdown(); -void Fifo_EnterLoop(const SVideoInitialize &video_initialize); -void Fifo_DoState(PointerWrap &f); -void Fifo_Stop(); - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _FIFO_H +#define _FIFO_H + +#include "pluginspecs_video.h" + +#include "Common.h" +#include "ChunkFile.h" + +#define FIFO_SIZE (1024*1024) + +void Fifo_Init(); +void Fifo_Shutdown(); +void Fifo_EnterLoop(const SVideoInitialize &video_initialize); +void Fifo_DoState(PointerWrap &f); +void Fifo_Stop(); + +#endif + diff --git a/Source/Core/VideoCommon/Src/LookUpTables.h b/Source/Core/VideoCommon/Src/LookUpTables.h index 4509f70bef..4d37fc6786 100644 --- a/Source/Core/VideoCommon/Src/LookUpTables.h +++ b/Source/Core/VideoCommon/Src/LookUpTables.h @@ -1,34 +1,34 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _LOOKUPTABLES_H -#define _LOOKUPTABLES_H - -#include "Common.h" - -extern const int lut3to8[8]; -extern const int lut4to8[16]; -extern const int lut5to8[32]; -extern int lut6to8[64]; -extern float lutu8tosfloat[256]; -extern float lutu8toufloat[256]; -extern float luts8tosfloat[256]; -extern float shiftLookup[32]; - -void InitLUTs(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _LOOKUPTABLES_H +#define _LOOKUPTABLES_H + +#include "Common.h" + +extern const int lut3to8[8]; +extern const int lut4to8[16]; +extern const int lut5to8[32]; +extern int lut6to8[64]; +extern float lutu8tosfloat[256]; +extern float lutu8toufloat[256]; +extern float luts8tosfloat[256]; +extern float shiftLookup[32]; + +void InitLUTs(); + +#endif diff --git a/Source/Core/VideoCommon/Src/NativeVertexFormat.h b/Source/Core/VideoCommon/Src/NativeVertexFormat.h index 3aee5cd753..bcfb9fd95d 100644 --- a/Source/Core/VideoCommon/Src/NativeVertexFormat.h +++ b/Source/Core/VideoCommon/Src/NativeVertexFormat.h @@ -1,105 +1,105 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _NATIVEVERTEXFORMAT_H -#define _NATIVEVERTEXFORMAT_H - -#include "PluginSpecs.h" - -// m_components -enum { - VB_HAS_POSMTXIDX =(1<<1), - VB_HAS_TEXMTXIDX0=(1<<2), - VB_HAS_TEXMTXIDX1=(1<<3), - VB_HAS_TEXMTXIDX2=(1<<4), - VB_HAS_TEXMTXIDX3=(1<<5), - VB_HAS_TEXMTXIDX4=(1<<6), - VB_HAS_TEXMTXIDX5=(1<<7), - VB_HAS_TEXMTXIDX6=(1<<8), - VB_HAS_TEXMTXIDX7=(1<<9), - VB_HAS_TEXMTXIDXALL=(0xff<<2), - - //VB_HAS_POS=0, // Implied, it always has pos! don't bother testing - VB_HAS_NRM0=(1<<10), - VB_HAS_NRM1=(1<<11), - VB_HAS_NRM2=(1<<12), - VB_HAS_NRMALL=(7<<10), - - VB_HAS_COL0=(1<<13), - VB_HAS_COL1=(1<<14), - - VB_HAS_UV0=(1<<15), - VB_HAS_UV1=(1<<16), - VB_HAS_UV2=(1<<17), - VB_HAS_UV3=(1<<18), - VB_HAS_UV4=(1<<19), - VB_HAS_UV5=(1<<20), - VB_HAS_UV6=(1<<21), - VB_HAS_UV7=(1<<22), - VB_HAS_UVALL=(0xff<<15), - VB_HAS_UVTEXMTXSHIFT=13, -}; - -#define LOADERDECL __cdecl -typedef void (LOADERDECL *TPipelineFunction)(); - -enum VarType { - VAR_BYTE, - VAR_UNSIGNED_BYTE, - VAR_SHORT, - VAR_UNSIGNED_SHORT, - VAR_FLOAT, -}; - -struct PortableVertexDeclaration -{ - int stride; - - int num_normals; - int normal_offset[3]; - VarType normal_gl_type; - int normal_gl_size; - VarType color_gl_type; // always GL_UNSIGNED_BYTE - int color_offset[2]; - VarType texcoord_gl_type[8]; - int texcoord_gl_size[8]; - int texcoord_offset[8]; - int texcoord_size[8]; - int posmtx_offset; -}; - -// The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp -// is in the respective plugin, not here in VideoCommon. - -// Note that this class can't just invent arbitrary vertex formats out of its input - -// all the data loading code must always be made compatible. -class NativeVertexFormat -{ - u8* m_compiledCode; - PortableVertexDeclaration vtx_decl; -public: - NativeVertexFormat(); - ~NativeVertexFormat(); - - void Initialize(const PortableVertexDeclaration &vtx_decl); - void SetupVertexPointers() const; - - // TODO: move these in under private: - u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present. -}; - -#endif // _NATIVEVERTEXFORMAT_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _NATIVEVERTEXFORMAT_H +#define _NATIVEVERTEXFORMAT_H + +#include "PluginSpecs.h" + +// m_components +enum { + VB_HAS_POSMTXIDX =(1<<1), + VB_HAS_TEXMTXIDX0=(1<<2), + VB_HAS_TEXMTXIDX1=(1<<3), + VB_HAS_TEXMTXIDX2=(1<<4), + VB_HAS_TEXMTXIDX3=(1<<5), + VB_HAS_TEXMTXIDX4=(1<<6), + VB_HAS_TEXMTXIDX5=(1<<7), + VB_HAS_TEXMTXIDX6=(1<<8), + VB_HAS_TEXMTXIDX7=(1<<9), + VB_HAS_TEXMTXIDXALL=(0xff<<2), + + //VB_HAS_POS=0, // Implied, it always has pos! don't bother testing + VB_HAS_NRM0=(1<<10), + VB_HAS_NRM1=(1<<11), + VB_HAS_NRM2=(1<<12), + VB_HAS_NRMALL=(7<<10), + + VB_HAS_COL0=(1<<13), + VB_HAS_COL1=(1<<14), + + VB_HAS_UV0=(1<<15), + VB_HAS_UV1=(1<<16), + VB_HAS_UV2=(1<<17), + VB_HAS_UV3=(1<<18), + VB_HAS_UV4=(1<<19), + VB_HAS_UV5=(1<<20), + VB_HAS_UV6=(1<<21), + VB_HAS_UV7=(1<<22), + VB_HAS_UVALL=(0xff<<15), + VB_HAS_UVTEXMTXSHIFT=13, +}; + +#define LOADERDECL __cdecl +typedef void (LOADERDECL *TPipelineFunction)(); + +enum VarType { + VAR_BYTE, + VAR_UNSIGNED_BYTE, + VAR_SHORT, + VAR_UNSIGNED_SHORT, + VAR_FLOAT, +}; + +struct PortableVertexDeclaration +{ + int stride; + + int num_normals; + int normal_offset[3]; + VarType normal_gl_type; + int normal_gl_size; + VarType color_gl_type; // always GL_UNSIGNED_BYTE + int color_offset[2]; + VarType texcoord_gl_type[8]; + int texcoord_gl_size[8]; + int texcoord_offset[8]; + int texcoord_size[8]; + int posmtx_offset; +}; + +// The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp +// is in the respective plugin, not here in VideoCommon. + +// Note that this class can't just invent arbitrary vertex formats out of its input - +// all the data loading code must always be made compatible. +class NativeVertexFormat +{ + u8* m_compiledCode; + PortableVertexDeclaration vtx_decl; +public: + NativeVertexFormat(); + ~NativeVertexFormat(); + + void Initialize(const PortableVertexDeclaration &vtx_decl); + void SetupVertexPointers() const; + + // TODO: move these in under private: + u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present. +}; + +#endif // _NATIVEVERTEXFORMAT_H diff --git a/Source/Core/VideoCommon/Src/OpcodeDecoding.h b/Source/Core/VideoCommon/Src/OpcodeDecoding.h index 3219714887..f2502e6b49 100644 --- a/Source/Core/VideoCommon/Src/OpcodeDecoding.h +++ b/Source/Core/VideoCommon/Src/OpcodeDecoding.h @@ -1,51 +1,51 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _OPCODE_DECODING_H -#define _OPCODE_DECODING_H - -#define GX_NOP 0x00 - -#define GX_LOAD_BP_REG 0x61 -#define GX_LOAD_CP_REG 0x08 -#define GX_LOAD_XF_REG 0x10 -#define GX_LOAD_INDX_A 0x20 -#define GX_LOAD_INDX_B 0x28 -#define GX_LOAD_INDX_C 0x30 -#define GX_LOAD_INDX_D 0x38 - -#define GX_CMD_CALL_DL 0x40 -#define GX_CMD_INVL_VC 0x48 - -#define GX_PRIMITIVE_MASK 0x78 -#define GX_PRIMITIVE_SHIFT 3 -#define GX_VAT_MASK 0x07 - -//these are defined 1/8th of their real values and without their top bit -#define GX_DRAW_QUADS 0x0 //0x80 -#define GX_DRAW_TRIANGLES 0x2 //0x90 -#define GX_DRAW_TRIANGLE_STRIP 0x3 //0x98 -#define GX_DRAW_TRIANGLE_FAN 0x4 //0xA0 -#define GX_DRAW_LINES 0x5 //0xA8 -#define GX_DRAW_LINE_STRIP 0x6 //0xB0 -#define GX_DRAW_POINTS 0x7 //0xB8 - -void OpcodeDecoder_Init(); -void OpcodeDecoder_Shutdown(); -void OpcodeDecoder_Run(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _OPCODE_DECODING_H +#define _OPCODE_DECODING_H + +#define GX_NOP 0x00 + +#define GX_LOAD_BP_REG 0x61 +#define GX_LOAD_CP_REG 0x08 +#define GX_LOAD_XF_REG 0x10 +#define GX_LOAD_INDX_A 0x20 +#define GX_LOAD_INDX_B 0x28 +#define GX_LOAD_INDX_C 0x30 +#define GX_LOAD_INDX_D 0x38 + +#define GX_CMD_CALL_DL 0x40 +#define GX_CMD_INVL_VC 0x48 + +#define GX_PRIMITIVE_MASK 0x78 +#define GX_PRIMITIVE_SHIFT 3 +#define GX_VAT_MASK 0x07 + +//these are defined 1/8th of their real values and without their top bit +#define GX_DRAW_QUADS 0x0 //0x80 +#define GX_DRAW_TRIANGLES 0x2 //0x90 +#define GX_DRAW_TRIANGLE_STRIP 0x3 //0x98 +#define GX_DRAW_TRIANGLE_FAN 0x4 //0xA0 +#define GX_DRAW_LINES 0x5 //0xA8 +#define GX_DRAW_LINE_STRIP 0x6 //0xB0 +#define GX_DRAW_POINTS 0x7 //0xB8 + +void OpcodeDecoder_Init(); +void OpcodeDecoder_Shutdown(); +void OpcodeDecoder_Run(); + +#endif diff --git a/Source/Core/VideoCommon/Src/PixelShader.h b/Source/Core/VideoCommon/Src/PixelShader.h index ae397d01b4..9823a2870b 100644 --- a/Source/Core/VideoCommon/Src/PixelShader.h +++ b/Source/Core/VideoCommon/Src/PixelShader.h @@ -1,44 +1,44 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef GCOGL_PIXELSHADER -#define GCOGL_PIXELSHADER - -#include "Common.h" - -#define I_COLORS "color" -#define I_KCOLORS "k" -#define I_ALPHA "alphaRef" -#define I_TEXDIMS "texdim" -#define I_ZBIAS "czbias" -#define I_INDTEXSCALE "cindscale" -#define I_INDTEXMTX "cindmtx" - -#define C_COLORS 0 -#define C_KCOLORS (C_COLORS+4) -#define C_ALPHA (C_KCOLORS+4) -#define C_TEXDIMS (C_ALPHA+1) -#define C_ZBIAS (C_TEXDIMS+8) -#define C_INDTEXSCALE (C_ZBIAS+2) -#define C_INDTEXMTX (C_INDTEXSCALE+2) -#define C_ENVCONST_END (C_INDTEXMTX+6) - -#define C_COLORMATRIX (C_INDTEXMTX+6) - -char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRenderZToCol0); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef GCOGL_PIXELSHADER +#define GCOGL_PIXELSHADER + +#include "Common.h" + +#define I_COLORS "color" +#define I_KCOLORS "k" +#define I_ALPHA "alphaRef" +#define I_TEXDIMS "texdim" +#define I_ZBIAS "czbias" +#define I_INDTEXSCALE "cindscale" +#define I_INDTEXMTX "cindmtx" + +#define C_COLORS 0 +#define C_KCOLORS (C_COLORS+4) +#define C_ALPHA (C_KCOLORS+4) +#define C_TEXDIMS (C_ALPHA+1) +#define C_ZBIAS (C_TEXDIMS+8) +#define C_INDTEXSCALE (C_ZBIAS+2) +#define C_INDTEXMTX (C_INDTEXSCALE+2) +#define C_ENVCONST_END (C_INDTEXMTX+6) + +#define C_COLORMATRIX (C_INDTEXMTX+6) + +char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRenderZToCol0); + +#endif diff --git a/Source/Core/VideoCommon/Src/Profiler.h b/Source/Core/VideoCommon/Src/Profiler.h index db7524bca6..30cbbd8ead 100644 --- a/Source/Core/VideoCommon/Src/Profiler.h +++ b/Source/Core/VideoCommon/Src/Profiler.h @@ -1,78 +1,78 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -// Zerofrog's Mini Internal Profiler - -#ifndef _PROFILER_H -#define _PROFILER_H - -#include - -#include "Common.h" - -// #define DVPROFILE // comment out to disable profiling - -extern int g_bWriteProfile; // global variable to enable/disable profiling (if DVPROFILE is defined) - -// IMPORTANT: For every Register there must be an End. Use the below DVProfileFunc utility class for safety. -void DVProfRegister(const char* pname); // first checks if this profiler exists in g_listProfilers -void DVProfEnd(u32 dwUserData); - -void DVProfWrite(const char* pfilename, u32 frames = 0); -void DVProfGenReport(std::string *report); -void DVProfClear(); // clears all the profilers - -#if defined(DVPROFILE) && defined(_WIN32) - -#ifdef _MSC_VER - -#ifndef __PRETTY_FUNCTION__ -#define __PRETTY_FUNCTION__ __FUNCTION__ -#endif - -#endif - -#define DVSTARTPROFILE() DVProfileFunc _pf(__PRETTY_FUNCTION__); -#define DVSTARTSUBPROFILE(name) DVProfileFunc _pf(name); - -class DVProfileFunc -{ -public: - u32 dwUserData; - DVProfileFunc(const char* pname) { DVProfRegister(pname); dwUserData = 0; } - DVProfileFunc(const char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); } - ~DVProfileFunc() { DVProfEnd(dwUserData); } -}; - -#else - -#define DVSTARTPROFILE() -#define DVSTARTSUBPROFILE(name) - -class DVProfileFunc -{ -public: - u32 dwUserData; - __forceinline DVProfileFunc(const char* pname) {} - __forceinline DVProfileFunc(const char* pname, u32 _dwUserData) { } - ~DVProfileFunc() {} -}; - -#endif - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +// Zerofrog's Mini Internal Profiler + +#ifndef _PROFILER_H +#define _PROFILER_H + +#include + +#include "Common.h" + +// #define DVPROFILE // comment out to disable profiling + +extern int g_bWriteProfile; // global variable to enable/disable profiling (if DVPROFILE is defined) + +// IMPORTANT: For every Register there must be an End. Use the below DVProfileFunc utility class for safety. +void DVProfRegister(const char* pname); // first checks if this profiler exists in g_listProfilers +void DVProfEnd(u32 dwUserData); + +void DVProfWrite(const char* pfilename, u32 frames = 0); +void DVProfGenReport(std::string *report); +void DVProfClear(); // clears all the profilers + +#if defined(DVPROFILE) && defined(_WIN32) + +#ifdef _MSC_VER + +#ifndef __PRETTY_FUNCTION__ +#define __PRETTY_FUNCTION__ __FUNCTION__ +#endif + +#endif + +#define DVSTARTPROFILE() DVProfileFunc _pf(__PRETTY_FUNCTION__); +#define DVSTARTSUBPROFILE(name) DVProfileFunc _pf(name); + +class DVProfileFunc +{ +public: + u32 dwUserData; + DVProfileFunc(const char* pname) { DVProfRegister(pname); dwUserData = 0; } + DVProfileFunc(const char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); } + ~DVProfileFunc() { DVProfEnd(dwUserData); } +}; + +#else + +#define DVSTARTPROFILE() +#define DVSTARTSUBPROFILE(name) + +class DVProfileFunc +{ +public: + u32 dwUserData; + __forceinline DVProfileFunc(const char* pname) {} + __forceinline DVProfileFunc(const char* pname, u32 _dwUserData) { } + ~DVProfileFunc() {} +}; + +#endif + +#endif diff --git a/Source/Core/VideoCommon/Src/Statistics.h b/Source/Core/VideoCommon/Src/Statistics.h index fe4a1e201c..f4747f922e 100644 --- a/Source/Core/VideoCommon/Src/Statistics.h +++ b/Source/Core/VideoCommon/Src/Statistics.h @@ -1,80 +1,80 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _STATISTICS_H -#define _STATISTICS_H - -struct Statistics -{ - int numPixelShadersCreated; - int numPixelShadersAlive; - int numVertexShadersCreated; - int numVertexShadersAlive; - - int numTexturesCreated; - int numTexturesAlive; - - int numRenderTargetsCreated; - int numRenderTargetsAlive; - - int numDListsCalled; - int numDListsCreated; - int numDListsAlive; - - int numVertexLoaders; - - struct ThisFrame - { - int numBPLoads; - int numCPLoads; - int numXFLoads; - - int numBPLoadsInDL; - int numCPLoadsInDL; - int numXFLoadsInDL; - - int numDLs; - int numPrims; - int numDLPrims; - int numShaderChanges; - - int numPrimitiveJoins; - int numDrawCalls; - int numBufferSplits; - - int numDListsCalled; - }; - ThisFrame thisFrame; - void ResetFrame(); - static void SwapDL(); -}; - -extern Statistics stats; - -#define STATISTICS - -#ifdef STATISTICS -#define INCSTAT(a) (a)++; -#define ADDSTAT(a,b) (a)+=(b); -#define SETSTAT(a,x) (a)=(int)(x); -#else -#define INCSTAT(a) ; -#define ADDSTAT(a,b) ; -#define SETSTAT(a,x) ; -#endif - -#endif // _STATISTICS_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _STATISTICS_H +#define _STATISTICS_H + +struct Statistics +{ + int numPixelShadersCreated; + int numPixelShadersAlive; + int numVertexShadersCreated; + int numVertexShadersAlive; + + int numTexturesCreated; + int numTexturesAlive; + + int numRenderTargetsCreated; + int numRenderTargetsAlive; + + int numDListsCalled; + int numDListsCreated; + int numDListsAlive; + + int numVertexLoaders; + + struct ThisFrame + { + int numBPLoads; + int numCPLoads; + int numXFLoads; + + int numBPLoadsInDL; + int numCPLoadsInDL; + int numXFLoadsInDL; + + int numDLs; + int numPrims; + int numDLPrims; + int numShaderChanges; + + int numPrimitiveJoins; + int numDrawCalls; + int numBufferSplits; + + int numDListsCalled; + }; + ThisFrame thisFrame; + void ResetFrame(); + static void SwapDL(); +}; + +extern Statistics stats; + +#define STATISTICS + +#ifdef STATISTICS +#define INCSTAT(a) (a)++; +#define ADDSTAT(a,b) (a)+=(b); +#define SETSTAT(a,x) (a)=(int)(x); +#else +#define INCSTAT(a) ; +#define ADDSTAT(a,b) ; +#define SETSTAT(a,x) ; +#endif + +#endif // _STATISTICS_H diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.h b/Source/Core/VideoCommon/Src/TextureDecoder.h index b981f3384c..9fdfd36850 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.h +++ b/Source/Core/VideoCommon/Src/TextureDecoder.h @@ -1,85 +1,85 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _TEXTUREDECODER_H -#define _TEXTUREDECODER_H - -enum -{ - TMEM_SIZE = 1024*1024, - HALFTMEM_SIZE = 512*1024 -}; -extern u8 texMem[TMEM_SIZE]; - -enum TextureFormat -{ - GX_TF_I4 = 0x0, - GX_TF_I8 = 0x1, - GX_TF_IA4 = 0x2, - GX_TF_IA8 = 0x3, - GX_TF_RGB565 = 0x4, - GX_TF_RGB5A3 = 0x5, - GX_TF_RGBA8 = 0x6, - GX_TF_C4 = 0x8, - GX_TF_C8 = 0x9, - GX_TF_C14X2 = 0xA, - GX_TF_CMPR = 0xE, - - _GX_TF_CTF = 0x20, // copy-texture-format only (simply means linear?) - _GX_TF_ZTF = 0x10, // Z-texture-format - - // these formats are also valid when copying targets - GX_CTF_R4 = 0x0 | _GX_TF_CTF, - GX_CTF_RA4 = 0x2 | _GX_TF_CTF, - GX_CTF_RA8 = 0x3 | _GX_TF_CTF, - GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF, - GX_CTF_A8 = 0x7 | _GX_TF_CTF, - GX_CTF_R8 = 0x8 | _GX_TF_CTF, - GX_CTF_G8 = 0x9 | _GX_TF_CTF, - GX_CTF_B8 = 0xA | _GX_TF_CTF, - GX_CTF_RG8 = 0xB | _GX_TF_CTF, - GX_CTF_GB8 = 0xC | _GX_TF_CTF, - - GX_TF_Z8 = 0x1 | _GX_TF_ZTF, - GX_TF_Z16 = 0x3 | _GX_TF_ZTF, - GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF, - - GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF, - GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF, - GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF, - GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF, -}; - -int TexDecoder_GetTexelSizeInNibbles(int format); -int TexDecoder_GetTextureSizeInBytes(int width, int height, int format); -int TexDecoder_GetBlockWidthInTexels(int format); -int TexDecoder_GetPaletteSize(int fmt); - -enum PC_TexFormat -{ - PC_TEX_FMT_NONE = 0, - PC_TEX_FMT_BGRA32 = 1, -}; - -PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt); - -u32 TexDecoder_GetSafeTextureHash(const u8 *src, int width, int height, int texformat, u32 seed=0); -u32 TexDecoder_GetTlutHash(const u16 *src, int len); - -void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _TEXTUREDECODER_H +#define _TEXTUREDECODER_H + +enum +{ + TMEM_SIZE = 1024*1024, + HALFTMEM_SIZE = 512*1024 +}; +extern u8 texMem[TMEM_SIZE]; + +enum TextureFormat +{ + GX_TF_I4 = 0x0, + GX_TF_I8 = 0x1, + GX_TF_IA4 = 0x2, + GX_TF_IA8 = 0x3, + GX_TF_RGB565 = 0x4, + GX_TF_RGB5A3 = 0x5, + GX_TF_RGBA8 = 0x6, + GX_TF_C4 = 0x8, + GX_TF_C8 = 0x9, + GX_TF_C14X2 = 0xA, + GX_TF_CMPR = 0xE, + + _GX_TF_CTF = 0x20, // copy-texture-format only (simply means linear?) + _GX_TF_ZTF = 0x10, // Z-texture-format + + // these formats are also valid when copying targets + GX_CTF_R4 = 0x0 | _GX_TF_CTF, + GX_CTF_RA4 = 0x2 | _GX_TF_CTF, + GX_CTF_RA8 = 0x3 | _GX_TF_CTF, + GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF, + GX_CTF_A8 = 0x7 | _GX_TF_CTF, + GX_CTF_R8 = 0x8 | _GX_TF_CTF, + GX_CTF_G8 = 0x9 | _GX_TF_CTF, + GX_CTF_B8 = 0xA | _GX_TF_CTF, + GX_CTF_RG8 = 0xB | _GX_TF_CTF, + GX_CTF_GB8 = 0xC | _GX_TF_CTF, + + GX_TF_Z8 = 0x1 | _GX_TF_ZTF, + GX_TF_Z16 = 0x3 | _GX_TF_ZTF, + GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF, + + GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF, + GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF, + GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF, + GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF, +}; + +int TexDecoder_GetTexelSizeInNibbles(int format); +int TexDecoder_GetTextureSizeInBytes(int width, int height, int format); +int TexDecoder_GetBlockWidthInTexels(int format); +int TexDecoder_GetPaletteSize(int fmt); + +enum PC_TexFormat +{ + PC_TEX_FMT_NONE = 0, + PC_TEX_FMT_BGRA32 = 1, +}; + +PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt); + +u32 TexDecoder_GetSafeTextureHash(const u8 *src, int width, int height, int texformat, u32 seed=0); +u32 TexDecoder_GetTlutHash(const u16 *src, int len); + +void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center); + +#endif diff --git a/Source/Core/VideoCommon/Src/VertexShader.h b/Source/Core/VideoCommon/Src/VertexShader.h index 1c89374132..309a6ab8b5 100644 --- a/Source/Core/VideoCommon/Src/VertexShader.h +++ b/Source/Core/VideoCommon/Src/VertexShader.h @@ -1,51 +1,51 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef GCOGL_VERTEXSHADER_H -#define GCOGL_VERTEXSHADER_H - -#include "XFMemory.h" - -#define SHADER_POSMTX_ATTRIB 1 -#define SHADER_NORM1_ATTRIB 6 -#define SHADER_NORM2_ATTRIB 7 - - -// shader variables -#define I_POSNORMALMATRIX "cpnmtx" -#define I_PROJECTION "cproj" -#define I_MATERIALS "cmtrl" -#define I_LIGHTS "clights" -#define I_TEXMATRICES "ctexmtx" -#define I_TRANSFORMMATRICES "ctrmtx" -#define I_NORMALMATRICES "cnmtx" -#define I_POSTTRANSFORMMATRICES "cpostmtx" -#define I_FOGPARAMS "cfog" - -#define C_POSNORMALMATRIX 0 -#define C_PROJECTION (C_POSNORMALMATRIX+6) -#define C_MATERIALS (C_PROJECTION+4) -#define C_LIGHTS (C_MATERIALS+4) -#define C_TEXMATRICES (C_LIGHTS+40) -#define C_TRANSFORMMATRICES (C_TEXMATRICES+24) -#define C_NORMALMATRICES (C_TRANSFORMMATRICES+64) -#define C_POSTTRANSFORMMATRICES (C_NORMALMATRICES+32) -#define C_FOGPARAMS (C_POSTTRANSFORMMATRICES+64) - -char *GenerateVertexShader(u32 components, bool has_zbuffer_target); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef GCOGL_VERTEXSHADER_H +#define GCOGL_VERTEXSHADER_H + +#include "XFMemory.h" + +#define SHADER_POSMTX_ATTRIB 1 +#define SHADER_NORM1_ATTRIB 6 +#define SHADER_NORM2_ATTRIB 7 + + +// shader variables +#define I_POSNORMALMATRIX "cpnmtx" +#define I_PROJECTION "cproj" +#define I_MATERIALS "cmtrl" +#define I_LIGHTS "clights" +#define I_TEXMATRICES "ctexmtx" +#define I_TRANSFORMMATRICES "ctrmtx" +#define I_NORMALMATRICES "cnmtx" +#define I_POSTTRANSFORMMATRICES "cpostmtx" +#define I_FOGPARAMS "cfog" + +#define C_POSNORMALMATRIX 0 +#define C_PROJECTION (C_POSNORMALMATRIX+6) +#define C_MATERIALS (C_PROJECTION+4) +#define C_LIGHTS (C_MATERIALS+4) +#define C_TEXMATRICES (C_LIGHTS+40) +#define C_TRANSFORMMATRICES (C_TEXMATRICES+24) +#define C_NORMALMATRICES (C_TRANSFORMMATRICES+64) +#define C_POSTTRANSFORMMATRICES (C_NORMALMATRICES+32) +#define C_FOGPARAMS (C_POSTTRANSFORMMATRICES+64) + +char *GenerateVertexShader(u32 components, bool has_zbuffer_target); + +#endif diff --git a/Source/Core/VideoCommon/Src/VideoState.h b/Source/Core/VideoCommon/Src/VideoState.h index 2fd1d5f366..28230f0021 100644 --- a/Source/Core/VideoCommon/Src/VideoState.h +++ b/Source/Core/VideoCommon/Src/VideoState.h @@ -1,26 +1,26 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __VIDEOSTATE_H -#define __VIDEOSTATE_H - -#include "Common.h" -#include "ChunkFile.h" - -void VideoCommon_DoState(PointerWrap &p); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __VIDEOSTATE_H +#define __VIDEOSTATE_H + +#include "Common.h" +#include "ChunkFile.h" + +void VideoCommon_DoState(PointerWrap &p); + +#endif diff --git a/Source/Core/VideoCommon/Src/XFBConvert.h b/Source/Core/VideoCommon/Src/XFBConvert.h index 1756d3af0a..f1a41a245e 100644 --- a/Source/Core/VideoCommon/Src/XFBConvert.h +++ b/Source/Core/VideoCommon/Src/XFBConvert.h @@ -1,31 +1,31 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _XFB_CONVERT -#define _XFB_CONVERT - -#include "Common.h" - -void InitXFBConvTables(); - -// Converts 4:2:2 YUV (YUYV) data to 32-bit RGBA data. -void ConvertFromXFB(u32 *dst, const u8* _pXFB, int width, int height); - -// Converts 32-bit RGBA data to 4:2:2 YUV (YUYV) data. -void ConvertToXFB(u32 *dst, const u8* _pEFB, int width, int height); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _XFB_CONVERT +#define _XFB_CONVERT + +#include "Common.h" + +void InitXFBConvTables(); + +// Converts 4:2:2 YUV (YUYV) data to 32-bit RGBA data. +void ConvertFromXFB(u32 *dst, const u8* _pXFB, int width, int height); + +// Converts 32-bit RGBA data to 4:2:2 YUV (YUYV) data. +void ConvertToXFB(u32 *dst, const u8* _pEFB, int width, int height); + +#endif diff --git a/Source/Core/VideoCommon/Src/XFMemory.h b/Source/Core/VideoCommon/Src/XFMemory.h index 398b0caa7d..92b78ae890 100644 --- a/Source/Core/VideoCommon/Src/XFMemory.h +++ b/Source/Core/VideoCommon/Src/XFMemory.h @@ -1,204 +1,204 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _XFMEMORY_H -#define _XFMEMORY_H - -#include "Common.h" - -///////////// -// Lighting -///////////// - -#define XF_TEXPROJ_ST 0 -#define XF_TEXPROJ_STQ 1 - -#define XF_TEXINPUT_AB11 0 -#define XF_TEXINPUT_ABC1 1 - -#define XF_TEXGEN_REGULAR 0 -#define XF_TEXGEN_EMBOSS_MAP 1 // used when bump mapping -#define XF_TEXGEN_COLOR_STRGBC0 2 -#define XF_TEXGEN_COLOR_STRGBC1 3 - -#define XF_SRCGEOM_INROW 0 // input is abc -#define XF_SRCNORMAL_INROW 1 // input is abc -#define XF_SRCCOLORS_INROW 2 -#define XF_SRCBINORMAL_T_INROW 3 // input is abc -#define XF_SRCBINORMAL_B_INROW 4 // input is abc -#define XF_SRCTEX0_INROW 5 -#define XF_SRCTEX1_INROW 6 -#define XF_SRCTEX2_INROW 7 -#define XF_SRCTEX3_INROW 8 -#define XF_SRCTEX4_INROW 9 -#define XF_SRCTEX5_INROW 10 -#define XF_SRCTEX6_INROW 11 -#define XF_SRCTEX7_INROW 12 - -#define GX_SRC_REG 0 -#define GX_SRC_VTX 1 - -struct Light -{ - u32 useless[3]; - u32 color; //rgba - float a0; //attenuation - float a1; - float a2; - float k0; //k stuff - float k1; - float k2; - union - { - struct { - float dpos[3]; - float ddir[3]; // specular lights only - }; - struct { - float sdir[3]; - float shalfangle[3]; // specular lights only - }; - }; -}; - -#define LIGHTDIF_NONE 0 -#define LIGHTDIF_SIGN 1 -#define LIGHTDIF_CLAMP 2 - -#define LIGHTATTN_SPEC 0 // specular attenuation -#define LIGHTATTN_SPOT 1 // distance/spotlight attenuation -#define LIGHTATTN_NONE 2 -#define LIGHTATTN_DIR 3 - -union LitChannel -{ - struct - { - unsigned matsource : 1; - unsigned enablelighting : 1; - unsigned lightMask0_3 : 4; - unsigned ambsource : 1; - unsigned diffusefunc : 2; // LIGHTDIF_X - unsigned attnfunc : 2; // LIGHTATTN_X - unsigned lightMask4_7 : 4; - }; - struct - { - u32 hex : 15; - u32 unused : 17; - }; - struct - { - u32 dummy0 : 7; - u32 lightparams : 4; - u32 dummy1 : 21; - }; - unsigned int GetFullLightMask() const - { - return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0; - } -}; - -struct ColorChannel -{ - u32 ambColor; - u32 matColor; - LitChannel color; - LitChannel alpha; -}; - -union INVTXSPEC -{ - struct - { - unsigned numcolors : 2; - unsigned numnormals : 2; // 0 - nothing, 1 - just normal, 2 - normals and binormals - unsigned numtextures : 4; - unsigned unused : 24; - }; - u32 hex; -}; - -union TexMtxInfo -{ - struct - { - unsigned unknown : 1; - unsigned projection : 1; // XF_TEXPROJ_X - unsigned inputform : 2; // XF_TEXINPUT_X - unsigned texgentype : 3; // XF_TEXGEN_X - unsigned sourcerow : 5; // XF_SRCGEOM_X - unsigned embosssourceshift : 3; // what generated texcoord to use - unsigned embosslightshift : 3; // light index that is used - }; - u32 hex; -}; - -union PostMtxInfo -{ - struct - { - unsigned index : 6; // base row of dual transform matrix - unsigned unused : 2; - unsigned normalize : 1; // normalize before send operation - }; - u32 hex; -}; - -struct TexCoordInfo -{ - TexMtxInfo texmtxinfo; - PostMtxInfo postmtxinfo; -}; - -struct XFRegisters -{ - int numTexGens; - int nNumChans; - INVTXSPEC hostinfo; // number of textures,colors,normals from vertex input - ColorChannel colChans[2]; //C0A0 C1A1 - TexCoordInfo texcoords[8]; - bool bEnableDualTexTransform; - float rawViewport[6]; - float rawProjection[7]; -}; - -#define XFMEM_SIZE 0x8000 -#define XFMEM_POSMATRICES 0x000 -#define XFMEM_POSMATRICES_END 0x100 -#define XFMEM_NORMALMATRICES 0x400 -#define XFMEM_NORMALMATRICES_END 0x460 -#define XFMEM_POSTMATRICES 0x500 -#define XFMEM_POSTMATRICES_END 0x600 -#define XFMEM_LIGHTS 0x600 -#define XFMEM_LIGHTS_END 0x680 - -struct Viewport -{ - float wd; - float ht; - float nearZ; - float xOrig; - float yOrig; - float farZ; -}; - -extern XFRegisters xfregs; -extern u32 xfmem[XFMEM_SIZE]; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _XFMEMORY_H +#define _XFMEMORY_H + +#include "Common.h" + +///////////// +// Lighting +///////////// + +#define XF_TEXPROJ_ST 0 +#define XF_TEXPROJ_STQ 1 + +#define XF_TEXINPUT_AB11 0 +#define XF_TEXINPUT_ABC1 1 + +#define XF_TEXGEN_REGULAR 0 +#define XF_TEXGEN_EMBOSS_MAP 1 // used when bump mapping +#define XF_TEXGEN_COLOR_STRGBC0 2 +#define XF_TEXGEN_COLOR_STRGBC1 3 + +#define XF_SRCGEOM_INROW 0 // input is abc +#define XF_SRCNORMAL_INROW 1 // input is abc +#define XF_SRCCOLORS_INROW 2 +#define XF_SRCBINORMAL_T_INROW 3 // input is abc +#define XF_SRCBINORMAL_B_INROW 4 // input is abc +#define XF_SRCTEX0_INROW 5 +#define XF_SRCTEX1_INROW 6 +#define XF_SRCTEX2_INROW 7 +#define XF_SRCTEX3_INROW 8 +#define XF_SRCTEX4_INROW 9 +#define XF_SRCTEX5_INROW 10 +#define XF_SRCTEX6_INROW 11 +#define XF_SRCTEX7_INROW 12 + +#define GX_SRC_REG 0 +#define GX_SRC_VTX 1 + +struct Light +{ + u32 useless[3]; + u32 color; //rgba + float a0; //attenuation + float a1; + float a2; + float k0; //k stuff + float k1; + float k2; + union + { + struct { + float dpos[3]; + float ddir[3]; // specular lights only + }; + struct { + float sdir[3]; + float shalfangle[3]; // specular lights only + }; + }; +}; + +#define LIGHTDIF_NONE 0 +#define LIGHTDIF_SIGN 1 +#define LIGHTDIF_CLAMP 2 + +#define LIGHTATTN_SPEC 0 // specular attenuation +#define LIGHTATTN_SPOT 1 // distance/spotlight attenuation +#define LIGHTATTN_NONE 2 +#define LIGHTATTN_DIR 3 + +union LitChannel +{ + struct + { + unsigned matsource : 1; + unsigned enablelighting : 1; + unsigned lightMask0_3 : 4; + unsigned ambsource : 1; + unsigned diffusefunc : 2; // LIGHTDIF_X + unsigned attnfunc : 2; // LIGHTATTN_X + unsigned lightMask4_7 : 4; + }; + struct + { + u32 hex : 15; + u32 unused : 17; + }; + struct + { + u32 dummy0 : 7; + u32 lightparams : 4; + u32 dummy1 : 21; + }; + unsigned int GetFullLightMask() const + { + return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0; + } +}; + +struct ColorChannel +{ + u32 ambColor; + u32 matColor; + LitChannel color; + LitChannel alpha; +}; + +union INVTXSPEC +{ + struct + { + unsigned numcolors : 2; + unsigned numnormals : 2; // 0 - nothing, 1 - just normal, 2 - normals and binormals + unsigned numtextures : 4; + unsigned unused : 24; + }; + u32 hex; +}; + +union TexMtxInfo +{ + struct + { + unsigned unknown : 1; + unsigned projection : 1; // XF_TEXPROJ_X + unsigned inputform : 2; // XF_TEXINPUT_X + unsigned texgentype : 3; // XF_TEXGEN_X + unsigned sourcerow : 5; // XF_SRCGEOM_X + unsigned embosssourceshift : 3; // what generated texcoord to use + unsigned embosslightshift : 3; // light index that is used + }; + u32 hex; +}; + +union PostMtxInfo +{ + struct + { + unsigned index : 6; // base row of dual transform matrix + unsigned unused : 2; + unsigned normalize : 1; // normalize before send operation + }; + u32 hex; +}; + +struct TexCoordInfo +{ + TexMtxInfo texmtxinfo; + PostMtxInfo postmtxinfo; +}; + +struct XFRegisters +{ + int numTexGens; + int nNumChans; + INVTXSPEC hostinfo; // number of textures,colors,normals from vertex input + ColorChannel colChans[2]; //C0A0 C1A1 + TexCoordInfo texcoords[8]; + bool bEnableDualTexTransform; + float rawViewport[6]; + float rawProjection[7]; +}; + +#define XFMEM_SIZE 0x8000 +#define XFMEM_POSMATRICES 0x000 +#define XFMEM_POSMATRICES_END 0x100 +#define XFMEM_NORMALMATRICES 0x400 +#define XFMEM_NORMALMATRICES_END 0x460 +#define XFMEM_POSTMATRICES 0x500 +#define XFMEM_POSTMATRICES_END 0x600 +#define XFMEM_LIGHTS 0x600 +#define XFMEM_LIGHTS_END 0x680 + +struct Viewport +{ + float wd; + float ht; + float nearZ; + float xOrig; + float yOrig; + float farZ; +}; + +extern XFRegisters xfregs; +extern u32 xfmem[XFMEM_SIZE]; + +#endif + diff --git a/Source/PluginSpecs/CommonTypes.h b/Source/PluginSpecs/CommonTypes.h index b5f260ae0a..984e176611 100644 --- a/Source/PluginSpecs/CommonTypes.h +++ b/Source/PluginSpecs/CommonTypes.h @@ -1,60 +1,60 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - - -// This header contains type definitions that are shared between the Dolphin -// core and the plugin specs. Any definitions that are only used by the core -// should be placed in "Common.h" instead. - -#ifndef _COMMONTYPES_H -#define _COMMONTYPES_H - -#ifdef _WIN32 - -#include - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -typedef signed __int8 s8; -typedef signed __int16 s16; -typedef signed __int32 s32; -typedef signed __int64 s64; - -#else - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -#if !defined(OSX64) -typedef unsigned int BOOL; -#endif -typedef unsigned long long u64; - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -#define TCHAR char - -#endif // _WIN32 - -#endif // _COMMONTYPES_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + + +// This header contains type definitions that are shared between the Dolphin +// core and the plugin specs. Any definitions that are only used by the core +// should be placed in "Common.h" instead. + +#ifndef _COMMONTYPES_H +#define _COMMONTYPES_H + +#ifdef _WIN32 + +#include + +typedef unsigned __int8 u8; +typedef unsigned __int16 u16; +typedef unsigned __int32 u32; +typedef unsigned __int64 u64; + +typedef signed __int8 s8; +typedef signed __int16 s16; +typedef signed __int32 s32; +typedef signed __int64 s64; + +#else + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +#if !defined(OSX64) +typedef unsigned int BOOL; +#endif +typedef unsigned long long u64; + +typedef char s8; +typedef short s16; +typedef int s32; +typedef long long s64; + +#define TCHAR char + +#endif // _WIN32 + +#endif // _COMMONTYPES_H diff --git a/Source/PluginSpecs/ExportEpilog.h b/Source/PluginSpecs/ExportEpilog.h index d3a9387023..43b80149ea 100644 --- a/Source/PluginSpecs/ExportEpilog.h +++ b/Source/PluginSpecs/ExportEpilog.h @@ -1,6 +1,6 @@ -#undef EXPORT -#undef CALL - -#if defined(__cplusplus) -} -#endif +#undef EXPORT +#undef CALL + +#if defined(__cplusplus) +} +#endif diff --git a/Source/PluginSpecs/ExportProlog.h b/Source/PluginSpecs/ExportProlog.h index 803f354742..99f5ca3064 100644 --- a/Source/PluginSpecs/ExportProlog.h +++ b/Source/PluginSpecs/ExportProlog.h @@ -1,15 +1,15 @@ -#ifdef _WIN32 - -#define EXPORT __declspec(dllexport) -#define CALL __cdecl - -#else - -#define EXPORT __attribute__ ((visibility("default"))) -#define CALL - -#endif - -#if defined(__cplusplus) -extern "C" { -#endif +#ifdef _WIN32 + +#define EXPORT __declspec(dllexport) +#define CALL __cdecl + +#else + +#define EXPORT __attribute__ ((visibility("default"))) +#define CALL + +#endif + +#if defined(__cplusplus) +extern "C" { +#endif diff --git a/Source/PluginSpecs/PluginSpecs.h b/Source/PluginSpecs/PluginSpecs.h index cbe2e60ddd..894215a299 100644 --- a/Source/PluginSpecs/PluginSpecs.h +++ b/Source/PluginSpecs/PluginSpecs.h @@ -1,79 +1,79 @@ -//__________________________________________________________________________________________________ -// Common plugin spec, version #1.0 maintained by F|RES -// - -#ifndef _PLUGINS_H_INCLUDED__ -#define _PLUGINS_H_INCLUDED__ - -#include "CommonTypes.h" - -#ifdef _WIN32 -#define EXPORT __declspec(dllexport) -#define CALL __cdecl -#else -#define EXPORT __attribute__ ((visibility("default"))) -#define CALL -#endif - -#ifdef _WIN32 - -#include - -#else - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -#define __cdecl - -// simulate something that looks like win32 -// long term, kill these - -// glxew defines BOOL. evil. -#ifdef BOOL -#undef BOOL -#endif - -#define BOOL unsigned int -#define HWND void* -#define HINSTANCE void* -#endif - -#if defined(__cplusplus) -extern "C" { -#endif - -// plugin types -#define PLUGIN_TYPE_VIDEO 1 -#define PLUGIN_TYPE_DVD 2 -#define PLUGIN_TYPE_PAD 3 -#define PLUGIN_TYPE_AUDIO 4 -#define PLUGIN_TYPE_COMPILER 5 -#define PLUGIN_TYPE_DSP 6 -#define PLUGIN_TYPE_WIIMOTE 7 - -#define STATE_MODE_READ 1 -#define STATE_MODE_WRITE 2 -#define STATE_MODE_MEASURE 3 - - -typedef struct -{ - u16 Version; // Set to 0x0100 - u16 Type; // Set to PLUGIN_TYPE_DVD - char Name[100]; // Name of the DLL -} PLUGIN_INFO; - -typedef struct -{ - HWND mainWindow; - HWND displayWindow; - HINSTANCE hInstance; -} OSData; - -#if defined(__cplusplus) -} -#endif -#endif +//__________________________________________________________________________________________________ +// Common plugin spec, version #1.0 maintained by F|RES +// + +#ifndef _PLUGINS_H_INCLUDED__ +#define _PLUGINS_H_INCLUDED__ + +#include "CommonTypes.h" + +#ifdef _WIN32 +#define EXPORT __declspec(dllexport) +#define CALL __cdecl +#else +#define EXPORT __attribute__ ((visibility("default"))) +#define CALL +#endif + +#ifdef _WIN32 + +#include + +#else + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#define __cdecl + +// simulate something that looks like win32 +// long term, kill these + +// glxew defines BOOL. evil. +#ifdef BOOL +#undef BOOL +#endif + +#define BOOL unsigned int +#define HWND void* +#define HINSTANCE void* +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +// plugin types +#define PLUGIN_TYPE_VIDEO 1 +#define PLUGIN_TYPE_DVD 2 +#define PLUGIN_TYPE_PAD 3 +#define PLUGIN_TYPE_AUDIO 4 +#define PLUGIN_TYPE_COMPILER 5 +#define PLUGIN_TYPE_DSP 6 +#define PLUGIN_TYPE_WIIMOTE 7 + +#define STATE_MODE_READ 1 +#define STATE_MODE_WRITE 2 +#define STATE_MODE_MEASURE 3 + + +typedef struct +{ + u16 Version; // Set to 0x0100 + u16 Type; // Set to PLUGIN_TYPE_DVD + char Name[100]; // Name of the DLL +} PLUGIN_INFO; + +typedef struct +{ + HWND mainWindow; + HWND displayWindow; + HINSTANCE hInstance; +} OSData; + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/Source/PluginSpecs/pluginspecs_dsp.h b/Source/PluginSpecs/pluginspecs_dsp.h index f634a0856e..6266411b01 100644 --- a/Source/PluginSpecs/pluginspecs_dsp.h +++ b/Source/PluginSpecs/pluginspecs_dsp.h @@ -1,149 +1,149 @@ -//__________________________________________________________________________________________________ -// Common dsp plugin spec, version #1.0 maintained by F|RES -// - -#ifndef _DSP_H_INCLUDED__ -#define _DSP_H_INCLUDED__ - -#include "PluginSpecs.h" -#include "ExportProlog.h" - -typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress); -typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress); -typedef unsigned char* (*TGetARAMPointer)(void); -typedef void (*TLogv)(const char* _szMessage, int _v); -typedef char* (*TName)(void); -typedef void (*TDebuggerBreak)(void); -typedef void (*TGenerateDSPInt)(void); -typedef unsigned int(*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples); - -typedef struct -{ - void* hWnd; - TARAM_Read_U8 pARAM_Read_U8; - TGetMemoryPointer pGetMemoryPointer; - TGetARAMPointer pGetARAMPointer; - TLogv pLog; - TName pName; - TDebuggerBreak pDebuggerBreak; - TGenerateDSPInt pGenerateDSPInterrupt; - TAudioGetStreaming pGetAudioStreaming; -} DSPInitialize; - -// __________________________________________________________________________________________________ -// Function: GetDllInfo -// Purpose: This function allows the emulator to gather information -// about the DLL by filling in the PluginInfo structure. -// input: a pointer to a PLUGIN_INFO structure that needs to be -// filled by the function. (see def above) -// output: none -// -EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); - -// __________________________________________________________________________________________________ -// Function: DllConfig -// Purpose: This function is optional function that is provided -// to allow the user to configure the DLL -// input: a handle to the window that calls this function -// output: none -// -EXPORT void CALL DllConfig(HWND _hParent); - -// __________________________________________________________________________________________________ -// Function: DllDebugger -// Purpose: Open the debugger -// input: a handle to the window that calls this function -// output: none -// -EXPORT void CALL DllDebugger(HWND _hParent, bool Show); - -// __________________________________________________________________________________________________ -// Function: DSP_Initialize -// Purpose: -// input: DSPInitialize -// output: none -// -EXPORT void CALL DSP_Initialize(DSPInitialize _dspInitialize); - -// __________________________________________________________________________________________________ -// Function: DSP_Shutdown -// Purpose: This function is called when the emulator is shutting down -// a game allowing the dll to de-initialise. -// input: none -// output: none -// -EXPORT void CALL DSP_Shutdown(void); - -// __________________________________________________________________________________________________ -// Function: DSP_ReadMailboxHigh -// Purpose: Send mail to high DSP Mailbox -// input: none -// output: none -// -EXPORT unsigned short CALL DSP_ReadMailboxHigh(bool _CPUMailbox); - -// __________________________________________________________________________________________________ -// Function: DSP_ReadMailboxLow -// Purpose: Send mail to low DSP Mailbox -// input: none -// output: none -// -EXPORT unsigned short CALL DSP_ReadMailboxLow(bool _CPUMailbox); - -// __________________________________________________________________________________________________ -// Function: DSP_WriteMailboxHigh -// Purpose: Send mail to high CPU Mailbox -// input: none -// output: none -// -EXPORT void CALL DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _uHighMail); - -// __________________________________________________________________________________________________ -// Function: DSP_WriteMailboxLow -// Purpose: Send mail to low CPU Mailbox -// input: none -// output: none -// -EXPORT void CALL DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _uLowMail); - -// __________________________________________________________________________________________________ -// Function: DSP_WriteControlRegister -// Purpose: This function is called if the core reads from the DSP control register -// input: Value to be written -// output: value of the control register -// -EXPORT unsigned short CALL DSP_WriteControlRegister(unsigned short _Value); - -// __________________________________________________________________________________________________ -// Function: DSP_ReadControlRegister -// Purpose: This function is called if the core reads from the DSP control register -// output: value of the control register -// -EXPORT unsigned short CALL DSP_ReadControlRegister(void); - -// __________________________________________________________________________________________________ -// Function: DSP_Update -// Purpose: This function is called from time to time from the core. -// input: cycles - run this number of DSP clock cycles. -// output: TRUE if the flag is set, else FALSE -// -EXPORT void CALL DSP_Update(int cycles); - -// __________________________________________________________________________________________________ -// Function: DSP_SendAIBuffer -// Purpose: This function sends the current AI Buffer to the DSP plugin -// input: _Address : Memory-Address -// input: _Size : Size of the Buffer (always 32) -// -EXPORT void CALL DSP_SendAIBuffer(unsigned int address, int sample_rate); - -// __________________________________________________________________________________________________ -// Function: DSP_DoState -// Purpose: Saves/load state -// input/output: ptr -// input: mode -// -EXPORT void CALL DSP_DoState(unsigned char **ptr, int mode); - -#include "ExportEpilog.h" -#endif +//__________________________________________________________________________________________________ +// Common dsp plugin spec, version #1.0 maintained by F|RES +// + +#ifndef _DSP_H_INCLUDED__ +#define _DSP_H_INCLUDED__ + +#include "PluginSpecs.h" +#include "ExportProlog.h" + +typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress); +typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress); +typedef unsigned char* (*TGetARAMPointer)(void); +typedef void (*TLogv)(const char* _szMessage, int _v); +typedef char* (*TName)(void); +typedef void (*TDebuggerBreak)(void); +typedef void (*TGenerateDSPInt)(void); +typedef unsigned int(*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples); + +typedef struct +{ + void* hWnd; + TARAM_Read_U8 pARAM_Read_U8; + TGetMemoryPointer pGetMemoryPointer; + TGetARAMPointer pGetARAMPointer; + TLogv pLog; + TName pName; + TDebuggerBreak pDebuggerBreak; + TGenerateDSPInt pGenerateDSPInterrupt; + TAudioGetStreaming pGetAudioStreaming; +} DSPInitialize; + +// __________________________________________________________________________________________________ +// Function: GetDllInfo +// Purpose: This function allows the emulator to gather information +// about the DLL by filling in the PluginInfo structure. +// input: a pointer to a PLUGIN_INFO structure that needs to be +// filled by the function. (see def above) +// output: none +// +EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); + +// __________________________________________________________________________________________________ +// Function: DllConfig +// Purpose: This function is optional function that is provided +// to allow the user to configure the DLL +// input: a handle to the window that calls this function +// output: none +// +EXPORT void CALL DllConfig(HWND _hParent); + +// __________________________________________________________________________________________________ +// Function: DllDebugger +// Purpose: Open the debugger +// input: a handle to the window that calls this function +// output: none +// +EXPORT void CALL DllDebugger(HWND _hParent, bool Show); + +// __________________________________________________________________________________________________ +// Function: DSP_Initialize +// Purpose: +// input: DSPInitialize +// output: none +// +EXPORT void CALL DSP_Initialize(DSPInitialize _dspInitialize); + +// __________________________________________________________________________________________________ +// Function: DSP_Shutdown +// Purpose: This function is called when the emulator is shutting down +// a game allowing the dll to de-initialise. +// input: none +// output: none +// +EXPORT void CALL DSP_Shutdown(void); + +// __________________________________________________________________________________________________ +// Function: DSP_ReadMailboxHigh +// Purpose: Send mail to high DSP Mailbox +// input: none +// output: none +// +EXPORT unsigned short CALL DSP_ReadMailboxHigh(bool _CPUMailbox); + +// __________________________________________________________________________________________________ +// Function: DSP_ReadMailboxLow +// Purpose: Send mail to low DSP Mailbox +// input: none +// output: none +// +EXPORT unsigned short CALL DSP_ReadMailboxLow(bool _CPUMailbox); + +// __________________________________________________________________________________________________ +// Function: DSP_WriteMailboxHigh +// Purpose: Send mail to high CPU Mailbox +// input: none +// output: none +// +EXPORT void CALL DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _uHighMail); + +// __________________________________________________________________________________________________ +// Function: DSP_WriteMailboxLow +// Purpose: Send mail to low CPU Mailbox +// input: none +// output: none +// +EXPORT void CALL DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _uLowMail); + +// __________________________________________________________________________________________________ +// Function: DSP_WriteControlRegister +// Purpose: This function is called if the core reads from the DSP control register +// input: Value to be written +// output: value of the control register +// +EXPORT unsigned short CALL DSP_WriteControlRegister(unsigned short _Value); + +// __________________________________________________________________________________________________ +// Function: DSP_ReadControlRegister +// Purpose: This function is called if the core reads from the DSP control register +// output: value of the control register +// +EXPORT unsigned short CALL DSP_ReadControlRegister(void); + +// __________________________________________________________________________________________________ +// Function: DSP_Update +// Purpose: This function is called from time to time from the core. +// input: cycles - run this number of DSP clock cycles. +// output: TRUE if the flag is set, else FALSE +// +EXPORT void CALL DSP_Update(int cycles); + +// __________________________________________________________________________________________________ +// Function: DSP_SendAIBuffer +// Purpose: This function sends the current AI Buffer to the DSP plugin +// input: _Address : Memory-Address +// input: _Size : Size of the Buffer (always 32) +// +EXPORT void CALL DSP_SendAIBuffer(unsigned int address, int sample_rate); + +// __________________________________________________________________________________________________ +// Function: DSP_DoState +// Purpose: Saves/load state +// input/output: ptr +// input: mode +// +EXPORT void CALL DSP_DoState(unsigned char **ptr, int mode); + +#include "ExportEpilog.h" +#endif diff --git a/Source/PluginSpecs/pluginspecs_pad.h b/Source/PluginSpecs/pluginspecs_pad.h index c0c6b9552a..f28930c056 100644 --- a/Source/PluginSpecs/pluginspecs_pad.h +++ b/Source/PluginSpecs/pluginspecs_pad.h @@ -1,127 +1,127 @@ -//__________________________________________________________________________________________________ -// Common pad plugin spec, version #1.0 maintained by F|RES -// - -#ifndef _PAD_H_INCLUDED__ -#define _PAD_H_INCLUDED__ - -#include "PluginSpecs.h" - -#include "ExportProlog.h" - -#define PAD_ERR_NONE 0 -#define PAD_ERR_NO_CONTROLLER -1 -#define PAD_ERR_NOT_READY -2 -#define PAD_ERR_TRANSFER -3 - -#define PAD_USE_ORIGIN 0x0080 -#define PAD_BUTTON_LEFT 0x0001 -#define PAD_BUTTON_RIGHT 0x0002 -#define PAD_BUTTON_DOWN 0x0004 -#define PAD_BUTTON_UP 0x0008 -#define PAD_TRIGGER_Z 0x0010 -#define PAD_TRIGGER_R 0x0020 -#define PAD_TRIGGER_L 0x0040 -#define PAD_BUTTON_A 0x0100 -#define PAD_BUTTON_B 0x0200 -#define PAD_BUTTON_X 0x0400 -#define PAD_BUTTON_Y 0x0800 -#define PAD_BUTTON_START 0x1000 - -typedef void (*TLog)(const char* _pMessage); - -typedef struct -{ - HWND hWnd; - TLog pLog; -} SPADInitialize; - -typedef struct -{ - unsigned short button; // Or-ed PAD_BUTTON_* bits - unsigned char stickX; // 0 <= stickX <= 255 - unsigned char stickY; // 0 <= stickY <= 255 - unsigned char substickX; // 0 <= substickX <= 255 - unsigned char substickY; // 0 <= substickY <= 255 - unsigned char triggerLeft; // 0 <= triggerLeft <= 255 - unsigned char triggerRight; // 0 <= triggerRight <= 255 - unsigned char analogA; // 0 <= analogA <= 255 - unsigned char analogB; // 0 <= analogB <= 255 - bool MicButton; - signed char err; // one of PAD_ERR_* number -} SPADStatus; - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////// - -// __________________________________________________________________________________________________ -// Function: GetDllInfo -// Purpose: This function allows the emulator to gather information -// about the DLL by filling in the PluginInfo structure. -// input: a pointer to a PLUGIN_INFO structure that needs to be -// filled by the function. (see def above) -// output: none -// -EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); - -// __________________________________________________________________________________________________ -// Function: DllConfig -// Purpose: This function is optional function that is provided -// to allow the user to configure the DLL -// input: a handle to the window that calls this function -// output: none -// -EXPORT void CALL DllConfig(HWND _hParent); - -// __________________________________________________________________________________________________ -// Function: -// Purpose: -// input: SPADInitialize -// output: none -// -EXPORT void CALL PAD_Initialize(SPADInitialize _PADInitialize); - -// __________________________________________________________________________________________________ -// Function: PAD_Shutdown -// Purpose: This function is called when the emulator is closing -// down allowing the DLL to de-initialise. -// input: none -// output: none -// -EXPORT void CALL PAD_Shutdown(); - -// __________________________________________________________________________________________________ -// Function: -// Purpose: -// input: -// output: -// -EXPORT void CALL PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus); - -// __________________________________________________________________________________________________ -// Function: PAD_Rumble -// Purpose: Pad rumble! -// input: PAD number, Command type (Stop=0, Rumble=1, Stop Hard=2) and strength of Rumble -// output: none -// -EXPORT void CALL PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength); - -// __________________________________________________________________________________________________ -// Function: PAD_GetAttachedPads -// Purpose: Get mask of attached pads (eg: controller 1 & 4 -> 0x9) -// input: none -// output: number of pads -// -EXPORT unsigned int CALL PAD_GetAttachedPads(); - -// __________________________________________________________________________________________________ -// Function: PAD_DoState -// Purpose: Saves/load state -// input/output: ptr -// input: mode -// -EXPORT void CALL PAD_DoState(void *ptr, int mode); - -#include "ExportEpilog.h" -#endif +//__________________________________________________________________________________________________ +// Common pad plugin spec, version #1.0 maintained by F|RES +// + +#ifndef _PAD_H_INCLUDED__ +#define _PAD_H_INCLUDED__ + +#include "PluginSpecs.h" + +#include "ExportProlog.h" + +#define PAD_ERR_NONE 0 +#define PAD_ERR_NO_CONTROLLER -1 +#define PAD_ERR_NOT_READY -2 +#define PAD_ERR_TRANSFER -3 + +#define PAD_USE_ORIGIN 0x0080 +#define PAD_BUTTON_LEFT 0x0001 +#define PAD_BUTTON_RIGHT 0x0002 +#define PAD_BUTTON_DOWN 0x0004 +#define PAD_BUTTON_UP 0x0008 +#define PAD_TRIGGER_Z 0x0010 +#define PAD_TRIGGER_R 0x0020 +#define PAD_TRIGGER_L 0x0040 +#define PAD_BUTTON_A 0x0100 +#define PAD_BUTTON_B 0x0200 +#define PAD_BUTTON_X 0x0400 +#define PAD_BUTTON_Y 0x0800 +#define PAD_BUTTON_START 0x1000 + +typedef void (*TLog)(const char* _pMessage); + +typedef struct +{ + HWND hWnd; + TLog pLog; +} SPADInitialize; + +typedef struct +{ + unsigned short button; // Or-ed PAD_BUTTON_* bits + unsigned char stickX; // 0 <= stickX <= 255 + unsigned char stickY; // 0 <= stickY <= 255 + unsigned char substickX; // 0 <= substickX <= 255 + unsigned char substickY; // 0 <= substickY <= 255 + unsigned char triggerLeft; // 0 <= triggerLeft <= 255 + unsigned char triggerRight; // 0 <= triggerRight <= 255 + unsigned char analogA; // 0 <= analogA <= 255 + unsigned char analogB; // 0 <= analogB <= 255 + bool MicButton; + signed char err; // one of PAD_ERR_* number +} SPADStatus; + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////// + +// __________________________________________________________________________________________________ +// Function: GetDllInfo +// Purpose: This function allows the emulator to gather information +// about the DLL by filling in the PluginInfo structure. +// input: a pointer to a PLUGIN_INFO structure that needs to be +// filled by the function. (see def above) +// output: none +// +EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); + +// __________________________________________________________________________________________________ +// Function: DllConfig +// Purpose: This function is optional function that is provided +// to allow the user to configure the DLL +// input: a handle to the window that calls this function +// output: none +// +EXPORT void CALL DllConfig(HWND _hParent); + +// __________________________________________________________________________________________________ +// Function: +// Purpose: +// input: SPADInitialize +// output: none +// +EXPORT void CALL PAD_Initialize(SPADInitialize _PADInitialize); + +// __________________________________________________________________________________________________ +// Function: PAD_Shutdown +// Purpose: This function is called when the emulator is closing +// down allowing the DLL to de-initialise. +// input: none +// output: none +// +EXPORT void CALL PAD_Shutdown(); + +// __________________________________________________________________________________________________ +// Function: +// Purpose: +// input: +// output: +// +EXPORT void CALL PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus); + +// __________________________________________________________________________________________________ +// Function: PAD_Rumble +// Purpose: Pad rumble! +// input: PAD number, Command type (Stop=0, Rumble=1, Stop Hard=2) and strength of Rumble +// output: none +// +EXPORT void CALL PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength); + +// __________________________________________________________________________________________________ +// Function: PAD_GetAttachedPads +// Purpose: Get mask of attached pads (eg: controller 1 & 4 -> 0x9) +// input: none +// output: number of pads +// +EXPORT unsigned int CALL PAD_GetAttachedPads(); + +// __________________________________________________________________________________________________ +// Function: PAD_DoState +// Purpose: Saves/load state +// input/output: ptr +// input: mode +// +EXPORT void CALL PAD_DoState(void *ptr, int mode); + +#include "ExportEpilog.h" +#endif diff --git a/Source/PluginSpecs/pluginspecs_video.h b/Source/PluginSpecs/pluginspecs_video.h index 567904ec6c..f0939b43aa 100644 --- a/Source/PluginSpecs/pluginspecs_video.h +++ b/Source/PluginSpecs/pluginspecs_video.h @@ -1,199 +1,199 @@ -//__________________________________________________________________________________________________ -// Common video plugin spec, version #1.0 maintained by F|RES -// - -#ifndef _VIDEO_H_INCLUDED__ -#define _VIDEO_H_INCLUDED__ - -#include "Thread.h" -#include "PluginSpecs.h" - -#include "ExportProlog.h" - - -typedef void (*TSetPEToken)(const unsigned short _token, const int _bSetTokenAcknowledge); -typedef void (*TSetPEFinish)(void); -typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _iAddress); -typedef void (*TVideoLog)(const char* _pMessage, BOOL _bBreak); -typedef void (*TSysMessage)(const char *fmt, ...); -typedef void (*TRequestWindowSize)(int _iWidth, int _iHeight, BOOL _bFullscreen); -typedef void (*TCopiedToXFB)(void); -typedef BOOL (*TPeekMessages)(void); -typedef void (*TUpdateInterrupts)(void); -typedef void (*TUpdateFPSDisplay)(const char* text); // sets the window title -typedef void (*TKeyPressed)(int keycode, BOOL shift, BOOL control); // sets the window title - -typedef struct -{ - // fifo registers - volatile u32 CPBase; - volatile u32 CPEnd; - u32 CPHiWatermark; - u32 CPLoWatermark; - volatile u32 CPReadWriteDistance; - volatile u32 CPWritePointer; - volatile u32 CPReadPointer; - volatile u32 CPBreakpoint; - - // Super Monkey Ball Adventure require this. - // Because the read&check-PEToken-loop stays in its JITed block I suppose. - // So no possiblity to ack the Token irq by the scheduler until some sort of PPC watchdog do its mess. - volatile u16 PEToken; - - volatile BOOL bFF_GPReadEnable; - volatile BOOL bFF_BPEnable; - volatile BOOL bFF_GPLinkEnable; - volatile BOOL bFF_Breakpoint; - - volatile BOOL CPCmdIdle; - volatile BOOL CPReadIdle; - - // for GP watchdog hack - volatile u32 Fake_GPWDToken; // cicular incrementer -} SCPFifoStruct; - -typedef struct -{ - void *pWindowHandle; - - TSetPEToken pSetPEToken; - TSetPEFinish pSetPEFinish; - TGetMemoryPointer pGetMemoryPointer; - TVideoLog pLog; - TSysMessage pSysMessage; - TRequestWindowSize pRequestWindowSize; - TCopiedToXFB pCopiedToXFB; - TPeekMessages pPeekMessages; - TUpdateInterrupts pUpdateInterrupts; - TUpdateFPSDisplay pUpdateFPSDisplay; - TKeyPressed pKeyPress; - - SCPFifoStruct *pCPFifo; - unsigned char *pVIRegs; - void *pMemoryBase; - bool bWii; -} SVideoInitialize; - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////// - -// __________________________________________________________________________________________________ -// Function: GetDllInfo -// Purpose: This function allows the emulator to gather information -// about the DLL by filling in the PluginInfo structure. -// input: a pointer to a PLUGIN_INFO structure that needs to be -// filled by the function. (see def above) -// output: none -// -// -#ifndef _WIN32 -#define _CDECLCALL -#endif - -EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); - -// __________________________________________________________________________________________________ -// Function: DllConfig -// Purpose: This function is optional function that is provided -// to allow the user to configure the DLL -// input: a handle to the window that calls this function -// output: none -// -EXPORT void CALL DllConfig(HWND _hParent); - -// __________________________________________________________________________________________________ -// Function: DllDebugger -// Purpose: Open the debugger -// input: a handle to the window that calls this function -// output: none -// -EXPORT void CALL DllDebugger(HWND _hParent, bool Show); - -// __________________________________________________________________________________________________ -// Function: Video_Initialize -// Purpose: -// input: SVideoInitialize* - pointer because window data will be passed back -// output: none -// -EXPORT void CALL Video_Initialize(SVideoInitialize* _pvideoInitialize); - -// __________________________________________________________________________________________________ -// Function: Video_Prepare -// Purpose: This function is called from the EmuThread before the -// emulation has started. It is just for threadsensitive -// APIs like OpenGL. -// input: none -// output: none -// -EXPORT void CALL Video_Prepare(void); - -// __________________________________________________________________________________________________ -// Function: Video_Shutdown -// Purpose: This function is called when the emulator is shutting down -// a game allowing the dll to de-initialise. -// input: none -// output: none -// -EXPORT void CALL Video_Shutdown(void); - -// __________________________________________________________________________________________________ -// Function: Video_ExecuteFifoBuffer -// Purpose: This function is called if data is inside the fifo-buffer -// input: a data-byte (i know we have to optimize this ;-)) -// output: none -// -EXPORT void CALL Video_SendFifoData(u8* _uData, u32 len); - -// __________________________________________________________________________________________________ -// Function: Video_UpdateXFB -// Purpose: This fucntion is called when you have to flip the yuv2 -// video-buffer. You should ignore this function after you -// got the first EFB to XFB copy. -// input: pointer to the XFB, width and height of the XFB -// output: none -// -EXPORT void CALL Video_UpdateXFB(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset); - -// __________________________________________________________________________________________________ -// Function: Video_Screenshot -// Purpose: This fucntion is called when you want to do a screenshot -// input: Filename -// output: TRUE if all was okay -// -EXPORT BOOL CALL Video_Screenshot(TCHAR* _szFilename); - -// __________________________________________________________________________________________________ -// Function: Video_EnterLoop -// Purpose: FIXME! -// input: none -// output: none -// -EXPORT void CALL Video_EnterLoop(void); - -// __________________________________________________________________________________________________ -// Function: Video_AddMessage -// Purpose: Adds a message to the display queue, to be shown forthe specified time -// input: pointer to the null-terminated string, time in milliseconds -// output: none -// -EXPORT void CALL Video_AddMessage(const char* pstr, unsigned int milliseconds); - -// __________________________________________________________________________________________________ -// Function: Video_DoState -// Purpose: Saves/Loads the current video data state (depends on mode parameter) -// input/output: ptr -// input: mode -// -EXPORT void CALL Video_DoState(unsigned char **ptr, int mode); - -// __________________________________________________________________________________________________ -// Function: Video_Stop -// Purpose: Stop the video plugin before shutdown -// input/output: -// input: -// -EXPORT void CALL Video_Stop(); - -#include "ExportEpilog.h" -#endif +//__________________________________________________________________________________________________ +// Common video plugin spec, version #1.0 maintained by F|RES +// + +#ifndef _VIDEO_H_INCLUDED__ +#define _VIDEO_H_INCLUDED__ + +#include "Thread.h" +#include "PluginSpecs.h" + +#include "ExportProlog.h" + + +typedef void (*TSetPEToken)(const unsigned short _token, const int _bSetTokenAcknowledge); +typedef void (*TSetPEFinish)(void); +typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _iAddress); +typedef void (*TVideoLog)(const char* _pMessage, BOOL _bBreak); +typedef void (*TSysMessage)(const char *fmt, ...); +typedef void (*TRequestWindowSize)(int _iWidth, int _iHeight, BOOL _bFullscreen); +typedef void (*TCopiedToXFB)(void); +typedef BOOL (*TPeekMessages)(void); +typedef void (*TUpdateInterrupts)(void); +typedef void (*TUpdateFPSDisplay)(const char* text); // sets the window title +typedef void (*TKeyPressed)(int keycode, BOOL shift, BOOL control); // sets the window title + +typedef struct +{ + // fifo registers + volatile u32 CPBase; + volatile u32 CPEnd; + u32 CPHiWatermark; + u32 CPLoWatermark; + volatile u32 CPReadWriteDistance; + volatile u32 CPWritePointer; + volatile u32 CPReadPointer; + volatile u32 CPBreakpoint; + + // Super Monkey Ball Adventure require this. + // Because the read&check-PEToken-loop stays in its JITed block I suppose. + // So no possiblity to ack the Token irq by the scheduler until some sort of PPC watchdog do its mess. + volatile u16 PEToken; + + volatile BOOL bFF_GPReadEnable; + volatile BOOL bFF_BPEnable; + volatile BOOL bFF_GPLinkEnable; + volatile BOOL bFF_Breakpoint; + + volatile BOOL CPCmdIdle; + volatile BOOL CPReadIdle; + + // for GP watchdog hack + volatile u32 Fake_GPWDToken; // cicular incrementer +} SCPFifoStruct; + +typedef struct +{ + void *pWindowHandle; + + TSetPEToken pSetPEToken; + TSetPEFinish pSetPEFinish; + TGetMemoryPointer pGetMemoryPointer; + TVideoLog pLog; + TSysMessage pSysMessage; + TRequestWindowSize pRequestWindowSize; + TCopiedToXFB pCopiedToXFB; + TPeekMessages pPeekMessages; + TUpdateInterrupts pUpdateInterrupts; + TUpdateFPSDisplay pUpdateFPSDisplay; + TKeyPressed pKeyPress; + + SCPFifoStruct *pCPFifo; + unsigned char *pVIRegs; + void *pMemoryBase; + bool bWii; +} SVideoInitialize; + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////// + +// __________________________________________________________________________________________________ +// Function: GetDllInfo +// Purpose: This function allows the emulator to gather information +// about the DLL by filling in the PluginInfo structure. +// input: a pointer to a PLUGIN_INFO structure that needs to be +// filled by the function. (see def above) +// output: none +// +// +#ifndef _WIN32 +#define _CDECLCALL +#endif + +EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); + +// __________________________________________________________________________________________________ +// Function: DllConfig +// Purpose: This function is optional function that is provided +// to allow the user to configure the DLL +// input: a handle to the window that calls this function +// output: none +// +EXPORT void CALL DllConfig(HWND _hParent); + +// __________________________________________________________________________________________________ +// Function: DllDebugger +// Purpose: Open the debugger +// input: a handle to the window that calls this function +// output: none +// +EXPORT void CALL DllDebugger(HWND _hParent, bool Show); + +// __________________________________________________________________________________________________ +// Function: Video_Initialize +// Purpose: +// input: SVideoInitialize* - pointer because window data will be passed back +// output: none +// +EXPORT void CALL Video_Initialize(SVideoInitialize* _pvideoInitialize); + +// __________________________________________________________________________________________________ +// Function: Video_Prepare +// Purpose: This function is called from the EmuThread before the +// emulation has started. It is just for threadsensitive +// APIs like OpenGL. +// input: none +// output: none +// +EXPORT void CALL Video_Prepare(void); + +// __________________________________________________________________________________________________ +// Function: Video_Shutdown +// Purpose: This function is called when the emulator is shutting down +// a game allowing the dll to de-initialise. +// input: none +// output: none +// +EXPORT void CALL Video_Shutdown(void); + +// __________________________________________________________________________________________________ +// Function: Video_ExecuteFifoBuffer +// Purpose: This function is called if data is inside the fifo-buffer +// input: a data-byte (i know we have to optimize this ;-)) +// output: none +// +EXPORT void CALL Video_SendFifoData(u8* _uData, u32 len); + +// __________________________________________________________________________________________________ +// Function: Video_UpdateXFB +// Purpose: This fucntion is called when you have to flip the yuv2 +// video-buffer. You should ignore this function after you +// got the first EFB to XFB copy. +// input: pointer to the XFB, width and height of the XFB +// output: none +// +EXPORT void CALL Video_UpdateXFB(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset); + +// __________________________________________________________________________________________________ +// Function: Video_Screenshot +// Purpose: This fucntion is called when you want to do a screenshot +// input: Filename +// output: TRUE if all was okay +// +EXPORT BOOL CALL Video_Screenshot(TCHAR* _szFilename); + +// __________________________________________________________________________________________________ +// Function: Video_EnterLoop +// Purpose: FIXME! +// input: none +// output: none +// +EXPORT void CALL Video_EnterLoop(void); + +// __________________________________________________________________________________________________ +// Function: Video_AddMessage +// Purpose: Adds a message to the display queue, to be shown forthe specified time +// input: pointer to the null-terminated string, time in milliseconds +// output: none +// +EXPORT void CALL Video_AddMessage(const char* pstr, unsigned int milliseconds); + +// __________________________________________________________________________________________________ +// Function: Video_DoState +// Purpose: Saves/Loads the current video data state (depends on mode parameter) +// input/output: ptr +// input: mode +// +EXPORT void CALL Video_DoState(unsigned char **ptr, int mode); + +// __________________________________________________________________________________________________ +// Function: Video_Stop +// Purpose: Stop the video plugin before shutdown +// input/output: +// input: +// +EXPORT void CALL Video_Stop(); + +#include "ExportEpilog.h" +#endif diff --git a/Source/PluginSpecs/pluginspecs_wiimote.h b/Source/PluginSpecs/pluginspecs_wiimote.h index 3aa72b502e..e9c9accabf 100644 --- a/Source/PluginSpecs/pluginspecs_wiimote.h +++ b/Source/PluginSpecs/pluginspecs_wiimote.h @@ -1,109 +1,109 @@ -//__________________________________________________________________________________________________ -// Common wiimote plugin spec, unversioned -// - -#ifndef _WIIMOTE_H_INCLUDED__ -#define _WIIMOTE_H_INCLUDED__ - -#include "PluginSpecs.h" -#include "ExportProlog.h" - -typedef void (*TLogv)(const char* _pMessage, int _v); - -// Called when the Wiimote sends input reports to the Core. -// Payload: an L2CAP packet. -typedef void (*TWiimoteInput)(u16 _channelID, const void* _pData, u32 _Size); - -// This data is passed from the core on initialization. -typedef struct -{ - HWND hWnd; - TLogv pLog; - TWiimoteInput pWiimoteInput; -} SWiimoteInitialize; - -///////////////////////////////////////////////////////////////////////////////////////////////////// -// I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////// - -// __________________________________________________________________________________________________ -// Function: GetDllInfo -// Purpose: This function allows the emulator to gather information -// about the DLL by filling in the PluginInfo structure. -// input: a pointer to a PLUGIN_INFO structure that needs to be -// filled by the function. (see def above) -// output: none -// -EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); - -// __________________________________________________________________________________________________ -// Function: DllConfig -// Purpose: This function is optional function that is provided -// to allow the user to configure the DLL -// input: a handle to the window that calls this function -// output: none -// -EXPORT void CALL DllConfig(HWND _hParent); - -// __________________________________________________________________________________________________ -// Function: -// Purpose: -// input: WiimoteInitialize -// output: none -// -EXPORT void CALL Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize); - -// __________________________________________________________________________________________________ -// Function: Wiimote_Shutdown -// Purpose: This function is called when the emulator is closing -// down allowing the DLL to de-initialise. -// input: none -// output: none -// -EXPORT void CALL Wiimote_Shutdown(); - -// __________________________________________________________________________________________________ -// Function: Wiimote_Output -// Purpose: An L2CAP packet is passed from the Core to the Wiimote, -// on the HID CONTROL channel. -// input: Da pakket. -// output: none -// -EXPORT void CALL Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size); - -// __________________________________________________________________________________________________ -// Function: Wiimote_Input -// Purpose: An L2CAP packet is passed from the Core to the Wiimote, -// on the HID INTERRUPT channel. -// input: Da pakket. -// output: none -// -EXPORT void CALL Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size); - -// __________________________________________________________________________________________________ -// Function: Wiimote_Update -// Purpose: This function is called periodically by the Core. -// input: none -// output: none -// -EXPORT void CALL Wiimote_Update(); - -// __________________________________________________________________________________________________ -// Function: PAD_GetAttachedPads -// Purpose: Get mask of attached pads (eg: controller 1 & 4 -> 0x9) -// input: none -// output: number of pads -// -EXPORT unsigned int CALL Wiimote_GetAttachedControllers(); - -// __________________________________________________________________________________________________ -// Function: Wiimote_DoState -// Purpose: Saves/load state -// input/output: ptr -// input: mode -// -EXPORT void CALL Wiimote_DoState(void *ptr, int mode); - -#include "ExportEpilog.h" - -#endif //_WIIMOTE_H_INCLUDED__ +//__________________________________________________________________________________________________ +// Common wiimote plugin spec, unversioned +// + +#ifndef _WIIMOTE_H_INCLUDED__ +#define _WIIMOTE_H_INCLUDED__ + +#include "PluginSpecs.h" +#include "ExportProlog.h" + +typedef void (*TLogv)(const char* _pMessage, int _v); + +// Called when the Wiimote sends input reports to the Core. +// Payload: an L2CAP packet. +typedef void (*TWiimoteInput)(u16 _channelID, const void* _pData, u32 _Size); + +// This data is passed from the core on initialization. +typedef struct +{ + HWND hWnd; + TLogv pLog; + TWiimoteInput pWiimoteInput; +} SWiimoteInitialize; + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////// + +// __________________________________________________________________________________________________ +// Function: GetDllInfo +// Purpose: This function allows the emulator to gather information +// about the DLL by filling in the PluginInfo structure. +// input: a pointer to a PLUGIN_INFO structure that needs to be +// filled by the function. (see def above) +// output: none +// +EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); + +// __________________________________________________________________________________________________ +// Function: DllConfig +// Purpose: This function is optional function that is provided +// to allow the user to configure the DLL +// input: a handle to the window that calls this function +// output: none +// +EXPORT void CALL DllConfig(HWND _hParent); + +// __________________________________________________________________________________________________ +// Function: +// Purpose: +// input: WiimoteInitialize +// output: none +// +EXPORT void CALL Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize); + +// __________________________________________________________________________________________________ +// Function: Wiimote_Shutdown +// Purpose: This function is called when the emulator is closing +// down allowing the DLL to de-initialise. +// input: none +// output: none +// +EXPORT void CALL Wiimote_Shutdown(); + +// __________________________________________________________________________________________________ +// Function: Wiimote_Output +// Purpose: An L2CAP packet is passed from the Core to the Wiimote, +// on the HID CONTROL channel. +// input: Da pakket. +// output: none +// +EXPORT void CALL Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size); + +// __________________________________________________________________________________________________ +// Function: Wiimote_Input +// Purpose: An L2CAP packet is passed from the Core to the Wiimote, +// on the HID INTERRUPT channel. +// input: Da pakket. +// output: none +// +EXPORT void CALL Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size); + +// __________________________________________________________________________________________________ +// Function: Wiimote_Update +// Purpose: This function is called periodically by the Core. +// input: none +// output: none +// +EXPORT void CALL Wiimote_Update(); + +// __________________________________________________________________________________________________ +// Function: PAD_GetAttachedPads +// Purpose: Get mask of attached pads (eg: controller 1 & 4 -> 0x9) +// input: none +// output: number of pads +// +EXPORT unsigned int CALL Wiimote_GetAttachedControllers(); + +// __________________________________________________________________________________________________ +// Function: Wiimote_DoState +// Purpose: Saves/load state +// input/output: ptr +// input: mode +// +EXPORT void CALL Wiimote_DoState(void *ptr, int mode); + +#include "ExportEpilog.h" + +#endif //_WIIMOTE_H_INCLUDED__ diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h index b41635b104..7877735fd9 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h @@ -1,43 +1,43 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _CONFIG_H -#define _CONFIG_H - -#include - -struct CConfig -{ - bool m_EnableHLEAudio; - bool m_EnableDTKMusic; - bool m_EnableThrottle; - bool m_Interpolation; - int m_SampleRate; - - CConfig(); - - void LoadDefaults(); - - void Load(); - - void Save(); -}; - -extern CConfig g_Config; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _CONFIG_H +#define _CONFIG_H + +#include + +struct CConfig +{ + bool m_EnableHLEAudio; + bool m_EnableDTKMusic; + bool m_EnableThrottle; + bool m_Interpolation; + int m_SampleRate; + + CConfig(); + + void LoadDefaults(); + + void Load(); + + void Save(); +}; + +extern CConfig g_Config; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h index a80b280b93..b40e3ced89 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h @@ -1,50 +1,50 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -class CConfigDlg - : public CDialogImpl -{ - public: - - enum { IDD = IDD_SETTINGS }; - - BEGIN_MSG_MAP(CConfigDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - COMMAND_ID_HANDLER(IDOK, OnCloseCmd) - COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) - END_MSG_MAP() - - private: - - CButton m_buttonEnableHLEAudio; - CButton m_buttonEnableDTKMusic; - CButton m_buttonEnableThrottle; - CButton m_buttonDumpSamples; - CButton m_buttonAntiGap; - CEdit m_editDumpSamplePath; - CComboBox m_comboSampleRate; - - // Handler prototypes (uncomment arguments if needed): - // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) - // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); - LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); -}; +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +class CConfigDlg + : public CDialogImpl +{ + public: + + enum { IDD = IDD_SETTINGS }; + + BEGIN_MSG_MAP(CConfigDlg) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_ID_HANDLER(IDOK, OnCloseCmd) + COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) + END_MSG_MAP() + + private: + + CButton m_buttonEnableHLEAudio; + CButton m_buttonEnableDTKMusic; + CButton m_buttonEnableThrottle; + CButton m_buttonDumpSamples; + CButton m_buttonAntiGap; + CEdit m_editDumpSamplePath; + CComboBox m_comboSampleRate; + + // Handler prototypes (uncomment arguments if needed): + // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); + LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); +}; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/DSPHandler.h b/Source/Plugins/Plugin_DSP_HLE/Src/DSPHandler.h index 1b5030b129..e710d4a502 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/DSPHandler.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/DSPHandler.h @@ -1,99 +1,99 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DSPHANDLER_H -#define _DSPHANDLER_H - -#include "Common.h" -#include "MailHandler.h" -#include "UCodes/UCodes.h" - -class CDSPHandler -{ -public: - void Update(); - unsigned short WriteControlRegister(unsigned short _Value); - unsigned short ReadControlRegister(); - void SendMailToDSP(u32 _uMail); - IUCode* GetUCode(); - void SetUCode(u32 _crc); - - CMailHandler& AccessMailHandler() { return m_MailHandler; } - - static CDSPHandler& GetInstance() - { - return *m_pInstance; - } - - static void Destroy() - { - delete m_pInstance; - m_pInstance = NULL; - } - - static CDSPHandler& CreateInstance() - { - if (!m_pInstance) - m_pInstance = new CDSPHandler(); - - return *m_pInstance; - } - -private: - CDSPHandler(); - ~CDSPHandler(); - - // UDSPControl - union UDSPControl - { - u16 Hex; - struct - { - unsigned DSPReset : 1; // Write 1 to reset and waits for 0 - unsigned DSPAssertInt : 1; - unsigned DSPHalt : 1; - - unsigned AI : 1; - unsigned AI_mask : 1; - unsigned ARAM : 1; - unsigned ARAM_mask : 1; - unsigned DSP : 1; - unsigned DSP_mask : 1; - - unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag - unsigned DSPInitCode : 1; - unsigned DSPInit : 1; // DSPInit() writes to this flag - unsigned pad : 4; - }; - - UDSPControl(u16 _Hex = 0) - : Hex(_Hex) - {} - }; - - // singleton instance - static CDSPHandler* m_pInstance; - - IUCode* m_pUCode; - UDSPControl m_DSPControl; - CMailHandler m_MailHandler; - - bool m_bHalt; - bool m_bAssertInt; -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DSPHANDLER_H +#define _DSPHANDLER_H + +#include "Common.h" +#include "MailHandler.h" +#include "UCodes/UCodes.h" + +class CDSPHandler +{ +public: + void Update(); + unsigned short WriteControlRegister(unsigned short _Value); + unsigned short ReadControlRegister(); + void SendMailToDSP(u32 _uMail); + IUCode* GetUCode(); + void SetUCode(u32 _crc); + + CMailHandler& AccessMailHandler() { return m_MailHandler; } + + static CDSPHandler& GetInstance() + { + return *m_pInstance; + } + + static void Destroy() + { + delete m_pInstance; + m_pInstance = NULL; + } + + static CDSPHandler& CreateInstance() + { + if (!m_pInstance) + m_pInstance = new CDSPHandler(); + + return *m_pInstance; + } + +private: + CDSPHandler(); + ~CDSPHandler(); + + // UDSPControl + union UDSPControl + { + u16 Hex; + struct + { + unsigned DSPReset : 1; // Write 1 to reset and waits for 0 + unsigned DSPAssertInt : 1; + unsigned DSPHalt : 1; + + unsigned AI : 1; + unsigned AI_mask : 1; + unsigned ARAM : 1; + unsigned ARAM_mask : 1; + unsigned DSP : 1; + unsigned DSP_mask : 1; + + unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag + unsigned DSPInitCode : 1; + unsigned DSPInit : 1; // DSPInit() writes to this flag + unsigned pad : 4; + }; + + UDSPControl(u16 _Hex = 0) + : Hex(_Hex) + {} + }; + + // singleton instance + static CDSPHandler* m_pInstance; + + IUCode* m_pUCode; + UDSPControl m_DSPControl; + CMailHandler m_MailHandler; + + bool m_bHalt; + bool m_bAssertInt; +}; + +#endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h index 51c1d04d58..2a50d97bc5 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h @@ -1,172 +1,172 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef __CDebugger_h__ -#define __CDebugger_h__ - -// general things -#include -#include - -// wx stuff, I'm not sure if we use all these -#ifndef WX_PRECOMP - #include - #include -#else - #include -#endif - -#include -#include -#include -#include -#include // for the timestamps - -#include -#include -#include -#include -#include - -#include "../Globals.h" - -class CPBView; -class IniFile; - -// Window settings -#undef CDebugger_STYLE -#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE - -class CDebugger : public wxDialog -{ - private: - DECLARE_EVENT_TABLE(); - - public: - CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"), - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = CDebugger_STYLE); - - virtual ~CDebugger(); - - void Save(IniFile& _IniFile) const; - void Load(IniFile& _IniFile); - void DoHide(); void DoShow(); - - void NotifyUpdate(); - void OnUpdate(wxCommandEvent& event); - - void ShowHideConsole(wxCommandEvent& event); // options - void ShowBase(wxCommandEvent& event); - void DoShowHideConsole(); - //void OnlyLooping(wxCommandEvent& event); - void OnOptions(wxCommandEvent& event); - void OnShowAll(wxCommandEvent& event); - - void ChangeFrequency(wxCommandEvent& event); // update frequency - void DoChangeFrequency(); - void ChangePreset(wxCommandEvent& event); - void DoChangePreset(); - - void OnSettingsCheck(wxCommandEvent& event); // settings - - // ============== Mail - void DoUpdateMail(); - void UpdateMail(wxNotebookEvent& event); - void ChangeMail(wxCommandEvent& event); - void ReadDir(); - bool NoDuplicate(std::string FileName); - void OnGameChange(wxCommandEvent& event); - void MailSettings(wxCommandEvent& event); - void Readfile(std::string FileName, bool GC); - std::string Readfile_(std::string FileName); - u32 CountFiles(std::string FileName); - - // ============== Blocks - void DoScrollBlocks(); - void ScrollBlocksMouse(wxMouseEvent& event); - void ScrollBlocksCursor(wxScrollWinEvent& event); - - - CPBView* m_GPRListView; - std::vector sMail, sMailEnd, sFullMail; - wxRadioBox * m_RadioBox[4], * m_RadioBoxShowAll; - - bool gSaveFile; // main options - bool gOnlyLooping; - bool gShowAll; - int giShowAll; - int gUpdFreq;// main update freq. - int gPreset; // main presets - bool bShowBase; // main presets - u32 gLastBlock; - - bool ScanMails; // mail settings - bool StoreMails; - - bool upd95; bool upd94; bool upd93; bool upd92; // block view settings - std::string str0; std::string str95; std::string str94; std::string str93; std::string str92; - std::vector PBn; std::vector PBp; - - // members - wxTextCtrl * m_log, * m_log1, // mail - * m_bl0, * m_bl95, * m_bl94; // blocks - - private: - - // declarations - wxNotebook *m_Notebook; // notebook - wxPanel *m_PageMain, *m_PageMail, *m_PageBlock; - - wxCheckBox *m_Check[9]; - wxRadioButton *m_Radio[5]; - wxCheckListBox * m_options, * m_opt_showall, * m_settings, * m_gc, * m_wii, * m_gcwiiset; - wxPanel *m_Controller; - - std::vector all_all_files, all_files, gc_files, wii_files; - - // WARNING: Make sure these are not also elsewhere, for example in resource.h. - enum - { - IDC_CHECK0 = 2000, - IDC_CHECK1, - IDC_CHECK2, - IDC_CHECK3, - IDC_CHECK4, - IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, IDC_CHECKLIST5, IDC_CHECKLIST6, - IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4, - IDG_LABEL1, IDG_LABEL2, - ID_UPD, - ID_SELC, - ID_PRESETS, - ID_GPR, - ID_NOTEBOOK, ID_PAGEMAIN, ID_PAGEMAIL, ID_PAGEBLOCK, // notebook - ID_LOG, ID_LOG1, // mails - ID_BL0, ID_BL95, ID_BL94, ID_BL93, ID_BL92, - ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values - - }; - - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); -}; - -#endif +////////////////////////////////////////////////////////////////////////////////////////// +// +// Licensetype: GNU General Public License (GPL) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. +// +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ +// +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// +////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef __CDebugger_h__ +#define __CDebugger_h__ + +// general things +#include +#include + +// wx stuff, I'm not sure if we use all these +#ifndef WX_PRECOMP + #include + #include +#else + #include +#endif + +#include +#include +#include +#include +#include // for the timestamps + +#include +#include +#include +#include +#include + +#include "../Globals.h" + +class CPBView; +class IniFile; + +// Window settings +#undef CDebugger_STYLE +#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE + +class CDebugger : public wxDialog +{ + private: + DECLARE_EVENT_TABLE(); + + public: + CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"), + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = CDebugger_STYLE); + + virtual ~CDebugger(); + + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + void DoHide(); void DoShow(); + + void NotifyUpdate(); + void OnUpdate(wxCommandEvent& event); + + void ShowHideConsole(wxCommandEvent& event); // options + void ShowBase(wxCommandEvent& event); + void DoShowHideConsole(); + //void OnlyLooping(wxCommandEvent& event); + void OnOptions(wxCommandEvent& event); + void OnShowAll(wxCommandEvent& event); + + void ChangeFrequency(wxCommandEvent& event); // update frequency + void DoChangeFrequency(); + void ChangePreset(wxCommandEvent& event); + void DoChangePreset(); + + void OnSettingsCheck(wxCommandEvent& event); // settings + + // ============== Mail + void DoUpdateMail(); + void UpdateMail(wxNotebookEvent& event); + void ChangeMail(wxCommandEvent& event); + void ReadDir(); + bool NoDuplicate(std::string FileName); + void OnGameChange(wxCommandEvent& event); + void MailSettings(wxCommandEvent& event); + void Readfile(std::string FileName, bool GC); + std::string Readfile_(std::string FileName); + u32 CountFiles(std::string FileName); + + // ============== Blocks + void DoScrollBlocks(); + void ScrollBlocksMouse(wxMouseEvent& event); + void ScrollBlocksCursor(wxScrollWinEvent& event); + + + CPBView* m_GPRListView; + std::vector sMail, sMailEnd, sFullMail; + wxRadioBox * m_RadioBox[4], * m_RadioBoxShowAll; + + bool gSaveFile; // main options + bool gOnlyLooping; + bool gShowAll; + int giShowAll; + int gUpdFreq;// main update freq. + int gPreset; // main presets + bool bShowBase; // main presets + u32 gLastBlock; + + bool ScanMails; // mail settings + bool StoreMails; + + bool upd95; bool upd94; bool upd93; bool upd92; // block view settings + std::string str0; std::string str95; std::string str94; std::string str93; std::string str92; + std::vector PBn; std::vector PBp; + + // members + wxTextCtrl * m_log, * m_log1, // mail + * m_bl0, * m_bl95, * m_bl94; // blocks + + private: + + // declarations + wxNotebook *m_Notebook; // notebook + wxPanel *m_PageMain, *m_PageMail, *m_PageBlock; + + wxCheckBox *m_Check[9]; + wxRadioButton *m_Radio[5]; + wxCheckListBox * m_options, * m_opt_showall, * m_settings, * m_gc, * m_wii, * m_gcwiiset; + wxPanel *m_Controller; + + std::vector all_all_files, all_files, gc_files, wii_files; + + // WARNING: Make sure these are not also elsewhere, for example in resource.h. + enum + { + IDC_CHECK0 = 2000, + IDC_CHECK1, + IDC_CHECK2, + IDC_CHECK3, + IDC_CHECK4, + IDC_CHECKLIST1, IDC_CHECKLIST2, IDC_CHECKLIST3, IDC_CHECKLIST4, IDC_CHECKLIST5, IDC_CHECKLIST6, + IDC_RADIO0, IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4, + IDG_LABEL1, IDG_LABEL2, + ID_UPD, + ID_SELC, + ID_PRESETS, + ID_GPR, + ID_NOTEBOOK, ID_PAGEMAIN, ID_PAGEMAIL, ID_PAGEBLOCK, // notebook + ID_LOG, ID_LOG1, // mails + ID_BL0, ID_BL95, ID_BL94, ID_BL93, ID_BL92, + ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values + + }; + + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); +}; + +#endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.h b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.h index ea6f274e88..8b0f0e322d 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.h @@ -1,47 +1,47 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __PBView_h__ -#define __PBView_h__ - -#include -#include - -#include "Common.h" - -class CPBView - : public wxListCtrl -{ - public: - - CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); - - void Update(); - - u32 m_CachedRegs[64][92]; - - - private: - - DECLARE_EVENT_TABLE() - - bool m_CachedRegHasChanged[64]; - - virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __PBView_h__ +#define __PBView_h__ + +#include +#include + +#include "Common.h" + +class CPBView + : public wxListCtrl +{ + public: + + CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); + + void Update(); + + u32 m_CachedRegs[64][92]; + + + private: + + DECLARE_EVENT_TABLE() + + bool m_CachedRegHasChanged[64]; + + virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem); +}; + +#endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Globals.h b/Source/Plugins/Plugin_DSP_HLE/Src/Globals.h index cb98fa9549..07739a7176 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Globals.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Globals.h @@ -1,39 +1,39 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _GLOBALS_H -#define _GLOBALS_H - -#include "Common.h" -#include "pluginspecs_dsp.h" - -extern DSPInitialize g_dspInitialize; -void DebugLog(const char* _fmt, ...); -void __Log_(int v, const char *fmt, ...); - -#if defined(_DEBUG) || defined(DEBUGFAST) - #define LOG_(v, ...) __Log_(v, __VA_ARGS__); -#else - #define LOG_(_v_, ...) -#endif - -u8 Memory_Read_U8(u32 _uAddress); -u16 Memory_Read_U16(u32 _uAddress); -u32 Memory_Read_U32(u32 _uAddress); -float Memory_Read_Float(u32 _uAddress); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _GLOBALS_H +#define _GLOBALS_H + +#include "Common.h" +#include "pluginspecs_dsp.h" + +extern DSPInitialize g_dspInitialize; +void DebugLog(const char* _fmt, ...); +void __Log_(int v, const char *fmt, ...); + +#if defined(_DEBUG) || defined(DEBUGFAST) + #define LOG_(v, ...) __Log_(v, __VA_ARGS__); +#else + #define LOG_(_v_, ...) +#endif + +u8 Memory_Read_U8(u32 _uAddress); +u16 Memory_Read_U16(u32 _uAddress); +u32 Memory_Read_U32(u32 _uAddress); +float Memory_Read_Float(u32 _uAddress); + +#endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.h b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.h index 3f63d563b8..c28d4ed04c 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Console.h @@ -1,28 +1,28 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -void startConsoleWin(int width, int height, char* fname); -int wprintf(const char *fmt, ...); -int aprintf(int a, char *fmt, ...); -void ClearScreen(); -void OpenConsole(); -void CloseConsole(); - -#ifdef _WIN32 - HWND GetConsoleHwnd(void); -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +void startConsoleWin(int width, int height, char* fname); +int wprintf(const char *fmt, ...); +int aprintf(int a, char *fmt, ...); +void ClearScreen(); +void OpenConsole(); +void CloseConsole(); + +#ifdef _WIN32 + HWND GetConsoleHwnd(void); +#endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h b/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h index c1858fa733..ba00aa9f4e 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h @@ -1,46 +1,46 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MAILHANDLER_H -#define _MAILHANDLER_H - -#include - -#include "Common.h" - -class CMailHandler -{ -public: - CMailHandler(); - ~CMailHandler(); - - void PushMail(u32 _Mail); - void Clear(); - void Halt(bool _Halt); - bool IsEmpty(); - - u16 ReadDSPMailboxHigh(); - u16 ReadDSPMailboxLow(); - void Update(); - -private: - // mail handler - std::queue m_Mails; -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MAILHANDLER_H +#define _MAILHANDLER_H + +#include + +#include "Common.h" + +class CMailHandler +{ +public: + CMailHandler(); + ~CMailHandler(); + + void PushMail(u32 _Mail); + void Clear(); + void Halt(bool _Halt); + bool IsEmpty(); + + u16 ReadDSPMailboxHigh(); + u16 ReadDSPMailboxLow(); + void Update(); + +private: + // mail handler + std::queue m_Mails; +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/DSoundStream.h b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/DSoundStream.h index f27293c997..99e3a9d7c6 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/DSoundStream.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/DSoundStream.h @@ -1,35 +1,35 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __SOUNDSTREAM_H__ -#define __SOUNDSTREAM_H__ - -namespace DSound -{ -typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels); - -bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback); -void DSound_UpdateSound(); -void DSound_StopSound(); - -float DSound_GetTimer(); -int DSound_GetCurSample(); -int DSound_GetSampleRate(); -} - - -#endif //__SOUNDSTREAM_H__ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __SOUNDSTREAM_H__ +#define __SOUNDSTREAM_H__ + +namespace DSound +{ +typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels); + +bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback); +void DSound_UpdateSound(); +void DSound_StopSound(); + +float DSound_GetTimer(); +int DSound_GetCurSample(); +int DSound_GetSampleRate(); +} + + +#endif //__SOUNDSTREAM_H__ diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.h b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.h index a3340845c6..3c5095ab70 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.h @@ -1,30 +1,30 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MIXER_H -#define _MIXER_H - -extern volatile bool mixer_HLEready; - -// Called from audio threads -void Mixer(short* buffer, int numSamples, int bits, int rate, int channels); - -// Called from main thread -void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate); - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MIXER_H +#define _MIXER_H + +extern volatile bool mixer_HLEready; + +// Called from audio threads +void Mixer(short* buffer, int numSamples, int bits, int rate, int channels); + +// Called from main thread +void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate); + +#endif + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h index d63dd50476..bc0373a61b 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h @@ -1,77 +1,77 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_AX -#define _UCODE_AX - -#include -#include "UCode_AXStructs.h" - -enum -{ - NUMBER_OF_PBS = 128 -}; - -class CUCode_AX : public IUCode -{ -public: - CUCode_AX(CMailHandler& _rMailHandler); - virtual ~CUCode_AX(); - - void HandleMail(u32 _uMail); - void MixAdd(short* _pBuffer, int _iSize); - void Update(); - - // Logging - //template - //void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs); - void Logging(short* _pBuffer, int _iSize, int a, bool Wii); - void SaveLog_(bool Wii, const char* _fmt, va_list ap); - void SaveMail(bool Wii, u32 _uMail); - void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii); - std::string TmpMailLog; - int saveNext; - - // PBs - u32 m_addressPBs; - u32 _CRC; - -private: - enum - { - MAIL_AX_ALIST = 0xBABE0000, - AXLIST_STUDIOADDR = 0x0000, - AXLIST_PBADDR = 0x0002, - AXLIST_SBUFFER = 0x0007, - AXLIST_COMPRESSORTABLE = 0x000A, - AXLIST_END = 0x000F - }; - - int *templbuffer; - int *temprbuffer; - - // ax task message handler - bool AXTask(u32& _uMail); - void SaveLog(const char* _fmt, ...); - void SendMail(u32 _uMail); -}; - -int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num); -void WriteBackPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num); - - -#endif // _UCODE_AX +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_AX +#define _UCODE_AX + +#include +#include "UCode_AXStructs.h" + +enum +{ + NUMBER_OF_PBS = 128 +}; + +class CUCode_AX : public IUCode +{ +public: + CUCode_AX(CMailHandler& _rMailHandler); + virtual ~CUCode_AX(); + + void HandleMail(u32 _uMail); + void MixAdd(short* _pBuffer, int _iSize); + void Update(); + + // Logging + //template + //void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs); + void Logging(short* _pBuffer, int _iSize, int a, bool Wii); + void SaveLog_(bool Wii, const char* _fmt, va_list ap); + void SaveMail(bool Wii, u32 _uMail); + void SaveLogFile(std::string f, int resizeTo, bool type, bool Wii); + std::string TmpMailLog; + int saveNext; + + // PBs + u32 m_addressPBs; + u32 _CRC; + +private: + enum + { + MAIL_AX_ALIST = 0xBABE0000, + AXLIST_STUDIOADDR = 0x0000, + AXLIST_PBADDR = 0x0002, + AXLIST_SBUFFER = 0x0007, + AXLIST_COMPRESSORTABLE = 0x000A, + AXLIST_END = 0x000F + }; + + int *templbuffer; + int *temprbuffer; + + // ax task message handler + bool AXTask(u32& _uMail); + void SaveLog(const char* _fmt, ...); + void SendMail(u32 _uMail); +}; + +int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num); +void WriteBackPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num); + + +#endif // _UCODE_AX diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXStructs.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXStructs.h index f19ee31af1..b8c2935bbc 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXStructs.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXStructs.h @@ -1,248 +1,248 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_AX_STRUCTS_H -#define _UCODE_AX_STRUCTS_H - -struct PBMixer -{ - u16 volume_left; - u16 unknown; - u16 volume_right; - u16 unknown2; - - u16 unknown3[8]; - u16 unknown4[6]; -}; - -struct PBMixerWii -{ - u16 volume_left; - u16 unknown; - u16 volume_right; - u16 unknown2; - - u16 unknown3[12]; - u16 unknown4[8]; -}; - -struct PBInitialTimeDelay -{ - u16 on; - u16 addrMemHigh; - u16 addrMemLow; - u16 offsetLeft; - u16 offsetRight; - u16 targetLeft; - u16 targetRight; -}; - -// Update data - read these each 1ms subframe and use them! -// It seems that to provide higher time precisions for MIDI events, some games -// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms). -// Using this data should fix games that are missing MIDI notes. -struct PBUpdates -{ - u16 num_updates[5]; - u16 data_hi; // These point to main RAM. Not sure about the structure of the data. - u16 data_lo; -}; - -struct PBUpdatesWii -{ - u16 num_updates[3]; - u16 data_hi; // These point to main RAM. Not sure about the structure of the data. - u16 data_lo; -}; - -struct PBDpop -{ - s16 unknown[9]; -}; - - struct PBDpopWii - { - s16 unknown[12]; - }; - - struct PBDpopWii_ // new CRC version - { - s16 unknown[7]; - }; - -struct PBVolumeEnvelope -{ - u16 cur_volume; - s16 cur_volume_delta; -}; - -struct PBUnknown2 -{ - u16 unknown_reserved[3]; -}; - -struct PBAudioAddr -{ - u16 looping; - u16 sample_format; - u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active) - u16 loop_addr_lo; - u16 end_addr_hi; // End of sample (and loop), inclusive - u16 end_addr_lo; - u16 cur_addr_hi; - u16 cur_addr_lo; -}; - -struct PBADPCMInfo -{ - s16 coefs[16]; - u16 gain; - u16 pred_scale; - s16 yn1; - s16 yn2; -}; - -struct PBSampleRateConverter -{ - u16 ratio_hi; - u16 ratio_lo; - u16 cur_addr_frac; - u16 last_samples[4]; -}; - -struct PBADPCMLoopInfo -{ - u16 pred_scale; - u16 yn1; - u16 yn2; -}; - -struct AXParamBlock -{ - u16 next_pb_hi; - u16 next_pb_lo; - - u16 this_pb_hi; - u16 this_pb_lo; - - u16 src_type; // Type of sample rate converter (none, ?, linear) - u16 coef_select; - - u16 mixer_control; - u16 running; // 1=RUN 0=STOP - u16 is_stream; // 1 = stream, 0 = one shot - -/* 9 */ PBMixer mixer; -/* 27 */ PBInitialTimeDelay initial_time_delay; -/* 34 */ PBUpdates updates; -/* 41 */ PBDpop dpop; -/* 50 */ PBVolumeEnvelope vol_env; -/* 52 */ PBUnknown2 unknown3; -/* 55 */ PBAudioAddr audio_addr; -/* 63 */ PBADPCMInfo adpcm; -/* 83 */ PBSampleRateConverter src; -/* 90 */ PBADPCMLoopInfo adpcm_loop_info; -/* 93 */ u16 unknown_maybe_padding[3]; -}; - -struct PBLpf -{ - u16 enabled; - u16 yn1; - u16 a0; - u16 b0; -}; - -struct PBHpf -{ - u16 enabled; - u16 yn1; - u16 a0; - u16 b0; -}; - -struct AXParamBlockWii -{ - u16 next_pb_hi; - u16 next_pb_lo; - - u16 this_pb_hi; - u16 this_pb_lo; - - u16 src_type; // Type of sample rate converter (none, ?, linear) - u16 coef_select; - u32 mixer_control; - - u16 running; // 1=RUN 0=STOP - u16 is_stream; // 1 = stream, 0 = one shot - -/* 10 */ PBMixerWii mixer; -/* 34 */ PBInitialTimeDelay initial_time_delay; -/* 41 */ PBUpdatesWii updates; -/* 46 */ PBDpopWii dpop; -/* 58 */ PBVolumeEnvelope vol_env; -/* 60 */ PBAudioAddr audio_addr; -/* 68 */ PBADPCMInfo adpcm; -/* 88 */ PBSampleRateConverter src; -/* 95 */ PBADPCMLoopInfo adpcm_loop_info; -/* 98 */ PBLpf lpf; -/* 102 */ PBHpf hpf; -/* 106 */ u16 pad[22]; -}; - -struct AXParamBlockWii_ // new CRC version -{ - u16 next_pb_hi; - u16 next_pb_lo; - - u16 this_pb_hi; - u16 this_pb_lo; - - u16 src_type; // Type of sample rate converter (none, ?, linear) - u16 coef_select; - u32 mixer_control; - - u16 running; // 1=RUN 0=STOP - u16 is_stream; // 1 = stream, 0 = one shot - -/* 10 */ PBMixerWii mixer; -/* 34 */ PBInitialTimeDelay initial_time_delay; -/* 41 */ PBUpdatesWii updates; -/* 46 */ PBDpopWii_ dpop; -/* 53 */ PBVolumeEnvelope vol_env; -/* 55 */ PBAudioAddr audio_addr; -/* 63 */ PBADPCMInfo adpcm; -/* 83 */ PBSampleRateConverter src; -/* 90 */ PBADPCMLoopInfo adpcm_loop_info; -/* 93 */ PBLpf lpf; -/* 97 */ PBHpf hpf; -/* 101 */ u16 pad[27]; -}; - -enum { - AUDIOFORMAT_ADPCM = 0, - AUDIOFORMAT_PCM8 = 0x19, - AUDIOFORMAT_PCM16 = 0xA, -}; - -enum { - SRCTYPE_LINEAR = 1, - SRCTYPE_NEAREST = 2, - MIXCONTROL_RAMPING = 8, -}; - -#endif // _UCODE_AX_STRUCTS_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_AX_STRUCTS_H +#define _UCODE_AX_STRUCTS_H + +struct PBMixer +{ + u16 volume_left; + u16 unknown; + u16 volume_right; + u16 unknown2; + + u16 unknown3[8]; + u16 unknown4[6]; +}; + +struct PBMixerWii +{ + u16 volume_left; + u16 unknown; + u16 volume_right; + u16 unknown2; + + u16 unknown3[12]; + u16 unknown4[8]; +}; + +struct PBInitialTimeDelay +{ + u16 on; + u16 addrMemHigh; + u16 addrMemLow; + u16 offsetLeft; + u16 offsetRight; + u16 targetLeft; + u16 targetRight; +}; + +// Update data - read these each 1ms subframe and use them! +// It seems that to provide higher time precisions for MIDI events, some games +// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms). +// Using this data should fix games that are missing MIDI notes. +struct PBUpdates +{ + u16 num_updates[5]; + u16 data_hi; // These point to main RAM. Not sure about the structure of the data. + u16 data_lo; +}; + +struct PBUpdatesWii +{ + u16 num_updates[3]; + u16 data_hi; // These point to main RAM. Not sure about the structure of the data. + u16 data_lo; +}; + +struct PBDpop +{ + s16 unknown[9]; +}; + + struct PBDpopWii + { + s16 unknown[12]; + }; + + struct PBDpopWii_ // new CRC version + { + s16 unknown[7]; + }; + +struct PBVolumeEnvelope +{ + u16 cur_volume; + s16 cur_volume_delta; +}; + +struct PBUnknown2 +{ + u16 unknown_reserved[3]; +}; + +struct PBAudioAddr +{ + u16 looping; + u16 sample_format; + u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active) + u16 loop_addr_lo; + u16 end_addr_hi; // End of sample (and loop), inclusive + u16 end_addr_lo; + u16 cur_addr_hi; + u16 cur_addr_lo; +}; + +struct PBADPCMInfo +{ + s16 coefs[16]; + u16 gain; + u16 pred_scale; + s16 yn1; + s16 yn2; +}; + +struct PBSampleRateConverter +{ + u16 ratio_hi; + u16 ratio_lo; + u16 cur_addr_frac; + u16 last_samples[4]; +}; + +struct PBADPCMLoopInfo +{ + u16 pred_scale; + u16 yn1; + u16 yn2; +}; + +struct AXParamBlock +{ + u16 next_pb_hi; + u16 next_pb_lo; + + u16 this_pb_hi; + u16 this_pb_lo; + + u16 src_type; // Type of sample rate converter (none, ?, linear) + u16 coef_select; + + u16 mixer_control; + u16 running; // 1=RUN 0=STOP + u16 is_stream; // 1 = stream, 0 = one shot + +/* 9 */ PBMixer mixer; +/* 27 */ PBInitialTimeDelay initial_time_delay; +/* 34 */ PBUpdates updates; +/* 41 */ PBDpop dpop; +/* 50 */ PBVolumeEnvelope vol_env; +/* 52 */ PBUnknown2 unknown3; +/* 55 */ PBAudioAddr audio_addr; +/* 63 */ PBADPCMInfo adpcm; +/* 83 */ PBSampleRateConverter src; +/* 90 */ PBADPCMLoopInfo adpcm_loop_info; +/* 93 */ u16 unknown_maybe_padding[3]; +}; + +struct PBLpf +{ + u16 enabled; + u16 yn1; + u16 a0; + u16 b0; +}; + +struct PBHpf +{ + u16 enabled; + u16 yn1; + u16 a0; + u16 b0; +}; + +struct AXParamBlockWii +{ + u16 next_pb_hi; + u16 next_pb_lo; + + u16 this_pb_hi; + u16 this_pb_lo; + + u16 src_type; // Type of sample rate converter (none, ?, linear) + u16 coef_select; + u32 mixer_control; + + u16 running; // 1=RUN 0=STOP + u16 is_stream; // 1 = stream, 0 = one shot + +/* 10 */ PBMixerWii mixer; +/* 34 */ PBInitialTimeDelay initial_time_delay; +/* 41 */ PBUpdatesWii updates; +/* 46 */ PBDpopWii dpop; +/* 58 */ PBVolumeEnvelope vol_env; +/* 60 */ PBAudioAddr audio_addr; +/* 68 */ PBADPCMInfo adpcm; +/* 88 */ PBSampleRateConverter src; +/* 95 */ PBADPCMLoopInfo adpcm_loop_info; +/* 98 */ PBLpf lpf; +/* 102 */ PBHpf hpf; +/* 106 */ u16 pad[22]; +}; + +struct AXParamBlockWii_ // new CRC version +{ + u16 next_pb_hi; + u16 next_pb_lo; + + u16 this_pb_hi; + u16 this_pb_lo; + + u16 src_type; // Type of sample rate converter (none, ?, linear) + u16 coef_select; + u32 mixer_control; + + u16 running; // 1=RUN 0=STOP + u16 is_stream; // 1 = stream, 0 = one shot + +/* 10 */ PBMixerWii mixer; +/* 34 */ PBInitialTimeDelay initial_time_delay; +/* 41 */ PBUpdatesWii updates; +/* 46 */ PBDpopWii_ dpop; +/* 53 */ PBVolumeEnvelope vol_env; +/* 55 */ PBAudioAddr audio_addr; +/* 63 */ PBADPCMInfo adpcm; +/* 83 */ PBSampleRateConverter src; +/* 90 */ PBADPCMLoopInfo adpcm_loop_info; +/* 93 */ PBLpf lpf; +/* 97 */ PBHpf hpf; +/* 101 */ u16 pad[27]; +}; + +enum { + AUDIOFORMAT_ADPCM = 0, + AUDIOFORMAT_PCM8 = 0x19, + AUDIOFORMAT_PCM16 = 0xA, +}; + +enum { + SRCTYPE_LINEAR = 1, + SRCTYPE_NEAREST = 2, + MIXCONTROL_RAMPING = 8, +}; + +#endif // _UCODE_AX_STRUCTS_H diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.h index 477426cc91..0e847fc5d8 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.h @@ -1,64 +1,64 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_AXWII -#define _UCODE_AXWII - -#include "UCode_AXStructs.h" - -#define NUMBER_OF_PBS 128 - -class CUCode_AXWii : public IUCode -{ -public: - CUCode_AXWii(CMailHandler& _rMailHandler, u32 _CRC); - virtual ~CUCode_AXWii(); - - void HandleMail(u32 _uMail); - void MixAdd(short* _pBuffer, int _iSize); - template - //void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs); - void MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs); - void Update(); - - // The logging function for the debugger - void Logging(short* _pBuffer, int _iSize, int a); - CUCode_AX * lCUCode_AX; // we need the logging functions in there - -private: - enum - { - MAIL_AX_ALIST = 0xBABE0000, - }; - - // PBs - u32 m_addressPBs; - u32 _CRC; - - int *templbuffer; - int *temprbuffer; - - // ax task message handler - bool AXTask(u32& _uMail); - void SaveLog(const char* _fmt, ...); - void SendMail(u32 _uMail); -}; - -//int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num); -//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num); - -#endif // _UCODE_AXWII +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_AXWII +#define _UCODE_AXWII + +#include "UCode_AXStructs.h" + +#define NUMBER_OF_PBS 128 + +class CUCode_AXWii : public IUCode +{ +public: + CUCode_AXWii(CMailHandler& _rMailHandler, u32 _CRC); + virtual ~CUCode_AXWii(); + + void HandleMail(u32 _uMail); + void MixAdd(short* _pBuffer, int _iSize); + template + //void Logging(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, int numberOfPBs); + void MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs); + void Update(); + + // The logging function for the debugger + void Logging(short* _pBuffer, int _iSize, int a); + CUCode_AX * lCUCode_AX; // we need the logging functions in there + +private: + enum + { + MAIL_AX_ALIST = 0xBABE0000, + }; + + // PBs + u32 m_addressPBs; + u32 _CRC; + + int *templbuffer; + int *temprbuffer; + + // ax task message handler + bool AXTask(u32& _uMail); + void SaveLog(const char* _fmt, ...); + void SendMail(u32 _uMail); +}; + +//int ReadOutPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num); +//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num); + +#endif // _UCODE_AXWII diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_ADPCM.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_ADPCM.h index ebaf3285d9..c177818673 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_ADPCM.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_ADPCM.h @@ -1,91 +1,91 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_AX_ADPCM_H -#define _UCODE_AX_ADPCM_H - -inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac) -{ - while (samplePos < newSamplePos) - { - if ((samplePos & 15) == 0) - { - adpcm.pred_scale = g_dspInitialize.pARAM_Read_U8((samplePos & ~15) >> 1); - samplePos += 2; - newSamplePos += 2; - } - - int scale = 1 << (adpcm.pred_scale & 0xF); - int coef_idx = adpcm.pred_scale >> 4; - - s32 coef1 = adpcm.coefs[coef_idx * 2 + 0]; - s32 coef2 = adpcm.coefs[coef_idx * 2 + 1]; - - int temp = (samplePos & 1) ? - (g_dspInitialize.pARAM_Read_U8(samplePos >> 1) & 0xF) : - (g_dspInitialize.pARAM_Read_U8(samplePos >> 1) >> 4); - - if (temp >= 8) - temp -= 16; - - // 0x400 = 0.5 in 11-bit fixed point - int val = (scale * temp) + ((0x400 + coef1 * adpcm.yn1 + coef2 * adpcm.yn2) >> 11); - - if (val > 0x7FFF) - val = 0x7FFF; - else if (val < -0x7FFF) - val = -0x7FFF; - - adpcm.yn2 = adpcm.yn1; - adpcm.yn1 = val; - - samplePos++; - } - - return adpcm.yn1; -} - -// ======================================================================================= -// Volume control (ramping) -// -------------- -inline u16 ADPCM_Vol(u16 vol, u16 delta) -{ - int x = vol; - if (delta && delta < 0x5000) - x += delta * 20 * 8; // unsure what the right step is - //x += 1 * 20 * 8; - else if (delta && delta > 0x5000) - //x -= (0x10000 - delta); // this is to small, it's often 1 - x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario - // did not have time to go to zero before the were closed - //x -= 1 * 20 * 16; - - // make lower limits - if (x < 0) x = 0; - //if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control; // does this make - // any sense? - - // make upper limits - //if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // maybe mixer_control also - // has a volume target? - //if (x >= 0x7fff) x = 0x7fff; // this seems a little high - if (x >= 0x4e20) x = 0x4e20; // add a definitive limit at 20 000 - return x; // update volume -} -// ============== - -#endif // _UCODE_AX_ADPCM_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_AX_ADPCM_H +#define _UCODE_AX_ADPCM_H + +inline s16 ADPCM_Step(PBADPCMInfo &adpcm, u32& samplePos, u32 newSamplePos, u16 frac) +{ + while (samplePos < newSamplePos) + { + if ((samplePos & 15) == 0) + { + adpcm.pred_scale = g_dspInitialize.pARAM_Read_U8((samplePos & ~15) >> 1); + samplePos += 2; + newSamplePos += 2; + } + + int scale = 1 << (adpcm.pred_scale & 0xF); + int coef_idx = adpcm.pred_scale >> 4; + + s32 coef1 = adpcm.coefs[coef_idx * 2 + 0]; + s32 coef2 = adpcm.coefs[coef_idx * 2 + 1]; + + int temp = (samplePos & 1) ? + (g_dspInitialize.pARAM_Read_U8(samplePos >> 1) & 0xF) : + (g_dspInitialize.pARAM_Read_U8(samplePos >> 1) >> 4); + + if (temp >= 8) + temp -= 16; + + // 0x400 = 0.5 in 11-bit fixed point + int val = (scale * temp) + ((0x400 + coef1 * adpcm.yn1 + coef2 * adpcm.yn2) >> 11); + + if (val > 0x7FFF) + val = 0x7FFF; + else if (val < -0x7FFF) + val = -0x7FFF; + + adpcm.yn2 = adpcm.yn1; + adpcm.yn1 = val; + + samplePos++; + } + + return adpcm.yn1; +} + +// ======================================================================================= +// Volume control (ramping) +// -------------- +inline u16 ADPCM_Vol(u16 vol, u16 delta) +{ + int x = vol; + if (delta && delta < 0x5000) + x += delta * 20 * 8; // unsure what the right step is + //x += 1 * 20 * 8; + else if (delta && delta > 0x5000) + //x -= (0x10000 - delta); // this is to small, it's often 1 + x -= (0x10000 - delta) * 20 * 16; // if this was 20 * 8 the sounds in Fire Emblem and Paper Mario + // did not have time to go to zero before the were closed + //x -= 1 * 20 * 16; + + // make lower limits + if (x < 0) x = 0; + //if (pb.mixer_control < 1000 && x < pb.mixer_control) x = pb.mixer_control; // does this make + // any sense? + + // make upper limits + //if (mixer_control > 1000 && x > mixer_control) x = mixer_control; // maybe mixer_control also + // has a volume target? + //if (x >= 0x7fff) x = 0x7fff; // this seems a little high + if (x >= 0x4e20) x = 0x4e20; // add a definitive limit at 20 000 + return x; // update volume +} +// ============== + +#endif // _UCODE_AX_ADPCM_H diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h index 330a799cd0..ab7a94c418 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h @@ -1,402 +1,402 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_AX_VOICE_H -#define _UCODE_AX_VOICE_H - -#include "UCode_AX_ADPCM.h" -#include "UCode_AX.h" -#include "../main.h" - - -// ---------------------------------------------------- -// Externals -// ----------- -extern bool gSSBM; -extern bool gSSBMremedy1; -extern bool gSSBMremedy2; -extern bool gSequenced; -extern bool gVolume; -extern bool gReset; -extern bool gSequenced; -extern float ratioFactor; - - -template -inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num) -{ - int count = 0; - u32 blockAddr = pbs_address; - u32 pAddr = 0; - - // reading and 'halfword' swap - for (int i = 0; i < _num; i++) - { - const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr); - pAddr = blockAddr; - - if (pSrc != NULL) - { - short *pDest = (short *)&_pPBs[i]; - for (u32 p = 0; p < sizeof(AXParamBlockWii) / 2; p++) - { - if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32 - else pDest[p] = Common::swap16(pSrc[p]); - - #if defined(_DEBUG) || defined(DEBUGFAST) - if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location - #endif - } - - _pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control); - blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo; - count++; - - // Detect the last mail by checking when next_pb = 0 - u32 next_pb = (Common::swap16(pSrc[0]) << 16) | Common::swap16(pSrc[1]); - if(next_pb == 0) break; - } - else - break; - } - - // return the number of read PBs - return count; -} - -template -inline void WriteBackPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num) -//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num) -{ - u32 blockAddr = pbs_address; - - // write back and 'halfword'swap - for (int i = 0; i < _num; i++) - { - short* pSrc = (short*)&_pPBs[i]; - short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(blockAddr); - _pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control); - for (size_t p = 0; p < sizeof(AXParamBlockWii) / 2; p++) - { - if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32 - else pDest[p] = Common::swap16(pSrc[p]); - } - - // next block - blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo; - } -} - - -template -inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, int _iSize, bool Wii) -{ -#ifdef _WIN32 - ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate(); -#else - ratioFactor = 32000.0f / 44100.0f; -#endif - - DoVoiceHacks(pb, Wii); - - // ============= - if (pb.running) - { - - // ======================================================================================= - // Read initial parameters - // ------------ - //constants - const u32 ratio = (u32)(((pb.src.ratio_hi << 16) + pb.src.ratio_lo) * ratioFactor); - u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo; - u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo; - - //variables - u32 samplePos = (pb.audio_addr.cur_addr_hi << 16) | pb.audio_addr.cur_addr_lo; - u32 frac = pb.src.cur_addr_frac; - // ============= - - // ======================================================================================= - // Handle No-SRC streams - No src streams have pb.src_type == 2 and have pb.src.ratio_hi = 0 - // and pb.src.ratio_lo = 0. We handle that by setting the sampling ratio integer to 1. This - // makes samplePos update in the correct way. I'm unsure how we are actually supposed to - // detect that this setting. Updates did not fix this automatically. - // --------------------------------------------------------------------------------------- - // Stream settings - // src_type = 2 (most other games have src_type = 0) - // ------------ - // Affected games: - // Baten Kaitos - Eternal Wings (2003) - // Baten Kaitos - Origins (2006)? - // Soul Calibur 2: The movie music use src_type 2 but it needs no adjustment, perhaps - // the sound format plays in to, Baten use ADPCM, SC2 use PCM16 - // ------------ - //if (pb.src_type == 2 && (pb.src.ratio_hi == 0 && pb.src.ratio_lo == 0)) - if (pb.running && (pb.src.ratio_hi == 0 && pb.src.ratio_lo == 0)) - { - pb.src.ratio_hi = 1; - } - // ============= - - - // ======================================================================================= - // Games that use looping to play non-looping music streams - SSBM has info in all - // pb.adpcm_loop_info parameters but has pb.audio_addr.looping = 0. If we treat these streams - // like any other looping streams the music works. I'm unsure how we are actually supposed to - // detect that these kinds of blocks should be looping. It seems like pb.mixer_control == 0 may - // identify these types of blocks. Updates did not write any looping values. - // -------------- - if ( - (pb.adpcm_loop_info.pred_scale || pb.adpcm_loop_info.yn1 || pb.adpcm_loop_info.yn2) - && pb.mixer_control == 0 - ) - { - pb.audio_addr.looping = 1; - } - // ============== - - // Top Spin 3 Wii - if(pb.audio_addr.sample_format > 25) pb.audio_addr.sample_format = 0; - - // ======================================================================================= - // Walk through _iSize. _iSize = numSamples. If the game goes slow _iSize will be higher to - // compensate for that. _iSize can be as low as 100 or as high as 2000 some cases. - for (int s = 0; s < _iSize; s++) - { - int sample = 0; - frac += ratio; - u32 newSamplePos = samplePos + (frac >> 16); //whole number of frac - - // ======================================================================================= - // Process sample format - // -------------- - switch (pb.audio_addr.sample_format) - { - case AUDIOFORMAT_PCM8: - // TODO - the linear interpolation code below is somewhat suspicious - pb.adpcm.yn2 = pb.adpcm.yn1; //save last sample - pb.adpcm.yn1 = ((s8)g_dspInitialize.pARAM_Read_U8(samplePos)) << 8; - - if (pb.src_type == SRCTYPE_NEAREST) - { - sample = pb.adpcm.yn1; - } - else //linear interpolation - { - sample = (pb.adpcm.yn1 * (u16)frac + pb.adpcm.yn2 * (u16)(0xFFFF - frac)) >> 16; - } - - samplePos = newSamplePos; - break; - - case AUDIOFORMAT_PCM16: - // TODO - the linear interpolation code below is somewhat suspicious - pb.adpcm.yn2 = pb.adpcm.yn1; //save last sample - pb.adpcm.yn1 = (s16)(u16)((g_dspInitialize.pARAM_Read_U8(samplePos * 2) << 8) | (g_dspInitialize.pARAM_Read_U8((samplePos * 2 + 1)))); - if (pb.src_type == SRCTYPE_NEAREST) - sample = pb.adpcm.yn1; - else //linear interpolation - sample = (pb.adpcm.yn1 * (u16)frac + pb.adpcm.yn2 * (u16)(0xFFFF - frac)) >> 16; - - samplePos = newSamplePos; - break; - - case AUDIOFORMAT_ADPCM: - sample = ADPCM_Step(pb.adpcm, samplePos, newSamplePos, frac); - break; - - default: - break; - } - // ================ - - // =================================================================== - // Overall volume control. In addition to this there is also separate volume settings to - // different channels (left, right etc). - frac &= 0xffff; - - int vol = pb.vol_env.cur_volume >> 9; - sample = sample * vol >> 8; - - if (pb.mixer_control & MIXCONTROL_RAMPING) - { - int x = pb.vol_env.cur_volume; - x += pb.vol_env.cur_volume_delta; // I'm not sure about this, can anybody find a game - // that use this? Or how does it work? - if (x < 0) x = 0; - if (x >= 0x7fff) x = 0x7fff; - pb.vol_env.cur_volume = x; // maybe not per sample?? :P - } - - int leftmix = pb.mixer.volume_left >> 5; - int rightmix = pb.mixer.volume_right >> 5; - int left = sample * leftmix >> 8; - int right = sample * rightmix >> 8; - //adpcm has to walk from oldSamplePos to samplePos here - templbuffer[s] += left; - temprbuffer[s] += right; - // =============== - - - // =================================================================== - // Control the behavior when we reach the end of the sample - if (samplePos >= sampleEnd) - { - if (pb.audio_addr.looping == 1) - { - samplePos = loopPos; - if (pb.audio_addr.sample_format == AUDIOFORMAT_ADPCM) - { - if (!pb.is_stream) - { - pb.adpcm.yn1 = pb.adpcm_loop_info.yn1; - pb.adpcm.yn2 = pb.adpcm_loop_info.yn2; - pb.adpcm.pred_scale = pb.adpcm_loop_info.pred_scale; - } - } - } - else - { - pb.running = 0; - break; - } - } - // =============== - } // end of the _iSize loop - - // Update volume - //if (sizeof(ParamBlockType) == sizeof(AXParamBlock)) // this is not needed anymore I think - if (gVolume) // allow us to turn this off in the debugger - { - pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown); - pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2); - } - - pb.src.cur_addr_frac = (u16)frac; - pb.audio_addr.cur_addr_hi = samplePos >> 16; - pb.audio_addr.cur_addr_lo = (u16)samplePos; - - } // if (pb.running) -} - - - -// ================================================ -// Voice hacks -// -------------- -template -inline void DoVoiceHacks(ParamBlockType &pb, bool Wii) -{ - // get necessary values - const u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo; - const u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo; - const u32 updaddr = (u32)(pb.updates.data_hi << 16) | pb.updates.data_lo; - const u16 updpar = Memory_Read_U16(updaddr); - const u16 upddata = Memory_Read_U16(updaddr + 2); - - // ======================================================================================= - /* Fix problems introduced with the SSBM fix. Sometimes when a music stream ended sampleEnd - would end up outside of bounds while the block was still playing resulting in noise - a strange noise. This should take care of that. - */ - // ------------ - if ( - (sampleEnd > (0x017fffff * 2) || loopPos > (0x017fffff * 2)) // ARAM bounds in nibbles - && gSSBMremedy1 - && !Wii - ) - { - pb.running = 0; - - // also reset all values if it makes any difference - pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0; - pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0; - pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0; - - pb.src.cur_addr_frac = 0; pb.src.ratio_hi = 0; pb.src.ratio_lo = 0; - pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0; - - pb.audio_addr.looping = 0; - pb.adpcm_loop_info.pred_scale = 0; - pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0; - } - - /* - // the fact that no settings are reset (except running) after a SSBM type music stream or another - looping block (for example in Battle Stadium DON) has ended could cause loud garbled sound to be - played from one or more blocks. Perhaps it was in conjunction with the old sequenced music fix below, - I'm not sure. This was an attempt to prevent that anyway by resetting all. But I'm not sure if this - is needed anymore. Please try to play SSBM without it and see if it works anyway. - */ - if ( - // detect blocks that have recently been running that we should reset - pb.running == 0 && pb.audio_addr.looping == 1 - //pb.running == 0 && pb.adpcm_loop_info.pred_scale - - // this prevents us from ruining sequenced music blocks, may not be needed - /* - && !(pb.updates.num_updates[0] || pb.updates.num_updates[1] || pb.updates.num_updates[2] - || pb.updates.num_updates[3] || pb.updates.num_updates[4]) - */ - && !(updpar || upddata) - - && pb.mixer_control == 0 // only use this in SSBM - - && gSSBMremedy2 // let us turn this fix on and off - && !Wii - ) - { - // reset the detection values - pb.audio_addr.looping = 0; - pb.adpcm_loop_info.pred_scale = 0; - pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0; - - //pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0; - //pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0; - //pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0; - - //pb.src.cur_addr_frac = 0; PBs[i].src.ratio_hi = 0; PBs[i].src.ratio_lo = 0; - //pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0; - } - - // ============= - - - // ======================================================================================= - // Reset all values - // ------------ - if (gReset - && (pb.running || pb.audio_addr.looping || pb.adpcm_loop_info.pred_scale) - ) - { - pb.running = 0; - - pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0; - pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0; - pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0; - - pb.src.cur_addr_frac = 0; pb.src.ratio_hi = 0; pb.src.ratio_lo = 0; - pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0; - - pb.audio_addr.looping = 0; - pb.adpcm_loop_info.pred_scale = 0; - pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0; - } -} - - -#endif // _UCODE_AX_VOICE_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_AX_VOICE_H +#define _UCODE_AX_VOICE_H + +#include "UCode_AX_ADPCM.h" +#include "UCode_AX.h" +#include "../main.h" + + +// ---------------------------------------------------- +// Externals +// ----------- +extern bool gSSBM; +extern bool gSSBMremedy1; +extern bool gSSBMremedy2; +extern bool gSequenced; +extern bool gVolume; +extern bool gReset; +extern bool gSequenced; +extern float ratioFactor; + + +template +inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num) +{ + int count = 0; + u32 blockAddr = pbs_address; + u32 pAddr = 0; + + // reading and 'halfword' swap + for (int i = 0; i < _num; i++) + { + const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr); + pAddr = blockAddr; + + if (pSrc != NULL) + { + short *pDest = (short *)&_pPBs[i]; + for (u32 p = 0; p < sizeof(AXParamBlockWii) / 2; p++) + { + if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32 + else pDest[p] = Common::swap16(pSrc[p]); + + #if defined(_DEBUG) || defined(DEBUGFAST) + if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location + #endif + } + + _pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control); + blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo; + count++; + + // Detect the last mail by checking when next_pb = 0 + u32 next_pb = (Common::swap16(pSrc[0]) << 16) | Common::swap16(pSrc[1]); + if(next_pb == 0) break; + } + else + break; + } + + // return the number of read PBs + return count; +} + +template +inline void WriteBackPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num) +//void WriteBackPBsWii(u32 pbs_address, AXParamBlockWii* _pPBs, int _num) +{ + u32 blockAddr = pbs_address; + + // write back and 'halfword'swap + for (int i = 0; i < _num; i++) + { + short* pSrc = (short*)&_pPBs[i]; + short* pDest = (short*)g_dspInitialize.pGetMemoryPointer(blockAddr); + _pPBs[i].mixer_control = Common::swap32(_pPBs[i].mixer_control); + for (size_t p = 0; p < sizeof(AXParamBlockWii) / 2; p++) + { + if(p == 6 || p == 7) pDest[p] = pSrc[p]; // control for the u32 + else pDest[p] = Common::swap16(pSrc[p]); + } + + // next block + blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo; + } +} + + +template +inline void MixAddVoice(ParamBlockType &pb, int *templbuffer, int *temprbuffer, int _iSize, bool Wii) +{ +#ifdef _WIN32 + ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate(); +#else + ratioFactor = 32000.0f / 44100.0f; +#endif + + DoVoiceHacks(pb, Wii); + + // ============= + if (pb.running) + { + + // ======================================================================================= + // Read initial parameters + // ------------ + //constants + const u32 ratio = (u32)(((pb.src.ratio_hi << 16) + pb.src.ratio_lo) * ratioFactor); + u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo; + u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo; + + //variables + u32 samplePos = (pb.audio_addr.cur_addr_hi << 16) | pb.audio_addr.cur_addr_lo; + u32 frac = pb.src.cur_addr_frac; + // ============= + + // ======================================================================================= + // Handle No-SRC streams - No src streams have pb.src_type == 2 and have pb.src.ratio_hi = 0 + // and pb.src.ratio_lo = 0. We handle that by setting the sampling ratio integer to 1. This + // makes samplePos update in the correct way. I'm unsure how we are actually supposed to + // detect that this setting. Updates did not fix this automatically. + // --------------------------------------------------------------------------------------- + // Stream settings + // src_type = 2 (most other games have src_type = 0) + // ------------ + // Affected games: + // Baten Kaitos - Eternal Wings (2003) + // Baten Kaitos - Origins (2006)? + // Soul Calibur 2: The movie music use src_type 2 but it needs no adjustment, perhaps + // the sound format plays in to, Baten use ADPCM, SC2 use PCM16 + // ------------ + //if (pb.src_type == 2 && (pb.src.ratio_hi == 0 && pb.src.ratio_lo == 0)) + if (pb.running && (pb.src.ratio_hi == 0 && pb.src.ratio_lo == 0)) + { + pb.src.ratio_hi = 1; + } + // ============= + + + // ======================================================================================= + // Games that use looping to play non-looping music streams - SSBM has info in all + // pb.adpcm_loop_info parameters but has pb.audio_addr.looping = 0. If we treat these streams + // like any other looping streams the music works. I'm unsure how we are actually supposed to + // detect that these kinds of blocks should be looping. It seems like pb.mixer_control == 0 may + // identify these types of blocks. Updates did not write any looping values. + // -------------- + if ( + (pb.adpcm_loop_info.pred_scale || pb.adpcm_loop_info.yn1 || pb.adpcm_loop_info.yn2) + && pb.mixer_control == 0 + ) + { + pb.audio_addr.looping = 1; + } + // ============== + + // Top Spin 3 Wii + if(pb.audio_addr.sample_format > 25) pb.audio_addr.sample_format = 0; + + // ======================================================================================= + // Walk through _iSize. _iSize = numSamples. If the game goes slow _iSize will be higher to + // compensate for that. _iSize can be as low as 100 or as high as 2000 some cases. + for (int s = 0; s < _iSize; s++) + { + int sample = 0; + frac += ratio; + u32 newSamplePos = samplePos + (frac >> 16); //whole number of frac + + // ======================================================================================= + // Process sample format + // -------------- + switch (pb.audio_addr.sample_format) + { + case AUDIOFORMAT_PCM8: + // TODO - the linear interpolation code below is somewhat suspicious + pb.adpcm.yn2 = pb.adpcm.yn1; //save last sample + pb.adpcm.yn1 = ((s8)g_dspInitialize.pARAM_Read_U8(samplePos)) << 8; + + if (pb.src_type == SRCTYPE_NEAREST) + { + sample = pb.adpcm.yn1; + } + else //linear interpolation + { + sample = (pb.adpcm.yn1 * (u16)frac + pb.adpcm.yn2 * (u16)(0xFFFF - frac)) >> 16; + } + + samplePos = newSamplePos; + break; + + case AUDIOFORMAT_PCM16: + // TODO - the linear interpolation code below is somewhat suspicious + pb.adpcm.yn2 = pb.adpcm.yn1; //save last sample + pb.adpcm.yn1 = (s16)(u16)((g_dspInitialize.pARAM_Read_U8(samplePos * 2) << 8) | (g_dspInitialize.pARAM_Read_U8((samplePos * 2 + 1)))); + if (pb.src_type == SRCTYPE_NEAREST) + sample = pb.adpcm.yn1; + else //linear interpolation + sample = (pb.adpcm.yn1 * (u16)frac + pb.adpcm.yn2 * (u16)(0xFFFF - frac)) >> 16; + + samplePos = newSamplePos; + break; + + case AUDIOFORMAT_ADPCM: + sample = ADPCM_Step(pb.adpcm, samplePos, newSamplePos, frac); + break; + + default: + break; + } + // ================ + + // =================================================================== + // Overall volume control. In addition to this there is also separate volume settings to + // different channels (left, right etc). + frac &= 0xffff; + + int vol = pb.vol_env.cur_volume >> 9; + sample = sample * vol >> 8; + + if (pb.mixer_control & MIXCONTROL_RAMPING) + { + int x = pb.vol_env.cur_volume; + x += pb.vol_env.cur_volume_delta; // I'm not sure about this, can anybody find a game + // that use this? Or how does it work? + if (x < 0) x = 0; + if (x >= 0x7fff) x = 0x7fff; + pb.vol_env.cur_volume = x; // maybe not per sample?? :P + } + + int leftmix = pb.mixer.volume_left >> 5; + int rightmix = pb.mixer.volume_right >> 5; + int left = sample * leftmix >> 8; + int right = sample * rightmix >> 8; + //adpcm has to walk from oldSamplePos to samplePos here + templbuffer[s] += left; + temprbuffer[s] += right; + // =============== + + + // =================================================================== + // Control the behavior when we reach the end of the sample + if (samplePos >= sampleEnd) + { + if (pb.audio_addr.looping == 1) + { + samplePos = loopPos; + if (pb.audio_addr.sample_format == AUDIOFORMAT_ADPCM) + { + if (!pb.is_stream) + { + pb.adpcm.yn1 = pb.adpcm_loop_info.yn1; + pb.adpcm.yn2 = pb.adpcm_loop_info.yn2; + pb.adpcm.pred_scale = pb.adpcm_loop_info.pred_scale; + } + } + } + else + { + pb.running = 0; + break; + } + } + // =============== + } // end of the _iSize loop + + // Update volume + //if (sizeof(ParamBlockType) == sizeof(AXParamBlock)) // this is not needed anymore I think + if (gVolume) // allow us to turn this off in the debugger + { + pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown); + pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2); + } + + pb.src.cur_addr_frac = (u16)frac; + pb.audio_addr.cur_addr_hi = samplePos >> 16; + pb.audio_addr.cur_addr_lo = (u16)samplePos; + + } // if (pb.running) +} + + + +// ================================================ +// Voice hacks +// -------------- +template +inline void DoVoiceHacks(ParamBlockType &pb, bool Wii) +{ + // get necessary values + const u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo; + const u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo; + const u32 updaddr = (u32)(pb.updates.data_hi << 16) | pb.updates.data_lo; + const u16 updpar = Memory_Read_U16(updaddr); + const u16 upddata = Memory_Read_U16(updaddr + 2); + + // ======================================================================================= + /* Fix problems introduced with the SSBM fix. Sometimes when a music stream ended sampleEnd + would end up outside of bounds while the block was still playing resulting in noise + a strange noise. This should take care of that. + */ + // ------------ + if ( + (sampleEnd > (0x017fffff * 2) || loopPos > (0x017fffff * 2)) // ARAM bounds in nibbles + && gSSBMremedy1 + && !Wii + ) + { + pb.running = 0; + + // also reset all values if it makes any difference + pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0; + pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0; + pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0; + + pb.src.cur_addr_frac = 0; pb.src.ratio_hi = 0; pb.src.ratio_lo = 0; + pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0; + + pb.audio_addr.looping = 0; + pb.adpcm_loop_info.pred_scale = 0; + pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0; + } + + /* + // the fact that no settings are reset (except running) after a SSBM type music stream or another + looping block (for example in Battle Stadium DON) has ended could cause loud garbled sound to be + played from one or more blocks. Perhaps it was in conjunction with the old sequenced music fix below, + I'm not sure. This was an attempt to prevent that anyway by resetting all. But I'm not sure if this + is needed anymore. Please try to play SSBM without it and see if it works anyway. + */ + if ( + // detect blocks that have recently been running that we should reset + pb.running == 0 && pb.audio_addr.looping == 1 + //pb.running == 0 && pb.adpcm_loop_info.pred_scale + + // this prevents us from ruining sequenced music blocks, may not be needed + /* + && !(pb.updates.num_updates[0] || pb.updates.num_updates[1] || pb.updates.num_updates[2] + || pb.updates.num_updates[3] || pb.updates.num_updates[4]) + */ + && !(updpar || upddata) + + && pb.mixer_control == 0 // only use this in SSBM + + && gSSBMremedy2 // let us turn this fix on and off + && !Wii + ) + { + // reset the detection values + pb.audio_addr.looping = 0; + pb.adpcm_loop_info.pred_scale = 0; + pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0; + + //pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0; + //pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0; + //pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0; + + //pb.src.cur_addr_frac = 0; PBs[i].src.ratio_hi = 0; PBs[i].src.ratio_lo = 0; + //pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0; + } + + // ============= + + + // ======================================================================================= + // Reset all values + // ------------ + if (gReset + && (pb.running || pb.audio_addr.looping || pb.adpcm_loop_info.pred_scale) + ) + { + pb.running = 0; + + pb.audio_addr.cur_addr_hi = 0; pb.audio_addr.cur_addr_lo = 0; + pb.audio_addr.end_addr_hi = 0; pb.audio_addr.end_addr_lo = 0; + pb.audio_addr.loop_addr_hi = 0; pb.audio_addr.loop_addr_lo = 0; + + pb.src.cur_addr_frac = 0; pb.src.ratio_hi = 0; pb.src.ratio_lo = 0; + pb.adpcm.pred_scale = 0; pb.adpcm.yn1 = 0; pb.adpcm.yn2 = 0; + + pb.audio_addr.looping = 0; + pb.adpcm_loop_info.pred_scale = 0; + pb.adpcm_loop_info.yn1 = 0; pb.adpcm_loop_info.yn2 = 0; + } +} + + +#endif // _UCODE_AX_VOICE_H diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_CARD.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_CARD.h index 528a5672f8..25cb41c7d0 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_CARD.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_CARD.h @@ -1,45 +1,45 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_CARD_H -#define _UCODE_CARD_H - -#include "UCodes.h" - -class CUCode_CARD : public IUCode -{ -private: - enum EDSP_Codes - { - DSP_INIT = 0xDCD10000, - DSP_RESUME = 0xDCD10001, - DSP_YIELD = 0xDCD10002, - DSP_DONE = 0xDCD10003, - DSP_SYNC = 0xDCD10004, - DSP_UNKN = 0xDCD10005, - }; - -public: - CUCode_CARD(CMailHandler& _rMailHandler); - virtual ~CUCode_CARD(); - - void HandleMail(u32 _uMail); - void Update(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_CARD_H +#define _UCODE_CARD_H + +#include "UCodes.h" + +class CUCode_CARD : public IUCode +{ +private: + enum EDSP_Codes + { + DSP_INIT = 0xDCD10000, + DSP_RESUME = 0xDCD10001, + DSP_YIELD = 0xDCD10002, + DSP_DONE = 0xDCD10003, + DSP_SYNC = 0xDCD10004, + DSP_UNKN = 0xDCD10005, + }; + +public: + CUCode_CARD(CMailHandler& _rMailHandler); + virtual ~CUCode_CARD(); + + void HandleMail(u32 _uMail); + void Update(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_InitAudioSystem.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_InitAudioSystem.h index 24231f7628..4dc8725432 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_InitAudioSystem.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_InitAudioSystem.h @@ -1,54 +1,54 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_INITAUDIOSYSTEM -#define _UCODE_INITAUDIOSYSTEM - -#include "UCodes.h" - -class CUCode_InitAudioSystem : public IUCode -{ -public: - CUCode_InitAudioSystem(CMailHandler& _rMailHandler); - virtual ~CUCode_InitAudioSystem(); - - void HandleMail(u32 _uMail); - void Update(); - void Init(); - -private: - struct SUCode - { - u32 m_RAMAddress; - u32 m_Length; - u32 m_IMEMAddress; - u32 m_Unk; - u32 m_StartPC; - }; - - SUCode m_CurrentUCode; - int m_BootTask_numSteps; - - u32 m_NextParameter; - - bool IsInitialized; - - void BootUCode(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_INITAUDIOSYSTEM +#define _UCODE_INITAUDIOSYSTEM + +#include "UCodes.h" + +class CUCode_InitAudioSystem : public IUCode +{ +public: + CUCode_InitAudioSystem(CMailHandler& _rMailHandler); + virtual ~CUCode_InitAudioSystem(); + + void HandleMail(u32 _uMail); + void Update(); + void Init(); + +private: + struct SUCode + { + u32 m_RAMAddress; + u32 m_Length; + u32 m_IMEMAddress; + u32 m_Unk; + u32 m_StartPC; + }; + + SUCode m_CurrentUCode; + int m_BootTask_numSteps; + + u32 m_NextParameter; + + bool IsInitialized; + + void BootUCode(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Jac.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Jac.h index 1a8a02acd4..5ff675bb30 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Jac.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Jac.h @@ -1,74 +1,74 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_JAC -#define _UCODE_JAC - -#include "UCodes.h" - -class CUCode_Jac : public IUCode -{ -private: - - enum EDSP_Codes - { - DSP_INIT = 0xDCD10000, - DSP_RESUME = 0xDCD10001, - DSP_YIELD = 0xDCD10002, - DSP_DONE = 0xDCD10003, - DSP_SYNC = 0xDCD10004, - DSP_UNKN = 0xDCD10005, - }; - - bool m_bListInProgress; - int m_numSteps; - int m_step; - u8 m_Buffer[1024]; - void ExecuteList(); - - u32 m_readOffset; - - u8 Read8() - { - return(m_Buffer[m_readOffset++]); - } - - // Hmm, don't these need bswaps? - u16 Read16() - { - u16 res = *(u16*)&m_Buffer[m_readOffset]; - m_readOffset += 2; - return(res); - } - - u32 Read32() - { - u32 res = *(u32*)&m_Buffer[m_readOffset]; - m_readOffset += 4; - return(res); - } - -public: - CUCode_Jac(CMailHandler& _rMailHandler); - virtual ~CUCode_Jac(); - - void HandleMail(u32 _uMail); - void Update(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_JAC +#define _UCODE_JAC + +#include "UCodes.h" + +class CUCode_Jac : public IUCode +{ +private: + + enum EDSP_Codes + { + DSP_INIT = 0xDCD10000, + DSP_RESUME = 0xDCD10001, + DSP_YIELD = 0xDCD10002, + DSP_DONE = 0xDCD10003, + DSP_SYNC = 0xDCD10004, + DSP_UNKN = 0xDCD10005, + }; + + bool m_bListInProgress; + int m_numSteps; + int m_step; + u8 m_Buffer[1024]; + void ExecuteList(); + + u32 m_readOffset; + + u8 Read8() + { + return(m_Buffer[m_readOffset++]); + } + + // Hmm, don't these need bswaps? + u16 Read16() + { + u16 res = *(u16*)&m_Buffer[m_readOffset]; + m_readOffset += 2; + return(res); + } + + u32 Read32() + { + u32 res = *(u32*)&m_Buffer[m_readOffset]; + m_readOffset += 4; + return(res); + } + +public: + CUCode_Jac(CMailHandler& _rMailHandler); + virtual ~CUCode_Jac(); + + void HandleMail(u32 _uMail); + void Update(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_ROM.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_ROM.h index 82d438485b..68b8fc21eb 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_ROM.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_ROM.h @@ -1,51 +1,51 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_ROM -#define _UCODE_ROM - -#include "UCodes.h" - -class CUCode_Rom : public IUCode -{ -public: - CUCode_Rom(CMailHandler& _rMailHandler); - virtual ~CUCode_Rom(); - - void HandleMail(u32 _uMail); - void Update(); - -private: - struct SUCode - { - u32 m_RAMAddress; - u32 m_Length; - u32 m_IMEMAddress; - u32 m_Unk; - u32 m_StartPC; - }; - - SUCode m_CurrentUCode; - int m_BootTask_numSteps; - - u32 m_NextParameter; - - void BootUCode(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_ROM +#define _UCODE_ROM + +#include "UCodes.h" + +class CUCode_Rom : public IUCode +{ +public: + CUCode_Rom(CMailHandler& _rMailHandler); + virtual ~CUCode_Rom(); + + void HandleMail(u32 _uMail); + void Update(); + +private: + struct SUCode + { + u32 m_RAMAddress; + u32 m_Length; + u32 m_IMEMAddress; + u32 m_Unk; + u32 m_StartPC; + }; + + SUCode m_CurrentUCode; + int m_BootTask_numSteps; + + u32 m_NextParameter; + + void BootUCode(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h index 760e76d883..3a89b78c38 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h @@ -1,75 +1,75 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_ZELDA_H -#define _UCODE_ZELDA_H - -#include "Common.h" -#include "UCodes.h" - -class CUCode_Zelda : public IUCode -{ -private: - enum EDSP_Codes - { - DSP_INIT = 0xDCD10000, - DSP_RESUME = 0xDCD10001, - DSP_YIELD = 0xDCD10002, - DSP_DONE = 0xDCD10003, - DSP_SYNC = 0xDCD10004, - DSP_UNKN = 0xDCD10005, - }; - - // List in progress - u32 m_numSteps; - bool m_bListInProgress; - u32 m_step; - u8 m_Buffer[1024]; - void ExecuteList(); - - u32 m_readOffset; - - u8 Read8() - { - return m_Buffer[m_readOffset++]; - } - - u16 Read16() - { - u16 res = *(u16*)&m_Buffer[m_readOffset]; - m_readOffset += 2; - return res; - } - - u32 Read32() - { - u32 res = *(u32*)&m_Buffer[m_readOffset]; - m_readOffset += 4; - return res; - } -public: - - CUCode_Zelda(CMailHandler& _rMailHandler); - virtual ~CUCode_Zelda(); - - void HandleMail(u32 _uMail); - void Update(); - void MixAdd(short* buffer, int size); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_ZELDA_H +#define _UCODE_ZELDA_H + +#include "Common.h" +#include "UCodes.h" + +class CUCode_Zelda : public IUCode +{ +private: + enum EDSP_Codes + { + DSP_INIT = 0xDCD10000, + DSP_RESUME = 0xDCD10001, + DSP_YIELD = 0xDCD10002, + DSP_DONE = 0xDCD10003, + DSP_SYNC = 0xDCD10004, + DSP_UNKN = 0xDCD10005, + }; + + // List in progress + u32 m_numSteps; + bool m_bListInProgress; + u32 m_step; + u8 m_Buffer[1024]; + void ExecuteList(); + + u32 m_readOffset; + + u8 Read8() + { + return m_Buffer[m_readOffset++]; + } + + u16 Read16() + { + u16 res = *(u16*)&m_Buffer[m_readOffset]; + m_readOffset += 2; + return res; + } + + u32 Read32() + { + u32 res = *(u32*)&m_Buffer[m_readOffset]; + m_readOffset += 4; + return res; + } +public: + + CUCode_Zelda(CMailHandler& _rMailHandler); + virtual ~CUCode_Zelda(); + + void HandleMail(u32 _uMail); + void Update(); + void MixAdd(short* buffer, int size); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.h index b7da4d0b6e..609b7ca85b 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.h @@ -1,48 +1,48 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODES_H -#define _UCODES_H - -#include "Common.h" - -#define UCODE_ROM 0x0000000 -#define UCODE_INIT_AUDIO_SYSTEM 0x0000001 - -class CMailHandler; - -class IUCode -{ -public: - IUCode(CMailHandler& _rMailHandler) - : m_rMailHandler(_rMailHandler) - {} - - virtual ~IUCode() - {} - - virtual void HandleMail(u32 _uMail) = 0; - virtual void Update(void) = 0; - virtual void MixAdd(short* buffer, int size) {} - -protected: - CMailHandler& m_rMailHandler; -}; - -extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODES_H +#define _UCODES_H + +#include "Common.h" + +#define UCODE_ROM 0x0000000 +#define UCODE_INIT_AUDIO_SYSTEM 0x0000001 + +class CMailHandler; + +class IUCode +{ +public: + IUCode(CMailHandler& _rMailHandler) + : m_rMailHandler(_rMailHandler) + {} + + virtual ~IUCode() + {} + + virtual void HandleMail(u32 _uMail) = 0; + virtual void Update(void) = 0; + virtual void MixAdd(short* buffer, int size) {} + +protected: + CMailHandler& m_rMailHandler; +}; + +extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler); + +#endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/resource.h b/Source/Plugins/Plugin_DSP_HLE/Src/resource.h index e217d7decd..86e0b09704 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/resource.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/resource.h @@ -1,30 +1,30 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDD_SETTINGS 101 -#define IDD_DIALOG2 102 -#define IDC_COMBO1 1001 -#define IDC_SAMPLERATE 1001 -#define IDC_EDIT1 1002 -#define IDC_SAMPLEDUMPPATH 1002 -#define IDC_ENABLE_AUDIO 1003 -#define IDC_ENABLE_HLE_AUDIO 1003 -#define IDC_ENABLE_DTK_MUSIC 1004 -#define IDC_DUMPSAMPLES 1005 -#define IDC_SAMPLEMINLENGTH 1006 -#define IDC_BROWSE 1007 -#define IDC_ENABLE_THROTTLE 1008 -#define IDC_ANTIGAP 1009 -#define IDC_CHECK3 1010 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1011 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDD_SETTINGS 101 +#define IDD_DIALOG2 102 +#define IDC_COMBO1 1001 +#define IDC_SAMPLERATE 1001 +#define IDC_EDIT1 1002 +#define IDC_SAMPLEDUMPPATH 1002 +#define IDC_ENABLE_AUDIO 1003 +#define IDC_ENABLE_HLE_AUDIO 1003 +#define IDC_ENABLE_DTK_MUSIC 1004 +#define IDC_DUMPSAMPLES 1005 +#define IDC_SAMPLEMINLENGTH 1006 +#define IDC_BROWSE 1007 +#define IDC_ENABLE_THROTTLE 1008 +#define IDC_ANTIGAP 1009 +#define IDC_CHECK3 1010 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1011 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/stdafx.h b/Source/Plugins/Plugin_DSP_HLE/Src/stdafx.h index 6e2672e1cd..7ec343bdd8 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/stdafx.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/stdafx.h @@ -1,35 +1,35 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#ifdef _WIN32 - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define _CRT_SECURE_NO_DEPRECATE 1 - -// Windows Header Files: -#include -#include - -// WTL -#include -#include -#include -#include - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#ifdef _WIN32 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define _CRT_SECURE_NO_DEPRECATE 1 + +// Windows Header Files: +#include +#include + +// WTL +#include +#include +#include +#include + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Res/atlres.h b/Source/Plugins/Plugin_DSP_LLE/Res/atlres.h index 6e4f0ecd39..4fec890c15 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Res/atlres.h +++ b/Source/Plugins/Plugin_DSP_LLE/Res/atlres.h @@ -1,262 +1,262 @@ -// Windows Template Library - WTL version 8.0 -// Copyright (C) Microsoft Corporation. All rights reserved. -// -// This file is a part of the Windows Template Library. -// The use and distribution terms for this software are covered by the -// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) -// which can be found in the file CPL.TXT at the root of this distribution. -// By using this software in any fashion, you are agreeing to be bound by -// the terms of this license. You must not remove this notice, or -// any other, from this software. - -#ifndef __ATLRES_H__ -#define __ATLRES_H__ - -#pragma once - -#if defined (_WIN32_WCE) && !defined (__ATLRESCE_H__) - #error Use atlresCE.h instead of atlres.h for Windows CE -#endif - - -#ifdef RC_INVOKED -#ifndef _INC_WINDOWS - -#define _INC_WINDOWS - - #ifndef _WIN32_WCE -#define VS_VERSION_INFO 1 - - #ifdef APSTUDIO_INVOKED -#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols - #endif // APSTUDIO_INVOKED - - #ifndef WINVER -#define WINVER 0x0400 // default to Windows Version 4.0 - #endif // !WINVER - - #include - -// operation messages sent to DLGINIT -#define LB_ADDSTRING (WM_USER + 1) -#define CB_ADDSTRING (WM_USER + 3) - #endif // !_WIN32_WCE - - #ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS - #endif // APSTUDIO_INVOKED - - #ifdef IDC_STATIC - #undef IDC_STATIC - #endif // IDC_STATIC -#define IDC_STATIC (-1) - -#endif // !_INC_WINDOWS -#endif // RC_INVOKED - -#ifdef APSTUDIO_INVOKED -#define APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// ATL resource types - -#ifndef RC_INVOKED -#define RT_DLGINIT MAKEINTRESOURCE(240) -#define RT_TOOLBAR MAKEINTRESOURCE(241) -#endif // RC_INVOKED - -/////////////////////////////////////////////////////////////////////////////// - -#ifdef APSTUDIO_INVOKED - #undef APSTUDIO_HIDDEN_SYMBOLS -#endif // APSTUDIO_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// Standard window components - -#define ID_SEPARATOR 0 // special separator value -#define ID_DEFAULT_PANE 0 // default status bar pane - -#ifndef RC_INVOKED // code only -// standard control bars (IDW = window ID) -#define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window -#define ATL_IDW_STATUS_BAR 0xE801 // Status bar window -#define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window - -// parts of a frame window -#define ATL_IDW_CLIENT 0xE900 -#define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max) -#define ATL_IDW_PANE_LAST 0xE9FF -#define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max) -#define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max) - -#define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters -#define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST - -// bands for a rebar -#define ATL_IDW_BAND_FIRST 0xEB00 -#define ATL_IDW_BAND_LAST 0xEBFF -#endif // !RC_INVOKED - -/////////////////////////////////////////////////////////////////////////////// -// Standard Commands - -// File commands -#define ID_FILE_NEW 0xE100 -#define ID_FILE_OPEN 0xE101 -#define ID_FILE_CLOSE 0xE102 -#define ID_FILE_SAVE 0xE103 -#define ID_FILE_SAVE_AS 0xE104 -#define ID_FILE_PAGE_SETUP 0xE105 -#define ID_FILE_PRINT_SETUP 0xE106 -#define ID_FILE_PRINT 0xE107 -#define ID_FILE_PRINT_DIRECT 0xE108 -#define ID_FILE_PRINT_PREVIEW 0xE109 -#define ID_FILE_UPDATE 0xE10A -#define ID_FILE_SAVE_COPY_AS 0xE10B -#define ID_FILE_SEND_MAIL 0xE10C - -#define ID_FILE_MRU_FIRST 0xE110 -#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max -#define ID_FILE_MRU_FILE2 0xE111 -#define ID_FILE_MRU_FILE3 0xE112 -#define ID_FILE_MRU_FILE4 0xE113 -#define ID_FILE_MRU_FILE5 0xE114 -#define ID_FILE_MRU_FILE6 0xE115 -#define ID_FILE_MRU_FILE7 0xE116 -#define ID_FILE_MRU_FILE8 0xE117 -#define ID_FILE_MRU_FILE9 0xE118 -#define ID_FILE_MRU_FILE10 0xE119 -#define ID_FILE_MRU_FILE11 0xE11A -#define ID_FILE_MRU_FILE12 0xE11B -#define ID_FILE_MRU_FILE13 0xE11C -#define ID_FILE_MRU_FILE14 0xE11D -#define ID_FILE_MRU_FILE15 0xE11E -#define ID_FILE_MRU_FILE16 0xE11F -#define ID_FILE_MRU_LAST 0xE11F - -// Edit commands -#define ID_EDIT_CLEAR 0xE120 -#define ID_EDIT_CLEAR_ALL 0xE121 -#define ID_EDIT_COPY 0xE122 -#define ID_EDIT_CUT 0xE123 -#define ID_EDIT_FIND 0xE124 -#define ID_EDIT_PASTE 0xE125 -#define ID_EDIT_PASTE_LINK 0xE126 -#define ID_EDIT_PASTE_SPECIAL 0xE127 -#define ID_EDIT_REPEAT 0xE128 -#define ID_EDIT_REPLACE 0xE129 -#define ID_EDIT_SELECT_ALL 0xE12A -#define ID_EDIT_UNDO 0xE12B -#define ID_EDIT_REDO 0xE12C - -// Window commands -#define ID_WINDOW_NEW 0xE130 -#define ID_WINDOW_ARRANGE 0xE131 -#define ID_WINDOW_CASCADE 0xE132 -#define ID_WINDOW_TILE_HORZ 0xE133 -#define ID_WINDOW_TILE_VERT 0xE134 -#define ID_WINDOW_SPLIT 0xE135 -#ifndef RC_INVOKED // code only -#define ATL_IDM_WINDOW_FIRST 0xE130 -#define ATL_IDM_WINDOW_LAST 0xE13F -#define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here -#define ATL_IDM_LAST_MDICHILD 0xFFFD -#endif // !RC_INVOKED -// TabView -#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD -#define ID_WINDOW_TABLAST 0xFFFD -#define ID_WINDOW_SHOWTABLIST 0xFFFE - -// Help and App commands -#define ID_APP_ABOUT 0xE140 -#define ID_APP_EXIT 0xE141 -#define ID_HELP_INDEX 0xE142 -#define ID_HELP_FINDER 0xE143 -#define ID_HELP_USING 0xE144 -#define ID_CONTEXT_HELP 0xE145 // shift-F1 -// special commands for processing help -#define ID_HELP 0xE146 // first attempt for F1 -#define ID_DEFAULT_HELP 0xE147 // last attempt - -// Misc -#define ID_NEXT_PANE 0xE150 -#define ID_PREV_PANE 0xE151 -#define ID_PANE_CLOSE 0xE152 - -// Format -#define ID_FORMAT_FONT 0xE160 - -// Scroll -#define ID_SCROLL_UP 0xE170 -#define ID_SCROLL_DOWN 0xE171 -#define ID_SCROLL_PAGE_UP 0xE172 -#define ID_SCROLL_PAGE_DOWN 0xE173 -#define ID_SCROLL_TOP 0xE174 -#define ID_SCROLL_BOTTOM 0xE175 -#define ID_SCROLL_LEFT 0xE176 -#define ID_SCROLL_RIGHT 0xE177 -#define ID_SCROLL_PAGE_LEFT 0xE178 -#define ID_SCROLL_PAGE_RIGHT 0xE179 -#define ID_SCROLL_ALL_LEFT 0xE17A -#define ID_SCROLL_ALL_RIGHT 0xE17B - -// OLE commands -#define ID_OLE_INSERT_NEW 0xE200 -#define ID_OLE_EDIT_LINKS 0xE201 -#define ID_OLE_EDIT_CONVERT 0xE202 -#define ID_OLE_EDIT_CHANGE_ICON 0xE203 -#define ID_OLE_EDIT_PROPERTIES 0xE204 -#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max -#ifndef RC_INVOKED // code only -#define ID_OLE_VERB_LAST 0xE21F -#endif // !RC_INVOKED - -// View commands (same number used as IDW used for toolbar and status bar) -#define ID_VIEW_TOOLBAR 0xE800 -#define ID_VIEW_STATUS_BAR 0xE801 -#define ID_VIEW_REFRESH 0xE803 - -/////////////////////////////////////////////////////////////////////////////// -// Standard control IDs - -#ifdef IDC_STATIC - #undef IDC_STATIC -#endif // IDC_STATIC -#define IDC_STATIC (-1) // all static controls - -/////////////////////////////////////////////////////////////////////////////// -// Standard string error/warnings - -// idle status bar message -#define ATL_IDS_IDLEMESSAGE 0xE001 - -#ifndef RC_INVOKED // code only -#define ATL_IDS_SCFIRST 0xEF00 -#endif // !RC_INVOKED - -#define ATL_IDS_SCSIZE 0xEF00 -#define ATL_IDS_SCMOVE 0xEF01 -#define ATL_IDS_SCMINIMIZE 0xEF02 -#define ATL_IDS_SCMAXIMIZE 0xEF03 -#define ATL_IDS_SCNEXTWINDOW 0xEF04 -#define ATL_IDS_SCPREVWINDOW 0xEF05 -#define ATL_IDS_SCCLOSE 0xEF06 -#define ATL_IDS_SCRESTORE 0xEF12 -#define ATL_IDS_SCTASKLIST 0xEF13 - -#define ATL_IDS_MDICHILD 0xEF1F -#define ATL_IDS_MRU_FILE 0xEFDA - -/////////////////////////////////////////////////////////////////////////////// -// Misc. control IDs - -// Property Sheet control id's (determined with Spy++) -#define ID_APPLY_NOW 0x3021 -#define ID_WIZBACK 0x3023 -#define ID_WIZNEXT 0x3024 -#define ID_WIZFINISH 0x3025 -#define ATL_IDC_TAB_CONTROL 0x3020 - -#endif // __ATLRES_H__ +// Windows Template Library - WTL version 8.0 +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// This file is a part of the Windows Template Library. +// The use and distribution terms for this software are covered by the +// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php) +// which can be found in the file CPL.TXT at the root of this distribution. +// By using this software in any fashion, you are agreeing to be bound by +// the terms of this license. You must not remove this notice, or +// any other, from this software. + +#ifndef __ATLRES_H__ +#define __ATLRES_H__ + +#pragma once + +#if defined (_WIN32_WCE) && !defined (__ATLRESCE_H__) + #error Use atlresCE.h instead of atlres.h for Windows CE +#endif + + +#ifdef RC_INVOKED +#ifndef _INC_WINDOWS + +#define _INC_WINDOWS + + #ifndef _WIN32_WCE +#define VS_VERSION_INFO 1 + + #ifdef APSTUDIO_INVOKED +#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols + #endif // APSTUDIO_INVOKED + + #ifndef WINVER +#define WINVER 0x0400 // default to Windows Version 4.0 + #endif // !WINVER + + #include + +// operation messages sent to DLGINIT +#define LB_ADDSTRING (WM_USER + 1) +#define CB_ADDSTRING (WM_USER + 3) + #endif // !_WIN32_WCE + + #ifdef APSTUDIO_INVOKED + #undef APSTUDIO_HIDDEN_SYMBOLS + #endif // APSTUDIO_INVOKED + + #ifdef IDC_STATIC + #undef IDC_STATIC + #endif // IDC_STATIC +#define IDC_STATIC (-1) + +#endif // !_INC_WINDOWS +#endif // RC_INVOKED + +#ifdef APSTUDIO_INVOKED +#define APSTUDIO_HIDDEN_SYMBOLS +#endif // APSTUDIO_INVOKED + +/////////////////////////////////////////////////////////////////////////////// +// ATL resource types + +#ifndef RC_INVOKED +#define RT_DLGINIT MAKEINTRESOURCE(240) +#define RT_TOOLBAR MAKEINTRESOURCE(241) +#endif // RC_INVOKED + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef APSTUDIO_INVOKED + #undef APSTUDIO_HIDDEN_SYMBOLS +#endif // APSTUDIO_INVOKED + +/////////////////////////////////////////////////////////////////////////////// +// Standard window components + +#define ID_SEPARATOR 0 // special separator value +#define ID_DEFAULT_PANE 0 // default status bar pane + +#ifndef RC_INVOKED // code only +// standard control bars (IDW = window ID) +#define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window +#define ATL_IDW_STATUS_BAR 0xE801 // Status bar window +#define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window + +// parts of a frame window +#define ATL_IDW_CLIENT 0xE900 +#define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max) +#define ATL_IDW_PANE_LAST 0xE9FF +#define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max) +#define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max) + +#define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters +#define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST + +// bands for a rebar +#define ATL_IDW_BAND_FIRST 0xEB00 +#define ATL_IDW_BAND_LAST 0xEBFF +#endif // !RC_INVOKED + +/////////////////////////////////////////////////////////////////////////////// +// Standard Commands + +// File commands +#define ID_FILE_NEW 0xE100 +#define ID_FILE_OPEN 0xE101 +#define ID_FILE_CLOSE 0xE102 +#define ID_FILE_SAVE 0xE103 +#define ID_FILE_SAVE_AS 0xE104 +#define ID_FILE_PAGE_SETUP 0xE105 +#define ID_FILE_PRINT_SETUP 0xE106 +#define ID_FILE_PRINT 0xE107 +#define ID_FILE_PRINT_DIRECT 0xE108 +#define ID_FILE_PRINT_PREVIEW 0xE109 +#define ID_FILE_UPDATE 0xE10A +#define ID_FILE_SAVE_COPY_AS 0xE10B +#define ID_FILE_SEND_MAIL 0xE10C + +#define ID_FILE_MRU_FIRST 0xE110 +#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max +#define ID_FILE_MRU_FILE2 0xE111 +#define ID_FILE_MRU_FILE3 0xE112 +#define ID_FILE_MRU_FILE4 0xE113 +#define ID_FILE_MRU_FILE5 0xE114 +#define ID_FILE_MRU_FILE6 0xE115 +#define ID_FILE_MRU_FILE7 0xE116 +#define ID_FILE_MRU_FILE8 0xE117 +#define ID_FILE_MRU_FILE9 0xE118 +#define ID_FILE_MRU_FILE10 0xE119 +#define ID_FILE_MRU_FILE11 0xE11A +#define ID_FILE_MRU_FILE12 0xE11B +#define ID_FILE_MRU_FILE13 0xE11C +#define ID_FILE_MRU_FILE14 0xE11D +#define ID_FILE_MRU_FILE15 0xE11E +#define ID_FILE_MRU_FILE16 0xE11F +#define ID_FILE_MRU_LAST 0xE11F + +// Edit commands +#define ID_EDIT_CLEAR 0xE120 +#define ID_EDIT_CLEAR_ALL 0xE121 +#define ID_EDIT_COPY 0xE122 +#define ID_EDIT_CUT 0xE123 +#define ID_EDIT_FIND 0xE124 +#define ID_EDIT_PASTE 0xE125 +#define ID_EDIT_PASTE_LINK 0xE126 +#define ID_EDIT_PASTE_SPECIAL 0xE127 +#define ID_EDIT_REPEAT 0xE128 +#define ID_EDIT_REPLACE 0xE129 +#define ID_EDIT_SELECT_ALL 0xE12A +#define ID_EDIT_UNDO 0xE12B +#define ID_EDIT_REDO 0xE12C + +// Window commands +#define ID_WINDOW_NEW 0xE130 +#define ID_WINDOW_ARRANGE 0xE131 +#define ID_WINDOW_CASCADE 0xE132 +#define ID_WINDOW_TILE_HORZ 0xE133 +#define ID_WINDOW_TILE_VERT 0xE134 +#define ID_WINDOW_SPLIT 0xE135 +#ifndef RC_INVOKED // code only +#define ATL_IDM_WINDOW_FIRST 0xE130 +#define ATL_IDM_WINDOW_LAST 0xE13F +#define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here +#define ATL_IDM_LAST_MDICHILD 0xFFFD +#endif // !RC_INVOKED +// TabView +#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD +#define ID_WINDOW_TABLAST 0xFFFD +#define ID_WINDOW_SHOWTABLIST 0xFFFE + +// Help and App commands +#define ID_APP_ABOUT 0xE140 +#define ID_APP_EXIT 0xE141 +#define ID_HELP_INDEX 0xE142 +#define ID_HELP_FINDER 0xE143 +#define ID_HELP_USING 0xE144 +#define ID_CONTEXT_HELP 0xE145 // shift-F1 +// special commands for processing help +#define ID_HELP 0xE146 // first attempt for F1 +#define ID_DEFAULT_HELP 0xE147 // last attempt + +// Misc +#define ID_NEXT_PANE 0xE150 +#define ID_PREV_PANE 0xE151 +#define ID_PANE_CLOSE 0xE152 + +// Format +#define ID_FORMAT_FONT 0xE160 + +// Scroll +#define ID_SCROLL_UP 0xE170 +#define ID_SCROLL_DOWN 0xE171 +#define ID_SCROLL_PAGE_UP 0xE172 +#define ID_SCROLL_PAGE_DOWN 0xE173 +#define ID_SCROLL_TOP 0xE174 +#define ID_SCROLL_BOTTOM 0xE175 +#define ID_SCROLL_LEFT 0xE176 +#define ID_SCROLL_RIGHT 0xE177 +#define ID_SCROLL_PAGE_LEFT 0xE178 +#define ID_SCROLL_PAGE_RIGHT 0xE179 +#define ID_SCROLL_ALL_LEFT 0xE17A +#define ID_SCROLL_ALL_RIGHT 0xE17B + +// OLE commands +#define ID_OLE_INSERT_NEW 0xE200 +#define ID_OLE_EDIT_LINKS 0xE201 +#define ID_OLE_EDIT_CONVERT 0xE202 +#define ID_OLE_EDIT_CHANGE_ICON 0xE203 +#define ID_OLE_EDIT_PROPERTIES 0xE204 +#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max +#ifndef RC_INVOKED // code only +#define ID_OLE_VERB_LAST 0xE21F +#endif // !RC_INVOKED + +// View commands (same number used as IDW used for toolbar and status bar) +#define ID_VIEW_TOOLBAR 0xE800 +#define ID_VIEW_STATUS_BAR 0xE801 +#define ID_VIEW_REFRESH 0xE803 + +/////////////////////////////////////////////////////////////////////////////// +// Standard control IDs + +#ifdef IDC_STATIC + #undef IDC_STATIC +#endif // IDC_STATIC +#define IDC_STATIC (-1) // all static controls + +/////////////////////////////////////////////////////////////////////////////// +// Standard string error/warnings + +// idle status bar message +#define ATL_IDS_IDLEMESSAGE 0xE001 + +#ifndef RC_INVOKED // code only +#define ATL_IDS_SCFIRST 0xEF00 +#endif // !RC_INVOKED + +#define ATL_IDS_SCSIZE 0xEF00 +#define ATL_IDS_SCMOVE 0xEF01 +#define ATL_IDS_SCMINIMIZE 0xEF02 +#define ATL_IDS_SCMAXIMIZE 0xEF03 +#define ATL_IDS_SCNEXTWINDOW 0xEF04 +#define ATL_IDS_SCPREVWINDOW 0xEF05 +#define ATL_IDS_SCCLOSE 0xEF06 +#define ATL_IDS_SCRESTORE 0xEF12 +#define ATL_IDS_SCTASKLIST 0xEF13 + +#define ATL_IDS_MDICHILD 0xEF1F +#define ATL_IDS_MRU_FILE 0xEFDA + +/////////////////////////////////////////////////////////////////////////////// +// Misc. control IDs + +// Property Sheet control id's (determined with Spy++) +#define ID_APPLY_NOW 0x3021 +#define ID_WIZBACK 0x3023 +#define ID_WIZNEXT 0x3024 +#define ID_WIZFINISH 0x3025 +#define ATL_IDC_TAB_CONTROL 0x3020 + +#endif // __ATLRES_H__ diff --git a/Source/Plugins/Plugin_DSP_LLE/Res/resource.h b/Source/Plugins/Plugin_DSP_LLE/Res/resource.h index 1d5ffbaf63..7d5ff49484 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Res/resource.h +++ b/Source/Plugins/Plugin_DSP_LLE/Res/resource.h @@ -1,30 +1,30 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resources.rc -// -#define IDR_MAINFRAME 128 -#define IDD_MAINDLG 129 -#define IDD_DISASMDLG 129 -#define IDD_DISASMDLG1 130 -#define IDD_REGISTERDLG 130 -#define IDC_LIST1 1000 -#define IDC_DISASM_LIST 1000 -#define ID_STEP 1001 -#define ID_SHOW_REGISTER 1002 -#define IDC_ASSERT_INT 1003 -#define ID_GO 1004 -#define IDC_HALT 1005 -#define IDC_HALT2 1006 -#define IDC_INIT 1006 -#define IDC_GROUP 1007 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 202 -#define _APS_NEXT_COMMAND_VALUE 32772 -#define _APS_NEXT_CONTROL_VALUE 1008 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resources.rc +// +#define IDR_MAINFRAME 128 +#define IDD_MAINDLG 129 +#define IDD_DISASMDLG 129 +#define IDD_DISASMDLG1 130 +#define IDD_REGISTERDLG 130 +#define IDC_LIST1 1000 +#define IDC_DISASM_LIST 1000 +#define ID_STEP 1001 +#define ID_SHOW_REGISTER 1002 +#define IDC_ASSERT_INT 1003 +#define ID_GO 1004 +#define IDC_HALT 1005 +#define IDC_HALT2 1006 +#define IDC_INIT 1006 +#define IDC_GROUP 1007 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 202 +#define _APS_NEXT_COMMAND_VALUE 32772 +#define _APS_NEXT_CONTROL_VALUE 1008 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/DSoundStream.h b/Source/Plugins/Plugin_DSP_LLE/Src/DSoundStream.h index f27293c997..99e3a9d7c6 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/DSoundStream.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/DSoundStream.h @@ -1,35 +1,35 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __SOUNDSTREAM_H__ -#define __SOUNDSTREAM_H__ - -namespace DSound -{ -typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels); - -bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback); -void DSound_UpdateSound(); -void DSound_StopSound(); - -float DSound_GetTimer(); -int DSound_GetCurSample(); -int DSound_GetSampleRate(); -} - - -#endif //__SOUNDSTREAM_H__ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __SOUNDSTREAM_H__ +#define __SOUNDSTREAM_H__ + +namespace DSound +{ +typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels); + +bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback); +void DSound_UpdateSound(); +void DSound_StopSound(); + +float DSound_GetTimer(); +int DSound_GetCurSample(); +int DSound_GetSampleRate(); +} + + +#endif //__SOUNDSTREAM_H__ diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/DisAsmDlg.h b/Source/Plugins/Plugin_DSP_LLE/Src/DisAsmDlg.h index c90914cd3c..ef128c24fc 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/DisAsmDlg.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/DisAsmDlg.h @@ -1,163 +1,163 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include "Globals.h" - -#include -#include - -#include "../res/resource.h" -#include "DisAsmListView.h" -#include "RegisterDlg.h" - -class CDisAsmDlg - : public CDialogImpl, public CUpdateUI, public CDialogResize -{ - public: - - CDisAsmDlg(); - - enum { IDD = IDD_DISASMDLG }; - - virtual BOOL PreTranslateMessage(MSG* pMsg); - virtual BOOL OnIdle(); - - - BEGIN_UPDATE_UI_MAP(CDisAsmDlg) - END_UPDATE_UI_MAP() - - BEGIN_DLGRESIZE_MAP(CDisAsmDlg) - DLGRESIZE_CONTROL(IDR_MAINFRAME, DLSZ_SIZE_X | DLSZ_SIZE_Y) - END_DLGRESIZE_MAP() - - BEGIN_MSG_MAP(CDisAsmDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - COMMAND_ID_HANDLER(ID_STEP, OnStep) - COMMAND_ID_HANDLER(ID_GO, OnGo) - COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters) - NOTIFY_CODE_HANDLER(NM_CLICK, OnDblClick) - NOTIFY_CODE_HANDLER(NM_RETURN, OnDblClick) - NOTIFY_CODE_HANDLER(NM_RCLICK, OnRClick) - NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) - NOTIFY_HANDLER(IDC_DISASM_LIST, LVN_ITEMCHANGED, OnLvnItemchangedDisasmList) - MESSAGE_HANDLER(WM_SIZE, OnSize) - CHAIN_MSG_MAP(CDialogResize) - - END_MSG_MAP() - -// Handler prototypes (uncomment arguments if needed): -// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); - - LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); - LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); - LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); - LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled); - - LRESULT OnDblClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/); - LRESULT OnRClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/); - - void CloseDialog(int nVal); - - bool CanDoStep(); - - void DebugBreak(); - - - private: - - enum EColumns - { - ColumnBP = 0, - ColumnFunction = 1, - ColumnAddress = 2, - ColumnMenmomic = 3, - ColumnOpcode = 4, - ColumnExt = 5, - ColumnParameter = 6 - }; - - enum EState - { - PAUSE, - STEP, - RUN, - RUN_START // ignores breakpoints and switches after one step to RUN - }; - EState m_State; - - - CListViewCtrl m_DisAsmListViewCtrl; - CRegisterDlg m_RegisterDlg; - //CWindow GroupLeft - CStatic GroupLeft; - - uint64 m_CachedStepCounter; - uint16 m_CachedCR; - uint32 m_CachedUCodeCRC; - - typedef std::listCBreakPointList; - CBreakPointList m_BreakPoints; - - // break point handling - bool IsBreakPoint(uint16 _Address); - void ToggleBreakPoint(uint16 _Address); - void RemoveBreakPoint(uint16 _Address); - void AddBreakPoint(uint16 _Address); - void ClearBreakPoints(); - - - // update dialog - void UpdateDisAsmListView(); - void UpdateRegisterFlags(); - void UpdateSymbolMap(); - void UpdateButtonTexts(); - - void RedrawDisAsmListView(); - void RebuildDisAsmListView(); - - - struct SSymbol - { - uint32 AddressStart; - uint32 AddressEnd; - std::string Name; - - SSymbol(uint32 _AddressStart = 0, uint32 _AddressEnd = 0, char* _Name = NULL) - : AddressStart(_AddressStart) - , AddressEnd(_AddressEnd) - , Name(_Name) - {} - }; - typedef std::mapCSymbolMap; - CSymbolMap m_SymbolMap; - - void AddSymbol(uint16 _AddressStart, uint16 _AddressEnd, char* _Name); - bool LoadSymbolMap(const char* _pFileName); - DWORD FindColor(uint16 _Address); - void UpdateDialog(); - - static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); -public: - LRESULT OnLvnItemchangedDisasmList(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/); - LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); -}; +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#include "Globals.h" + +#include +#include + +#include "../res/resource.h" +#include "DisAsmListView.h" +#include "RegisterDlg.h" + +class CDisAsmDlg + : public CDialogImpl, public CUpdateUI, public CDialogResize +{ + public: + + CDisAsmDlg(); + + enum { IDD = IDD_DISASMDLG }; + + virtual BOOL PreTranslateMessage(MSG* pMsg); + virtual BOOL OnIdle(); + + + BEGIN_UPDATE_UI_MAP(CDisAsmDlg) + END_UPDATE_UI_MAP() + + BEGIN_DLGRESIZE_MAP(CDisAsmDlg) + DLGRESIZE_CONTROL(IDR_MAINFRAME, DLSZ_SIZE_X | DLSZ_SIZE_Y) + END_DLGRESIZE_MAP() + + BEGIN_MSG_MAP(CDisAsmDlg) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + COMMAND_ID_HANDLER(ID_STEP, OnStep) + COMMAND_ID_HANDLER(ID_GO, OnGo) + COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters) + NOTIFY_CODE_HANDLER(NM_CLICK, OnDblClick) + NOTIFY_CODE_HANDLER(NM_RETURN, OnDblClick) + NOTIFY_CODE_HANDLER(NM_RCLICK, OnRClick) + NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) + NOTIFY_HANDLER(IDC_DISASM_LIST, LVN_ITEMCHANGED, OnLvnItemchangedDisasmList) + MESSAGE_HANDLER(WM_SIZE, OnSize) + CHAIN_MSG_MAP(CDialogResize) + + END_MSG_MAP() + +// Handler prototypes (uncomment arguments if needed): +// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) +// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) +// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); + + LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); + LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); + LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); + LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled); + + LRESULT OnDblClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/); + LRESULT OnRClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/); + + void CloseDialog(int nVal); + + bool CanDoStep(); + + void DebugBreak(); + + + private: + + enum EColumns + { + ColumnBP = 0, + ColumnFunction = 1, + ColumnAddress = 2, + ColumnMenmomic = 3, + ColumnOpcode = 4, + ColumnExt = 5, + ColumnParameter = 6 + }; + + enum EState + { + PAUSE, + STEP, + RUN, + RUN_START // ignores breakpoints and switches after one step to RUN + }; + EState m_State; + + + CListViewCtrl m_DisAsmListViewCtrl; + CRegisterDlg m_RegisterDlg; + //CWindow GroupLeft + CStatic GroupLeft; + + uint64 m_CachedStepCounter; + uint16 m_CachedCR; + uint32 m_CachedUCodeCRC; + + typedef std::listCBreakPointList; + CBreakPointList m_BreakPoints; + + // break point handling + bool IsBreakPoint(uint16 _Address); + void ToggleBreakPoint(uint16 _Address); + void RemoveBreakPoint(uint16 _Address); + void AddBreakPoint(uint16 _Address); + void ClearBreakPoints(); + + + // update dialog + void UpdateDisAsmListView(); + void UpdateRegisterFlags(); + void UpdateSymbolMap(); + void UpdateButtonTexts(); + + void RedrawDisAsmListView(); + void RebuildDisAsmListView(); + + + struct SSymbol + { + uint32 AddressStart; + uint32 AddressEnd; + std::string Name; + + SSymbol(uint32 _AddressStart = 0, uint32 _AddressEnd = 0, char* _Name = NULL) + : AddressStart(_AddressStart) + , AddressEnd(_AddressEnd) + , Name(_Name) + {} + }; + typedef std::mapCSymbolMap; + CSymbolMap m_SymbolMap; + + void AddSymbol(uint16 _AddressStart, uint16 _AddressEnd, char* _Name); + bool LoadSymbolMap(const char* _pFileName); + DWORD FindColor(uint16 _Address); + void UpdateDialog(); + + static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); +public: + LRESULT OnLvnItemchangedDisasmList(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/); + LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); +}; diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/DisAsmListView.h b/Source/Plugins/Plugin_DSP_LLE/Src/DisAsmListView.h index 5fbc6725e7..65f9dd7f1f 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/DisAsmListView.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/DisAsmListView.h @@ -1,64 +1,64 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MYLISTVIEW_H -#define _MYLISTVIEW_H - -class CDisAsmListView - : public CWindowImpl, - public CCustomDraw -{ - public: - - BEGIN_MSG_MAP(CDisAsmListView) - CHAIN_MSG_MAP(CCustomDraw) - END_MSG_MAP() - - DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) - { - return(CDRF_NOTIFYITEMDRAW); - } - - - DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) - { - NMLVCUSTOMDRAW* pLVCD = reinterpret_cast(lpNMCustomDraw); - - // This is the prepaint stage for an item. Here's where we set the - // item's text color. Our return value will tell Windows to draw the - // item itself, but it will use the new color we set here for the background - - COLORREF crText; - - if ((pLVCD->nmcd.dwItemSpec % 2) == 0) - { - crText = RGB(200, 200, 255); - } - else - { - crText = RGB(255, 255, 255); - } - - // Store the color back in the NMLVCUSTOMDRAW struct. - pLVCD->clrTextBk = crText; - - // Tell Windows to paint the control itself. - return(CDRF_DODEFAULT); - } -}; - -#endif _MYLISTVIEW_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MYLISTVIEW_H +#define _MYLISTVIEW_H + +class CDisAsmListView + : public CWindowImpl, + public CCustomDraw +{ + public: + + BEGIN_MSG_MAP(CDisAsmListView) + CHAIN_MSG_MAP(CCustomDraw) + END_MSG_MAP() + + DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) + { + return(CDRF_NOTIFYITEMDRAW); + } + + + DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) + { + NMLVCUSTOMDRAW* pLVCD = reinterpret_cast(lpNMCustomDraw); + + // This is the prepaint stage for an item. Here's where we set the + // item's text color. Our return value will tell Windows to draw the + // item itself, but it will use the new color we set here for the background + + COLORREF crText; + + if ((pLVCD->nmcd.dwItemSpec % 2) == 0) + { + crText = RGB(200, 200, 255); + } + else + { + crText = RGB(255, 255, 255); + } + + // Store the color back in the NMLVCUSTOMDRAW struct. + pLVCD->clrTextBk = crText; + + // Tell Windows to paint the control itself. + return(CDRF_DODEFAULT); + } +}; + +#endif _MYLISTVIEW_H diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Globals.h b/Source/Plugins/Plugin_DSP_LLE/Src/Globals.h index d5c4f43a73..7265b25057 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Globals.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Globals.h @@ -1,60 +1,60 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _GLOBALS_H -#define _GLOBALS_H - -#include "pluginspecs_dsp.h" -#include "Common.h" -#include - -#define WITH_DSP_ON_THREAD 1 -#define DUMP_DSP_IMEM 0 -#define PROFILE 1 - -extern DSPInitialize g_dspInitialize; -void DebugLog(const char* _fmt, ...); -void ErrorLog(const char* _fmt, ...); -void DSP_DebugBreak(); - - -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -typedef unsigned long long uint64; -typedef unsigned int uint; - -typedef signed char sint8; -typedef signed short sint16; -typedef signed int sint32; -typedef signed long long sint64; - -typedef const uint32 cuint32; - -u16 Memory_Read_U16(u32 _uAddress); // For PB address detection -u32 Memory_Read_U32(u32 _uAddress); - -#if PROFILE - void ProfilerDump(uint64 _count); - void ProfilerInit(); - void ProfilerAddDelta(int _addr, int _delta); - void ProfilerStart(); -#endif - - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _GLOBALS_H +#define _GLOBALS_H + +#include "pluginspecs_dsp.h" +#include "Common.h" +#include + +#define WITH_DSP_ON_THREAD 1 +#define DUMP_DSP_IMEM 0 +#define PROFILE 1 + +extern DSPInitialize g_dspInitialize; +void DebugLog(const char* _fmt, ...); +void ErrorLog(const char* _fmt, ...); +void DSP_DebugBreak(); + + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned int uint32; +typedef unsigned long long uint64; +typedef unsigned int uint; + +typedef signed char sint8; +typedef signed short sint16; +typedef signed int sint32; +typedef signed long long sint64; + +typedef const uint32 cuint32; + +u16 Memory_Read_U16(u32 _uAddress); // For PB address detection +u32 Memory_Read_U32(u32 _uAddress); + +#if PROFILE + void ProfilerDump(uint64 _count); + void ProfilerInit(); + void ProfilerAddDelta(int _addr, int _delta); + void ProfilerStart(); +#endif + + +#endif + diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/HLE_Helper.h b/Source/Plugins/Plugin_DSP_LLE/Src/HLE_Helper.h index 11108a7e24..f1aa055cf0 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/HLE_Helper.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/HLE_Helper.h @@ -1,129 +1,129 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef HLE_HELPER_H -#define HLE_HELPER_H - -#include "gdsp_interpreter.h" - -bool WriteDMEM(uint16 addr, uint16 val); -uint16 ReadDMEM(uint16 addr); -void Update_SR_Register(sint64 _Value); -sint8 GetMultiplyModifier(); - -template -class TAccumulator -{ -public: - - TAccumulator() - { - _assert_(N < 2); - } - - void operator=(sint64 val) - { - setValue(val); - } - - void operator<<=(sint64 value) - { - sint64 acc = getValue(); - acc <<= value; - setValue(acc); - } - - void operator>>=(sint64 value) - { - sint64 acc = getValue(); - acc >>= value; - setValue(acc); - } - - void operator+=(sint64 value) - { - sint64 acc = getValue(); - acc += value; - setValue(acc); - } - - operator sint64() - { - return getValue(); - } - - operator uint64() - { - return getValue(); - } - - inline void setValue(sint64 val) - { - g_dsp.r[0x1c + N] = (uint16)val; - val >>= 16; - g_dsp.r[0x1e + N] = (uint16)val; - val >>= 16; - g_dsp.r[0x10 + N] = (uint16)val; - } - - inline sint64 getValue() - { - sint64 val; - sint64 low_acc; - val = (sint8)g_dsp.r[0x10 + N]; - val <<= 32; - low_acc = g_dsp.r[0x1e + N]; - low_acc <<= 16; - low_acc |= g_dsp.r[0x1c + N]; - val |= low_acc; - return(val); - } -}; - -class CProd -{ -public: - CProd() - { - } - - void operator=(sint64 val) - { - g_dsp.r[0x14] = (uint16)val; - val >>= 16; - g_dsp.r[0x15] = (uint16)val; - val >>= 16; - g_dsp.r[0x16] = (uint16)val; - g_dsp.r[0x17] = 0; - } - - operator sint64() - { - sint64 val; - sint64 low_prod; - val = (sint8)g_dsp.r[0x16]; - val <<= 32; - low_prod = g_dsp.r[0x15]; - low_prod += g_dsp.r[0x17]; - low_prod <<= 16; - low_prod |= g_dsp.r[0x14]; - val += low_prod; - return(val); - } -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef HLE_HELPER_H +#define HLE_HELPER_H + +#include "gdsp_interpreter.h" + +bool WriteDMEM(uint16 addr, uint16 val); +uint16 ReadDMEM(uint16 addr); +void Update_SR_Register(sint64 _Value); +sint8 GetMultiplyModifier(); + +template +class TAccumulator +{ +public: + + TAccumulator() + { + _assert_(N < 2); + } + + void operator=(sint64 val) + { + setValue(val); + } + + void operator<<=(sint64 value) + { + sint64 acc = getValue(); + acc <<= value; + setValue(acc); + } + + void operator>>=(sint64 value) + { + sint64 acc = getValue(); + acc >>= value; + setValue(acc); + } + + void operator+=(sint64 value) + { + sint64 acc = getValue(); + acc += value; + setValue(acc); + } + + operator sint64() + { + return getValue(); + } + + operator uint64() + { + return getValue(); + } + + inline void setValue(sint64 val) + { + g_dsp.r[0x1c + N] = (uint16)val; + val >>= 16; + g_dsp.r[0x1e + N] = (uint16)val; + val >>= 16; + g_dsp.r[0x10 + N] = (uint16)val; + } + + inline sint64 getValue() + { + sint64 val; + sint64 low_acc; + val = (sint8)g_dsp.r[0x10 + N]; + val <<= 32; + low_acc = g_dsp.r[0x1e + N]; + low_acc <<= 16; + low_acc |= g_dsp.r[0x1c + N]; + val |= low_acc; + return(val); + } +}; + +class CProd +{ +public: + CProd() + { + } + + void operator=(sint64 val) + { + g_dsp.r[0x14] = (uint16)val; + val >>= 16; + g_dsp.r[0x15] = (uint16)val; + val >>= 16; + g_dsp.r[0x16] = (uint16)val; + g_dsp.r[0x17] = 0; + } + + operator sint64() + { + sint64 val; + sint64 low_prod; + val = (sint8)g_dsp.r[0x16]; + val <<= 32; + low_prod = g_dsp.r[0x15]; + low_prod += g_dsp.r[0x17]; + low_prod <<= 16; + low_prod |= g_dsp.r[0x14]; + val += low_prod; + return(val); + } +}; + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.h b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.h index 4c405dafae..8d83f1e494 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Console.h @@ -1,26 +1,26 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#ifdef _WIN32 - -void startConsoleWin(int width, int height, char* fname); -int wprintf(char *fmt, ...); -void ClearScreen(); -HWND GetConsoleHwnd(void); - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#ifdef _WIN32 + +void startConsoleWin(int width, int height, char* fname); +int wprintf(char *fmt, ...); +void ClearScreen(); +HWND GetConsoleHwnd(void); + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Logging.h b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Logging.h index a6b3fec1a8..4b483d7152 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Logging.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/Logging.h @@ -1,23 +1,23 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#ifdef _WIN32 - -void Logging(); - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#ifdef _WIN32 + +void Logging(); + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/UCode_AXStructs.h b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/UCode_AXStructs.h index aa0fab47cd..6b0500ad52 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Logging/UCode_AXStructs.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Logging/UCode_AXStructs.h @@ -1,145 +1,145 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -#ifdef _WIN32 - - -#ifndef UCODE_AX_STRUCTS -#define UCODE_AX_STRUCTS - -struct PBMixer -{ - u16 volume_left; - u16 unknown; - u16 volume_right; - u16 unknown2; - - u16 unknown3[8]; - u16 unknown4[6]; -}; - -struct PBInitialTimeDelay -{ - u16 unknown[7]; -}; - -// Update data - read these each 1ms subframe and use them! -// It seems that to provide higher time precisions for MIDI events, some games -// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms). -// Using this data should fix games that are missing MIDI notes. -struct PBUpdates -{ - u16 num_updates[5]; - u16 data_hi; // These point to main RAM. Not sure about the structure of the data. - u16 data_lo; -}; - -struct PBUnknown -{ - s16 unknown[9]; -}; - -struct PBVolumeEnvelope -{ - u16 cur_volume; - s16 cur_volume_delta; -}; - -struct PBUnknown2 -{ - u16 unknown_reserved[3]; -}; - -struct PBAudioAddr -{ - u16 looping; - u16 sample_format; - u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active) - u16 loop_addr_lo; - u16 end_addr_hi; // End of sample (and loop), inclusive - u16 end_addr_lo; - u16 cur_addr_hi; - u16 cur_addr_lo; -}; - -struct PBADPCMInfo -{ - s16 coefs[16]; - u16 unknown; - u16 pred_scale; - s16 yn1; - s16 yn2; -}; - -struct PBSampleRateConverter -{ - u16 ratio_hi; - u16 ratio_lo; - u16 cur_addr_frac; - u16 last_samples[4]; -}; - -struct PBADPCMLoopInfo -{ - u16 pred_scale; - u16 yn1; - u16 yn2; -}; - -struct AXParamBlock -{ - u16 next_pb_hi; - u16 next_pb_lo; - - u16 this_pb_hi; - u16 this_pb_lo; - - u16 src_type; // Type of sample rate converter (2 = none, ?, linear) - u16 unknown1; - - u16 mixer_control; - u16 running; // 1=RUN 0=STOP - u16 is_stream; // 1 = stream, 0 = one shot - - PBMixer mixer; - PBInitialTimeDelay initial_time_delay; - PBUpdates updates; - PBUnknown unknown2; - PBVolumeEnvelope vol_env; - PBUnknown2 unknown3; - PBAudioAddr audio_addr; - PBADPCMInfo adpcm; - PBSampleRateConverter src; - PBADPCMLoopInfo adpcm_loop_info; - u16 unknown_maybe_padding[3]; -}; - -enum { - AUDIOFORMAT_ADPCM = 0, - AUDIOFORMAT_PCM8 = 0x19, - AUDIOFORMAT_PCM16 = 0xA, -}; - -enum { - SRCTYPE_LINEAR = 1, - SRCTYPE_NEAREST = 2, - MIXCONTROL_RAMPING = 8, -}; - - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +#ifdef _WIN32 + + +#ifndef UCODE_AX_STRUCTS +#define UCODE_AX_STRUCTS + +struct PBMixer +{ + u16 volume_left; + u16 unknown; + u16 volume_right; + u16 unknown2; + + u16 unknown3[8]; + u16 unknown4[6]; +}; + +struct PBInitialTimeDelay +{ + u16 unknown[7]; +}; + +// Update data - read these each 1ms subframe and use them! +// It seems that to provide higher time precisions for MIDI events, some games +// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms). +// Using this data should fix games that are missing MIDI notes. +struct PBUpdates +{ + u16 num_updates[5]; + u16 data_hi; // These point to main RAM. Not sure about the structure of the data. + u16 data_lo; +}; + +struct PBUnknown +{ + s16 unknown[9]; +}; + +struct PBVolumeEnvelope +{ + u16 cur_volume; + s16 cur_volume_delta; +}; + +struct PBUnknown2 +{ + u16 unknown_reserved[3]; +}; + +struct PBAudioAddr +{ + u16 looping; + u16 sample_format; + u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active) + u16 loop_addr_lo; + u16 end_addr_hi; // End of sample (and loop), inclusive + u16 end_addr_lo; + u16 cur_addr_hi; + u16 cur_addr_lo; +}; + +struct PBADPCMInfo +{ + s16 coefs[16]; + u16 unknown; + u16 pred_scale; + s16 yn1; + s16 yn2; +}; + +struct PBSampleRateConverter +{ + u16 ratio_hi; + u16 ratio_lo; + u16 cur_addr_frac; + u16 last_samples[4]; +}; + +struct PBADPCMLoopInfo +{ + u16 pred_scale; + u16 yn1; + u16 yn2; +}; + +struct AXParamBlock +{ + u16 next_pb_hi; + u16 next_pb_lo; + + u16 this_pb_hi; + u16 this_pb_lo; + + u16 src_type; // Type of sample rate converter (2 = none, ?, linear) + u16 unknown1; + + u16 mixer_control; + u16 running; // 1=RUN 0=STOP + u16 is_stream; // 1 = stream, 0 = one shot + + PBMixer mixer; + PBInitialTimeDelay initial_time_delay; + PBUpdates updates; + PBUnknown unknown2; + PBVolumeEnvelope vol_env; + PBUnknown2 unknown3; + PBAudioAddr audio_addr; + PBADPCMInfo adpcm; + PBSampleRateConverter src; + PBADPCMLoopInfo adpcm_loop_info; + u16 unknown_maybe_padding[3]; +}; + +enum { + AUDIOFORMAT_ADPCM = 0, + AUDIOFORMAT_PCM8 = 0x19, + AUDIOFORMAT_PCM16 = 0xA, +}; + +enum { + SRCTYPE_LINEAR = 1, + SRCTYPE_NEAREST = 2, + MIXCONTROL_RAMPING = 8, +}; + + +#endif + #endif // win32 \ No newline at end of file diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Mixer.h b/Source/Plugins/Plugin_DSP_LLE/Src/Mixer.h index a3340845c6..3c5095ab70 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Mixer.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Mixer.h @@ -1,30 +1,30 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MIXER_H -#define _MIXER_H - -extern volatile bool mixer_HLEready; - -// Called from audio threads -void Mixer(short* buffer, int numSamples, int bits, int rate, int channels); - -// Called from main thread -void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate); - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MIXER_H +#define _MIXER_H + +extern volatile bool mixer_HLEready; + +// Called from audio threads +void Mixer(short* buffer, int numSamples, int bits, int rate, int channels); + +// Called from main thread +void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate); + +#endif + diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/RegSettings.h b/Source/Plugins/Plugin_DSP_LLE/Src/RegSettings.h index 2ddf1bdf44..83a71e2415 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/RegSettings.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/RegSettings.h @@ -1,81 +1,81 @@ -// RegSettings.h -// -// Copyright (c) 2001 Magomed Abdurakhmanov -// maq@hotbox.ru, http://mickels.iwt.ru/en -// -// -// -// No warranties are given. Use at your own risk. -// -////////////////////////////////////////////////////////////////////// - -#if !defined (AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_) -#define AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include -#include - -class CWindowSettings -{ - public: - - WINDOWPLACEMENT m_WindowPlacement; - - CWindowSettings(); - void GetFrom(CWindow& Wnd); - void ApplyTo(CWindow& Wnd, int nCmdShow = SW_SHOWNORMAL) const; - - bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER); - bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const; -}; - -class CReBarSettings -{ - public: - - struct BandInfo - { - DWORD ID; - DWORD cx; - bool BreakLine; - }* m_pBands; - - DWORD m_cbBandCount; - - CReBarSettings(); - ~CReBarSettings(); - - void GetFrom(CReBarCtrl& ReBar); - void ApplyTo(CReBarCtrl& ReBar) const; - - bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER); - bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const; -}; - -class CSplitterSettings -{ - public: - - DWORD m_dwPos; - - templatevoid GetFrom(const T& Splitter) - { - m_dwPos = Splitter.GetSplitterPos(); - } - - - templatevoid ApplyTo(T& Splitter) const - { - Splitter.SetSplitterPos(m_dwPos); - } - - - bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER); - bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const; -}; - -#endif // !defined(AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_) +// RegSettings.h +// +// Copyright (c) 2001 Magomed Abdurakhmanov +// maq@hotbox.ru, http://mickels.iwt.ru/en +// +// +// +// No warranties are given. Use at your own risk. +// +////////////////////////////////////////////////////////////////////// + +#if !defined (AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_) +#define AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include + +class CWindowSettings +{ + public: + + WINDOWPLACEMENT m_WindowPlacement; + + CWindowSettings(); + void GetFrom(CWindow& Wnd); + void ApplyTo(CWindow& Wnd, int nCmdShow = SW_SHOWNORMAL) const; + + bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER); + bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const; +}; + +class CReBarSettings +{ + public: + + struct BandInfo + { + DWORD ID; + DWORD cx; + bool BreakLine; + }* m_pBands; + + DWORD m_cbBandCount; + + CReBarSettings(); + ~CReBarSettings(); + + void GetFrom(CReBarCtrl& ReBar); + void ApplyTo(CReBarCtrl& ReBar) const; + + bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER); + bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const; +}; + +class CSplitterSettings +{ + public: + + DWORD m_dwPos; + + templatevoid GetFrom(const T& Splitter) + { + m_dwPos = Splitter.GetSplitterPos(); + } + + + templatevoid ApplyTo(T& Splitter) const + { + Splitter.SetSplitterPos(m_dwPos); + } + + + bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER); + bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const; +}; + +#endif // !defined(AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_) diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/RegisterDlg.h b/Source/Plugins/Plugin_DSP_LLE/Src/RegisterDlg.h index 52fa22c957..7f7a1e4e21 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/RegisterDlg.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/RegisterDlg.h @@ -1,80 +1,80 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "Globals.h" - -#include -#include "DisAsmListView.h" - -class CRegisterDlg - : public CDialogImpl, public CUpdateUI -{ - public: - - CRegisterDlg(); - - enum { IDD = IDD_REGISTERDLG }; - - virtual BOOL PreTranslateMessage(MSG* pMsg); - virtual BOOL OnIdle(); - - - BEGIN_UPDATE_UI_MAP(CRegisterDlg) - END_UPDATE_UI_MAP() - - BEGIN_MSG_MAP(CRegisterDlg) - MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) - MESSAGE_HANDLER(WM_DESTROY, OnDestroy) - NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) - -// COMMAND_ID_HANDLER(ID_STEP, OnStep) -// COMMAND_ID_HANDLER(ID_GO, OnGo) -// COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters) - END_MSG_MAP() - -// Handler prototypes (uncomment arguments if needed): -// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) - - LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); - LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); - LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled); - - -// LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); -// LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); -// LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - - void CloseDialog(int nVal); - - void UpdateRegisterListView(); - - - private: - - CListViewCtrl m_RegisterListViewCtrl; - - static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); - - - uint64 m_CachedCounter; - uint16 m_CachedRegs[32]; - bool m_CachedRegHasChanged[32]; -}; +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "Globals.h" + +#include +#include "DisAsmListView.h" + +class CRegisterDlg + : public CDialogImpl, public CUpdateUI +{ + public: + + CRegisterDlg(); + + enum { IDD = IDD_REGISTERDLG }; + + virtual BOOL PreTranslateMessage(MSG* pMsg); + virtual BOOL OnIdle(); + + + BEGIN_UPDATE_UI_MAP(CRegisterDlg) + END_UPDATE_UI_MAP() + + BEGIN_MSG_MAP(CRegisterDlg) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) + +// COMMAND_ID_HANDLER(ID_STEP, OnStep) +// COMMAND_ID_HANDLER(ID_GO, OnGo) +// COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters) + END_MSG_MAP() + +// Handler prototypes (uncomment arguments if needed): +// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) +// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) +// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); + LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled); + + +// LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); +// LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); +// LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); + + void CloseDialog(int nVal); + + void UpdateRegisterListView(); + + + private: + + CListViewCtrl m_RegisterListViewCtrl; + + static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort); + + + uint64 m_CachedCounter; + uint16 m_CachedRegs[32]; + bool m_CachedRegHasChanged[32]; +}; diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Tools.h b/Source/Plugins/Plugin_DSP_LLE/Src/Tools.h index b7fe485d4a..6c66e6f993 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Tools.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Tools.h @@ -1,50 +1,50 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -// UDSPControl -union UDSPControl -{ - uint16 Hex; - struct - { - unsigned DSPReset : 1; // Write 1 to reset and waits for 0 - unsigned DSPAssertInt : 1; - unsigned DSPHalt : 1; - - unsigned AI : 1; - unsigned AI_mask : 1; - unsigned ARAM : 1; - unsigned ARAM_mask : 1; - unsigned DSP : 1; - unsigned DSP_mask : 1; - - unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag - unsigned unk3 : 1; - unsigned DSPInit : 1; // DSPInit() writes to this flag - unsigned pad : 4; - }; - - UDSPControl(uint16 _Hex = 0) - : Hex(_Hex) {} -}; - - -bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc); -uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength); -bool DumpCWCode(uint32 _Address, uint32 _Length); +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +// UDSPControl +union UDSPControl +{ + uint16 Hex; + struct + { + unsigned DSPReset : 1; // Write 1 to reset and waits for 0 + unsigned DSPAssertInt : 1; + unsigned DSPHalt : 1; + + unsigned AI : 1; + unsigned AI_mask : 1; + unsigned ARAM : 1; + unsigned ARAM_mask : 1; + unsigned DSP : 1; + unsigned DSP_mask : 1; + + unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag + unsigned unk3 : 1; + unsigned DSPInit : 1; // DSPInit() writes to this flag + unsigned pad : 4; + }; + + UDSPControl(uint16 _Hex = 0) + : Hex(_Hex) {} +}; + + +bool DumpDSPCode(uint32 _Address, uint32 _Length, uint32 crc); +uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength); +bool DumpCWCode(uint32 _Address, uint32 _Length); diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/disassemble.h b/Source/Plugins/Plugin_DSP_LLE/Src/disassemble.h index 12c6dbdf3b..13772d12f3 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/disassemble.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/disassemble.h @@ -1,46 +1,46 @@ -/*==================================================================== - - filename: opcodes.h - project: GameCube DSP Tool (gcdsp) - created: 2005.03.04 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ - -#pragma once - -typedef struct gd_globals_t -{ - bool print_tabs; - bool show_hex; - bool show_pc; - bool decode_names; - bool decode_registers; - - uint16* binbuf; - uint16 pc; - char* buffer; - uint16 buffer_size; - char ext_separator; -} gd_globals_t; - - -char* gd_dis_opcode(gd_globals_t* gdg); -bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output); -const char* gd_dis_get_reg_name(uint16 reg); +/*==================================================================== + + filename: opcodes.h + project: GameCube DSP Tool (gcdsp) + created: 2005.03.04 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ + +#pragma once + +typedef struct gd_globals_t +{ + bool print_tabs; + bool show_hex; + bool show_pc; + bool decode_names; + bool decode_registers; + + uint16* binbuf; + uint16 pc; + char* buffer; + uint16 buffer_size; + char ext_separator; +} gd_globals_t; + + +char* gd_dis_opcode(gd_globals_t* gdg); +bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output); +const char* gd_dis_get_reg_name(uint16 reg); diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_aram.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_aram.h index 46547f3b23..4866b38147 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_aram.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_aram.h @@ -1,23 +1,23 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _GDSP_ARAM_H -#define _GDSP_ARAM_H - -uint16 dsp_read_aram(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _GDSP_ARAM_H +#define _GDSP_ARAM_H + +uint16 dsp_read_aram(); + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_ext_op.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_ext_op.h index b6fb8fc9be..b27a5bbcca 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_ext_op.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_ext_op.h @@ -1,33 +1,33 @@ -/*==================================================================== - - filename: opcodes.h - project: GameCube DSP Tool (gcdsp) - created: 2005.03.04 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ - -#ifndef _GDSP_EXT_OP_H -#define _GDSP_EXT_OP_H - -void dsp_op_ext_ops_pro(uint16 _Opcode); -void dsp_op_ext_ops_epi(uint16 _Opcode); - - -#endif +/*==================================================================== + + filename: opcodes.h + project: GameCube DSP Tool (gcdsp) + created: 2005.03.04 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ + +#ifndef _GDSP_EXT_OP_H +#define _GDSP_EXT_OP_H + +void dsp_op_ext_ops_pro(uint16 _Opcode); +void dsp_op_ext_ops_epi(uint16 _Opcode); + + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_ifx.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_ifx.h index 8211829811..24fb43555d 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_ifx.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_ifx.h @@ -1,35 +1,35 @@ -/*==================================================================== - - filename: gdsp_ifx.h - project: GCemu - created: 2004-6-18 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie & Tratax - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ - -// ADPCM hw - -#ifndef _GDSP_IFX_H -#define _GDSP_IFX_H - -void gdsp_ifx_write(uint16 addr, uint16 val); -uint16 gdsp_ifx_read(uint16 addr); - - -#endif +/*==================================================================== + + filename: gdsp_ifx.h + project: GCemu + created: 2004-6-18 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie & Tratax + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ + +// ADPCM hw + +#ifndef _GDSP_IFX_H +#define _GDSP_IFX_H + +void gdsp_ifx_write(uint16 addr, uint16 val); +uint16 gdsp_ifx_read(uint16 addr); + + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interface.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interface.h index 8d4ab9f1b5..b051a7c4d8 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interface.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interface.h @@ -1,67 +1,67 @@ -/*==================================================================== - - filename: gdsp_interface.h - project: GCemu - created: 2004-6-18 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie & Tratax - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ -#ifndef _GDSP_INTERFACE_H -#define _GDSP_INTERFACE_H - -#include "Globals.h" - -#define GDSP_MBOX_CPU 0 -#define GDSP_MBOX_DSP 1 - -#define DSP_DSMAH 0xce -#define DSP_DSMAL 0xcf -#define DSP_DSCR 0xc9 -#define DSP_DSPA 0xcd -#define DSP_DSBL 0xcb -#define DSP_ACSAH 0xd4 -#define DSP_ACSAL 0xd5 -#define DSP_ACEAH 0xd6 -#define DSP_ACEAL 0xd7 -#define DSP_ACCAH 0xd8 -#define DSP_ACCAL 0xd9 - -#define DSP_COEF_A1_0 0xa0 -#define DSP_FORMAT 0xd1 -#define DSP_PRED_SCALE 0xda -#define DSP_YN1 0xdb -#define DSP_YN2 0xdc -#define DSP_ARAM 0xdd -#define DSP_GAIN 0xde - -extern uint16 gdsp_ifx_regs[256]; - -uint32 gdsp_mbox_peek(uint8 mbx); -void gdsp_mbox_write_h(uint8 mbx, uint16 val); -void gdsp_mbox_write_l(uint8 mbx, uint16 val); -uint16 gdsp_mbox_read_h(uint8 mbx); -uint16 gdsp_mbox_read_l(uint8 mbx); - -void gdsp_ifx_init(); - -void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size); - - -#endif - +/*==================================================================== + + filename: gdsp_interface.h + project: GCemu + created: 2004-6-18 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie & Tratax + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ +#ifndef _GDSP_INTERFACE_H +#define _GDSP_INTERFACE_H + +#include "Globals.h" + +#define GDSP_MBOX_CPU 0 +#define GDSP_MBOX_DSP 1 + +#define DSP_DSMAH 0xce +#define DSP_DSMAL 0xcf +#define DSP_DSCR 0xc9 +#define DSP_DSPA 0xcd +#define DSP_DSBL 0xcb +#define DSP_ACSAH 0xd4 +#define DSP_ACSAL 0xd5 +#define DSP_ACEAH 0xd6 +#define DSP_ACEAL 0xd7 +#define DSP_ACCAH 0xd8 +#define DSP_ACCAL 0xd9 + +#define DSP_COEF_A1_0 0xa0 +#define DSP_FORMAT 0xd1 +#define DSP_PRED_SCALE 0xda +#define DSP_YN1 0xdb +#define DSP_YN2 0xdc +#define DSP_ARAM 0xdd +#define DSP_GAIN 0xde + +extern uint16 gdsp_ifx_regs[256]; + +uint32 gdsp_mbox_peek(uint8 mbx); +void gdsp_mbox_write_h(uint8 mbx, uint16 val); +void gdsp_mbox_write_l(uint8 mbx, uint16 val); +uint16 gdsp_mbox_read_h(uint8 mbx); +uint16 gdsp_mbox_read_l(uint8 mbx); + +void gdsp_ifx_init(); + +void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size); + + +#endif + diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interpreter.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interpreter.h index 1ba0d685f8..65123e6927 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interpreter.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interpreter.h @@ -1,94 +1,94 @@ -/*==================================================================== - - filename: gdsp_interpreter.h - project: GCemu - created: 2004-6-18 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie & Tratax - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ - -#ifndef _GDSP_INTERPRETER_H -#define _GDSP_INTERPRETER_H - -#include "Globals.h" - -#define DSP_IRAM_SIZE (0x1000) -#define DSP_IRAM_MASK (0x0fff) -#define DSP_IROM_SIZE (0x1000) -#define DSP_IROM_MASK (0x0fff) -#define DSP_DRAM_SIZE (0x1000) -#define DSP_DRAM_MASK (0x0fff) -#define DSP_DROM_SIZE (0x1000) -#define DSP_DROM_MASK (0x0fff) -#define DSP_COEF_SIZE (0x1000) -#define DSP_COEF_MASK (0x0fff) - -#define DSP_RESET_VECTOR (0x8000) - -#define DSP_STACK_DEPTH 0x20 -#define DSP_STACK_MASK 0x1f - -struct SDSP -{ - static uint16 r[32]; - static uint16 pc; - static uint16 err_pc; - static uint16* iram; - static uint16* dram; - static uint16* irom; - static uint16* drom; - static uint16* coef; - static uint8* cpu_ram; - static uint16 cr; - static uint8 reg_stack_ptr[4]; - // lets make stack depth to 32 for now - static uint16 reg_stack[4][DSP_STACK_DEPTH]; - static void (* irq_request)(void); - - // for debugger only - static uint32 iram_crc; - static uint64 step_counter; - static bool exception_in_progress_hack; -}; - -extern SDSP g_dsp; - - -void gdsp_init(void); -void gdsp_reset(void); -bool gdsp_load_rom(char* fname); -bool gdsp_load_coef(char* fname); - - -// steps through DSP code, returns false if error occured -void gdsp_step(void); -void gdsp_loop_step(); -bool gdsp_run(void); -bool gdsp_runx(uint16 cnt); -void gdsp_stop(void); - -void gdsp_write_cr(uint16 val); -uint16 gdsp_read_cr(void); - -uint16* gdsp_get_iram(void); -uint16* gdsp_get_irom(void); -uint16* gdsp_get_dram(void); -uint16* gdsp_get_drom(void); - -#endif +/*==================================================================== + + filename: gdsp_interpreter.h + project: GCemu + created: 2004-6-18 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie & Tratax + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ + +#ifndef _GDSP_INTERPRETER_H +#define _GDSP_INTERPRETER_H + +#include "Globals.h" + +#define DSP_IRAM_SIZE (0x1000) +#define DSP_IRAM_MASK (0x0fff) +#define DSP_IROM_SIZE (0x1000) +#define DSP_IROM_MASK (0x0fff) +#define DSP_DRAM_SIZE (0x1000) +#define DSP_DRAM_MASK (0x0fff) +#define DSP_DROM_SIZE (0x1000) +#define DSP_DROM_MASK (0x0fff) +#define DSP_COEF_SIZE (0x1000) +#define DSP_COEF_MASK (0x0fff) + +#define DSP_RESET_VECTOR (0x8000) + +#define DSP_STACK_DEPTH 0x20 +#define DSP_STACK_MASK 0x1f + +struct SDSP +{ + static uint16 r[32]; + static uint16 pc; + static uint16 err_pc; + static uint16* iram; + static uint16* dram; + static uint16* irom; + static uint16* drom; + static uint16* coef; + static uint8* cpu_ram; + static uint16 cr; + static uint8 reg_stack_ptr[4]; + // lets make stack depth to 32 for now + static uint16 reg_stack[4][DSP_STACK_DEPTH]; + static void (* irq_request)(void); + + // for debugger only + static uint32 iram_crc; + static uint64 step_counter; + static bool exception_in_progress_hack; +}; + +extern SDSP g_dsp; + + +void gdsp_init(void); +void gdsp_reset(void); +bool gdsp_load_rom(char* fname); +bool gdsp_load_coef(char* fname); + + +// steps through DSP code, returns false if error occured +void gdsp_step(void); +void gdsp_loop_step(); +bool gdsp_run(void); +bool gdsp_runx(uint16 cnt); +void gdsp_stop(void); + +void gdsp_write_cr(uint16 val); +uint16 gdsp_read_cr(void); + +uint16* gdsp_get_iram(void); +uint16* gdsp_get_irom(void); +uint16* gdsp_get_dram(void); +uint16* gdsp_get_drom(void); + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_memory.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_memory.h index a80321ee4d..df42a1a951 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_memory.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_memory.h @@ -1,37 +1,37 @@ -/*==================================================================== - - filename: gdsp_memory.h - project: GCemu - created: 2004-6-18 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie & Tratax - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ -#ifndef _GDSP_MEMORY_H -#define _GDSP_MEMORY_H - -#include "Globals.h" - -uint16 dsp_fetch_code(void); -uint16 dsp_peek_code(void); -uint16 dsp_imem_read(uint16 addr); -bool dsp_dmem_write(uint16 addr, uint16 val); -uint16 dsp_dmem_read(uint16 addr); - - -#endif +/*==================================================================== + + filename: gdsp_memory.h + project: GCemu + created: 2004-6-18 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie & Tratax + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ +#ifndef _GDSP_MEMORY_H +#define _GDSP_MEMORY_H + +#include "Globals.h" + +uint16 dsp_fetch_code(void); +uint16 dsp_peek_code(void); +uint16 dsp_imem_read(uint16 addr); +bool dsp_dmem_write(uint16 addr, uint16 val); +uint16 dsp_dmem_read(uint16 addr); + + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_opcodes.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_opcodes.h index e8212ad647..e44ffa1c8c 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_opcodes.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_opcodes.h @@ -1,50 +1,50 @@ -/*==================================================================== - - filename: gdsp_opcodes.h - project: GCemu - created: 2004-6-18 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie & Tratax - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ -#ifndef _GDSP_OPCODES_H -#define _GDSP_OPCODES_H - -#include "Globals.h" - -void dsp_op0(uint16 opc); -void dsp_op1(uint16 opc); -void dsp_op2(uint16 opc); -void dsp_op3(uint16 opc); -void dsp_op4(uint16 opc); -void dsp_op5(uint16 opc); -void dsp_op6(uint16 opc); -void dsp_op7(uint16 opc); -void dsp_op8(uint16 opc); -void dsp_op9(uint16 opc); -void dsp_opab(uint16 opc); -void dsp_opcd(uint16 opc); -void dsp_ope(uint16 opc); -void dsp_opf(uint16 opc); - - -#define R_SR 0x13 - -#define FLAG_ENABLE_INTERUPT 11 - -#endif +/*==================================================================== + + filename: gdsp_opcodes.h + project: GCemu + created: 2004-6-18 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie & Tratax + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ +#ifndef _GDSP_OPCODES_H +#define _GDSP_OPCODES_H + +#include "Globals.h" + +void dsp_op0(uint16 opc); +void dsp_op1(uint16 opc); +void dsp_op2(uint16 opc); +void dsp_op3(uint16 opc); +void dsp_op4(uint16 opc); +void dsp_op5(uint16 opc); +void dsp_op6(uint16 opc); +void dsp_op7(uint16 opc); +void dsp_op8(uint16 opc); +void dsp_op9(uint16 opc); +void dsp_opab(uint16 opc); +void dsp_opcd(uint16 opc); +void dsp_ope(uint16 opc); +void dsp_opf(uint16 opc); + + +#define R_SR 0x13 + +#define FLAG_ENABLE_INTERUPT 11 + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_opcodes_helper.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_opcodes_helper.h index 7f5b0c0585..38ba759a80 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_opcodes_helper.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_opcodes_helper.h @@ -1,258 +1,258 @@ -/*==================================================================== - - filename: opcodes.h - project: GameCube DSP Tool (gcdsp) - created: 2005.03.04 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ - -#ifndef _GDSP_OPCODES_HELPER_H -#define _GDSP_OPCODES_HELPER_H - -#include "Globals.h" - -#include "gdsp_opcodes.h" -#include "gdsp_memory.h" -#include "gdsp_interpreter.h" -#include "gdsp_registers.h" -#include "gdsp_ext_op.h" - -// --------------------------------------------------------------------------------------- -// -// --- SR -// -// --------------------------------------------------------------------------------------- - -inline void dsp_SR_set_flag(uint8 flag) -{ - g_dsp.r[R_SR] |= (1 << flag); -} - - -inline bool dsp_SR_is_flag_set(uint8 flag) -{ - return((g_dsp.r[R_SR] & (1 << flag)) > 0); -} - - -// --------------------------------------------------------------------------------------- -// -// --- reg -// -// --------------------------------------------------------------------------------------- - -inline uint16 dsp_op_read_reg(uint8 reg) -{ - uint16 val; - - switch (reg & 0x1f) - { - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - val = dsp_reg_load_stack(reg - 0x0c); - break; - - default: - val = g_dsp.r[reg]; - break; - } - - return(val); -} - - -inline void dsp_op_write_reg(uint8 reg, uint16 val) -{ - switch (reg & 0x1f) - { - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: - dsp_reg_store_stack(reg - 0x0c, val); - break; - - default: - g_dsp.r[reg] = val; - break; - } -} - - -// --------------------------------------------------------------------------------------- -// -// --- prod -// -// --------------------------------------------------------------------------------------- - - -inline sint64 dsp_get_long_prod() -{ -#if PROFILE - ProfilerAddDelta(g_dsp.err_pc, 1); -#endif - - sint64 val; - sint64 low_prod; - val = (sint8)g_dsp.r[0x16]; - val <<= 32; - low_prod = g_dsp.r[0x15]; - low_prod += g_dsp.r[0x17]; - low_prod <<= 16; - low_prod |= g_dsp.r[0x14]; - val += low_prod; - return(val); -} - - -inline void dsp_set_long_prod(sint64 val) -{ -#if PROFILE - ProfilerAddDelta(g_dsp.err_pc, 1); -#endif - - g_dsp.r[0x14] = (uint16)val; - val >>= 16; - g_dsp.r[0x15] = (uint16)val; - val >>= 16; - g_dsp.r[0x16] = (uint16)val; - g_dsp.r[0x17] = 0; -} - - -// --------------------------------------------------------------------------------------- -// -// --- acc -// -// --------------------------------------------------------------------------------------- - -inline sint64 dsp_get_long_acc(uint8 reg) -{ -#if PROFILE - ProfilerAddDelta(g_dsp.err_pc, 1); -#endif - - _assert_(reg < 2); - sint64 val; - sint64 low_acc; - val = (sint8)g_dsp.r[0x10 + reg]; - val <<= 32; - low_acc = g_dsp.r[0x1e + reg]; - low_acc <<= 16; - low_acc |= g_dsp.r[0x1c + reg]; - val |= low_acc; - return(val); -} - - -inline uint64 dsp_get_ulong_acc(uint8 reg) -{ -#if PROFILE - ProfilerAddDelta(g_dsp.err_pc, 1); -#endif - - _assert_(reg < 2); - uint64 val; - uint64 low_acc; - val = (uint8)g_dsp.r[0x10 + reg]; - val <<= 32; - low_acc = g_dsp.r[0x1e + reg]; - low_acc <<= 16; - low_acc |= g_dsp.r[0x1c + reg]; - val |= low_acc; - return(val); -} - - -inline void dsp_set_long_acc(uint8 _reg, sint64 val) -{ -#if PROFILE - ProfilerAddDelta(g_dsp.err_pc, 1); -#endif - - _assert_(_reg < 2); - g_dsp.r[0x1c + _reg] = (uint16)val; - val >>= 16; - g_dsp.r[0x1e + _reg] = (uint16)val; - val >>= 16; - g_dsp.r[0x10 + _reg] = (uint16)val; -} - - -inline sint16 dsp_get_acc_l(uint8 _reg) -{ - _assert_(_reg < 2); - return(g_dsp.r[0x1c + _reg]); -} - - -inline sint16 dsp_get_acc_m(uint8 _reg) -{ - _assert_(_reg < 2); - return(g_dsp.r[0x1e + _reg]); -} - - -inline sint16 dsp_get_acc_h(uint8 _reg) -{ - _assert_(_reg < 2); - return(g_dsp.r[0x10 + _reg]); -} - - -// --------------------------------------------------------------------------------------- -// -// --- acx -// -// --------------------------------------------------------------------------------------- - - -inline sint64 dsp_get_long_acx(uint8 _reg) -{ -#if PROFILE - ProfilerAddDelta(g_dsp.err_pc, 1); -#endif - - _assert_(_reg < 2); - sint64 val = (sint16)g_dsp.r[0x1a + _reg]; - val <<= 16; - sint64 low_acc = g_dsp.r[0x18 + _reg]; - val |= low_acc; - return(val); -} - - -inline sint16 dsp_get_ax_l(uint8 _reg) -{ - _assert_(_reg < 2); - return(g_dsp.r[0x18 + _reg]); -} - - -inline sint16 dsp_get_ax_h(uint8 _reg) -{ - _assert_(_reg < 2); - return(g_dsp.r[0x1a + _reg]); -} - - -#endif +/*==================================================================== + + filename: opcodes.h + project: GameCube DSP Tool (gcdsp) + created: 2005.03.04 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ + +#ifndef _GDSP_OPCODES_HELPER_H +#define _GDSP_OPCODES_HELPER_H + +#include "Globals.h" + +#include "gdsp_opcodes.h" +#include "gdsp_memory.h" +#include "gdsp_interpreter.h" +#include "gdsp_registers.h" +#include "gdsp_ext_op.h" + +// --------------------------------------------------------------------------------------- +// +// --- SR +// +// --------------------------------------------------------------------------------------- + +inline void dsp_SR_set_flag(uint8 flag) +{ + g_dsp.r[R_SR] |= (1 << flag); +} + + +inline bool dsp_SR_is_flag_set(uint8 flag) +{ + return((g_dsp.r[R_SR] & (1 << flag)) > 0); +} + + +// --------------------------------------------------------------------------------------- +// +// --- reg +// +// --------------------------------------------------------------------------------------- + +inline uint16 dsp_op_read_reg(uint8 reg) +{ + uint16 val; + + switch (reg & 0x1f) + { + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + val = dsp_reg_load_stack(reg - 0x0c); + break; + + default: + val = g_dsp.r[reg]; + break; + } + + return(val); +} + + +inline void dsp_op_write_reg(uint8 reg, uint16 val) +{ + switch (reg & 0x1f) + { + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + dsp_reg_store_stack(reg - 0x0c, val); + break; + + default: + g_dsp.r[reg] = val; + break; + } +} + + +// --------------------------------------------------------------------------------------- +// +// --- prod +// +// --------------------------------------------------------------------------------------- + + +inline sint64 dsp_get_long_prod() +{ +#if PROFILE + ProfilerAddDelta(g_dsp.err_pc, 1); +#endif + + sint64 val; + sint64 low_prod; + val = (sint8)g_dsp.r[0x16]; + val <<= 32; + low_prod = g_dsp.r[0x15]; + low_prod += g_dsp.r[0x17]; + low_prod <<= 16; + low_prod |= g_dsp.r[0x14]; + val += low_prod; + return(val); +} + + +inline void dsp_set_long_prod(sint64 val) +{ +#if PROFILE + ProfilerAddDelta(g_dsp.err_pc, 1); +#endif + + g_dsp.r[0x14] = (uint16)val; + val >>= 16; + g_dsp.r[0x15] = (uint16)val; + val >>= 16; + g_dsp.r[0x16] = (uint16)val; + g_dsp.r[0x17] = 0; +} + + +// --------------------------------------------------------------------------------------- +// +// --- acc +// +// --------------------------------------------------------------------------------------- + +inline sint64 dsp_get_long_acc(uint8 reg) +{ +#if PROFILE + ProfilerAddDelta(g_dsp.err_pc, 1); +#endif + + _assert_(reg < 2); + sint64 val; + sint64 low_acc; + val = (sint8)g_dsp.r[0x10 + reg]; + val <<= 32; + low_acc = g_dsp.r[0x1e + reg]; + low_acc <<= 16; + low_acc |= g_dsp.r[0x1c + reg]; + val |= low_acc; + return(val); +} + + +inline uint64 dsp_get_ulong_acc(uint8 reg) +{ +#if PROFILE + ProfilerAddDelta(g_dsp.err_pc, 1); +#endif + + _assert_(reg < 2); + uint64 val; + uint64 low_acc; + val = (uint8)g_dsp.r[0x10 + reg]; + val <<= 32; + low_acc = g_dsp.r[0x1e + reg]; + low_acc <<= 16; + low_acc |= g_dsp.r[0x1c + reg]; + val |= low_acc; + return(val); +} + + +inline void dsp_set_long_acc(uint8 _reg, sint64 val) +{ +#if PROFILE + ProfilerAddDelta(g_dsp.err_pc, 1); +#endif + + _assert_(_reg < 2); + g_dsp.r[0x1c + _reg] = (uint16)val; + val >>= 16; + g_dsp.r[0x1e + _reg] = (uint16)val; + val >>= 16; + g_dsp.r[0x10 + _reg] = (uint16)val; +} + + +inline sint16 dsp_get_acc_l(uint8 _reg) +{ + _assert_(_reg < 2); + return(g_dsp.r[0x1c + _reg]); +} + + +inline sint16 dsp_get_acc_m(uint8 _reg) +{ + _assert_(_reg < 2); + return(g_dsp.r[0x1e + _reg]); +} + + +inline sint16 dsp_get_acc_h(uint8 _reg) +{ + _assert_(_reg < 2); + return(g_dsp.r[0x10 + _reg]); +} + + +// --------------------------------------------------------------------------------------- +// +// --- acx +// +// --------------------------------------------------------------------------------------- + + +inline sint64 dsp_get_long_acx(uint8 _reg) +{ +#if PROFILE + ProfilerAddDelta(g_dsp.err_pc, 1); +#endif + + _assert_(_reg < 2); + sint64 val = (sint16)g_dsp.r[0x1a + _reg]; + val <<= 16; + sint64 low_acc = g_dsp.r[0x18 + _reg]; + val |= low_acc; + return(val); +} + + +inline sint16 dsp_get_ax_l(uint8 _reg) +{ + _assert_(_reg < 2); + return(g_dsp.r[0x18 + _reg]); +} + + +inline sint16 dsp_get_ax_h(uint8 _reg) +{ + _assert_(_reg < 2); + return(g_dsp.r[0x1a + _reg]); +} + + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_registers.h b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_registers.h index ebbaf1a8dc..20a2525ab4 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_registers.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_registers.h @@ -1,42 +1,42 @@ -/*==================================================================== - - filename: gdsp_registers.h - project: GCemu - created: 2004-6-18 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie & Tratax - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ -#ifndef _GDSP_REGISTERS_H -#define _GDSP_REGISTERS_H - -#include "Globals.h" - -#define DSP_REG_ST0 0x0c -#define DSP_REG_ST1 0x0c -#define DSP_REG_ST2 0x0c -#define DSP_REG_ST3 0x0c - -#define DSP_STACK_C 0 -#define DSP_STACK_D 1 - -void dsp_reg_store_stack(uint8 stack_reg, uint16 val); -uint16 dsp_reg_load_stack(uint8 stack_reg); - - -#endif +/*==================================================================== + + filename: gdsp_registers.h + project: GCemu + created: 2004-6-18 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie & Tratax + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ +#ifndef _GDSP_REGISTERS_H +#define _GDSP_REGISTERS_H + +#include "Globals.h" + +#define DSP_REG_ST0 0x0c +#define DSP_REG_ST1 0x0c +#define DSP_REG_ST2 0x0c +#define DSP_REG_ST3 0x0c + +#define DSP_STACK_C 0 +#define DSP_STACK_D 1 + +void dsp_reg_store_stack(uint8 stack_reg, uint16 val); +uint16 dsp_reg_load_stack(uint8 stack_reg); + + +#endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/opcodes.h b/Source/Plugins/Plugin_DSP_LLE/Src/opcodes.h index 2d05f14780..c26e291c22 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/opcodes.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/opcodes.h @@ -1,86 +1,86 @@ -/*==================================================================== - - filename: opcodes.h - project: GameCube DSP Tool (gcdsp) - created: 2005.03.04 - mail: duddie@walla.com - - Copyright (c) 2005 Duddie - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - ====================================================================*/ -#ifndef _OPCODES_H -#define _OPCODES_H - -enum partype_t -{ - P_NONE = 0x0000, - P_VAL = 0x0001, - P_IMM = 0x0002, - P_MEM = 0x0003, - P_STR = 0x0004, - P_REG = 0x8000, - P_REG08 = P_REG | 0x0800, - P_REG10 = P_REG | 0x1000, - P_REG18 = P_REG | 0x1800, - P_REG19 = P_REG | 0x1900, - P_REG1A = P_REG | 0x1a00, - P_REG1C = P_REG | 0x1c00, - P_ACCM = P_REG | 0x1e00, - P_ACCM_D = P_REG | 0x1e80, - P_ACC = P_REG | 0x2000, - P_ACC_D = P_REG | 0x2080, - P_AX = P_REG | 0x2200, - P_AX_D = P_REG | 0x2280, - P_REGS_MASK = 0x03f80, - P_REF = P_REG | 0x4000, - P_PRG = P_REF | P_REG, -}; - -#define P_EXT 0x80 - -typedef struct opcpar_t -{ - partype_t type; - uint8 size; - uint8 loc; - sint8 lshift; - uint16 mask; -} opcpar_t; - -typedef struct opc_t -{ - const char* name; - uint16 opcode; - uint16 opcode_mask; - uint8 size; - uint8 param_count; - opcpar_t params[8]; -} opc_t; - -extern opc_t opcodes[]; -extern const uint32 opcodes_size; -extern opc_t opcodes_ext[]; -extern const uint32 opcodes_ext_size; - -inline uint16 swap16(uint16 x) -{ - return((x >> 8) | (x << 8)); -} - - -#endif - +/*==================================================================== + + filename: opcodes.h + project: GameCube DSP Tool (gcdsp) + created: 2005.03.04 + mail: duddie@walla.com + + Copyright (c) 2005 Duddie + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + ====================================================================*/ +#ifndef _OPCODES_H +#define _OPCODES_H + +enum partype_t +{ + P_NONE = 0x0000, + P_VAL = 0x0001, + P_IMM = 0x0002, + P_MEM = 0x0003, + P_STR = 0x0004, + P_REG = 0x8000, + P_REG08 = P_REG | 0x0800, + P_REG10 = P_REG | 0x1000, + P_REG18 = P_REG | 0x1800, + P_REG19 = P_REG | 0x1900, + P_REG1A = P_REG | 0x1a00, + P_REG1C = P_REG | 0x1c00, + P_ACCM = P_REG | 0x1e00, + P_ACCM_D = P_REG | 0x1e80, + P_ACC = P_REG | 0x2000, + P_ACC_D = P_REG | 0x2080, + P_AX = P_REG | 0x2200, + P_AX_D = P_REG | 0x2280, + P_REGS_MASK = 0x03f80, + P_REF = P_REG | 0x4000, + P_PRG = P_REF | P_REG, +}; + +#define P_EXT 0x80 + +typedef struct opcpar_t +{ + partype_t type; + uint8 size; + uint8 loc; + sint8 lshift; + uint16 mask; +} opcpar_t; + +typedef struct opc_t +{ + const char* name; + uint16 opcode; + uint16 opcode_mask; + uint8 size; + uint8 param_count; + opcpar_t params[8]; +} opc_t; + +extern opc_t opcodes[]; +extern const uint32 opcodes_size; +extern opc_t opcodes_ext[]; +extern const uint32 opcodes_ext_size; + +inline uint16 swap16(uint16 x) +{ + return((x >> 8) | (x << 8)); +} + + +#endif + diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/stdafx.h b/Source/Plugins/Plugin_DSP_LLE/Src/stdafx.h index c5352abd51..d9c6c36428 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/stdafx.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/stdafx.h @@ -1,36 +1,36 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define _CRT_SECURE_NO_DEPRECATE 1 - -#include -#include - -// WTL -#include -#include - -#include -#include -#include -#include - -#include "PluginSpecs_DSP.h" - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define _CRT_SECURE_NO_DEPRECATE 1 + +#include +#include + +// WTL +#include +#include + +#include +#include +#include +#include + +#include "PluginSpecs_DSP.h" + diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/DSPHandler.h b/Source/Plugins/Plugin_DSP_NULL/Src/DSPHandler.h index 1b5030b129..e710d4a502 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/DSPHandler.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/DSPHandler.h @@ -1,99 +1,99 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DSPHANDLER_H -#define _DSPHANDLER_H - -#include "Common.h" -#include "MailHandler.h" -#include "UCodes/UCodes.h" - -class CDSPHandler -{ -public: - void Update(); - unsigned short WriteControlRegister(unsigned short _Value); - unsigned short ReadControlRegister(); - void SendMailToDSP(u32 _uMail); - IUCode* GetUCode(); - void SetUCode(u32 _crc); - - CMailHandler& AccessMailHandler() { return m_MailHandler; } - - static CDSPHandler& GetInstance() - { - return *m_pInstance; - } - - static void Destroy() - { - delete m_pInstance; - m_pInstance = NULL; - } - - static CDSPHandler& CreateInstance() - { - if (!m_pInstance) - m_pInstance = new CDSPHandler(); - - return *m_pInstance; - } - -private: - CDSPHandler(); - ~CDSPHandler(); - - // UDSPControl - union UDSPControl - { - u16 Hex; - struct - { - unsigned DSPReset : 1; // Write 1 to reset and waits for 0 - unsigned DSPAssertInt : 1; - unsigned DSPHalt : 1; - - unsigned AI : 1; - unsigned AI_mask : 1; - unsigned ARAM : 1; - unsigned ARAM_mask : 1; - unsigned DSP : 1; - unsigned DSP_mask : 1; - - unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag - unsigned DSPInitCode : 1; - unsigned DSPInit : 1; // DSPInit() writes to this flag - unsigned pad : 4; - }; - - UDSPControl(u16 _Hex = 0) - : Hex(_Hex) - {} - }; - - // singleton instance - static CDSPHandler* m_pInstance; - - IUCode* m_pUCode; - UDSPControl m_DSPControl; - CMailHandler m_MailHandler; - - bool m_bHalt; - bool m_bAssertInt; -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DSPHANDLER_H +#define _DSPHANDLER_H + +#include "Common.h" +#include "MailHandler.h" +#include "UCodes/UCodes.h" + +class CDSPHandler +{ +public: + void Update(); + unsigned short WriteControlRegister(unsigned short _Value); + unsigned short ReadControlRegister(); + void SendMailToDSP(u32 _uMail); + IUCode* GetUCode(); + void SetUCode(u32 _crc); + + CMailHandler& AccessMailHandler() { return m_MailHandler; } + + static CDSPHandler& GetInstance() + { + return *m_pInstance; + } + + static void Destroy() + { + delete m_pInstance; + m_pInstance = NULL; + } + + static CDSPHandler& CreateInstance() + { + if (!m_pInstance) + m_pInstance = new CDSPHandler(); + + return *m_pInstance; + } + +private: + CDSPHandler(); + ~CDSPHandler(); + + // UDSPControl + union UDSPControl + { + u16 Hex; + struct + { + unsigned DSPReset : 1; // Write 1 to reset and waits for 0 + unsigned DSPAssertInt : 1; + unsigned DSPHalt : 1; + + unsigned AI : 1; + unsigned AI_mask : 1; + unsigned ARAM : 1; + unsigned ARAM_mask : 1; + unsigned DSP : 1; + unsigned DSP_mask : 1; + + unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag + unsigned DSPInitCode : 1; + unsigned DSPInit : 1; // DSPInit() writes to this flag + unsigned pad : 4; + }; + + UDSPControl(u16 _Hex = 0) + : Hex(_Hex) + {} + }; + + // singleton instance + static CDSPHandler* m_pInstance; + + IUCode* m_pUCode; + UDSPControl m_DSPControl; + CMailHandler m_MailHandler; + + bool m_bHalt; + bool m_bAssertInt; +}; + +#endif diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/MailHandler.h b/Source/Plugins/Plugin_DSP_NULL/Src/MailHandler.h index c1858fa733..ba00aa9f4e 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/MailHandler.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/MailHandler.h @@ -1,46 +1,46 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MAILHANDLER_H -#define _MAILHANDLER_H - -#include - -#include "Common.h" - -class CMailHandler -{ -public: - CMailHandler(); - ~CMailHandler(); - - void PushMail(u32 _Mail); - void Clear(); - void Halt(bool _Halt); - bool IsEmpty(); - - u16 ReadDSPMailboxHigh(); - u16 ReadDSPMailboxLow(); - void Update(); - -private: - // mail handler - std::queue m_Mails; -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MAILHANDLER_H +#define _MAILHANDLER_H + +#include + +#include "Common.h" + +class CMailHandler +{ +public: + CMailHandler(); + ~CMailHandler(); + + void PushMail(u32 _Mail); + void Clear(); + void Halt(bool _Halt); + bool IsEmpty(); + + u16 ReadDSPMailboxHigh(); + u16 ReadDSPMailboxLow(); + void Update(); + +private: + // mail handler + std::queue m_Mails; +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_AX.h b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_AX.h index 7f8aedfda6..56a08d9730 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_AX.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_AX.h @@ -1,67 +1,67 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_AX -#define _UCODE_AX - -#include "UCode_AXStructs.h" - -class CUCode_AX : public IUCode -{ -public: - CUCode_AX(CMailHandler& _rMailHandler, bool wii = false); - virtual ~CUCode_AX(); - - void HandleMail(u32 _uMail); - void MixAdd(short* _pBuffer, int _iSize); - void Update(); - -private: - - enum - { - NUMBER_OF_PBS = 64 - }; - - enum - { - MAIL_AX_ALIST = 0xBABE0000, - AXLIST_STUDIOADDR = 0x0000, - AXLIST_PBADDR = 0x0002, - AXLIST_SBUFFER = 0x0007, - AXLIST_COMPRESSORTABLE = 0x000A, - AXLIST_END = 0x000F - }; - - // PBs - u32 m_addressPBs; - - int *templbuffer; - int *temprbuffer; - - bool wii_mode; - - // ax task message handler - bool AXTask(u32& _uMail); - - void SendMail(u32 _uMail); - int ReadOutPBs(AXParamBlock *_pPBs, int _num); - void WriteBackPBs(AXParamBlock *_pPBs, int _num); - s16 ADPCM_Step(AXParamBlock& pb, u32& samplePos, u32 newSamplePos, u16 frac); -}; - -#endif // _UCODE_AX +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_AX +#define _UCODE_AX + +#include "UCode_AXStructs.h" + +class CUCode_AX : public IUCode +{ +public: + CUCode_AX(CMailHandler& _rMailHandler, bool wii = false); + virtual ~CUCode_AX(); + + void HandleMail(u32 _uMail); + void MixAdd(short* _pBuffer, int _iSize); + void Update(); + +private: + + enum + { + NUMBER_OF_PBS = 64 + }; + + enum + { + MAIL_AX_ALIST = 0xBABE0000, + AXLIST_STUDIOADDR = 0x0000, + AXLIST_PBADDR = 0x0002, + AXLIST_SBUFFER = 0x0007, + AXLIST_COMPRESSORTABLE = 0x000A, + AXLIST_END = 0x000F + }; + + // PBs + u32 m_addressPBs; + + int *templbuffer; + int *temprbuffer; + + bool wii_mode; + + // ax task message handler + bool AXTask(u32& _uMail); + + void SendMail(u32 _uMail); + int ReadOutPBs(AXParamBlock *_pPBs, int _num); + void WriteBackPBs(AXParamBlock *_pPBs, int _num); + s16 ADPCM_Step(AXParamBlock& pb, u32& samplePos, u32 newSamplePos, u16 frac); +}; + +#endif // _UCODE_AX diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_AXStructs.h b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_AXStructs.h index 207e8d932c..1e88fa80ee 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_AXStructs.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_AXStructs.h @@ -1,141 +1,141 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef UCODE_AX_STRUCTS -#define UCODE_AX_STRUCTS - -struct PBMixer -{ - u16 volume_left; - u16 unknown; - u16 volume_right; - u16 unknown2; - - u16 unknown3[8]; - u16 unknown4[6]; -}; - -struct PBInitialTimeDelay -{ - u16 unknown[7]; -}; - -// Update data - read these each 1ms subframe and use them! -// It seems that to provide higher time precisions for MIDI events, some games -// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms). -// Using this data should fix games that are missing MIDI notes. -struct PBUpdates -{ - u16 num_updates[5]; - u16 data_hi; // These point to main RAM. Not sure about the structure of the data. - u16 data_lo; -}; - -struct PBUnknown -{ - s16 unknown[9]; -}; - -struct PBVolumeEnvelope -{ - u16 cur_volume; - s16 cur_volume_delta; -}; - -struct PBUnknown2 -{ - u16 unknown_reserved[3]; -}; - -struct PBAudioAddr -{ - u16 looping; - u16 sample_format; - u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active) - u16 loop_addr_lo; - u16 end_addr_hi; // End of sample (and loop), inclusive - u16 end_addr_lo; - u16 cur_addr_hi; - u16 cur_addr_lo; -}; - -struct PBADPCMInfo -{ - s16 coefs[16]; - u16 unknown; - u16 pred_scale; - s16 yn1; - s16 yn2; -}; - -struct PBSampleRateConverter -{ - u16 ratio_hi; - u16 ratio_lo; - u16 cur_addr_frac; - u16 last_samples[4]; -}; - -struct PBADPCMLoopInfo -{ - u16 pred_scale; - u16 yn1; - u16 yn2; -}; - -struct AXParamBlock -{ - u16 next_pb_hi; - u16 next_pb_lo; - - u16 this_pb_hi; - u16 this_pb_lo; - - u16 src_type; // Type of sample rate converter (none, ?, linear) - u16 unknown1; - - u16 mixer_control; - u16 running; // 1=RUN 0=STOP - u16 is_stream; // 1 = stream, 0 = one shot - - PBMixer mixer; - PBInitialTimeDelay initial_time_delay; - PBUpdates updates; - PBUnknown unknown2; - PBVolumeEnvelope vol_env; - PBUnknown2 unknown3; - PBAudioAddr audio_addr; - PBADPCMInfo adpcm; - PBSampleRateConverter src; - PBADPCMLoopInfo adpcm_loop_info; - u16 unknown_maybe_padding[3]; -}; - -enum { - AUDIOFORMAT_ADPCM = 0, - AUDIOFORMAT_PCM8 = 0x19, - AUDIOFORMAT_PCM16 = 0xA, -}; - -enum { - SRCTYPE_LINEAR = 1, - SRCTYPE_NEAREST = 2, - MIXCONTROL_RAMPING = 8, -}; - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef UCODE_AX_STRUCTS +#define UCODE_AX_STRUCTS + +struct PBMixer +{ + u16 volume_left; + u16 unknown; + u16 volume_right; + u16 unknown2; + + u16 unknown3[8]; + u16 unknown4[6]; +}; + +struct PBInitialTimeDelay +{ + u16 unknown[7]; +}; + +// Update data - read these each 1ms subframe and use them! +// It seems that to provide higher time precisions for MIDI events, some games +// use this thing to update the parameter blocks per 1ms sub-block (a block is 5ms). +// Using this data should fix games that are missing MIDI notes. +struct PBUpdates +{ + u16 num_updates[5]; + u16 data_hi; // These point to main RAM. Not sure about the structure of the data. + u16 data_lo; +}; + +struct PBUnknown +{ + s16 unknown[9]; +}; + +struct PBVolumeEnvelope +{ + u16 cur_volume; + s16 cur_volume_delta; +}; + +struct PBUnknown2 +{ + u16 unknown_reserved[3]; +}; + +struct PBAudioAddr +{ + u16 looping; + u16 sample_format; + u16 loop_addr_hi; // Start of loop (this will point to a shared "zero" buffer if one-shot mode is active) + u16 loop_addr_lo; + u16 end_addr_hi; // End of sample (and loop), inclusive + u16 end_addr_lo; + u16 cur_addr_hi; + u16 cur_addr_lo; +}; + +struct PBADPCMInfo +{ + s16 coefs[16]; + u16 unknown; + u16 pred_scale; + s16 yn1; + s16 yn2; +}; + +struct PBSampleRateConverter +{ + u16 ratio_hi; + u16 ratio_lo; + u16 cur_addr_frac; + u16 last_samples[4]; +}; + +struct PBADPCMLoopInfo +{ + u16 pred_scale; + u16 yn1; + u16 yn2; +}; + +struct AXParamBlock +{ + u16 next_pb_hi; + u16 next_pb_lo; + + u16 this_pb_hi; + u16 this_pb_lo; + + u16 src_type; // Type of sample rate converter (none, ?, linear) + u16 unknown1; + + u16 mixer_control; + u16 running; // 1=RUN 0=STOP + u16 is_stream; // 1 = stream, 0 = one shot + + PBMixer mixer; + PBInitialTimeDelay initial_time_delay; + PBUpdates updates; + PBUnknown unknown2; + PBVolumeEnvelope vol_env; + PBUnknown2 unknown3; + PBAudioAddr audio_addr; + PBADPCMInfo adpcm; + PBSampleRateConverter src; + PBADPCMLoopInfo adpcm_loop_info; + u16 unknown_maybe_padding[3]; +}; + +enum { + AUDIOFORMAT_ADPCM = 0, + AUDIOFORMAT_PCM8 = 0x19, + AUDIOFORMAT_PCM16 = 0xA, +}; + +enum { + SRCTYPE_LINEAR = 1, + SRCTYPE_NEAREST = 2, + MIXCONTROL_RAMPING = 8, +}; + + +#endif diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_CARD.h b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_CARD.h index 528a5672f8..25cb41c7d0 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_CARD.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_CARD.h @@ -1,45 +1,45 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_CARD_H -#define _UCODE_CARD_H - -#include "UCodes.h" - -class CUCode_CARD : public IUCode -{ -private: - enum EDSP_Codes - { - DSP_INIT = 0xDCD10000, - DSP_RESUME = 0xDCD10001, - DSP_YIELD = 0xDCD10002, - DSP_DONE = 0xDCD10003, - DSP_SYNC = 0xDCD10004, - DSP_UNKN = 0xDCD10005, - }; - -public: - CUCode_CARD(CMailHandler& _rMailHandler); - virtual ~CUCode_CARD(); - - void HandleMail(u32 _uMail); - void Update(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_CARD_H +#define _UCODE_CARD_H + +#include "UCodes.h" + +class CUCode_CARD : public IUCode +{ +private: + enum EDSP_Codes + { + DSP_INIT = 0xDCD10000, + DSP_RESUME = 0xDCD10001, + DSP_YIELD = 0xDCD10002, + DSP_DONE = 0xDCD10003, + DSP_SYNC = 0xDCD10004, + DSP_UNKN = 0xDCD10005, + }; + +public: + CUCode_CARD(CMailHandler& _rMailHandler); + virtual ~CUCode_CARD(); + + void HandleMail(u32 _uMail); + void Update(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_InitAudioSystem.h b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_InitAudioSystem.h index 24231f7628..4dc8725432 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_InitAudioSystem.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_InitAudioSystem.h @@ -1,54 +1,54 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_INITAUDIOSYSTEM -#define _UCODE_INITAUDIOSYSTEM - -#include "UCodes.h" - -class CUCode_InitAudioSystem : public IUCode -{ -public: - CUCode_InitAudioSystem(CMailHandler& _rMailHandler); - virtual ~CUCode_InitAudioSystem(); - - void HandleMail(u32 _uMail); - void Update(); - void Init(); - -private: - struct SUCode - { - u32 m_RAMAddress; - u32 m_Length; - u32 m_IMEMAddress; - u32 m_Unk; - u32 m_StartPC; - }; - - SUCode m_CurrentUCode; - int m_BootTask_numSteps; - - u32 m_NextParameter; - - bool IsInitialized; - - void BootUCode(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_INITAUDIOSYSTEM +#define _UCODE_INITAUDIOSYSTEM + +#include "UCodes.h" + +class CUCode_InitAudioSystem : public IUCode +{ +public: + CUCode_InitAudioSystem(CMailHandler& _rMailHandler); + virtual ~CUCode_InitAudioSystem(); + + void HandleMail(u32 _uMail); + void Update(); + void Init(); + +private: + struct SUCode + { + u32 m_RAMAddress; + u32 m_Length; + u32 m_IMEMAddress; + u32 m_Unk; + u32 m_StartPC; + }; + + SUCode m_CurrentUCode; + int m_BootTask_numSteps; + + u32 m_NextParameter; + + bool IsInitialized; + + void BootUCode(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_Jac.h b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_Jac.h index 1a8a02acd4..5ff675bb30 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_Jac.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_Jac.h @@ -1,74 +1,74 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_JAC -#define _UCODE_JAC - -#include "UCodes.h" - -class CUCode_Jac : public IUCode -{ -private: - - enum EDSP_Codes - { - DSP_INIT = 0xDCD10000, - DSP_RESUME = 0xDCD10001, - DSP_YIELD = 0xDCD10002, - DSP_DONE = 0xDCD10003, - DSP_SYNC = 0xDCD10004, - DSP_UNKN = 0xDCD10005, - }; - - bool m_bListInProgress; - int m_numSteps; - int m_step; - u8 m_Buffer[1024]; - void ExecuteList(); - - u32 m_readOffset; - - u8 Read8() - { - return(m_Buffer[m_readOffset++]); - } - - // Hmm, don't these need bswaps? - u16 Read16() - { - u16 res = *(u16*)&m_Buffer[m_readOffset]; - m_readOffset += 2; - return(res); - } - - u32 Read32() - { - u32 res = *(u32*)&m_Buffer[m_readOffset]; - m_readOffset += 4; - return(res); - } - -public: - CUCode_Jac(CMailHandler& _rMailHandler); - virtual ~CUCode_Jac(); - - void HandleMail(u32 _uMail); - void Update(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_JAC +#define _UCODE_JAC + +#include "UCodes.h" + +class CUCode_Jac : public IUCode +{ +private: + + enum EDSP_Codes + { + DSP_INIT = 0xDCD10000, + DSP_RESUME = 0xDCD10001, + DSP_YIELD = 0xDCD10002, + DSP_DONE = 0xDCD10003, + DSP_SYNC = 0xDCD10004, + DSP_UNKN = 0xDCD10005, + }; + + bool m_bListInProgress; + int m_numSteps; + int m_step; + u8 m_Buffer[1024]; + void ExecuteList(); + + u32 m_readOffset; + + u8 Read8() + { + return(m_Buffer[m_readOffset++]); + } + + // Hmm, don't these need bswaps? + u16 Read16() + { + u16 res = *(u16*)&m_Buffer[m_readOffset]; + m_readOffset += 2; + return(res); + } + + u32 Read32() + { + u32 res = *(u32*)&m_Buffer[m_readOffset]; + m_readOffset += 4; + return(res); + } + +public: + CUCode_Jac(CMailHandler& _rMailHandler); + virtual ~CUCode_Jac(); + + void HandleMail(u32 _uMail); + void Update(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_ROM.h b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_ROM.h index 82d438485b..68b8fc21eb 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_ROM.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_ROM.h @@ -1,51 +1,51 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_ROM -#define _UCODE_ROM - -#include "UCodes.h" - -class CUCode_Rom : public IUCode -{ -public: - CUCode_Rom(CMailHandler& _rMailHandler); - virtual ~CUCode_Rom(); - - void HandleMail(u32 _uMail); - void Update(); - -private: - struct SUCode - { - u32 m_RAMAddress; - u32 m_Length; - u32 m_IMEMAddress; - u32 m_Unk; - u32 m_StartPC; - }; - - SUCode m_CurrentUCode; - int m_BootTask_numSteps; - - u32 m_NextParameter; - - void BootUCode(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_ROM +#define _UCODE_ROM + +#include "UCodes.h" + +class CUCode_Rom : public IUCode +{ +public: + CUCode_Rom(CMailHandler& _rMailHandler); + virtual ~CUCode_Rom(); + + void HandleMail(u32 _uMail); + void Update(); + +private: + struct SUCode + { + u32 m_RAMAddress; + u32 m_Length; + u32 m_IMEMAddress; + u32 m_Unk; + u32 m_StartPC; + }; + + SUCode m_CurrentUCode; + int m_BootTask_numSteps; + + u32 m_NextParameter; + + void BootUCode(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_Zelda.h b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_Zelda.h index e2013b0a7f..a4d4d2ebfc 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_Zelda.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCode_Zelda.h @@ -1,74 +1,74 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODE_ZELDA_H -#define _UCODE_ZELDA_H - -#include "Common.h" -#include "UCodes.h" - -class CUCode_Zelda : public IUCode -{ -private: - enum EDSP_Codes - { - DSP_INIT = 0xDCD10000, - DSP_RESUME = 0xDCD10001, - DSP_YIELD = 0xDCD10002, - DSP_DONE = 0xDCD10003, - DSP_SYNC = 0xDCD10004, - DSP_UNKN = 0xDCD10005, - }; - - // List in progress - u32 m_numSteps; - bool m_bListInProgress; - u32 m_step; - u8 m_Buffer[1024]; - void ExecuteList(); - - u32 m_readOffset; - - u8 Read8() - { - return m_Buffer[m_readOffset++]; - } - - u16 Read16() - { - u16 res = *(u16*)&m_Buffer[m_readOffset]; - m_readOffset += 2; - return res; - } - - u32 Read32() - { - u32 res = *(u32*)&m_Buffer[m_readOffset]; - m_readOffset += 4; - return res; - } -public: - - CUCode_Zelda(CMailHandler& _rMailHandler); - virtual ~CUCode_Zelda(); - - void HandleMail(u32 _uMail); - void Update(); -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODE_ZELDA_H +#define _UCODE_ZELDA_H + +#include "Common.h" +#include "UCodes.h" + +class CUCode_Zelda : public IUCode +{ +private: + enum EDSP_Codes + { + DSP_INIT = 0xDCD10000, + DSP_RESUME = 0xDCD10001, + DSP_YIELD = 0xDCD10002, + DSP_DONE = 0xDCD10003, + DSP_SYNC = 0xDCD10004, + DSP_UNKN = 0xDCD10005, + }; + + // List in progress + u32 m_numSteps; + bool m_bListInProgress; + u32 m_step; + u8 m_Buffer[1024]; + void ExecuteList(); + + u32 m_readOffset; + + u8 Read8() + { + return m_Buffer[m_readOffset++]; + } + + u16 Read16() + { + u16 res = *(u16*)&m_Buffer[m_readOffset]; + m_readOffset += 2; + return res; + } + + u32 Read32() + { + u32 res = *(u32*)&m_Buffer[m_readOffset]; + m_readOffset += 4; + return res; + } +public: + + CUCode_Zelda(CMailHandler& _rMailHandler); + virtual ~CUCode_Zelda(); + + void HandleMail(u32 _uMail); + void Update(); +}; + +#endif + diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCodes.h b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCodes.h index b7da4d0b6e..609b7ca85b 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCodes.h +++ b/Source/Plugins/Plugin_DSP_NULL/Src/UCodes/UCodes.h @@ -1,48 +1,48 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UCODES_H -#define _UCODES_H - -#include "Common.h" - -#define UCODE_ROM 0x0000000 -#define UCODE_INIT_AUDIO_SYSTEM 0x0000001 - -class CMailHandler; - -class IUCode -{ -public: - IUCode(CMailHandler& _rMailHandler) - : m_rMailHandler(_rMailHandler) - {} - - virtual ~IUCode() - {} - - virtual void HandleMail(u32 _uMail) = 0; - virtual void Update(void) = 0; - virtual void MixAdd(short* buffer, int size) {} - -protected: - CMailHandler& m_rMailHandler; -}; - -extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UCODES_H +#define _UCODES_H + +#include "Common.h" + +#define UCODE_ROM 0x0000000 +#define UCODE_INIT_AUDIO_SYSTEM 0x0000001 + +class CMailHandler; + +class IUCode +{ +public: + IUCode(CMailHandler& _rMailHandler) + : m_rMailHandler(_rMailHandler) + {} + + virtual ~IUCode() + {} + + virtual void HandleMail(u32 _uMail) = 0; + virtual void Update(void) = 0; + virtual void MixAdd(short* buffer, int size) {} + +protected: + CMailHandler& m_rMailHandler; +}; + +extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler); + +#endif diff --git a/Source/Plugins/Plugin_PadSimple/Src/DirectInputBase.h b/Source/Plugins/Plugin_PadSimple/Src/DirectInputBase.h index 25b621cf52..2845599c36 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/DirectInputBase.h +++ b/Source/Plugins/Plugin_PadSimple/Src/DirectInputBase.h @@ -1,44 +1,44 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DIRECTINPUTBASE_H -#define _DIRECTINPUTBASE_H - -class DInput -{ - public: - - DInput(); - ~DInput(); - - static void DInput::DIKToString(unsigned int keycode, char *keyStr); - - HRESULT Init(HWND hWnd); - void Free(); - HRESULT Read(); - - - BYTE diks[256]; // DirectInput keyboard state buffer - - private: - - LPDIRECTINPUT8 g_pDI; // The DirectInput object - LPDIRECTINPUTDEVICE8 g_pKeyboard; // The keyboard device -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DIRECTINPUTBASE_H +#define _DIRECTINPUTBASE_H + +class DInput +{ + public: + + DInput(); + ~DInput(); + + static void DInput::DIKToString(unsigned int keycode, char *keyStr); + + HRESULT Init(HWND hWnd); + void Free(); + HRESULT Read(); + + + BYTE diks[256]; // DirectInput keyboard state buffer + + private: + + LPDIRECTINPUT8 g_pDI; // The DirectInput object + LPDIRECTINPUTDEVICE8 g_pKeyboard; // The keyboard device +}; + +#endif + diff --git a/Source/Plugins/Plugin_PadSimple/Src/stdafx.h b/Source/Plugins/Plugin_PadSimple/Src/stdafx.h index 703cfe85dc..3556b66a4f 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/stdafx.h +++ b/Source/Plugins/Plugin_PadSimple/Src/stdafx.h @@ -1,34 +1,34 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -// Insert your headers here -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define _CRT_SECURE_NO_DEPRECATE 1 - -#include -#include -#include -#include -#include - -// DInput -#define DIRECTINPUT_VERSION 0x0800 -#include - - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define _CRT_SECURE_NO_DEPRECATE 1 + +#include +#include +#include +#include +#include + +// DInput +#define DIRECTINPUT_VERSION 0x0800 +#include + + diff --git a/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.h b/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.h index cc493276ea..9f6e97dc85 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.h @@ -1,29 +1,29 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BPSTRUCTS_H -#define _BPSTRUCTS_H - -#pragma pack(4) - -#include "BPMemory.h" - -void BPInit(); -void LoadBPReg(u32 value0); -void ActivateTextures(); - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BPSTRUCTS_H +#define _BPSTRUCTS_H + +#pragma pack(4) + +#include "BPMemory.h" + +void BPInit(); +void LoadBPReg(u32 value0); +void ActivateTextures(); + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h b/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h index 2208d766b6..e937958707 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h @@ -1,29 +1,29 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _CPSTRUCTS_H -#define _CPSTRUCTS_H - -#include "Common.h" -#include "CPMemory.h" -#include "XFMemory.h" - -void CPUpdateMatricesA(); -void CPUpdateMatricesB(); -void LoadCPReg(u32 SubCmd, u32 Value); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _CPSTRUCTS_H +#define _CPSTRUCTS_H + +#include "Common.h" +#include "CPMemory.h" +#include "XFMemory.h" + +void CPUpdateMatricesA(); +void CPUpdateMatricesB(); +void LoadCPReg(u32 SubCmd, u32 Value); + +#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Config.h b/Source/Plugins/Plugin_VideoDX9/Src/Config.h index 5057cc1c4b..23e5b82f04 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Config.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Config.h @@ -1,67 +1,67 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _GLOBALS_H -#define _GLOBALS_H - -#include - -struct Config -{ - Config(); - void Load(); - void Save(); - - int iAdapter; - int iFSResolution; - int iMultisampleMode; - - int iPostprocessEffect; - int iCompileDLsLevel; - - bool renderToMainframe; - bool bFullscreen; - bool bVsync; - bool bWireFrame; - bool bOverlayStats; - bool bDumpTextures; - bool bOldCard; - bool bShowShaderErrors; - //enhancements - bool bForceFiltering; - bool bForceMaxAniso; - - bool bPreUpscale; - int iPreUpscaleFilter; - - bool bTruform; - int iTruformLevel; - - int iWindowedRes; - - char psProfile[16]; - char vsProfile[16]; - - bool bTexFmtOverlayEnable; - bool bTexFmtOverlayCenter; - - std::string texDumpPath; -}; - -extern Config g_Config; - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _GLOBALS_H +#define _GLOBALS_H + +#include + +struct Config +{ + Config(); + void Load(); + void Save(); + + int iAdapter; + int iFSResolution; + int iMultisampleMode; + + int iPostprocessEffect; + int iCompileDLsLevel; + + bool renderToMainframe; + bool bFullscreen; + bool bVsync; + bool bWireFrame; + bool bOverlayStats; + bool bDumpTextures; + bool bOldCard; + bool bShowShaderErrors; + //enhancements + bool bForceFiltering; + bool bForceMaxAniso; + + bool bPreUpscale; + int iPreUpscaleFilter; + + bool bTruform; + int iTruformLevel; + + int iWindowedRes; + + char psProfile[16]; + char vsProfile[16]; + + bool bTexFmtOverlayEnable; + bool bTexFmtOverlayCenter; + + std::string texDumpPath; +}; + +extern Config g_Config; + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h index a61e71534e..8eee0df3af 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.h @@ -1,97 +1,97 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _D3DBASE_H -#define _D3DBASE_H - -#include - -#include -#include - -#ifndef SAFE_RELEASE -#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } -#endif - -#include "Common.h" - -namespace D3D -{ - enum ShaderVersion - { - PSNONE = 0, - PS20 = 2, - PS30 = 3, - PS40 = 4, - }; - - HRESULT Init(); - HRESULT Create(int adapter, HWND wnd, bool fullscreen, int resolution, int aa_mode); - void Close(); - void Shutdown(); - - void Reset(); - bool BeginFrame(bool clear=true, u32 color=0, float z=1.0f); - void EndFrame(); - void SwitchFullscreen(bool fullscreen); - bool IsFullscreen(); - int GetDisplayWidth(); - int GetDisplayHeight(); - ShaderVersion GetShaderVersion(); - LPDIRECT3DSURFACE9 GetBackBufferSurface(); - const D3DCAPS9 &GetCaps(); - extern IDirect3DDevice9 *dev; - void ShowD3DError(HRESULT err); - void EnableAlphaToCoverage(); - - struct Resolution - { - char name[32]; - int xres; - int yres; - std::set bitdepths; - std::set refreshes; - }; - - struct AALevel - { - AALevel(const char *n, D3DMULTISAMPLE_TYPE m, int q) {strcpy(name, n); ms_setting=m; qual_setting=q;} - char name[32]; - D3DMULTISAMPLE_TYPE ms_setting; - int qual_setting; - }; - - struct Adapter - { - D3DADAPTER_IDENTIFIER9 ident; - std::vector resolutions; - std::vector aa_levels; - bool supports_alpha_to_coverage; - }; - - struct Shader - { - int Minor; - int Major; - }; - - const Adapter &GetAdapter(int i); - const Adapter &GetCurAdapter(); - int GetNumAdapters(); -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _D3DBASE_H +#define _D3DBASE_H + +#include + +#include +#include + +#ifndef SAFE_RELEASE +#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } +#endif + +#include "Common.h" + +namespace D3D +{ + enum ShaderVersion + { + PSNONE = 0, + PS20 = 2, + PS30 = 3, + PS40 = 4, + }; + + HRESULT Init(); + HRESULT Create(int adapter, HWND wnd, bool fullscreen, int resolution, int aa_mode); + void Close(); + void Shutdown(); + + void Reset(); + bool BeginFrame(bool clear=true, u32 color=0, float z=1.0f); + void EndFrame(); + void SwitchFullscreen(bool fullscreen); + bool IsFullscreen(); + int GetDisplayWidth(); + int GetDisplayHeight(); + ShaderVersion GetShaderVersion(); + LPDIRECT3DSURFACE9 GetBackBufferSurface(); + const D3DCAPS9 &GetCaps(); + extern IDirect3DDevice9 *dev; + void ShowD3DError(HRESULT err); + void EnableAlphaToCoverage(); + + struct Resolution + { + char name[32]; + int xres; + int yres; + std::set bitdepths; + std::set refreshes; + }; + + struct AALevel + { + AALevel(const char *n, D3DMULTISAMPLE_TYPE m, int q) {strcpy(name, n); ms_setting=m; qual_setting=q;} + char name[32]; + D3DMULTISAMPLE_TYPE ms_setting; + int qual_setting; + }; + + struct Adapter + { + D3DADAPTER_IDENTIFIER9 ident; + std::vector resolutions; + std::vector aa_levels; + bool supports_alpha_to_coverage; + }; + + struct Shader + { + int Minor; + int Major; + }; + + const Adapter &GetAdapter(int i); + const Adapter &GetCurAdapter(); + int GetNumAdapters(); +} + +#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DPostprocess.h b/Source/Plugins/Plugin_VideoDX9/Src/D3DPostprocess.h index e46b88fcdc..e57828f16b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DPostprocess.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DPostprocess.h @@ -1,33 +1,33 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -namespace Postprocess -{ - - void Initialize(); - void Cleanup(); - - void BeginFrame(); - void FinalizeFrame(); - - int GetWidth(); - int GetHeight(); - - const char **GetPostprocessingNames(); +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +namespace Postprocess +{ + + void Initialize(); + void Cleanup(); + + void BeginFrame(); + void FinalizeFrame(); + + int GetWidth(); + int GetHeight(); + + const char **GetPostprocessingNames(); } \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DShader.h b/Source/Plugins/Plugin_VideoDX9/Src/D3DShader.h index 257bd8b550..bd6cb7aa1e 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DShader.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DShader.h @@ -1,26 +1,26 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "D3DBase.h" - -namespace D3D -{ - LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len); - LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len); +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "D3DBase.h" + +namespace D3D +{ + LPDIRECT3DVERTEXSHADER9 CompileVShader(const char *code, int len); + LPDIRECT3DPIXELSHADER9 CompilePShader(const char *code, int len); } \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.h b/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.h index 183f097690..625b11da55 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.h @@ -1,28 +1,28 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "D3DBase.h" - -namespace D3D -{ - LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int height, const int pitch, D3DFORMAT fmt = D3DFMT_A8R8G8B8); - void ReplaceTexture2D(LPDIRECT3DTEXTURE9 pTexture, const u8* buffer, const int width, const int height,const int pitch, D3DFORMAT fmt); - LPDIRECT3DTEXTURE9 CreateRenderTarget(const int width, const int height); - LPDIRECT3DSURFACE9 CreateDepthStencilSurface(const int width, const int height); -} +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "D3DBase.h" + +namespace D3D +{ + LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int height, const int pitch, D3DFORMAT fmt = D3DFMT_A8R8G8B8); + void ReplaceTexture2D(LPDIRECT3DTEXTURE9 pTexture, const u8* buffer, const int width, const int height,const int pitch, D3DFORMAT fmt); + LPDIRECT3DTEXTURE9 CreateRenderTarget(const int width, const int height); + LPDIRECT3DSURFACE9 CreateDepthStencilSurface(const int width, const int height); +} diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h index 7a45b86df2..9b0cafb778 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.h @@ -1,61 +1,61 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "D3DBase.h" - -namespace D3D -{ - // Font creation flags - #define D3DFONT_BOLD 0x0001 - #define D3DFONT_ITALIC 0x0002 - - // Font rendering flags - #define D3DFONT_CENTERED 0x0001 - - //a cut-down variant of the DXSDK CD3DFont class - class CD3DFont - { - LPDIRECT3DTEXTURE9 m_pTexture; // The d3d texture for this font - LPDIRECT3DVERTEXBUFFER9 m_pVB; // VertexBuffer for rendering text - //int m_dwTexWidth; // Texture dimensions - //int m_dwTexHeight; - float m_fTextScale; - float m_fTexCoords[128-32][4]; - - public: - CD3DFont(); - // 2D (no longer 3D) text drawing function - // Initializing and destroying device-dependent objects - void SetRenderStates(); - int Init(); - int Shutdown(); - int DrawTextScaled( float x, float y, - float fXScale, float fYScale, - float spacing, u32 dwColor, - const char* strText, bool center=true ); - - - // Constructor / destructor - //~CD3DFont(); - }; - - extern CD3DFont font; - - void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1=0, float v1=0, float u2=1, float v2=1); -} +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "D3DBase.h" + +namespace D3D +{ + // Font creation flags + #define D3DFONT_BOLD 0x0001 + #define D3DFONT_ITALIC 0x0002 + + // Font rendering flags + #define D3DFONT_CENTERED 0x0001 + + //a cut-down variant of the DXSDK CD3DFont class + class CD3DFont + { + LPDIRECT3DTEXTURE9 m_pTexture; // The d3d texture for this font + LPDIRECT3DVERTEXBUFFER9 m_pVB; // VertexBuffer for rendering text + //int m_dwTexWidth; // Texture dimensions + //int m_dwTexHeight; + float m_fTextScale; + float m_fTexCoords[128-32][4]; + + public: + CD3DFont(); + // 2D (no longer 3D) text drawing function + // Initializing and destroying device-dependent objects + void SetRenderStates(); + int Init(); + int Shutdown(); + int DrawTextScaled( float x, float y, + float fXScale, float fYScale, + float spacing, u32 dwColor, + const char* strText, bool center=true ); + + + // Constructor / destructor + //~CD3DFont(); + }; + + extern CD3DFont font; + + void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1=0, float v1=0, float u2=1, float v2=1); +} diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DLCompiler.h b/Source/Plugins/Plugin_VideoDX9/Src/DLCompiler.h index 566ed81a6a..68e371a65a 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/DLCompiler.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/DLCompiler.h @@ -1,72 +1,72 @@ -#pragma once - -#if 0 - -#include "D3DBase.h" -#include "DecodedVArray.h" -#include - - -class CompiledDList -{ - u32 *data; - int dataSize; - int pass; - int codeSize; - u8 *code; - - struct Batch - { - DecodedVArray varray; - LPDIRECT3DINDEXBUFFER9 ibuffer; - int numDraws; - }; - Batch *batches; - int numBatches; - - u32 addr, size; - bool Compile(); - bool Pass1(); - void Pass2(); - void Run(); - -public: - CompiledDList(u32 _addr, u32 _size); - ~CompiledDList(); - bool Call(); - static void DrawHelperHelper(CompiledDList *dl, int vno, int prim); -}; - -class DListCache -{ - struct DLCacheEntry - { - CompiledDList *dlist; - int frameCount; - int pass; - u32 size; - DLCacheEntry() - { - pass=0; - dlist=0; - frameCount=0; - } - void Destroy() - { - if (dlist) - delete dlist; - } - }; - - typedef std::map DLCache; - - static DLCache dlists; - -public: - static void Init(); - static void Cleanup(); - static void Shutdown(); - static void Call(u32 _addr, u32 _size); -}; - +#pragma once + +#if 0 + +#include "D3DBase.h" +#include "DecodedVArray.h" +#include + + +class CompiledDList +{ + u32 *data; + int dataSize; + int pass; + int codeSize; + u8 *code; + + struct Batch + { + DecodedVArray varray; + LPDIRECT3DINDEXBUFFER9 ibuffer; + int numDraws; + }; + Batch *batches; + int numBatches; + + u32 addr, size; + bool Compile(); + bool Pass1(); + void Pass2(); + void Run(); + +public: + CompiledDList(u32 _addr, u32 _size); + ~CompiledDList(); + bool Call(); + static void DrawHelperHelper(CompiledDList *dl, int vno, int prim); +}; + +class DListCache +{ + struct DLCacheEntry + { + CompiledDList *dlist; + int frameCount; + int pass; + u32 size; + DLCacheEntry() + { + pass=0; + dlist=0; + frameCount=0; + } + void Destroy() + { + if (dlist) + delete dlist; + } + }; + + typedef std::map DLCache; + + static DLCache dlists; + +public: + static void Init(); + static void Cleanup(); + static void Shutdown(); + static void Call(u32 _addr, u32 _size); +}; + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DecodedVArray.h b/Source/Plugins/Plugin_VideoDX9/Src/DecodedVArray.h index 75ddc05d87..4150533a44 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/DecodedVArray.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/DecodedVArray.h @@ -1,114 +1,114 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _DECODED_VARRAY_H -#define _DECODED_VARRAY_H - -#include "Vec3.h" -#include "Common.h" - -typedef Vec3 DecPos; -typedef Vec3 DecNormal; - -struct DecUV -{ - float u,v; -}; - -typedef u32 DecColor; -typedef u8 DecMtxInd; - -int ComputeVertexSize(u32 components); - -//TODO(ector): Change the internal implementation to pack it tight according to components -// The tight packing will be fed directly to the gfx card in the mystic future. -class DecodedVArray -{ - int size; - u32 components; - int vertexSize; - -public: - int count; - DecodedVArray(); - ~DecodedVArray(); - void SetComponents(u32 comps) {components = comps; vertexSize = ComputeVertexSize(components); - ComputeComponents(); } - u32 GetComponents() const {return components;} - void Create(int _size, int pmcount, int tmcount, int nrmcount, int colcount, int tccount); - void Zero(); - void Destroy(); - void Reset() {count=0;} - int GetSize() {return size;} - int GetCount() {return count;} - void Next() {count++;} - void SetPosNrmIdx(int i) {posMtxInds[count] = i;} - void SetTcIdx(int n, int i) {texMtxInds[n][count] = i;} - void SetPosX(float x) {positions[count].x=x;} - void SetPosY(float y) {positions[count].y=y;} - void SetPosZ(float z) {positions[count].z=z;} - - void SetNormalX(int n,float x) {normals[n][count].x=x;} - void SetNormalY(int n,float y) {normals[n][count].y=y;} - void SetNormalZ(int n,float z) {normals[n][count].z=z;} - void SetU(int n, float u) {uvs[n][count].u = u;} - void SetV(int n, float v) {uvs[n][count].v = v;} - void SetPosition(float x, float y, float z) { - positions[count].x=x; - positions[count].y=y; - positions[count].z=z; - } - void SetNormal(int n, float x, float y, float z) { - normals[n][count].x=x; - normals[n][count].y=y; - normals[n][count].z=z; - } - void SetColor(int n, u32 c) - { - colors[n][count] = c; - } - void SetUV(int n, float u, float v) { - uvs[n][count].u=u; - uvs[n][count].v=v; - } - - void ComputeComponents() { - hasPosMatIdx = (components & (1 << 1)) != 0; - for(int i = 0; i < 8; i++) - hasTexMatIdx[i] = (components & (1 << (i + 2))) != 0; - hasNrm = (components & (1 << 10)) != 0; - } - - const DecPos &GetPos(int n) const { return positions[n]; } - const DecNormal &GetNormal(int i, int n) const { return normals[i][n]; } - const DecColor &GetColor(int i, int n) const { return colors[i][n]; } - const DecUV &GetUV(int i, int n) const { return uvs[i][n]; } - const DecMtxInd &GetPosMtxInd(int n) const { return posMtxInds[n]; } - const DecMtxInd &GetTexMtxInd(int i, int n) const { return texMtxInds[i][n]; } -//private: - DecPos *positions; - DecNormal *normals[3]; - DecColor *colors[2]; - DecUV *uvs[8]; - DecMtxInd *posMtxInds; - DecMtxInd *texMtxInds[8]; - - // Component data - bool hasPosMatIdx, hasTexMatIdx[8], hasNrm; -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _DECODED_VARRAY_H +#define _DECODED_VARRAY_H + +#include "Vec3.h" +#include "Common.h" + +typedef Vec3 DecPos; +typedef Vec3 DecNormal; + +struct DecUV +{ + float u,v; +}; + +typedef u32 DecColor; +typedef u8 DecMtxInd; + +int ComputeVertexSize(u32 components); + +//TODO(ector): Change the internal implementation to pack it tight according to components +// The tight packing will be fed directly to the gfx card in the mystic future. +class DecodedVArray +{ + int size; + u32 components; + int vertexSize; + +public: + int count; + DecodedVArray(); + ~DecodedVArray(); + void SetComponents(u32 comps) {components = comps; vertexSize = ComputeVertexSize(components); + ComputeComponents(); } + u32 GetComponents() const {return components;} + void Create(int _size, int pmcount, int tmcount, int nrmcount, int colcount, int tccount); + void Zero(); + void Destroy(); + void Reset() {count=0;} + int GetSize() {return size;} + int GetCount() {return count;} + void Next() {count++;} + void SetPosNrmIdx(int i) {posMtxInds[count] = i;} + void SetTcIdx(int n, int i) {texMtxInds[n][count] = i;} + void SetPosX(float x) {positions[count].x=x;} + void SetPosY(float y) {positions[count].y=y;} + void SetPosZ(float z) {positions[count].z=z;} + + void SetNormalX(int n,float x) {normals[n][count].x=x;} + void SetNormalY(int n,float y) {normals[n][count].y=y;} + void SetNormalZ(int n,float z) {normals[n][count].z=z;} + void SetU(int n, float u) {uvs[n][count].u = u;} + void SetV(int n, float v) {uvs[n][count].v = v;} + void SetPosition(float x, float y, float z) { + positions[count].x=x; + positions[count].y=y; + positions[count].z=z; + } + void SetNormal(int n, float x, float y, float z) { + normals[n][count].x=x; + normals[n][count].y=y; + normals[n][count].z=z; + } + void SetColor(int n, u32 c) + { + colors[n][count] = c; + } + void SetUV(int n, float u, float v) { + uvs[n][count].u=u; + uvs[n][count].v=v; + } + + void ComputeComponents() { + hasPosMatIdx = (components & (1 << 1)) != 0; + for(int i = 0; i < 8; i++) + hasTexMatIdx[i] = (components & (1 << (i + 2))) != 0; + hasNrm = (components & (1 << 10)) != 0; + } + + const DecPos &GetPos(int n) const { return positions[n]; } + const DecNormal &GetNormal(int i, int n) const { return normals[i][n]; } + const DecColor &GetColor(int i, int n) const { return colors[i][n]; } + const DecUV &GetUV(int i, int n) const { return uvs[i][n]; } + const DecMtxInd &GetPosMtxInd(int n) const { return posMtxInds[n]; } + const DecMtxInd &GetTexMtxInd(int i, int n) const { return texMtxInds[i][n]; } +//private: + DecPos *positions; + DecNormal *normals[3]; + DecColor *colors[2]; + DecUV *uvs[8]; + DecMtxInd *posMtxInds; + DecMtxInd *texMtxInds[8]; + + // Component data + bool hasPosMatIdx, hasTexMatIdx[8], hasNrm; +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.h b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.h index 8d7bdf01be..489fd3218c 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.h @@ -1,20 +1,20 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + void DlgSettings_Show(HINSTANCE hInstance, HWND parent); \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h index 0746b17a5a..3b575636df 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.h @@ -1,16 +1,16 @@ -#ifndef _EMUWINDOW_H -#define _EMUWINDOW_H - -#include - -namespace EmuWindow -{ - HWND GetWnd(); - HWND GetParentWnd(); - HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title); - void Show(); - void Close(); - void SetSize(int displayWidth, int displayHeight); -} - -#endif +#ifndef _EMUWINDOW_H +#define _EMUWINDOW_H + +#include + +namespace EmuWindow +{ + HWND GetWnd(); + HWND GetParentWnd(); + HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title); + void Show(); + void Close(); + void SetSize(int displayWidth, int displayHeight); +} + +#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/IndexGenerator.h b/Source/Plugins/Plugin_VideoDX9/Src/IndexGenerator.h index 7ebf01049b..91ce0cf20a 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/IndexGenerator.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/IndexGenerator.h @@ -1,36 +1,36 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -class IndexGenerator -{ - unsigned short *ptr; - int numPrims; - int index; -public: - void Start(unsigned short *startptr); - void AddList(int numVerts); - void AddStrip(int numVerts); - void AddLineList(int numVerts); - void AddPointList(int numVerts); //dummy for counting vertices - void AddLineStrip(int numVerts); - void AddFan(int numVerts); - void AddQuads(int numVerts); - int GetNumPrims() {return numPrims;} //returns numprimitives - int GetNumVerts() {return index;} //returns numprimitives +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +class IndexGenerator +{ + unsigned short *ptr; + int numPrims; + int index; +public: + void Start(unsigned short *startptr); + void AddList(int numVerts); + void AddStrip(int numVerts); + void AddLineList(int numVerts); + void AddPointList(int numVerts); //dummy for counting vertices + void AddLineStrip(int numVerts); + void AddFan(int numVerts); + void AddQuads(int numVerts); + int GetNumPrims() {return numPrims;} //returns numprimitives + int GetNumVerts() {return index;} //returns numprimitives }; \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/PixelShader.h b/Source/Plugins/Plugin_VideoDX9/Src/PixelShader.h index cfbc55faff..43c65518f9 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/PixelShader.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/PixelShader.h @@ -1,30 +1,30 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "Common.h" -#include "D3DShader.h" - -const char *GeneratePixelShader(); - -#define PS_CONST_COLORS 0 -#define PS_CONST_KCOLORS 4 -#define PS_CONST_CONSTALPHA 8 -#define PS_CONST_ALPHAREF 9 // x,y -#define PS_CONST_INDMTXSTART 10 +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "Common.h" +#include "D3DShader.h" + +const char *GeneratePixelShader(); + +#define PS_CONST_COLORS 0 +#define PS_CONST_KCOLORS 4 +#define PS_CONST_CONSTALPHA 8 +#define PS_CONST_ALPHAREF 9 // x,y +#define PS_CONST_INDMTXSTART 10 #define PS_CONST_INDSIZE 2 \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/RGBAFloat.h b/Source/Plugins/Plugin_VideoDX9/Src/RGBAFloat.h index a1f7e05e68..7226d472d7 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/RGBAFloat.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/RGBAFloat.h @@ -1,84 +1,84 @@ -#ifndef _RGBAFLOAT_H -#define _RGBAFLOAT_H - -struct RGBAFloat -{ - float r,g,b,a; - RGBAFloat(){a=r=g=b=1.0f;} - RGBAFloat(float _r, float _g, float _b, float _a) - { - r=_r;g=_g;b=_b;a=_a; - } - void clamp() - { - if (r>1) r=1; - if (g>1) g=1; - if (b>1) b=1; - if (a>1) a=1; - if (r<0) r=0; - if (g<0) g=0; - if (b<0) b=0; - if (a<0) a=0; - } - void convertToD3DColor(u32 &color) - { - clamp(); - color = (int(a*255)<<24) | (int(r*255)<<16) | (int(g*255)<<8) | (int(b*255)); - } - void convertRGB_GC(u32 color) - { - r=((color>>24)&0xFF)/255.0f; - g=((color>>16)&0xFF)/255.0f; - b=((color>>8)&0xFF)/255.0f; - } - void convertRGB(u32 color) - { - r=((color>>16)&0xFF)/255.0f; - g=((color>>8)&0xFF)/255.0f; - b=((color)&0xFF)/255.0f; - } - void convertA(u32 color) - { - a=((color>>24)&0xFF)/255.0f; - } - void convertA_GC(u32 color) - { - a=((color)&0xFF)/255.0f; - } - void convert(u32 color) - { - convertRGB(color); - convertA(color); - } - void convert_GC(u32 color) - { - convertRGB_GC(color); - convertA_GC(color); - } - void operator *=(float f) - { - r*=f;g*=f;b*=f; a*=f; - } - RGBAFloat operator *(float f) - { - return RGBAFloat(r*f,g*f,b*f,a*f); - } - RGBAFloat operator *(RGBAFloat &o) - { - return RGBAFloat(r*o.r,g*o.g,b*o.b,a*o.a); - } - void operator *=(RGBAFloat &o) - { - r*=o.r;g*=o.g;b*=o.b;a*=o.a; - } - RGBAFloat operator +(RGBAFloat &o) - { - return RGBAFloat(r+o.r,g+o.g,b+o.b,a+o.a); - } - void operator +=(RGBAFloat &o) - { - r+=o.r;g+=o.g;b+=o.b;a+=o.a; - } -}; - +#ifndef _RGBAFLOAT_H +#define _RGBAFLOAT_H + +struct RGBAFloat +{ + float r,g,b,a; + RGBAFloat(){a=r=g=b=1.0f;} + RGBAFloat(float _r, float _g, float _b, float _a) + { + r=_r;g=_g;b=_b;a=_a; + } + void clamp() + { + if (r>1) r=1; + if (g>1) g=1; + if (b>1) b=1; + if (a>1) a=1; + if (r<0) r=0; + if (g<0) g=0; + if (b<0) b=0; + if (a<0) a=0; + } + void convertToD3DColor(u32 &color) + { + clamp(); + color = (int(a*255)<<24) | (int(r*255)<<16) | (int(g*255)<<8) | (int(b*255)); + } + void convertRGB_GC(u32 color) + { + r=((color>>24)&0xFF)/255.0f; + g=((color>>16)&0xFF)/255.0f; + b=((color>>8)&0xFF)/255.0f; + } + void convertRGB(u32 color) + { + r=((color>>16)&0xFF)/255.0f; + g=((color>>8)&0xFF)/255.0f; + b=((color)&0xFF)/255.0f; + } + void convertA(u32 color) + { + a=((color>>24)&0xFF)/255.0f; + } + void convertA_GC(u32 color) + { + a=((color)&0xFF)/255.0f; + } + void convert(u32 color) + { + convertRGB(color); + convertA(color); + } + void convert_GC(u32 color) + { + convertRGB_GC(color); + convertA_GC(color); + } + void operator *=(float f) + { + r*=f;g*=f;b*=f; a*=f; + } + RGBAFloat operator *(float f) + { + return RGBAFloat(r*f,g*f,b*f,a*f); + } + RGBAFloat operator *(RGBAFloat &o) + { + return RGBAFloat(r*o.r,g*o.g,b*o.b,a*o.a); + } + void operator *=(RGBAFloat &o) + { + r*=o.r;g*=o.g;b*=o.b;a*=o.a; + } + RGBAFloat operator +(RGBAFloat &o) + { + return RGBAFloat(r+o.r,g+o.g,b+o.b,a+o.a); + } + void operator +=(RGBAFloat &o) + { + r+=o.r;g+=o.g;b+=o.b;a+=o.a; + } +}; + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.h b/Source/Plugins/Plugin_VideoDX9/Src/Render.h index 0e3a39126a..d7086efdf3 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.h @@ -1,123 +1,123 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __H_RENDER__ -#define __H_RENDER__ - -#include "PluginSpecs_Video.h" -#include -#include -#include "D3DBase.h" - - -class Renderer -{ - // screen offset - static float m_x,m_y,m_width, m_height,xScale,yScale; - const static int MaxTextureStages = 9; - const static int MaxRenderStates = 210; - const static DWORD MaxTextureTypes = 33; - const static DWORD MaxSamplerSize = 13; - const static DWORD MaxSamplerTypes = 15; - static std::vector m_Textures; - static DWORD m_RenderStates[MaxRenderStates]; - static DWORD m_TextureStageStates[MaxTextureStages][MaxTextureTypes]; - static DWORD m_SamplerStates[MaxSamplerSize][MaxSamplerTypes]; - static DWORD m_FVF; - -public: - - static void Init(SVideoInitialize &_VideoInitialize); - static void Shutdown(); - - // initialize opengl standard values (like view port) - static void Initialize(void); - // must be called if the window size has changed - static void ReinitView(void); - // - // --- Render Functions --- - // - static void SwapBuffers(void); - static void Flush(void); - static float GetXScale(){return xScale;} - static float GetYScale(){return yScale;} - - static void SetScissorBox(RECT &rc); - static void SetViewport(float* _Viewport); - static void SetProjection(float* _pProjection, int constantIndex = -1); - - - static void AddMessage(const std::string &message, unsigned int ms); - static void ProcessMessages(); - static void RenderText(const std::string &text, int left, int top, unsigned int color); - - /** - * Assigns a texture to a device stage. - * @param Stage Stage to assign to. - * @param pTexture Texture to be assigned. - */ - static void SetTexture( DWORD Stage, IDirect3DBaseTexture9 *pTexture ); - - /** - * Sets the current vertex stream declaration. - * @param FVF Fixed function vertex type - */ - static void SetFVF( DWORD FVF ); - - /** - * Sets a single device render-state parameter. - * @param State Device state variable that is being modified. - * @param Value New value for the device render state to be set. - */ - static void SetRenderState( D3DRENDERSTATETYPE State, DWORD Value ); - - /** - * Sets the state value for the currently assigned texture. - * @param Stage Stage identifier of the texture for which the state value is set. - * @param Type Texture state to set. - * @param Value State value to set. - */ - static void SetTextureStageState( DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,DWORD Value ); - - /** - * Sets the sampler state value. - * @param Sampler The sampler stage index. - * @param Type Type of the sampler. - * @param Value State value to set. - */ - static void SetSamplerState( DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value ); - - /** - * Renders data specified by a user memory pointer as a sequence of geometric primitives of the specified type. - * @param PrimitiveType Type of primitive to render. - * @param PrimitiveCount Number of primitives to render. - * @param pVertexStreamZeroData User memory pointer to the vertex data. - * @param VertexStreamZeroStride The number of bytes of data for each vertex. - */ - static void DrawPrimitiveUP( D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, - const void* pVertexStreamZeroData, UINT VertexStreamZeroStride ); - - /** - * Renders a sequence of non indexed, geometric primitives of the specified type from the current set of data input streams. - * @param PrimitiveType Type of primitive to render. - * @param StartVertex Index of the first vertex to load. - * @param PrimitiveCount Number of primitives to render. - */ - static void DrawPrimitive( D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount ); -}; - -#endif // __H_RENDER__ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __H_RENDER__ +#define __H_RENDER__ + +#include "PluginSpecs_Video.h" +#include +#include +#include "D3DBase.h" + + +class Renderer +{ + // screen offset + static float m_x,m_y,m_width, m_height,xScale,yScale; + const static int MaxTextureStages = 9; + const static int MaxRenderStates = 210; + const static DWORD MaxTextureTypes = 33; + const static DWORD MaxSamplerSize = 13; + const static DWORD MaxSamplerTypes = 15; + static std::vector m_Textures; + static DWORD m_RenderStates[MaxRenderStates]; + static DWORD m_TextureStageStates[MaxTextureStages][MaxTextureTypes]; + static DWORD m_SamplerStates[MaxSamplerSize][MaxSamplerTypes]; + static DWORD m_FVF; + +public: + + static void Init(SVideoInitialize &_VideoInitialize); + static void Shutdown(); + + // initialize opengl standard values (like view port) + static void Initialize(void); + // must be called if the window size has changed + static void ReinitView(void); + // + // --- Render Functions --- + // + static void SwapBuffers(void); + static void Flush(void); + static float GetXScale(){return xScale;} + static float GetYScale(){return yScale;} + + static void SetScissorBox(RECT &rc); + static void SetViewport(float* _Viewport); + static void SetProjection(float* _pProjection, int constantIndex = -1); + + + static void AddMessage(const std::string &message, unsigned int ms); + static void ProcessMessages(); + static void RenderText(const std::string &text, int left, int top, unsigned int color); + + /** + * Assigns a texture to a device stage. + * @param Stage Stage to assign to. + * @param pTexture Texture to be assigned. + */ + static void SetTexture( DWORD Stage, IDirect3DBaseTexture9 *pTexture ); + + /** + * Sets the current vertex stream declaration. + * @param FVF Fixed function vertex type + */ + static void SetFVF( DWORD FVF ); + + /** + * Sets a single device render-state parameter. + * @param State Device state variable that is being modified. + * @param Value New value for the device render state to be set. + */ + static void SetRenderState( D3DRENDERSTATETYPE State, DWORD Value ); + + /** + * Sets the state value for the currently assigned texture. + * @param Stage Stage identifier of the texture for which the state value is set. + * @param Type Texture state to set. + * @param Value State value to set. + */ + static void SetTextureStageState( DWORD Stage, D3DTEXTURESTAGESTATETYPE Type,DWORD Value ); + + /** + * Sets the sampler state value. + * @param Sampler The sampler stage index. + * @param Type Type of the sampler. + * @param Value State value to set. + */ + static void SetSamplerState( DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value ); + + /** + * Renders data specified by a user memory pointer as a sequence of geometric primitives of the specified type. + * @param PrimitiveType Type of primitive to render. + * @param PrimitiveCount Number of primitives to render. + * @param pVertexStreamZeroData User memory pointer to the vertex data. + * @param VertexStreamZeroStride The number of bytes of data for each vertex. + */ + static void DrawPrimitiveUP( D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, + const void* pVertexStreamZeroData, UINT VertexStreamZeroStride ); + + /** + * Renders a sequence of non indexed, geometric primitives of the specified type from the current set of data input streams. + * @param PrimitiveType Type of primitive to render. + * @param StartVertex Index of the first vertex to load. + * @param PrimitiveCount Number of primitives to render. + */ + static void DrawPrimitive( D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount ); +}; + +#endif // __H_RENDER__ diff --git a/Source/Plugins/Plugin_VideoDX9/Src/ShaderManager.h b/Source/Plugins/Plugin_VideoDX9/Src/ShaderManager.h index 0a668adc7c..9b067bdab3 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/ShaderManager.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/ShaderManager.h @@ -1,97 +1,97 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "D3DBase.h" - -#include -#include "PixelShader.h" -#include "VertexShader.h" - -typedef u32 tevhash; - -tevhash GetCurrentTEV(); - - -class PShaderCache -{ - struct PSCacheEntry - { - LPDIRECT3DPIXELSHADER9 shader; - //CGPShader shader; - - int frameCount; - PSCacheEntry() - { - shader=0; - frameCount=0; - } - void Destroy() - { - if (shader) - shader->Release(); - } - }; - - - typedef std::map PSCache; - - static PSCache pshaders; - -public: - static void Init(); - static void Cleanup(); - static void Shutdown(); - static void SetShader(); -}; - - - -class VShaderCache -{ - struct VSCacheEntry - { - LPDIRECT3DVERTEXSHADER9 shader; - //CGVShader shader; - int frameCount; - VSCacheEntry() - { - shader=0; - frameCount=0; - } - void Destroy() - { - if (shader) - shader->Release(); - } - }; - - typedef std::map VSCache; - - static VSCache vshaders; - - -public: - static void Init(); - static void Cleanup(); - static void Shutdown(); - static void SetShader(); -}; - -void InitCG(); +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "D3DBase.h" + +#include +#include "PixelShader.h" +#include "VertexShader.h" + +typedef u32 tevhash; + +tevhash GetCurrentTEV(); + + +class PShaderCache +{ + struct PSCacheEntry + { + LPDIRECT3DPIXELSHADER9 shader; + //CGPShader shader; + + int frameCount; + PSCacheEntry() + { + shader=0; + frameCount=0; + } + void Destroy() + { + if (shader) + shader->Release(); + } + }; + + + typedef std::map PSCache; + + static PSCache pshaders; + +public: + static void Init(); + static void Cleanup(); + static void Shutdown(); + static void SetShader(); +}; + + + +class VShaderCache +{ + struct VSCacheEntry + { + LPDIRECT3DVERTEXSHADER9 shader; + //CGVShader shader; + int frameCount; + VSCacheEntry() + { + shader=0; + frameCount=0; + } + void Destroy() + { + if (shader) + shader->Release(); + } + }; + + typedef std::map VSCache; + + static VSCache vshaders; + + +public: + static void Init(); + static void Cleanup(); + static void Shutdown(); + static void SetShader(); +}; + +void InitCG(); void ShutdownCG(); \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h index a3a4e7d6b7..02dbf7a362 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h @@ -1,64 +1,64 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _TEXTURECACHE_H -#define _TEXTURECACHE_H - - -#include - -#include "D3DBase.h" - -class TextureCache -{ - struct TCacheEntry - { - LPDIRECT3DTEXTURE9 texture; - u32 addr; - u32 hash; - u32 paletteHash; - u32 hashoffset; - u32 oldpixel; - bool isRenderTarget; - bool isNonPow2; - int frameCount; - int w,h,fmt; - TCacheEntry() - { - texture=0; - isRenderTarget=0; - hash=0; - } - void Destroy(); - }; - - - typedef std::map TexCache; - - static u8 *temp; - static TexCache textures; - -public: - static void Init(); - static void Cleanup(); - static void Shutdown(); - static void Invalidate(); - static void Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt); - static void CopyEFBToRenderTarget(u32 address, RECT *source); -}; - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _TEXTURECACHE_H +#define _TEXTURECACHE_H + + +#include + +#include "D3DBase.h" + +class TextureCache +{ + struct TCacheEntry + { + LPDIRECT3DTEXTURE9 texture; + u32 addr; + u32 hash; + u32 paletteHash; + u32 hashoffset; + u32 oldpixel; + bool isRenderTarget; + bool isNonPow2; + int frameCount; + int w,h,fmt; + TCacheEntry() + { + texture=0; + isRenderTarget=0; + hash=0; + } + void Destroy(); + }; + + + typedef std::map TexCache; + + static u8 *temp; + static TexCache textures; + +public: + static void Init(); + static void Cleanup(); + static void Shutdown(); + static void Invalidate(); + static void Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt); + static void CopyEFBToRenderTarget(u32 address, RECT *source); +}; + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.h b/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.h index c1e2a2a393..8169a47335 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.h @@ -1,55 +1,55 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _TRANSFORMENGINE_H -#define _TRANSFORMENGINE_H - -//T&L Engine -//as much work as possible will be delegated to vertex shaders later -//to take full advantage of current PC HW - -#include "VertexManager.h" -#include "DecodedVArray.h" - -class CTransformEngine -{ - static float* m_pPosMatrix; - static float* m_pNormalMatrix; - static float* m_pTexMatrix[8]; - static float* m_pTexPostMatrix[8]; - -public: - static void TransformVertices(int _numVertices, - const DecodedVArray *varray, - D3DVertex *vbuffer); - - static void SetPosNormalMatrix(float *p, float *n) - { - m_pPosMatrix = p; - m_pNormalMatrix = n; - } - static void SetTexMatrix(int i, float *f) - { - m_pTexMatrix[i] = f; - } - static void SetTexPostMatrix(int i, float *f) - { - m_pTexPostMatrix[i] = f; - } -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _TRANSFORMENGINE_H +#define _TRANSFORMENGINE_H + +//T&L Engine +//as much work as possible will be delegated to vertex shaders later +//to take full advantage of current PC HW + +#include "VertexManager.h" +#include "DecodedVArray.h" + +class CTransformEngine +{ + static float* m_pPosMatrix; + static float* m_pNormalMatrix; + static float* m_pTexMatrix[8]; + static float* m_pTexPostMatrix[8]; + +public: + static void TransformVertices(int _numVertices, + const DecodedVArray *varray, + D3DVertex *vbuffer); + + static void SetPosNormalMatrix(float *p, float *n) + { + m_pPosMatrix = p; + m_pNormalMatrix = n; + } + static void SetTexMatrix(int i, float *f) + { + m_pTexMatrix[i] = f; + } + static void SetTexPostMatrix(int i, float *f) + { + m_pTexPostMatrix[i] = f; + } +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Utils.h b/Source/Plugins/Plugin_VideoDX9/Src/Utils.h index bbd1fc64c3..f5b6efb5c4 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Utils.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Utils.h @@ -1,63 +1,63 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _UTILS_H -#define _UTILS_H - -#include "Common.h" -#include "main.h" -#include "LookUpTables.h" - -extern int frameCount; - -LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); - -//#define RAM_MASK 0x1FFFFFF - -inline u8 *Memory_GetPtr(u32 _uAddress) -{ - return g_VideoInitialize.pGetMemoryPointer(_uAddress); -} - -inline u8 Memory_Read_U8(u32 _uAddress) -{ - return *g_VideoInitialize.pGetMemoryPointer(_uAddress); -} - -inline u16 Memory_Read_U16(u32 _uAddress) -{ - return _byteswap_ushort(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress)); -// return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]); -} - -inline u32 Memory_Read_U32(u32 _uAddress) -{ - if (_uAddress == 0x020143a8) - { - int i =0; - } - return _byteswap_ulong(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress)); -// return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]); -} - -inline float Memory_Read_Float(u32 _uAddress) -{ - u32 uTemp = Memory_Read_U32(_uAddress); - return *(float*)&uTemp; -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _UTILS_H +#define _UTILS_H + +#include "Common.h" +#include "main.h" +#include "LookUpTables.h" + +extern int frameCount; + +LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +//#define RAM_MASK 0x1FFFFFF + +inline u8 *Memory_GetPtr(u32 _uAddress) +{ + return g_VideoInitialize.pGetMemoryPointer(_uAddress); +} + +inline u8 Memory_Read_U8(u32 _uAddress) +{ + return *g_VideoInitialize.pGetMemoryPointer(_uAddress); +} + +inline u16 Memory_Read_U16(u32 _uAddress) +{ + return _byteswap_ushort(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress)); +// return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]); +} + +inline u32 Memory_Read_U32(u32 _uAddress) +{ + if (_uAddress == 0x020143a8) + { + int i =0; + } + return _byteswap_ulong(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress)); +// return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]); +} + +inline float Memory_Read_Float(u32 _uAddress) +{ + u32 uTemp = Memory_Read_U32(_uAddress); + return *(float*)&uTemp; +} + +#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Vec3.h b/Source/Plugins/Plugin_VideoDX9/Src/Vec3.h index 298c0c8da2..074bc499cb 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Vec3.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Vec3.h @@ -1,116 +1,116 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VEC3_H -#define _VEC3_H - -#include -#include - -class Vec3 -{ -public: - float x,y,z; - Vec3() { } - explicit Vec3(float f) {x=y=z=f;} - explicit Vec3(const float *f) {x=f[0]; y=f[1]; z=f[2];} - Vec3(const float _x, const float _y, const float _z) { - x=_x; y=_y; z=_z; - } - void set(const float _x, const float _y, const float _z) { - x=_x; y=_y; z=_z; - } - Vec3 operator + (const Vec3 &other) const { - return Vec3(x+other.x, y+other.y, z+other.z); - } - void operator += (const Vec3 &other) { - x+=other.x; y+=other.y; z+=other.z; - } - Vec3 operator -(const Vec3 &v) const { - return Vec3(x-v.x,y-v.y,z-v.z); - } - void operator -= (const Vec3 &other) - { - x-=other.x; y-=other.y; z-=other.z; - } - Vec3 operator -() const { - return Vec3(-x,-y,-z); - } - - Vec3 operator * (const float f) const { - return Vec3(x*f,y*f,z*f); - } - Vec3 operator / (const float f) const { - float invf = (1.0f/f); - return Vec3(x*invf,y*invf,z*invf); - } - void operator /= (const float f) - { - *this = *this / f; - } - float operator * (const Vec3 &other) const { - return x*other.x + y*other.y + z*other.z; - } - void operator *= (const float f) { - *this = *this * f; - } - Vec3 scaled_by(const Vec3 &other) const { - return Vec3(x*other.x, y*other.y, z*other.z); - } - - Vec3 operator %(const Vec3 &v) const { - return Vec3(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x); - } - float length2() const { - return x*x+y*y+z*z; - } - float length() const { - return sqrtf(length2()); - } - float distance2_to(Vec3 &other) - { - return (other-(*this)).length2(); - } - Vec3 normalized() const { - return (*this) / length(); - - } - void normalize() { - (*this) /= length(); - } - float &operator [] (int i) - { - return *((&x) + i); - } - const float operator [] (const int i) const - { - return *((&x) + i); - } - bool operator == (const Vec3 &other) const - { - if (x==other.x && y==other.y && z==other.z) - return true; - else - return false; - } - void setZero() - { - memset((void *)this,0,sizeof(float)*3); - } -}; - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VEC3_H +#define _VEC3_H + +#include +#include + +class Vec3 +{ +public: + float x,y,z; + Vec3() { } + explicit Vec3(float f) {x=y=z=f;} + explicit Vec3(const float *f) {x=f[0]; y=f[1]; z=f[2];} + Vec3(const float _x, const float _y, const float _z) { + x=_x; y=_y; z=_z; + } + void set(const float _x, const float _y, const float _z) { + x=_x; y=_y; z=_z; + } + Vec3 operator + (const Vec3 &other) const { + return Vec3(x+other.x, y+other.y, z+other.z); + } + void operator += (const Vec3 &other) { + x+=other.x; y+=other.y; z+=other.z; + } + Vec3 operator -(const Vec3 &v) const { + return Vec3(x-v.x,y-v.y,z-v.z); + } + void operator -= (const Vec3 &other) + { + x-=other.x; y-=other.y; z-=other.z; + } + Vec3 operator -() const { + return Vec3(-x,-y,-z); + } + + Vec3 operator * (const float f) const { + return Vec3(x*f,y*f,z*f); + } + Vec3 operator / (const float f) const { + float invf = (1.0f/f); + return Vec3(x*invf,y*invf,z*invf); + } + void operator /= (const float f) + { + *this = *this / f; + } + float operator * (const Vec3 &other) const { + return x*other.x + y*other.y + z*other.z; + } + void operator *= (const float f) { + *this = *this * f; + } + Vec3 scaled_by(const Vec3 &other) const { + return Vec3(x*other.x, y*other.y, z*other.z); + } + + Vec3 operator %(const Vec3 &v) const { + return Vec3(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x); + } + float length2() const { + return x*x+y*y+z*z; + } + float length() const { + return sqrtf(length2()); + } + float distance2_to(Vec3 &other) + { + return (other-(*this)).length2(); + } + Vec3 normalized() const { + return (*this) / length(); + + } + void normalize() { + (*this) /= length(); + } + float &operator [] (int i) + { + return *((&x) + i); + } + const float operator [] (const int i) const + { + return *((&x) + i); + } + bool operator == (const Vec3 &other) const + { + if (x==other.x && y==other.y && z==other.z) + return true; + else + return false; + } + void setZero() + { + memset((void *)this,0,sizeof(float)*3); + } +}; + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.h index 2558a5554b..72229a84e0 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.h @@ -1,195 +1,195 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VERTEXLOADER_H -#define _VERTEXLOADER_H - -int ComputeVertexSize(u32 components); - -#include "CPStructs.h" -#include "DecodedVArray.h" -#include "DataReader.h" - -#define LOADERDECL __cdecl -typedef void (LOADERDECL *TPipelineFunction)(const void*); - -class VertexLoader -{ -public: - enum - { - NRM_ZERO = 0, - NRM_ONE = 1, - NRM_THREE = 3 - }; - - enum { - VB_HAS_POSMTXIDX =(1<<1), - VB_HAS_TEXMTXIDX0=(1<<2), - VB_HAS_TEXMTXIDX1=(1<<3), - VB_HAS_TEXMTXIDX2=(1<<4), - VB_HAS_TEXMTXIDX3=(1<<5), - VB_HAS_TEXMTXIDX4=(1<<6), - VB_HAS_TEXMTXIDX5=(1<<7), - VB_HAS_TEXMTXIDX6=(1<<8), - VB_HAS_TEXMTXIDX7=(1<<9), - VB_HAS_TEXMTXIDXALL=(0xff<<2), - //VB_HAS_POS=0, // Implied, it always has pos! don't bother testing - VB_HAS_NRM0=(1<<10), - VB_HAS_NRM1=(1<<11), - VB_HAS_NRM2=(1<<12), - VB_HAS_NRMALL=(7<<10), - - VB_HAS_COL0=(1<<13), - VB_HAS_COL1=(1<<14), - - VB_HAS_UV0=(1<<15), - VB_HAS_UV1=(1<<16), - VB_HAS_UV2=(1<<17), - VB_HAS_UV3=(1<<18), - VB_HAS_UV4=(1<<19), - VB_HAS_UV5=(1<<20), - VB_HAS_UV6=(1<<21), - VB_HAS_UV7=(1<<22), - VB_HAS_UVALL=(0xff<<15), - VB_HAS_UVTEXMTXSHIFT=13, - }; - -private: - TPipelineFunction m_PipelineStates[32]; - int m_numPipelineStates; - int m_VertexSize; - int m_counter; - - u32 m_components; - - UVAT_group0 m_group0; - UVAT_group1 m_group1; - UVAT_group2 m_group2; - - bool m_AttrDirty; - TVtxAttr m_VtxAttr; //Decoded into easy format - - //common for all loaders - static TVtxDesc m_VtxDesc; - static bool m_DescDirty; - - // seup the pipeline with this vertex fmt - void SetupColor(int num, int _iMode, int _iFormat, int _iElements); - void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac); - -public: - // constructor - VertexLoader(); - ~VertexLoader(); - // run the pipeline - static void SetVArray(DecodedVArray *_varray); - void Setup(); - void PrepareRun(); - void RunVertices(int count); - void WriteCall(TPipelineFunction func); - int GetVertexSize(){return m_VertexSize;} - - //VtxDesc - global - static void SetVtxDesc_Lo(u32 _iValue) - { - u64 old = m_VtxDesc.Hex; - m_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits - m_VtxDesc.Hex |= _iValue; - if (m_VtxDesc.Hex != old) - m_DescDirty = true; - }; - - static void SetVtxDesc_Hi(u32 _iValue) - { - u64 old = m_VtxDesc.Hex; - m_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits - m_VtxDesc.Hex |= (u64)_iValue << 17; - if (m_VtxDesc.Hex != old) - m_DescDirty = true; - }; - - static TVtxDesc &GetVtxDesc() {return m_VtxDesc;} - - void SetVAT_group0(u32 _group0) - { - if (m_group0.Hex == _group0) - return; - m_AttrDirty = true; - m_group0.Hex = _group0; - - m_VtxAttr.PosElements = m_group0.PosElements; - m_VtxAttr.PosFormat = m_group0.PosFormat; - m_VtxAttr.PosFrac = m_group0.PosFrac; - m_VtxAttr.NormalElements = m_group0.NormalElements; - m_VtxAttr.NormalFormat = m_group0.NormalFormat; - m_VtxAttr.color[0].Elements = m_group0.Color0Elements; - m_VtxAttr.color[0].Comp = m_group0.Color0Comp; - m_VtxAttr.color[1].Elements = m_group0.Color1Elements; - m_VtxAttr.color[1].Comp = m_group0.Color1Comp; - m_VtxAttr.texCoord[0].Elements = m_group0.Tex0CoordElements; - m_VtxAttr.texCoord[0].Format = m_group0.Tex0CoordFormat; - m_VtxAttr.texCoord[0].Frac = m_group0.Tex0Frac; - m_VtxAttr.ByteDequant = m_group0.ByteDequant; - m_VtxAttr.NormalIndex3 = m_group0.NormalIndex3; - }; - - void SetVAT_group1(u32 _group1) - { - if (m_group1.Hex == _group1) - return; - m_AttrDirty = true; - m_group1.Hex = _group1; - - m_VtxAttr.texCoord[1].Elements = m_group1.Tex1CoordElements; - m_VtxAttr.texCoord[1].Format = m_group1.Tex1CoordFormat; - m_VtxAttr.texCoord[1].Frac = m_group1.Tex1Frac; - m_VtxAttr.texCoord[2].Elements = m_group1.Tex2CoordElements; - m_VtxAttr.texCoord[2].Format = m_group1.Tex2CoordFormat; - m_VtxAttr.texCoord[2].Frac = m_group1.Tex2Frac; - m_VtxAttr.texCoord[3].Elements = m_group1.Tex3CoordElements; - m_VtxAttr.texCoord[3].Format = m_group1.Tex3CoordFormat; - m_VtxAttr.texCoord[3].Frac = m_group1.Tex3Frac; - m_VtxAttr.texCoord[4].Elements = m_group1.Tex4CoordElements; - m_VtxAttr.texCoord[4].Format = m_group1.Tex4CoordFormat; - }; - - void SetVAT_group2(u32 _group2) - { - if (m_group2.Hex == _group2) - return; - m_AttrDirty = true; - m_group2.Hex = _group2; - - m_VtxAttr.texCoord[4].Frac = m_group2.Tex4Frac; - m_VtxAttr.texCoord[5].Elements = m_group2.Tex5CoordElements; - m_VtxAttr.texCoord[5].Format = m_group2.Tex5CoordFormat; - m_VtxAttr.texCoord[5].Frac = m_group2.Tex5Frac; - m_VtxAttr.texCoord[6].Elements = m_group2.Tex6CoordElements; - m_VtxAttr.texCoord[6].Format = m_group2.Tex6CoordFormat; - m_VtxAttr.texCoord[6].Frac = m_group2.Tex6Frac; - m_VtxAttr.texCoord[7].Elements = m_group2.Tex7CoordElements; - m_VtxAttr.texCoord[7].Format = m_group2.Tex7CoordFormat; - m_VtxAttr.texCoord[7].Frac = m_group2.Tex7Frac; - }; -}; - -extern VertexLoader g_VertexLoaders[8]; -extern DecodedVArray* varray; - - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VERTEXLOADER_H +#define _VERTEXLOADER_H + +int ComputeVertexSize(u32 components); + +#include "CPStructs.h" +#include "DecodedVArray.h" +#include "DataReader.h" + +#define LOADERDECL __cdecl +typedef void (LOADERDECL *TPipelineFunction)(const void*); + +class VertexLoader +{ +public: + enum + { + NRM_ZERO = 0, + NRM_ONE = 1, + NRM_THREE = 3 + }; + + enum { + VB_HAS_POSMTXIDX =(1<<1), + VB_HAS_TEXMTXIDX0=(1<<2), + VB_HAS_TEXMTXIDX1=(1<<3), + VB_HAS_TEXMTXIDX2=(1<<4), + VB_HAS_TEXMTXIDX3=(1<<5), + VB_HAS_TEXMTXIDX4=(1<<6), + VB_HAS_TEXMTXIDX5=(1<<7), + VB_HAS_TEXMTXIDX6=(1<<8), + VB_HAS_TEXMTXIDX7=(1<<9), + VB_HAS_TEXMTXIDXALL=(0xff<<2), + //VB_HAS_POS=0, // Implied, it always has pos! don't bother testing + VB_HAS_NRM0=(1<<10), + VB_HAS_NRM1=(1<<11), + VB_HAS_NRM2=(1<<12), + VB_HAS_NRMALL=(7<<10), + + VB_HAS_COL0=(1<<13), + VB_HAS_COL1=(1<<14), + + VB_HAS_UV0=(1<<15), + VB_HAS_UV1=(1<<16), + VB_HAS_UV2=(1<<17), + VB_HAS_UV3=(1<<18), + VB_HAS_UV4=(1<<19), + VB_HAS_UV5=(1<<20), + VB_HAS_UV6=(1<<21), + VB_HAS_UV7=(1<<22), + VB_HAS_UVALL=(0xff<<15), + VB_HAS_UVTEXMTXSHIFT=13, + }; + +private: + TPipelineFunction m_PipelineStates[32]; + int m_numPipelineStates; + int m_VertexSize; + int m_counter; + + u32 m_components; + + UVAT_group0 m_group0; + UVAT_group1 m_group1; + UVAT_group2 m_group2; + + bool m_AttrDirty; + TVtxAttr m_VtxAttr; //Decoded into easy format + + //common for all loaders + static TVtxDesc m_VtxDesc; + static bool m_DescDirty; + + // seup the pipeline with this vertex fmt + void SetupColor(int num, int _iMode, int _iFormat, int _iElements); + void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac); + +public: + // constructor + VertexLoader(); + ~VertexLoader(); + // run the pipeline + static void SetVArray(DecodedVArray *_varray); + void Setup(); + void PrepareRun(); + void RunVertices(int count); + void WriteCall(TPipelineFunction func); + int GetVertexSize(){return m_VertexSize;} + + //VtxDesc - global + static void SetVtxDesc_Lo(u32 _iValue) + { + u64 old = m_VtxDesc.Hex; + m_VtxDesc.Hex &= ~0x1FFFF; // keep the Upper bits + m_VtxDesc.Hex |= _iValue; + if (m_VtxDesc.Hex != old) + m_DescDirty = true; + }; + + static void SetVtxDesc_Hi(u32 _iValue) + { + u64 old = m_VtxDesc.Hex; + m_VtxDesc.Hex &= 0x1FFFF; // keep the lower 17Bits + m_VtxDesc.Hex |= (u64)_iValue << 17; + if (m_VtxDesc.Hex != old) + m_DescDirty = true; + }; + + static TVtxDesc &GetVtxDesc() {return m_VtxDesc;} + + void SetVAT_group0(u32 _group0) + { + if (m_group0.Hex == _group0) + return; + m_AttrDirty = true; + m_group0.Hex = _group0; + + m_VtxAttr.PosElements = m_group0.PosElements; + m_VtxAttr.PosFormat = m_group0.PosFormat; + m_VtxAttr.PosFrac = m_group0.PosFrac; + m_VtxAttr.NormalElements = m_group0.NormalElements; + m_VtxAttr.NormalFormat = m_group0.NormalFormat; + m_VtxAttr.color[0].Elements = m_group0.Color0Elements; + m_VtxAttr.color[0].Comp = m_group0.Color0Comp; + m_VtxAttr.color[1].Elements = m_group0.Color1Elements; + m_VtxAttr.color[1].Comp = m_group0.Color1Comp; + m_VtxAttr.texCoord[0].Elements = m_group0.Tex0CoordElements; + m_VtxAttr.texCoord[0].Format = m_group0.Tex0CoordFormat; + m_VtxAttr.texCoord[0].Frac = m_group0.Tex0Frac; + m_VtxAttr.ByteDequant = m_group0.ByteDequant; + m_VtxAttr.NormalIndex3 = m_group0.NormalIndex3; + }; + + void SetVAT_group1(u32 _group1) + { + if (m_group1.Hex == _group1) + return; + m_AttrDirty = true; + m_group1.Hex = _group1; + + m_VtxAttr.texCoord[1].Elements = m_group1.Tex1CoordElements; + m_VtxAttr.texCoord[1].Format = m_group1.Tex1CoordFormat; + m_VtxAttr.texCoord[1].Frac = m_group1.Tex1Frac; + m_VtxAttr.texCoord[2].Elements = m_group1.Tex2CoordElements; + m_VtxAttr.texCoord[2].Format = m_group1.Tex2CoordFormat; + m_VtxAttr.texCoord[2].Frac = m_group1.Tex2Frac; + m_VtxAttr.texCoord[3].Elements = m_group1.Tex3CoordElements; + m_VtxAttr.texCoord[3].Format = m_group1.Tex3CoordFormat; + m_VtxAttr.texCoord[3].Frac = m_group1.Tex3Frac; + m_VtxAttr.texCoord[4].Elements = m_group1.Tex4CoordElements; + m_VtxAttr.texCoord[4].Format = m_group1.Tex4CoordFormat; + }; + + void SetVAT_group2(u32 _group2) + { + if (m_group2.Hex == _group2) + return; + m_AttrDirty = true; + m_group2.Hex = _group2; + + m_VtxAttr.texCoord[4].Frac = m_group2.Tex4Frac; + m_VtxAttr.texCoord[5].Elements = m_group2.Tex5CoordElements; + m_VtxAttr.texCoord[5].Format = m_group2.Tex5CoordFormat; + m_VtxAttr.texCoord[5].Frac = m_group2.Tex5Frac; + m_VtxAttr.texCoord[6].Elements = m_group2.Tex6CoordElements; + m_VtxAttr.texCoord[6].Format = m_group2.Tex6CoordFormat; + m_VtxAttr.texCoord[6].Frac = m_group2.Tex6Frac; + m_VtxAttr.texCoord[7].Elements = m_group2.Tex7CoordElements; + m_VtxAttr.texCoord[7].Format = m_group2.Tex7CoordFormat; + m_VtxAttr.texCoord[7].Frac = m_group2.Tex7Frac; + }; +}; + +extern VertexLoader g_VertexLoaders[8]; +extern DecodedVArray* varray; + + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Color.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Color.h index fbabd4a1bc..e90daad6bb 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Color.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Color.h @@ -1,226 +1,226 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VERTEXLOADERCOLOR_H -#define _VERTEXLOADERCOLOR_H - -#include "LookUpTables.h" - -#define RSHIFT 16 -#define GSHIFT 8 -#define BSHIFT 0 -#define ASHIFT 24 - -extern DecodedVArray *varray; -extern int colIndex; - -inline void _SetCol(u32 val) -{ - varray->SetColor(colIndex, val); - colIndex++; -} - -void _SetCol4444(u16 val) -{ - u32 col = lut4to8[(val>>0)&0xF]<>12)&0xF] <>8)&0xF] <>4)&0xF] <>18)&0x3F] << RSHIFT; - col |= lut6to8[(val>>12)&0x3F] << GSHIFT; - col |= lut6to8[(val>>6)&0x3F] << BSHIFT; - col |= lut6to8[(val>>0)&0x3F] << ASHIFT; - _SetCol(col); -} - -void _SetCol565(u16 val) -{ - u32 col = lut5to8[(val>>11)&0x1f] << RSHIFT; - col |= lut6to8[(val>>5 )&0x3f] << GSHIFT; - col |= lut5to8[(val )&0x1f] << BSHIFT; - _SetCol(col | (0xFF<SetColor(colIndex, val); + colIndex++; +} + +void _SetCol4444(u16 val) +{ + u32 col = lut4to8[(val>>0)&0xF]<>12)&0xF] <>8)&0xF] <>4)&0xF] <>18)&0x3F] << RSHIFT; + col |= lut6to8[(val>>12)&0x3F] << GSHIFT; + col |= lut6to8[(val>>6)&0x3F] << BSHIFT; + col |= lut6to8[(val>>0)&0x3F] << ASHIFT; + _SetCol(col); +} + +void _SetCol565(u16 val) +{ + u32 col = lut5to8[(val>>11)&0x1f] << RSHIFT; + col |= lut6to8[(val>>5 )&0x3f] << GSHIFT; + col |= lut5to8[(val )&0x1f] << BSHIFT; + _SetCol(col | (0xFF<SetPosNrmIdx(index); -} - -int s_texmtxread = 0, s_texmtxwrite = 0; -void LOADERDECL TexMtx_ReadDirect_UByte(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - int index = DataReadU8() & 0x3f; - varray->SetTcIdx(s_texmtxread++, index); -} +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "Common.h" + +#include "TransformEngine.h" + +// ============================================================================== +// Direct +// ============================================================================== +void LOADERDECL PosMtx_ReadDirect_UByte(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + int index = DataReadU8() & 0x3f; + float *flipmem = (float *)xfmem; + varray->SetPosNrmIdx(index); +} + +int s_texmtxread = 0, s_texmtxwrite = 0; +void LOADERDECL TexMtx_ReadDirect_UByte(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + int index = DataReadU8() & 0x3f; + varray->SetTcIdx(s_texmtxread++, index); +} diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Normal.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Normal.h index 2f74ad59a9..cad10161e3 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Normal.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Normal.h @@ -1,90 +1,90 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "CommonTypes.h" - -class VertexLoader_Normal -{ -public: - - static bool index3; - // Init - static void Init(void); - - // GetSize - static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements); - - // GetFunction - static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements); - -private: - enum ENormalType - { - NRM_NOT_PRESENT = 0, - NRM_DIRECT = 1, - NRM_INDEX8 = 2, - NRM_INDEX16 = 3, - NUM_NRM_TYPE - }; - - enum ENormalFormat - { - FORMAT_UBYTE = 0, - FORMAT_BYTE = 1, - FORMAT_USHORT = 2, - FORMAT_SHORT = 3, - FORMAT_FLOAT = 4, - NUM_NRM_FORMAT - }; - - enum ENormalElements - { - NRM_NBT = 0, - NRM_NBT3 = 1, - NUM_NRM_ELEMENTS - }; - - // tables - static u8 m_sizeTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS]; - static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS]; - - // direct - static void LOADERDECL Normal_DirectByte(const void* _p); - static void LOADERDECL Normal_DirectShort(const void* _p); - static void LOADERDECL Normal_DirectFloat(const void* _p); - static void LOADERDECL Normal_DirectByte3(const void* _p); - static void LOADERDECL Normal_DirectShort3(const void* _p); - static void LOADERDECL Normal_DirectFloat3(const void* _p); - - // index8 - static void LOADERDECL Normal_Index8_Byte(const void* _p); - static void LOADERDECL Normal_Index8_Short(const void* _p); - static void LOADERDECL Normal_Index8_Float(const void* _p); - static void LOADERDECL Normal_Index8_Byte3(const void* _p); - static void LOADERDECL Normal_Index8_Short3(const void* _p); - static void LOADERDECL Normal_Index8_Float3(const void* _p); - - // index16 - static void LOADERDECL Normal_Index16_Byte(const void* _p); - static void LOADERDECL Normal_Index16_Short(const void* _p); - static void LOADERDECL Normal_Index16_Float(const void* _p); - static void LOADERDECL Normal_Index16_Byte3(const void* _p); - static void LOADERDECL Normal_Index16_Short3(const void* _p); - static void LOADERDECL Normal_Index16_Float3(const void* _p); +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "CommonTypes.h" + +class VertexLoader_Normal +{ +public: + + static bool index3; + // Init + static void Init(void); + + // GetSize + static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements); + + // GetFunction + static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements); + +private: + enum ENormalType + { + NRM_NOT_PRESENT = 0, + NRM_DIRECT = 1, + NRM_INDEX8 = 2, + NRM_INDEX16 = 3, + NUM_NRM_TYPE + }; + + enum ENormalFormat + { + FORMAT_UBYTE = 0, + FORMAT_BYTE = 1, + FORMAT_USHORT = 2, + FORMAT_SHORT = 3, + FORMAT_FLOAT = 4, + NUM_NRM_FORMAT + }; + + enum ENormalElements + { + NRM_NBT = 0, + NRM_NBT3 = 1, + NUM_NRM_ELEMENTS + }; + + // tables + static u8 m_sizeTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS]; + static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS]; + + // direct + static void LOADERDECL Normal_DirectByte(const void* _p); + static void LOADERDECL Normal_DirectShort(const void* _p); + static void LOADERDECL Normal_DirectFloat(const void* _p); + static void LOADERDECL Normal_DirectByte3(const void* _p); + static void LOADERDECL Normal_DirectShort3(const void* _p); + static void LOADERDECL Normal_DirectFloat3(const void* _p); + + // index8 + static void LOADERDECL Normal_Index8_Byte(const void* _p); + static void LOADERDECL Normal_Index8_Short(const void* _p); + static void LOADERDECL Normal_Index8_Float(const void* _p); + static void LOADERDECL Normal_Index8_Byte3(const void* _p); + static void LOADERDECL Normal_Index8_Short3(const void* _p); + static void LOADERDECL Normal_Index8_Float3(const void* _p); + + // index16 + static void LOADERDECL Normal_Index16_Byte(const void* _p); + static void LOADERDECL Normal_Index16_Short(const void* _p); + static void LOADERDECL Normal_Index16_Float(const void* _p); + static void LOADERDECL Normal_Index16_Byte3(const void* _p); + static void LOADERDECL Normal_Index16_Short3(const void* _p); + static void LOADERDECL Normal_Index16_Float3(const void* _p); }; \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Position.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Position.h index a664a00861..cc76a654a6 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Position.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_Position.h @@ -1,213 +1,213 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef VERTEXHANDLER_POSITION_H -#define VERTEXHANDLER_POSITION_H - -#include "Common.h" -#include "Utils.h" - - -// ============================================================================== -// Direct -// ============================================================================== - -template -inline void LOADERDECL _ReadPos8Mem(int iAddress, TVtxAttr* pVtxAttr) -{ - varray->SetPosX(((float)(T)Memory_Read_U8(iAddress)) * posScale); - varray->SetPosY(((float)(T)Memory_Read_U8(iAddress+1)) * posScale); - if (pVtxAttr->PosElements) - varray->SetPosZ(((float)(T)Memory_Read_U8(iAddress+2)) * posScale); - else - varray->SetPosZ(1.0); -} -template -inline void LOADERDECL _ReadPos16Mem(int iAddress, TVtxAttr* pVtxAttr) -{ - varray->SetPosX(((float)(T)Memory_Read_U16(iAddress)) * posScale); - varray->SetPosY(((float)(T)Memory_Read_U16(iAddress+2)) * posScale); - if (pVtxAttr->PosElements) - varray->SetPosZ(((float)(T)Memory_Read_U16(iAddress+4)) * posScale); - else - varray->SetPosZ(1.0); -} - -void LOADERDECL _ReadPosFloatMem(int iAddress, TVtxAttr* pVtxAttr) -{ - u32 uTemp; - uTemp = Memory_Read_U32(iAddress ); - varray->SetPosX(*(float*)&uTemp); - uTemp = Memory_Read_U32(iAddress+4); - varray->SetPosY(*(float*)&uTemp); - if (pVtxAttr->PosElements) - { - uTemp = Memory_Read_U32(iAddress+8); - varray->SetPosZ(*(float*)&uTemp); - } - else - varray->SetPosZ(1.0); -} - -void LOADERDECL Pos_ReadDirect_UByte(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - varray->SetPosX((float)DataReadU8() * posScale); - varray->SetPosY((float)DataReadU8() * posScale); - - if (pVtxAttr->PosElements) - varray->SetPosZ((float)DataReadU8() * posScale); - else - varray->SetPosZ(1.0); -} - -void LOADERDECL Pos_ReadDirect_Byte(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - varray->SetPosX((float)(s8)DataReadU8() * posScale); - varray->SetPosY((float)(s8)DataReadU8() * posScale); - - if (pVtxAttr->PosElements) - varray->SetPosZ((float)(s8)DataReadU8() * posScale); - else - varray->SetPosZ(1.0); -} - -void LOADERDECL Pos_ReadDirect_UShort(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - - varray->SetPosX((float)DataReadU16() * posScale); - varray->SetPosY((float)DataReadU16() * posScale); - - if (pVtxAttr->PosElements) - varray->SetPosZ((float)DataReadU16() * posScale); - else - varray->SetPosZ(1.0); -} - -void LOADERDECL Pos_ReadDirect_Short(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - - varray->SetPosX((float)(s16)DataReadU16() * posScale); - varray->SetPosY((float)(s16)DataReadU16() * posScale); - - if (pVtxAttr->PosElements) - varray->SetPosZ((float)(s16)DataReadU16() * posScale); - else - varray->SetPosZ(1.0); -} - -void LOADERDECL Pos_ReadDirect_Float(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - - varray->SetPosX(DataReadF32()); - varray->SetPosY(DataReadF32()); - - if (pVtxAttr->PosElements) - varray->SetPosZ(DataReadF32()); - else - varray->SetPosZ(1.0); -} - -// ============================================================================== -// Index 8 -// ============================================================================== - -void LOADERDECL Pos_ReadIndex8_UByte(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPos8Mem(iAddress, pVtxAttr); -} -void LOADERDECL Pos_ReadIndex8_Byte(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPos8Mem(iAddress, pVtxAttr); -} - -void LOADERDECL Pos_ReadIndex8_UShort(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPos16Mem(iAddress, pVtxAttr); -} - -void LOADERDECL Pos_ReadIndex8_Short(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPos16Mem(iAddress, pVtxAttr); -} - -void LOADERDECL Pos_ReadIndex8_Float(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPosFloatMem(iAddress, pVtxAttr); -} - -// ============================================================================== -// Index 16 -// ============================================================================== - -void LOADERDECL Pos_ReadIndex16_UByte(const void* _p){ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPos8Mem(iAddress, pVtxAttr); -} - -void LOADERDECL Pos_ReadIndex16_Byte(const void* _p){ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPos8Mem(iAddress, pVtxAttr); -} - -void LOADERDECL Pos_ReadIndex16_UShort(const void* _p){ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPos16Mem(iAddress, pVtxAttr); -} - -void LOADERDECL Pos_ReadIndex16_Short(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPos16Mem(iAddress, pVtxAttr); -} - -void LOADERDECL Pos_ReadIndex16_Float(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); - _ReadPosFloatMem(iAddress, pVtxAttr); -} - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef VERTEXHANDLER_POSITION_H +#define VERTEXHANDLER_POSITION_H + +#include "Common.h" +#include "Utils.h" + + +// ============================================================================== +// Direct +// ============================================================================== + +template +inline void LOADERDECL _ReadPos8Mem(int iAddress, TVtxAttr* pVtxAttr) +{ + varray->SetPosX(((float)(T)Memory_Read_U8(iAddress)) * posScale); + varray->SetPosY(((float)(T)Memory_Read_U8(iAddress+1)) * posScale); + if (pVtxAttr->PosElements) + varray->SetPosZ(((float)(T)Memory_Read_U8(iAddress+2)) * posScale); + else + varray->SetPosZ(1.0); +} +template +inline void LOADERDECL _ReadPos16Mem(int iAddress, TVtxAttr* pVtxAttr) +{ + varray->SetPosX(((float)(T)Memory_Read_U16(iAddress)) * posScale); + varray->SetPosY(((float)(T)Memory_Read_U16(iAddress+2)) * posScale); + if (pVtxAttr->PosElements) + varray->SetPosZ(((float)(T)Memory_Read_U16(iAddress+4)) * posScale); + else + varray->SetPosZ(1.0); +} + +void LOADERDECL _ReadPosFloatMem(int iAddress, TVtxAttr* pVtxAttr) +{ + u32 uTemp; + uTemp = Memory_Read_U32(iAddress ); + varray->SetPosX(*(float*)&uTemp); + uTemp = Memory_Read_U32(iAddress+4); + varray->SetPosY(*(float*)&uTemp); + if (pVtxAttr->PosElements) + { + uTemp = Memory_Read_U32(iAddress+8); + varray->SetPosZ(*(float*)&uTemp); + } + else + varray->SetPosZ(1.0); +} + +void LOADERDECL Pos_ReadDirect_UByte(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + varray->SetPosX((float)DataReadU8() * posScale); + varray->SetPosY((float)DataReadU8() * posScale); + + if (pVtxAttr->PosElements) + varray->SetPosZ((float)DataReadU8() * posScale); + else + varray->SetPosZ(1.0); +} + +void LOADERDECL Pos_ReadDirect_Byte(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + varray->SetPosX((float)(s8)DataReadU8() * posScale); + varray->SetPosY((float)(s8)DataReadU8() * posScale); + + if (pVtxAttr->PosElements) + varray->SetPosZ((float)(s8)DataReadU8() * posScale); + else + varray->SetPosZ(1.0); +} + +void LOADERDECL Pos_ReadDirect_UShort(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + + varray->SetPosX((float)DataReadU16() * posScale); + varray->SetPosY((float)DataReadU16() * posScale); + + if (pVtxAttr->PosElements) + varray->SetPosZ((float)DataReadU16() * posScale); + else + varray->SetPosZ(1.0); +} + +void LOADERDECL Pos_ReadDirect_Short(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + + varray->SetPosX((float)(s16)DataReadU16() * posScale); + varray->SetPosY((float)(s16)DataReadU16() * posScale); + + if (pVtxAttr->PosElements) + varray->SetPosZ((float)(s16)DataReadU16() * posScale); + else + varray->SetPosZ(1.0); +} + +void LOADERDECL Pos_ReadDirect_Float(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + + varray->SetPosX(DataReadF32()); + varray->SetPosY(DataReadF32()); + + if (pVtxAttr->PosElements) + varray->SetPosZ(DataReadF32()); + else + varray->SetPosZ(1.0); +} + +// ============================================================================== +// Index 8 +// ============================================================================== + +void LOADERDECL Pos_ReadIndex8_UByte(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPos8Mem(iAddress, pVtxAttr); +} +void LOADERDECL Pos_ReadIndex8_Byte(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPos8Mem(iAddress, pVtxAttr); +} + +void LOADERDECL Pos_ReadIndex8_UShort(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPos16Mem(iAddress, pVtxAttr); +} + +void LOADERDECL Pos_ReadIndex8_Short(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPos16Mem(iAddress, pVtxAttr); +} + +void LOADERDECL Pos_ReadIndex8_Float(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPosFloatMem(iAddress, pVtxAttr); +} + +// ============================================================================== +// Index 16 +// ============================================================================== + +void LOADERDECL Pos_ReadIndex16_UByte(const void* _p){ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPos8Mem(iAddress, pVtxAttr); +} + +void LOADERDECL Pos_ReadIndex16_Byte(const void* _p){ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPos8Mem(iAddress, pVtxAttr); +} + +void LOADERDECL Pos_ReadIndex16_UShort(const void* _p){ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPos16Mem(iAddress, pVtxAttr); +} + +void LOADERDECL Pos_ReadIndex16_Short(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPos16Mem(iAddress, pVtxAttr); +} + +void LOADERDECL Pos_ReadIndex16_Float(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); + _ReadPosFloatMem(iAddress, pVtxAttr); +} + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_TextCoord.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_TextCoord.h index 90f1ca1625..8f0513f0fa 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_TextCoord.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader_TextCoord.h @@ -1,202 +1,202 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef VERTEXHANDLER_TEXCOORD_H -#define VERTEXHANDLER_TEXCOORD_H - -extern int tcIndex; - -void LOADERDECL TexCoord_ReadDirect_UByte(const void* _p) -{ - varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, DataReadU8() * tcScaleV[tcIndex]); - tcIndex++; -} - -void LOADERDECL TexCoord_ReadDirect_Byte(const void* _p) -{ - varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, (s8)DataReadU8() * tcScaleV[tcIndex]); - tcIndex++; -} - -void LOADERDECL TexCoord_ReadDirect_UShort(const void* _p) -{ - varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, DataReadU16() * tcScaleV[tcIndex]); - tcIndex++; -} - -void LOADERDECL TexCoord_ReadDirect_Short(const void* _p) -{ - varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]); - tcIndex++; -} -void LOADERDECL TexCoord_ReadDirect_Float(const void* _p) -{ - varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, DataReadF32() * tcScaleV[tcIndex]); - tcIndex++; -} - -// ================================================================================== -void LOADERDECL TexCoord_ReadIndex8_UByte(const void* _p) -{ - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - - varray->SetU(tcIndex, (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]); - tcIndex++; -} -void LOADERDECL TexCoord_ReadIndex8_Byte(const void* _p) -{ - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - - varray->SetU(tcIndex, (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, (float)(s8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]); - - tcIndex++; -} -void LOADERDECL TexCoord_ReadIndex8_UShort(const void* _p) -{ - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - - varray->SetU(tcIndex, (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]); - tcIndex++; -} -void LOADERDECL TexCoord_ReadIndex8_Short(const void* _p) -{ - u8 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - - varray->SetU(tcIndex, (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - varray->SetV(tcIndex, (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]); - tcIndex++; -} -void LOADERDECL TexCoord_ReadIndex8_Float(const void* _p) -{ - u16 Index = DataReadU8(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - u32 uTemp; - uTemp = Memory_Read_U32(iAddress ); - varray->SetU(tcIndex, *(float*)&uTemp * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - { - uTemp = Memory_Read_U32(iAddress+4); - varray->SetV(tcIndex, *(float*)&uTemp * tcScaleV[tcIndex]); - } - tcIndex++; -} - - -// ================================================================================== -void LOADERDECL TexCoord_ReadIndex16_UByte(const void* _p) -{ - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - - u32 uTemp; - uTemp = (u8)Memory_Read_U8(iAddress ); - varray->SetU(tcIndex, float(uTemp)* tcScaleU[tcIndex]); - - if (tcElements[tcIndex]) - { - uTemp = (u8)Memory_Read_U8(iAddress+1); - varray->SetV(tcIndex, float(uTemp)* tcScaleV[tcIndex]); - } - tcIndex++; -} -void LOADERDECL TexCoord_ReadIndex16_Byte(const void* _p) -{ - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - - u32 uTemp; - uTemp = (s8)Memory_Read_U8(iAddress ); - varray->SetU(tcIndex, float(uTemp)* tcScaleU[tcIndex]); - - if (tcElements[tcIndex]) - { - uTemp = (s8)Memory_Read_U8(iAddress+1); - varray->SetV(tcIndex, float(uTemp)* tcScaleV[tcIndex]); - } - tcIndex++; -} - -void LOADERDECL TexCoord_ReadIndex16_UShort(const void* _p) -{ - TVtxAttr* pVtxAttr = (TVtxAttr*)_p; - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - - float uTemp; - uTemp = (float)(u16)Memory_Read_U16(iAddress ); - varray->SetU(tcIndex, uTemp * tcScaleU[tcIndex]); - - if (tcElements[tcIndex]) - { - uTemp = (float)(u16)Memory_Read_U16(iAddress+2); - varray->SetV(tcIndex, uTemp * tcScaleV[tcIndex]); - } - tcIndex++; -} -void LOADERDECL TexCoord_ReadIndex16_Short(const void* _p) -{ - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - - float uTemp; - uTemp = (float)(s16)Memory_Read_U16(iAddress ); - varray->SetU(tcIndex, uTemp * tcScaleU[tcIndex]); - - if (tcElements[tcIndex]) - { - uTemp = (float)(s16)Memory_Read_U16(iAddress+2); - varray->SetV(tcIndex, uTemp * tcScaleV[tcIndex]); - } - tcIndex++; -} -void LOADERDECL TexCoord_ReadIndex16_Float(const void* _p) -{ - u16 Index = DataReadU16(); - u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); - u32 uTemp; - uTemp = Memory_Read_U32(iAddress ); - varray->SetU(tcIndex, *(float*)&uTemp * tcScaleU[tcIndex]); - if (tcElements[tcIndex]) - { - uTemp = Memory_Read_U32(iAddress+4); - varray->SetV(tcIndex, *(float*)&uTemp * tcScaleV[tcIndex]); - } - tcIndex++; -} - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef VERTEXHANDLER_TEXCOORD_H +#define VERTEXHANDLER_TEXCOORD_H + +extern int tcIndex; + +void LOADERDECL TexCoord_ReadDirect_UByte(const void* _p) +{ + varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, DataReadU8() * tcScaleV[tcIndex]); + tcIndex++; +} + +void LOADERDECL TexCoord_ReadDirect_Byte(const void* _p) +{ + varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, (s8)DataReadU8() * tcScaleV[tcIndex]); + tcIndex++; +} + +void LOADERDECL TexCoord_ReadDirect_UShort(const void* _p) +{ + varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, DataReadU16() * tcScaleV[tcIndex]); + tcIndex++; +} + +void LOADERDECL TexCoord_ReadDirect_Short(const void* _p) +{ + varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]); + tcIndex++; +} +void LOADERDECL TexCoord_ReadDirect_Float(const void* _p) +{ + varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, DataReadF32() * tcScaleV[tcIndex]); + tcIndex++; +} + +// ================================================================================== +void LOADERDECL TexCoord_ReadIndex8_UByte(const void* _p) +{ + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + + varray->SetU(tcIndex, (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]); + tcIndex++; +} +void LOADERDECL TexCoord_ReadIndex8_Byte(const void* _p) +{ + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + + varray->SetU(tcIndex, (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, (float)(s8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]); + + tcIndex++; +} +void LOADERDECL TexCoord_ReadIndex8_UShort(const void* _p) +{ + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + + varray->SetU(tcIndex, (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]); + tcIndex++; +} +void LOADERDECL TexCoord_ReadIndex8_Short(const void* _p) +{ + u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + + varray->SetU(tcIndex, (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + varray->SetV(tcIndex, (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]); + tcIndex++; +} +void LOADERDECL TexCoord_ReadIndex8_Float(const void* _p) +{ + u16 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + u32 uTemp; + uTemp = Memory_Read_U32(iAddress ); + varray->SetU(tcIndex, *(float*)&uTemp * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + { + uTemp = Memory_Read_U32(iAddress+4); + varray->SetV(tcIndex, *(float*)&uTemp * tcScaleV[tcIndex]); + } + tcIndex++; +} + + +// ================================================================================== +void LOADERDECL TexCoord_ReadIndex16_UByte(const void* _p) +{ + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + + u32 uTemp; + uTemp = (u8)Memory_Read_U8(iAddress ); + varray->SetU(tcIndex, float(uTemp)* tcScaleU[tcIndex]); + + if (tcElements[tcIndex]) + { + uTemp = (u8)Memory_Read_U8(iAddress+1); + varray->SetV(tcIndex, float(uTemp)* tcScaleV[tcIndex]); + } + tcIndex++; +} +void LOADERDECL TexCoord_ReadIndex16_Byte(const void* _p) +{ + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + + u32 uTemp; + uTemp = (s8)Memory_Read_U8(iAddress ); + varray->SetU(tcIndex, float(uTemp)* tcScaleU[tcIndex]); + + if (tcElements[tcIndex]) + { + uTemp = (s8)Memory_Read_U8(iAddress+1); + varray->SetV(tcIndex, float(uTemp)* tcScaleV[tcIndex]); + } + tcIndex++; +} + +void LOADERDECL TexCoord_ReadIndex16_UShort(const void* _p) +{ + TVtxAttr* pVtxAttr = (TVtxAttr*)_p; + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + + float uTemp; + uTemp = (float)(u16)Memory_Read_U16(iAddress ); + varray->SetU(tcIndex, uTemp * tcScaleU[tcIndex]); + + if (tcElements[tcIndex]) + { + uTemp = (float)(u16)Memory_Read_U16(iAddress+2); + varray->SetV(tcIndex, uTemp * tcScaleV[tcIndex]); + } + tcIndex++; +} +void LOADERDECL TexCoord_ReadIndex16_Short(const void* _p) +{ + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + + float uTemp; + uTemp = (float)(s16)Memory_Read_U16(iAddress ); + varray->SetU(tcIndex, uTemp * tcScaleU[tcIndex]); + + if (tcElements[tcIndex]) + { + uTemp = (float)(s16)Memory_Read_U16(iAddress+2); + varray->SetV(tcIndex, uTemp * tcScaleV[tcIndex]); + } + tcIndex++; +} +void LOADERDECL TexCoord_ReadIndex16_Float(const void* _p) +{ + u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]); + u32 uTemp; + uTemp = Memory_Read_U32(iAddress ); + varray->SetU(tcIndex, *(float*)&uTemp * tcScaleU[tcIndex]); + if (tcElements[tcIndex]) + { + uTemp = Memory_Read_U32(iAddress+4); + varray->SetV(tcIndex, *(float*)&uTemp * tcScaleV[tcIndex]); + } + tcIndex++; +} + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.h index d4e39b8083..cd17fb4c89 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.h @@ -1,61 +1,61 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#pragma once - -#include "CPStructs.h" -#include "VertexLoader.h" -#include "DecodedVArray.h" - -struct UV -{ - float u,v,w; -}; - -struct D3DVertex { - Vec3 pos; - Vec3 normal; - u32 colors[2]; - UV uv[8]; -}; - -enum Collection -{ - C_NOTHING=0, - C_TRIANGLES=1, - C_LINES=2, - C_POINTS=3 -}; - -namespace VertexManager -{ - -extern const Collection collectionTypeLUT[8]; - -bool Init(); -void Shutdown(); - -void BeginFrame(); - -void CreateDeviceObjects(); -void DestroyDeviceObjects(); - -void AddVertices(int _primitive, int _numVertices, const DecodedVArray *varray); -void Flush(); - -} // namespace +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#pragma once + +#include "CPStructs.h" +#include "VertexLoader.h" +#include "DecodedVArray.h" + +struct UV +{ + float u,v,w; +}; + +struct D3DVertex { + Vec3 pos; + Vec3 normal; + u32 colors[2]; + UV uv[8]; +}; + +enum Collection +{ + C_NOTHING=0, + C_TRIANGLES=1, + C_LINES=2, + C_POINTS=3 +}; + +namespace VertexManager +{ + +extern const Collection collectionTypeLUT[8]; + +bool Init(); +void Shutdown(); + +void BeginFrame(); + +void CreateDeviceObjects(); +void DestroyDeviceObjects(); + +void AddVertices(int _primitive, int _numVertices, const DecodedVArray *varray); +void Flush(); + +} // namespace diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexShader.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexShader.h index bc0c2578fb..848254b07c 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexShader.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexShader.h @@ -1,50 +1,50 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VERTEXSHADER_H -#define _VERTEXSHADER_H - -#include "Common.h" - -const char *GenerateVertexShader(); - -// shader variables -#define I_POSNORMALMATRIX "cpnmtx" -#define I_PROJECTION "cproj" -#define I_MATERIALS "cmtrl" -#define I_LIGHTS "clights" -#define I_TEXMATRICES "ctexmtx" -#define I_TRANSFORMMATRICES "ctrmtx" -#define I_NORMALMATRICES "cnmtx" -#define I_POSTTRANSFORMMATRICES "cpostmtx" -#define I_FOGPARAMS "cfog" - -#define C_POSNORMALMATRIX 0 -#define C_PROJECTION (C_POSNORMALMATRIX+6) -#define C_MATERIALS (C_PROJECTION+4) -#define C_LIGHTS (C_MATERIALS+4) -#define C_TEXMATRICES (C_LIGHTS+40) -#define C_TRANSFORMMATRICES (C_TEXMATRICES+24) -#define C_NORMALMATRICES (C_TRANSFORMMATRICES+64) -#define C_POSTTRANSFORMMATRICES (C_NORMALMATRICES+32) -#define C_FOGPARAMS (C_POSTTRANSFORMMATRICES+64) - -#define PS_CONST_COLORS 0 -#define PS_CONST_KCOLORS 4 -#define PS_CONST_CONSTALPHA 8 - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VERTEXSHADER_H +#define _VERTEXSHADER_H + +#include "Common.h" + +const char *GenerateVertexShader(); + +// shader variables +#define I_POSNORMALMATRIX "cpnmtx" +#define I_PROJECTION "cproj" +#define I_MATERIALS "cmtrl" +#define I_LIGHTS "clights" +#define I_TEXMATRICES "ctexmtx" +#define I_TRANSFORMMATRICES "ctrmtx" +#define I_NORMALMATRICES "cnmtx" +#define I_POSTTRANSFORMMATRICES "cpostmtx" +#define I_FOGPARAMS "cfog" + +#define C_POSNORMALMATRIX 0 +#define C_PROJECTION (C_POSNORMALMATRIX+6) +#define C_MATERIALS (C_PROJECTION+4) +#define C_LIGHTS (C_MATERIALS+4) +#define C_TEXMATRICES (C_LIGHTS+40) +#define C_TRANSFORMMATRICES (C_TEXMATRICES+24) +#define C_NORMALMATRICES (C_TRANSFORMMATRICES+64) +#define C_POSTTRANSFORMMATRICES (C_NORMALMATRICES+32) +#define C_FOGPARAMS (C_POSTTRANSFORMMATRICES+64) + +#define PS_CONST_COLORS 0 +#define PS_CONST_KCOLORS 4 +#define PS_CONST_CONSTALPHA 8 + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/DialogManager.h b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/DialogManager.h index 47e275a7f8..1ce828a640 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/DialogManager.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/DialogManager.h @@ -1,12 +1,12 @@ -#pragma once - -#include - -class DialogManager -{ -public: - static void AddDlg(HWND hDialog); - static bool IsDialogMessage(LPMSG message); - static void EnableAll(BOOL enable); -}; - +#pragma once + +#include + +class DialogManager +{ +public: + static void AddDlg(HWND hDialog); + static bool IsDialogMessage(LPMSG message); + static void EnableAll(BOOL enable); +}; + diff --git a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/File.h b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/File.h index 7bb5cfe07e..0f401b76a2 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/File.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/File.h @@ -1,61 +1,61 @@ -#ifndef __LAMEFILE_H__ -#define __LAMEFILE_H__ - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include - -namespace W32Util -{ - - enum eFileMode - { - FILE_READ=5, - FILE_WRITE=6, - FILE_ERROR=0xff - }; - - class File - { - HANDLE fileHandle; - eFileMode mode; - bool isOpen; - public: - File(); - virtual ~File(); - - bool Open(const TCHAR *filename, eFileMode mode); - void Adopt(HANDLE h) { fileHandle = h;} - void Close(); - - void WriteInt(int i); - void WriteChar(char i); - int Write(void *data, int size); - - - int ReadInt(); - char ReadChar(); - int Read(void *data, int size); - - int WR(void *data, int size); //write or read depending on open mode - bool MagicCookie(int cookie); - - int GetSize(); - eFileMode GetMode() {return mode;} - void SeekBeg(int pos) - { - if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN); - } - void SeekEnd(int pos) - { - if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END); - } - void SeekCurrent(int pos) - { - if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT); - } - }; - -} - - +#ifndef __LAMEFILE_H__ +#define __LAMEFILE_H__ + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include + +namespace W32Util +{ + + enum eFileMode + { + FILE_READ=5, + FILE_WRITE=6, + FILE_ERROR=0xff + }; + + class File + { + HANDLE fileHandle; + eFileMode mode; + bool isOpen; + public: + File(); + virtual ~File(); + + bool Open(const TCHAR *filename, eFileMode mode); + void Adopt(HANDLE h) { fileHandle = h;} + void Close(); + + void WriteInt(int i); + void WriteChar(char i); + int Write(void *data, int size); + + + int ReadInt(); + char ReadChar(); + int Read(void *data, int size); + + int WR(void *data, int size); //write or read depending on open mode + bool MagicCookie(int cookie); + + int GetSize(); + eFileMode GetMode() {return mode;} + void SeekBeg(int pos) + { + if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN); + } + void SeekEnd(int pos) + { + if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END); + } + void SeekCurrent(int pos) + { + if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT); + } + }; + +} + + #endif //__LAMEFILE_H__ \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/Misc.h b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/Misc.h index c9e8f4e55c..c5d6fc368d 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/Misc.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/Misc.h @@ -1,9 +1,9 @@ -#pragma once - -namespace W32Util -{ - void CenterWindow(HWND hwnd); - HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h); - void NiceSizeFormat(size_t size, char *out); - BOOL CopyTextToClipboard(HWND hwnd, TCHAR *text); +#pragma once + +namespace W32Util +{ + void CenterWindow(HWND hwnd); + HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h); + void NiceSizeFormat(size_t size, char *out); + BOOL CopyTextToClipboard(HWND hwnd, TCHAR *text); } \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/PropertySheet.h b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/PropertySheet.h index 0a1783b3b6..1080d21afb 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/PropertySheet.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/PropertySheet.h @@ -1,86 +1,86 @@ -#pragma once - -#include - -namespace W32Util -{ - class PropSheet; - - class Tab - { - public: - PropSheet *sheet; //back pointer .. - virtual void Init(HWND hDlg) {} - virtual void Command(HWND hDlg, WPARAM wParam) {} - virtual void Apply(HWND hDlg) {} - virtual bool HasPrev() {return true;} - virtual bool HasFinish() {return false;} - virtual bool HasNext() {return true;} - static INT_PTR __stdcall TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); - }; - - - class WizExteriorPage : public Tab - { - int captionID; - public: - WizExteriorPage(int caption) {captionID = caption;} - void Init(HWND hDlg); - }; - - - class WizFirstPage : public WizExteriorPage - { - public: - WizFirstPage(int caption) : WizExteriorPage(caption) {} - bool HasPrev() {return false;} - }; - - - class WizLastPage : public WizExteriorPage - { - public: - WizLastPage(int caption) : WizExteriorPage(caption) {} - bool HasNext() {return false;} - bool HasFinish() {return true;} - }; - - - class WizInteriorPage : public Tab - { - public: - }; - - class PropSheet - { - LPCTSTR watermark; - LPCTSTR header; - HFONT hTitleFont; - HFONT hDialogFont; - HICON icon; - struct Page - { - Page(Tab *_tab, LPCTSTR _resource, LPCTSTR _title, LPCTSTR _subtitle = 0) - : tab(_tab), resource(_resource), title(_title), hdrSubTitle(_subtitle) {} - Tab *tab; - LPCTSTR resource; - LPCTSTR title; - LPCTSTR hdrSubTitle; - }; - public: - PropSheet(); - typedef std::vector DlgList; - DlgList list; - void SetWaterMark(LPCTSTR _watermark) {watermark=_watermark;} - void SetHeader(LPCTSTR _header) {header=_header;} - void SetIcon(HICON _icon) {icon = _icon;} - void Add(Tab *tab, LPCTSTR resource, LPCTSTR title, LPCTSTR subtitle = 0); - void Show(HINSTANCE hInstance, HWND hParent, std::string title, int startpage=0, bool floating = false, bool wizard = false); - HFONT GetTitleFont() {return hTitleFont;} - HFONT GetFont() {return hDialogFont;} - static int CALLBACK Callback(HWND hwndDlg, UINT uMsg, LPARAM lParam); - }; - - - +#pragma once + +#include + +namespace W32Util +{ + class PropSheet; + + class Tab + { + public: + PropSheet *sheet; //back pointer .. + virtual void Init(HWND hDlg) {} + virtual void Command(HWND hDlg, WPARAM wParam) {} + virtual void Apply(HWND hDlg) {} + virtual bool HasPrev() {return true;} + virtual bool HasFinish() {return false;} + virtual bool HasNext() {return true;} + static INT_PTR __stdcall TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + }; + + + class WizExteriorPage : public Tab + { + int captionID; + public: + WizExteriorPage(int caption) {captionID = caption;} + void Init(HWND hDlg); + }; + + + class WizFirstPage : public WizExteriorPage + { + public: + WizFirstPage(int caption) : WizExteriorPage(caption) {} + bool HasPrev() {return false;} + }; + + + class WizLastPage : public WizExteriorPage + { + public: + WizLastPage(int caption) : WizExteriorPage(caption) {} + bool HasNext() {return false;} + bool HasFinish() {return true;} + }; + + + class WizInteriorPage : public Tab + { + public: + }; + + class PropSheet + { + LPCTSTR watermark; + LPCTSTR header; + HFONT hTitleFont; + HFONT hDialogFont; + HICON icon; + struct Page + { + Page(Tab *_tab, LPCTSTR _resource, LPCTSTR _title, LPCTSTR _subtitle = 0) + : tab(_tab), resource(_resource), title(_title), hdrSubTitle(_subtitle) {} + Tab *tab; + LPCTSTR resource; + LPCTSTR title; + LPCTSTR hdrSubTitle; + }; + public: + PropSheet(); + typedef std::vector DlgList; + DlgList list; + void SetWaterMark(LPCTSTR _watermark) {watermark=_watermark;} + void SetHeader(LPCTSTR _header) {header=_header;} + void SetIcon(HICON _icon) {icon = _icon;} + void Add(Tab *tab, LPCTSTR resource, LPCTSTR title, LPCTSTR subtitle = 0); + void Show(HINSTANCE hInstance, HWND hParent, std::string title, int startpage=0, bool floating = false, bool wizard = false); + HFONT GetTitleFont() {return hTitleFont;} + HFONT GetFont() {return hDialogFont;} + static int CALLBACK Callback(HWND hwndDlg, UINT uMsg, LPARAM lParam); + }; + + + } \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/ShellUtil.h b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/ShellUtil.h index ee9953d853..f952923068 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/ShellUtil.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/ShellUtil.h @@ -1,15 +1,15 @@ -#pragma once - -#include -#include - - -namespace W32Util -{ - std::string BrowseForFolder(HWND parent, char *title); - bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle, - const char *_pInitialFolder,const char *_pFilter,const char *_pExtension, - std::string& _strFileName); - std::vector BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle, - const char *_pInitialFolder,const char *_pFilter,const char *_pExtension); +#pragma once + +#include +#include + + +namespace W32Util +{ + std::string BrowseForFolder(HWND parent, char *title); + bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle, + const char *_pInitialFolder,const char *_pFilter,const char *_pExtension, + std::string& _strFileName); + std::vector BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle, + const char *_pInitialFolder,const char *_pFilter,const char *_pExtension); } \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/TabControl.h b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/TabControl.h index 6afb54a5b3..1e51b53017 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/TabControl.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/TabControl.h @@ -1,36 +1,36 @@ -#pragma once - -namespace W32Util -{ -#define MAX_WIN_DIALOGS 32 - - - class TabControl - { - private: - - HINSTANCE m_hInstance; - HWND m_hWndParent; - HWND m_hTabCtrl; - - HWND m_WinDialogs[MAX_WIN_DIALOGS]; - int m_numDialogs; - - public: - - TabControl(HINSTANCE _hInstance, HWND _hTabCtrl,DLGPROC _lpDialogFunc); - - ~TabControl(void); - - // - // --- tools --- - // - - HWND AddItem (char* _szText,int _iResource,DLGPROC _lpDialogFunc); - - void SelectDialog (int _nDialogId); - - void MessageHandler(UINT message, WPARAM wParam, LPARAM lParam); - }; - -} +#pragma once + +namespace W32Util +{ +#define MAX_WIN_DIALOGS 32 + + + class TabControl + { + private: + + HINSTANCE m_hInstance; + HWND m_hWndParent; + HWND m_hTabCtrl; + + HWND m_WinDialogs[MAX_WIN_DIALOGS]; + int m_numDialogs; + + public: + + TabControl(HINSTANCE _hInstance, HWND _hTabCtrl,DLGPROC _lpDialogFunc); + + ~TabControl(void); + + // + // --- tools --- + // + + HWND AddItem (char* _szText,int _iResource,DLGPROC _lpDialogFunc); + + void SelectDialog (int _nDialogId); + + void MessageHandler(UINT message, WPARAM wParam, LPARAM lParam); + }; + +} diff --git a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/Thread.h b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/Thread.h index 3320a8a8d4..b0f89ee7b9 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/W32Util/Thread.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/W32Util/Thread.h @@ -1,36 +1,36 @@ -#pragma once - -namespace W32Util -{ - class Thread - { - private: - HANDLE _handle; - DWORD _tid; // thread id - - public: - Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg); - ~Thread () ; - - // - // --- tools --- - // - - void Resume(void); - - void Suspend(void); - - void WaitForDeath(void); - - void Terminate(void); - - void SetPriority(int _nPriority); - - bool IsActive (void); - - HANDLE GetHandle(void) {return _handle;} - - }; - -} - +#pragma once + +namespace W32Util +{ + class Thread + { + private: + HANDLE _handle; + DWORD _tid; // thread id + + public: + Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg); + ~Thread () ; + + // + // --- tools --- + // + + void Resume(void); + + void Suspend(void); + + void WaitForDeath(void); + + void Terminate(void); + + void SetPriority(int _nPriority); + + bool IsActive (void); + + HANDLE GetHandle(void) {return _handle;} + + }; + +} + diff --git a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h b/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h index d0322cca98..de884712e6 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h @@ -1,30 +1,30 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _XFSTRUCTS_H -#define _XFSTRUCTS_H - -#include "Common.h" -#include "Vec3.h" -#include "XFMemory.h" - -void XFUpdateVP(); -void XFUpdatePJ(); -void LoadXFReg(u32 transferSize, u32 address, u32 *pData); -void LoadIndexedXF(u32 val, int array); - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _XFSTRUCTS_H +#define _XFSTRUCTS_H + +#include "Common.h" +#include "Vec3.h" +#include "XFMemory.h" + +void XFUpdateVP(); +void XFUpdatePJ(); +void LoadXFReg(u32 transferSize, u32 address, u32 *pData); +void LoadIndexedXF(u32 val, int array); + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.h b/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.h index 97c714e613..48d53b2190 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/bmp_io.h @@ -1,27 +1,27 @@ -/* bmp_io.h 16 May 1999 */ - -#ifndef _BMP_IO_H -#define _BMP_IO_H - -int bmp_read ( char *filein_name, int *xsize, int *ysize, int **rarray, - int **garray, int **barray ); -int bmp_read_data ( FILE *filein, int xsize, int ysize, int *rarray, - int *garray, int *barray ); -int bmp_read_header ( FILE *filein, int *xsize, int *ysize, int *psize ); -int bmp_read_palette ( FILE *filein, int psize ); -int bmp_read_test ( char *filein_name ); - -int bmp_write ( char *fileout_name, int xsize, int ysize, char* rgba ); -int bmp_write_data ( FILE *fileout, int xsize, int ysize, char *rarray, char *garray, char *barray ); - -int bmp_write_header ( FILE *fileout, int xsize, int ysize ); -int bmp_write_test ( char *fileout_name ); - -int read_u_long_int ( unsigned long int *u_long_int_val, FILE *filein ); -int read_u_short_int ( unsigned short int *u_short_int_val, FILE *filein ); - -int write_u_long_int ( unsigned long int u_long_int_val, FILE *fileout ); -int write_u_short_int ( unsigned short int u_short_int_val, FILE *fileout ); - - +/* bmp_io.h 16 May 1999 */ + +#ifndef _BMP_IO_H +#define _BMP_IO_H + +int bmp_read ( char *filein_name, int *xsize, int *ysize, int **rarray, + int **garray, int **barray ); +int bmp_read_data ( FILE *filein, int xsize, int ysize, int *rarray, + int *garray, int *barray ); +int bmp_read_header ( FILE *filein, int *xsize, int *ysize, int *psize ); +int bmp_read_palette ( FILE *filein, int psize ); +int bmp_read_test ( char *filein_name ); + +int bmp_write ( char *fileout_name, int xsize, int ysize, char* rgba ); +int bmp_write_data ( FILE *fileout, int xsize, int ysize, char *rarray, char *garray, char *barray ); + +int bmp_write_header ( FILE *fileout, int xsize, int ysize ); +int bmp_write_test ( char *fileout_name ); + +int read_u_long_int ( unsigned long int *u_long_int_val, FILE *filein ); +int read_u_short_int ( unsigned short int *u_short_int_val, FILE *filein ); + +int write_u_long_int ( unsigned long int u_long_int_val, FILE *fileout ); +int write_u_short_int ( unsigned short int u_short_int_val, FILE *fileout ); + + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.h b/Source/Plugins/Plugin_VideoDX9/Src/main.h index 8d78bfbb0c..c2c5754719 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.h @@ -1,28 +1,28 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef MAIN_H -#define MAIN_H - -#include "PluginSpecs_Video.h" -#include "Render.h" - -extern SVideoInitialize g_VideoInitialize; - -void DebugLog(const char* _fmt, ...); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef MAIN_H +#define MAIN_H + +#include "PluginSpecs_Video.h" +#include "Render.h" + +extern SVideoInitialize g_VideoInitialize; + +void DebugLog(const char* _fmt, ...); + +#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/resource.h b/Source/Plugins/Plugin_VideoDX9/Src/resource.h index b2acfb2b11..4ed74ba7eb 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/resource.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/resource.h @@ -1,67 +1,67 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDD_ABOUT 101 -#define IDD_SETTINGS 102 -#define IDD_DEBUGGER 103 -#define IDD_ADVANCED 104 -#define IDD_ENHANCEMENTS 105 -#define IDC_ENABLETEXTURING 1001 -#define IDC_CHECK2 1002 -#define IDC_WIREFRAME 1002 -#define IDC_USESHADERS 1002 -#define IDC_FORCEANISOTROPY 1002 -#define IDC_FULLSCREENENABLE 1002 -#define IDC_LIST1 1003 -#define IDC_FULLSCREENENABLE2 1003 -#define IDC_VSYNC 1003 -#define IDC_DEBUGSTEP 1004 -#define IDC_RENDER_TO_MAINWINDOW 1004 -#define IDC_REGISTERS 1005 -#define IDC_ENABLEDEBUGGING 1006 -#define IDC_TAB1 1007 -#define IDC_REGISTERSELECT 1007 -#define IDC_ADAPTER 1008 -#define IDC_DEVICE 1009 -#define IDC_RESOLUTION 1010 -#define IDC_RESOLUTIONWINDOWED 1011 -#define IDC_ANTIALIASMODE 1012 -#define IDC_PPPARAM1 1013 -#define IDC_SHADERVERSION 1013 -#define IDC_PPPARAM2 1014 -#define IDC_CHECK1 1015 -#define IDC_POSTPROCESS 1016 -#define IDC_TRUFORM 1016 -#define IDC_PPPARAM1LABEL 1017 -#define IDC_POSTPROCESSEFFECT 1017 -#define IDC_PPPARAM2LABEL 1018 -#define IDC_PPPARAM1LABEL2 1018 -#define IDC_ANTIALIASQUALITY 1019 -#define IDC_ENABLEPOSTPROCESS 1020 -#define IDC_ANIMATE1 1021 -#define IDC_OVERLAYSTATS 1022 -#define IDC_DLOPTLEVEL 1023 -#define IDC_PREUPSCALETYPE 1024 -#define IDC_TRUFORMLEVEL 1025 -#define IDC_PREUPSCALE 1026 -#define IDC_SLIDER1 1027 -#define IDC_TEXDUMPPATH 1028 -#define IDC_TEXDUMP 1029 -#define IDC_FORCEFILTERING 1030 -#define IDC_BROWSETEXDUMPPATH 1031 -#define IDC_SHOWSHADERERRORS 1033 -#define IDC_CHECK3 1034 -#define IDC_TEXFMT_CENTER 1034 -#define IDC_TEXFMT_OVERLAY 1035 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 106 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1036 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDD_ABOUT 101 +#define IDD_SETTINGS 102 +#define IDD_DEBUGGER 103 +#define IDD_ADVANCED 104 +#define IDD_ENHANCEMENTS 105 +#define IDC_ENABLETEXTURING 1001 +#define IDC_CHECK2 1002 +#define IDC_WIREFRAME 1002 +#define IDC_USESHADERS 1002 +#define IDC_FORCEANISOTROPY 1002 +#define IDC_FULLSCREENENABLE 1002 +#define IDC_LIST1 1003 +#define IDC_FULLSCREENENABLE2 1003 +#define IDC_VSYNC 1003 +#define IDC_DEBUGSTEP 1004 +#define IDC_RENDER_TO_MAINWINDOW 1004 +#define IDC_REGISTERS 1005 +#define IDC_ENABLEDEBUGGING 1006 +#define IDC_TAB1 1007 +#define IDC_REGISTERSELECT 1007 +#define IDC_ADAPTER 1008 +#define IDC_DEVICE 1009 +#define IDC_RESOLUTION 1010 +#define IDC_RESOLUTIONWINDOWED 1011 +#define IDC_ANTIALIASMODE 1012 +#define IDC_PPPARAM1 1013 +#define IDC_SHADERVERSION 1013 +#define IDC_PPPARAM2 1014 +#define IDC_CHECK1 1015 +#define IDC_POSTPROCESS 1016 +#define IDC_TRUFORM 1016 +#define IDC_PPPARAM1LABEL 1017 +#define IDC_POSTPROCESSEFFECT 1017 +#define IDC_PPPARAM2LABEL 1018 +#define IDC_PPPARAM1LABEL2 1018 +#define IDC_ANTIALIASQUALITY 1019 +#define IDC_ENABLEPOSTPROCESS 1020 +#define IDC_ANIMATE1 1021 +#define IDC_OVERLAYSTATS 1022 +#define IDC_DLOPTLEVEL 1023 +#define IDC_PREUPSCALETYPE 1024 +#define IDC_TRUFORMLEVEL 1025 +#define IDC_PREUPSCALE 1026 +#define IDC_SLIDER1 1027 +#define IDC_TEXDUMPPATH 1028 +#define IDC_TEXDUMP 1029 +#define IDC_FORCEFILTERING 1030 +#define IDC_BROWSETEXDUMPPATH 1031 +#define IDC_SHOWSHADERERRORS 1033 +#define IDC_CHECK3 1034 +#define IDC_TEXFMT_CENTER 1034 +#define IDC_TEXFMT_OVERLAY 1035 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 106 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1036 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/stdafx.h b/Source/Plugins/Plugin_VideoDX9/Src/stdafx.h index 5fce96353a..3b33194b09 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/stdafx.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/stdafx.h @@ -1,26 +1,26 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once -#define _WIN32_WINNT 0x501 -#ifndef _WIN32_IE -#define _WIN32_IE 0x0500 // Default value is 0x0400 -#endif - -#include -#include - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once +#define _WIN32_WINNT 0x501 +#ifndef _WIN32_IE +#define _WIN32_IE 0x0500 // Default value is 0x0400 +#endif + +#include +#include + diff --git a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.h b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.h index a4e9a8f2fb..d82ef0a2c9 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.h @@ -1,27 +1,27 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _BPSTRUCTS_H -#define _BPSTRUCTS_H - -#include "BPMemory.h" - -void BPInit(); -void LoadBPReg(u32 value0); -void BPReload(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _BPSTRUCTS_H +#define _BPSTRUCTS_H + +#include "BPMemory.h" + +void BPInit(); +void LoadBPReg(u32 value0); +void BPReload(); + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.h b/Source/Plugins/Plugin_VideoOGL/Src/Config.h index 5e56626c0f..d39e1e9907 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.h @@ -1,81 +1,81 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _CONFIG_H -#define _CONFIG_H - -// Log in two categories, andsave three other options in the same byte -#define CONF_LOG 1 -#define CONF_PRIMLOG 2 -#define CONF_SAVETEXTURES 4 -#define CONF_SAVETARGETS 8 -#define CONF_SAVESHADERS 16 - -struct Config -{ - Config(); - void Load(); - void Save(); - - // General - bool bFullscreen; - bool renderToMainframe; - char iFSResolution[16]; - char iWindowedRes[16]; - bool bStretchToFit; - bool bKeepAR; - bool bHideCursor; - bool bSafeTextureCache; - - // Enhancements - int iMultisampleMode; - bool bForceFiltering; - int iMaxAnisotropy; - - // Information - bool bShowFPS; - bool bOverlayStats; - bool bTexFmtOverlayEnable; - bool bTexFmtOverlayCenter; - - // Render - bool bUseXFB; - bool bWireFrame; - bool bDisableLighting; - bool bDisableTexturing; - - // Utility - char texDumpPath[280]; - bool bDumpTextures; - - // Hacks - bool bEFBToTextureDisable; - bool bEFBToTextureDisableHotKey; - bool bProjectionHax1; - bool bProjectionHax2; - - int iLog; // CONF_ bits - int iSaveTargetId; - - //currently unused: - int iCompileDLsLevel; - bool bShowShaderErrors; -}; - -extern Config g_Config; - -#endif // _CONFIG_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _CONFIG_H +#define _CONFIG_H + +// Log in two categories, andsave three other options in the same byte +#define CONF_LOG 1 +#define CONF_PRIMLOG 2 +#define CONF_SAVETEXTURES 4 +#define CONF_SAVETARGETS 8 +#define CONF_SAVESHADERS 16 + +struct Config +{ + Config(); + void Load(); + void Save(); + + // General + bool bFullscreen; + bool renderToMainframe; + char iFSResolution[16]; + char iWindowedRes[16]; + bool bStretchToFit; + bool bKeepAR; + bool bHideCursor; + bool bSafeTextureCache; + + // Enhancements + int iMultisampleMode; + bool bForceFiltering; + int iMaxAnisotropy; + + // Information + bool bShowFPS; + bool bOverlayStats; + bool bTexFmtOverlayEnable; + bool bTexFmtOverlayCenter; + + // Render + bool bUseXFB; + bool bWireFrame; + bool bDisableLighting; + bool bDisableTexturing; + + // Utility + char texDumpPath[280]; + bool bDumpTextures; + + // Hacks + bool bEFBToTextureDisable; + bool bEFBToTextureDisableHotKey; + bool bProjectionHax1; + bool bProjectionHax2; + + int iLog; // CONF_ bits + int iSaveTargetId; + + //currently unused: + int iCompileDLsLevel; + bool bShowShaderErrors; +}; + +extern Config g_Config; + +#endif // _CONFIG_H diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h index 168107d426..6a18ff2d15 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h @@ -1,143 +1,143 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __CDebugger_h__ -#define __CDebugger_h__ - - -// wx stuff, I'm not sure if we use all these -#ifndef WX_PRECOMP - #include - #include -#else - #include -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include -#include // notebook - -#include "../Globals.h" - -class CPBView; -class IniFile; - -// Window settings - I'm not sure what these do. I just copied them gtom elsewhere basically. -#undef CDebugger_STYLE - -#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE - -class CDebugger : public wxDialog -{ - private: - DECLARE_EVENT_TABLE(); - - public: - CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"), - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = CDebugger_STYLE); - - virtual ~CDebugger(); - - void Save(IniFile& _IniFile) const; - void Load(IniFile& _IniFile); - void DoHide(); void DoShow(); - - void NotifyUpdate(); - void OnUpdate(wxCommandEvent& event); - - void GeneralSettings(wxCommandEvent& event); - void LogSettings(wxCommandEvent& event); - void DoShowHideConsole(); - void ChangeFrequency(wxCommandEvent& event); - void DoChangeFrequency(); - void ChangePreset(wxCommandEvent& event); - void DoChangePreset(); - - void Ap(wxCommandEvent& event); - void Am(wxCommandEvent& event); - void Bp(wxCommandEvent& event); - void Bm(wxCommandEvent& event); - - CPBView* m_GPRListView; - - int gUpdFreq; - bool bInfoLog; - bool bPrimLog; - - - private: - - // declarations - wxNotebook *m_Notebook; // notebook - wxPanel *m_PageMain; - - wxCheckBox *m_Check[7]; - wxCheckListBox * m_options, * m_settings; - wxRadioButton *m_Radio[5]; - wxRadioBox *m_RadioBox[3]; - wxStaticBox *m_Label[2]; - wxPanel *m_Controller; - - // WARNING: Make sure these are not also elsewhere, for example in resource.h. - enum - { - ID_NOTEBOOK = 2000, ID_PAGEMAIN, // notebook - - ID_SAVETOFILE, ID_SHOWCONSOLE, // options - IDC_CHECK2, - IDC_CHECK3, - IDC_CHECK4, - IDC_CHECK5, - IDC_CHECK6, - IDC_CHECK7, - IDC_CHECK8, - IDC_CHECK9, - - ID_CHECKLIST1, - - IDC_RADIO0, - IDC_RADIO1, - IDC_RADIO2, - IDC_RADIO3, - - IDG_LABEL1, - IDG_LABEL2, - - ID_UPD, - ID_AP, - ID_AM, - ID_BP, - ID_BM, - ID_GPR, - ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values - - }; - - void OnShow(wxShowEvent& event); - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __CDebugger_h__ +#define __CDebugger_h__ + + +// wx stuff, I'm not sure if we use all these +#ifndef WX_PRECOMP + #include + #include +#else + #include +#endif + +#include +#include +#include +#include + +#include +#include +#include +#include +#include // notebook + +#include "../Globals.h" + +class CPBView; +class IniFile; + +// Window settings - I'm not sure what these do. I just copied them gtom elsewhere basically. +#undef CDebugger_STYLE + +#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE + +class CDebugger : public wxDialog +{ + private: + DECLARE_EVENT_TABLE(); + + public: + CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"), + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = CDebugger_STYLE); + + virtual ~CDebugger(); + + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + void DoHide(); void DoShow(); + + void NotifyUpdate(); + void OnUpdate(wxCommandEvent& event); + + void GeneralSettings(wxCommandEvent& event); + void LogSettings(wxCommandEvent& event); + void DoShowHideConsole(); + void ChangeFrequency(wxCommandEvent& event); + void DoChangeFrequency(); + void ChangePreset(wxCommandEvent& event); + void DoChangePreset(); + + void Ap(wxCommandEvent& event); + void Am(wxCommandEvent& event); + void Bp(wxCommandEvent& event); + void Bm(wxCommandEvent& event); + + CPBView* m_GPRListView; + + int gUpdFreq; + bool bInfoLog; + bool bPrimLog; + + + private: + + // declarations + wxNotebook *m_Notebook; // notebook + wxPanel *m_PageMain; + + wxCheckBox *m_Check[7]; + wxCheckListBox * m_options, * m_settings; + wxRadioButton *m_Radio[5]; + wxRadioBox *m_RadioBox[3]; + wxStaticBox *m_Label[2]; + wxPanel *m_Controller; + + // WARNING: Make sure these are not also elsewhere, for example in resource.h. + enum + { + ID_NOTEBOOK = 2000, ID_PAGEMAIN, // notebook + + ID_SAVETOFILE, ID_SHOWCONSOLE, // options + IDC_CHECK2, + IDC_CHECK3, + IDC_CHECK4, + IDC_CHECK5, + IDC_CHECK6, + IDC_CHECK7, + IDC_CHECK8, + IDC_CHECK9, + + ID_CHECKLIST1, + + IDC_RADIO0, + IDC_RADIO1, + IDC_RADIO2, + IDC_RADIO3, + + IDG_LABEL1, + IDG_LABEL2, + + ID_UPD, + ID_AP, + ID_AM, + ID_BP, + ID_BM, + ID_GPR, + ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values + + }; + + void OnShow(wxShowEvent& event); + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/PBView.h b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/PBView.h index c86eb598fd..cce3a12f1d 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/PBView.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/PBView.h @@ -1,42 +1,42 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __PBView_h__ -#define __PBView_h__ - -#include -#include - -#include "Common.h" - -class CPBView : public wxListCtrl -{ -public: - CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); - void Update(); - u32 m_CachedRegs[10][10]; - -private: - DECLARE_EVENT_TABLE() - bool m_CachedRegHasChanged[64]; - - #ifdef _WIN32 - virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem); - #endif -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __PBView_h__ +#define __PBView_h__ + +#include +#include + +#include "Common.h" + +class CPBView : public wxListCtrl +{ +public: + CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); + void Update(); + u32 m_CachedRegs[10][10]; + +private: + DECLARE_EVENT_TABLE() + bool m_CachedRegHasChanged[64]; + + #ifdef _WIN32 + virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem); + #endif +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h index 62b377f825..c11264ae84 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h @@ -1,137 +1,137 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _GLINIT_H -#define _GLINIT_H - -#include "pluginspecs_video.h" - -#ifdef _WIN32 - -#define GLEW_STATIC - -#include -#include -#include -#include - -#else // linux basic definitions - -#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) -#define I_NEED_OS2_H // HAXXOR -//#include -#if defined(HAVE_X11) && HAVE_X11 -#include -#else -#undef BOOL -#include -#include "cocoaGL.h" -#endif - -#if defined(__APPLE__) -#include - -#else - -#include - -#endif -//#include -#define __inline inline - -#include // ftime(), struct timeb - -inline unsigned long timeGetTime() -{ -#ifdef _WIN32 - _timeb t; - _ftime(&t); -#else - timeb t; - ftime(&t); -#endif - - return (unsigned long)(t.time*1000+t.millitm); -} - -#endif // linux basic definitions - -#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils -#define GL_DEPTH_STENCIL_EXT 0x84F9 -#define GL_UNSIGNED_INT_24_8_EXT 0x84FA -#define GL_DEPTH24_STENCIL8_EXT 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 -#endif - -#define GL_REPORT_ERROR() { err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } } - -#if defined(_DEBUG) || defined(DEBUGFAST) -#define GL_REPORT_ERRORD() { GLenum err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } } -#else -#define GL_REPORT_ERRORD() -#endif - -#ifndef _WIN32 - -#undef I_NEED_OS2_H -#undef BOOL - -#if defined(HAVE_X11) && HAVE_X11 -#include -#include -#include -#include -//#include -#endif -#include -#include - -typedef struct { - int screen; -#if defined(OSX64) - NSWindow *cocoaWin; - NSOpenGLContext *cocoaCtx; -#else //linux - Window win; - Display *dpy; - GLXContext ctx; - XSetWindowAttributes attr; - Bool fs; - Bool doubleBuffered; - XF86VidModeModeInfo deskMode; -#endif - int x, y; - unsigned int width, height; - unsigned int depth; -} GLWindow; - -extern GLWindow GLWin; - -#endif - -// yeah yeah, these should be hidden -extern int nBackbufferWidth, nBackbufferHeight; -extern int nXoff, nYoff; - -bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height); -bool OpenGL_MakeCurrent(); -void OpenGL_SwapBuffers(); -void OpenGL_SetWindowText(const char *text); -void OpenGL_Shutdown(); -void OpenGL_Update(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _GLINIT_H +#define _GLINIT_H + +#include "pluginspecs_video.h" + +#ifdef _WIN32 + +#define GLEW_STATIC + +#include +#include +#include +#include + +#else // linux basic definitions + +#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) +#define I_NEED_OS2_H // HAXXOR +//#include +#if defined(HAVE_X11) && HAVE_X11 +#include +#else +#undef BOOL +#include +#include "cocoaGL.h" +#endif + +#if defined(__APPLE__) +#include + +#else + +#include + +#endif +//#include +#define __inline inline + +#include // ftime(), struct timeb + +inline unsigned long timeGetTime() +{ +#ifdef _WIN32 + _timeb t; + _ftime(&t); +#else + timeb t; + ftime(&t); +#endif + + return (unsigned long)(t.time*1000+t.millitm); +} + +#endif // linux basic definitions + +#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#endif + +#define GL_REPORT_ERROR() { err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } } + +#if defined(_DEBUG) || defined(DEBUGFAST) +#define GL_REPORT_ERRORD() { GLenum err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } } +#else +#define GL_REPORT_ERRORD() +#endif + +#ifndef _WIN32 + +#undef I_NEED_OS2_H +#undef BOOL + +#if defined(HAVE_X11) && HAVE_X11 +#include +#include +#include +#include +//#include +#endif +#include +#include + +typedef struct { + int screen; +#if defined(OSX64) + NSWindow *cocoaWin; + NSOpenGLContext *cocoaCtx; +#else //linux + Window win; + Display *dpy; + GLXContext ctx; + XSetWindowAttributes attr; + Bool fs; + Bool doubleBuffered; + XF86VidModeModeInfo deskMode; +#endif + int x, y; + unsigned int width, height; + unsigned int depth; +} GLWindow; + +extern GLWindow GLWin; + +#endif + +// yeah yeah, these should be hidden +extern int nBackbufferWidth, nBackbufferHeight; +extern int nXoff, nYoff; + +bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height); +bool OpenGL_MakeCurrent(); +void OpenGL_SwapBuffers(); +void OpenGL_SetWindowText(const char *text); +void OpenGL_Shutdown(); +void OpenGL_Update(); + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h index 84c6c5f944..8808182a4b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h @@ -1,156 +1,156 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __CONFIGDIALOG_h__ -#define __CONFIGDIALOG_h__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#undef ConfigDialog_STYLE -#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - - -class ConfigDialog : public wxDialog -{ - public: - ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("OpenGL Plugin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigDialog_STYLE); - virtual ~ConfigDialog(); - void CloseClick(wxCommandEvent& event); - - void AddFSReso(char *reso); - void AddWindowReso(char *reso); - void AddAAMode(int mode); - - private: - DECLARE_EVENT_TABLE(); - - wxBoxSizer* sGeneral; - wxStaticBoxSizer* sbBasic; - wxGridBagSizer* sBasic; - wxStaticBoxSizer* sbEnhancements; - wxGridBagSizer* sEnhancements; - wxBoxSizer* sAdvanced; - wxStaticBoxSizer* sbInfo; - wxGridBagSizer* sInfo; - wxStaticBoxSizer* sbRendering; - wxGridBagSizer* sRendering; - wxStaticBoxSizer* sbUtilities; - wxGridBagSizer* sUtilities; - wxStaticBoxSizer* sbHacks; - wxGridBagSizer* sHacks; - - wxButton *m_About; - wxButton *m_Close; - wxNotebook *m_Notebook; - wxPanel *m_PageGeneral; - wxPanel *m_PageAdvanced; - wxCheckBox *m_Fullscreen; - wxCheckBox *m_RenderToMainWindow; - wxCheckBox *m_StretchToFit; - wxCheckBox *m_KeepAR; - wxCheckBox *m_HideCursor; - wxArrayString arrayStringFor_FullscreenCB; - wxComboBox *m_FullscreenCB; - wxArrayString arrayStringFor_WindowResolutionCB; - wxComboBox *m_WindowResolutionCB; - - wxCheckBox *m_ForceFiltering; // advanced - wxChoice *m_MaxAnisotropyCB; - wxArrayString arrayStringFor_MaxAnisotropyCB; - wxComboBox *m_AliasModeCB; - wxCheckBox *m_ShowFPS; - wxCheckBox *m_ShaderErrors; - wxCheckBox *m_Statistics; - wxCheckBox *m_TexFmtOverlay; - wxCheckBox *m_TexFmtCenter; - wxCheckBox *m_UseXFB; - wxCheckBox *m_Wireframe; - wxCheckBox *m_DisableLighting; - wxCheckBox *m_DisableTexturing; - wxCheckBox *m_DumpTextures; - wxDirPickerCtrl *m_TexturePath; - wxCheckBox *m_EFBToTextureDisable, *m_EFBToTextureDisableHotKey; - wxCheckBox *m_ProjectionHax1; - wxCheckBox *m_ProjectionHax2; - wxCheckBox *m_SafeTextureCache; - - enum - { - ID_CLOSE = 1000, - ID_ABOUTOGL, - - ID_NOTEBOOK, - ID_PAGEGENERAL, - ID_PAGEADVANCED, - - ID_FULLSCREEN, - ID_RENDERTOMAINWINDOW, - ID_STRETCHTOFIT, - ID_KEEPAR, - ID_HIDECURSOR, - ID_FSTEXT, - ID_FULLSCREENCB, - ID_WMTEXT, - ID_WINDOWRESOLUTIONCB, - - ID_FORCEFILTERING, - ID_MAXANISOTROPY, - ID_AATEXT, - ID_ALIASMODECB, - - ID_SHOWFPS, - ID_SHADERERRORS, - ID_STATISTICS, - ID_TEXFMTOVERLAY, - ID_TEXFMTCENTER, - - ID_USEXFB, - ID_WIREFRAME, - ID_DISABLELIGHTING, - ID_DISABLETEXTURING, - ID_SAFETEXTURECACHE, - - ID_DUMPTEXTURES, - ID_TEXTUREPATH, - - ID_EFBTOTEXTUREDISABLE, ID_EFBTOTEXTUREDISABLEHOTKEY, - ID_PROJECTIONHACK1, - ID_PROJECTIONHACK2 - }; - - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); - - void AboutClick(wxCommandEvent& event); - void GeneralSettingsChanged(wxCommandEvent& event); - void AdvancedSettingsChanged(wxCommandEvent& event); - void TexturePathChange(wxFileDirPickerEvent& event); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __CONFIGDIALOG_h__ +#define __CONFIGDIALOG_h__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#undef ConfigDialog_STYLE +#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + + +class ConfigDialog : public wxDialog +{ + public: + ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("OpenGL Plugin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigDialog_STYLE); + virtual ~ConfigDialog(); + void CloseClick(wxCommandEvent& event); + + void AddFSReso(char *reso); + void AddWindowReso(char *reso); + void AddAAMode(int mode); + + private: + DECLARE_EVENT_TABLE(); + + wxBoxSizer* sGeneral; + wxStaticBoxSizer* sbBasic; + wxGridBagSizer* sBasic; + wxStaticBoxSizer* sbEnhancements; + wxGridBagSizer* sEnhancements; + wxBoxSizer* sAdvanced; + wxStaticBoxSizer* sbInfo; + wxGridBagSizer* sInfo; + wxStaticBoxSizer* sbRendering; + wxGridBagSizer* sRendering; + wxStaticBoxSizer* sbUtilities; + wxGridBagSizer* sUtilities; + wxStaticBoxSizer* sbHacks; + wxGridBagSizer* sHacks; + + wxButton *m_About; + wxButton *m_Close; + wxNotebook *m_Notebook; + wxPanel *m_PageGeneral; + wxPanel *m_PageAdvanced; + wxCheckBox *m_Fullscreen; + wxCheckBox *m_RenderToMainWindow; + wxCheckBox *m_StretchToFit; + wxCheckBox *m_KeepAR; + wxCheckBox *m_HideCursor; + wxArrayString arrayStringFor_FullscreenCB; + wxComboBox *m_FullscreenCB; + wxArrayString arrayStringFor_WindowResolutionCB; + wxComboBox *m_WindowResolutionCB; + + wxCheckBox *m_ForceFiltering; // advanced + wxChoice *m_MaxAnisotropyCB; + wxArrayString arrayStringFor_MaxAnisotropyCB; + wxComboBox *m_AliasModeCB; + wxCheckBox *m_ShowFPS; + wxCheckBox *m_ShaderErrors; + wxCheckBox *m_Statistics; + wxCheckBox *m_TexFmtOverlay; + wxCheckBox *m_TexFmtCenter; + wxCheckBox *m_UseXFB; + wxCheckBox *m_Wireframe; + wxCheckBox *m_DisableLighting; + wxCheckBox *m_DisableTexturing; + wxCheckBox *m_DumpTextures; + wxDirPickerCtrl *m_TexturePath; + wxCheckBox *m_EFBToTextureDisable, *m_EFBToTextureDisableHotKey; + wxCheckBox *m_ProjectionHax1; + wxCheckBox *m_ProjectionHax2; + wxCheckBox *m_SafeTextureCache; + + enum + { + ID_CLOSE = 1000, + ID_ABOUTOGL, + + ID_NOTEBOOK, + ID_PAGEGENERAL, + ID_PAGEADVANCED, + + ID_FULLSCREEN, + ID_RENDERTOMAINWINDOW, + ID_STRETCHTOFIT, + ID_KEEPAR, + ID_HIDECURSOR, + ID_FSTEXT, + ID_FULLSCREENCB, + ID_WMTEXT, + ID_WINDOWRESOLUTIONCB, + + ID_FORCEFILTERING, + ID_MAXANISOTROPY, + ID_AATEXT, + ID_ALIASMODECB, + + ID_SHOWFPS, + ID_SHADERERRORS, + ID_STATISTICS, + ID_TEXFMTOVERLAY, + ID_TEXFMTCENTER, + + ID_USEXFB, + ID_WIREFRAME, + ID_DISABLELIGHTING, + ID_DISABLETEXTURING, + ID_SAFETEXTURECACHE, + + ID_DUMPTEXTURES, + ID_TEXTUREPATH, + + ID_EFBTOTEXTUREDISABLE, ID_EFBTOTEXTUREDISABLEHOTKEY, + ID_PROJECTIONHACK1, + ID_PROJECTIONHACK2 + }; + + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); + + void AboutClick(wxCommandEvent& event); + void GeneralSettingsChanged(wxCommandEvent& event); + void AdvancedSettingsChanged(wxCommandEvent& event); + void TexturePathChange(wxFileDirPickerEvent& event); +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h index 12c85035df..a59f43df43 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h @@ -1,87 +1,87 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -// This file should DIE. - -#ifndef _GLOBALS_H -#define _GLOBALS_H - -// #define LOGGING - -#include "Common.h" -#include "x64Emitter.h" -#include "Config.h" - -#define ERROR_LOG __Log - -#if defined(_DEBUG) || defined(DEBUGFAST) -#define INFO_LOG if( g_Config.iLog & CONF_LOG ) __Log -#define PRIM_LOG if( g_Config.iLog & CONF_PRIMLOG ) __Log -#define DEBUG_LOG __Log -#else -#define INFO_LOG(...) -#define PRIM_LOG(...) -#define DEBUG_LOG(...) -#endif - -void DebugLog(const char* _fmt, ...); -void __Log(const char *format, ...); -void __Log(int type, const char *format, ...); -void HandleGLError(); - -#if defined(_MSC_VER) && !defined(__x86_64__) && !defined(_M_X64) -void * memcpy_amd(void *dest, const void *src, size_t n); -unsigned char memcmp_mmx(const void* src1, const void* src2, int cmpsize); -#define memcpy_gc memcpy_amd -#define memcmp_gc memcmp_mmx -#else -#define memcpy_gc memcpy -#define memcmp_gc memcmp -#endif - -#include "main.h" - -inline u8 *Memory_GetPtr(u32 _uAddress) -{ - return g_VideoInitialize.pGetMemoryPointer(_uAddress);//&g_pMemory[_uAddress & RAM_MASK]; -} - -inline u8 Memory_Read_U8(u32 _uAddress) -{ - return *(u8*)g_VideoInitialize.pGetMemoryPointer(_uAddress);//g_pMemory[_uAddress & RAM_MASK]; -} - -inline u16 Memory_Read_U16(u32 _uAddress) -{ - return Common::swap16(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress)); - //return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]); -} - -inline u32 Memory_Read_U32(u32 _uAddress) -{ - return Common::swap32(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress)); - //return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]); -} - -inline float Memory_Read_Float(u32 _uAddress) -{ - union {u32 i; float f;} temp; - temp.i = Memory_Read_U32(_uAddress); - return temp.f; -} - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +// This file should DIE. + +#ifndef _GLOBALS_H +#define _GLOBALS_H + +// #define LOGGING + +#include "Common.h" +#include "x64Emitter.h" +#include "Config.h" + +#define ERROR_LOG __Log + +#if defined(_DEBUG) || defined(DEBUGFAST) +#define INFO_LOG if( g_Config.iLog & CONF_LOG ) __Log +#define PRIM_LOG if( g_Config.iLog & CONF_PRIMLOG ) __Log +#define DEBUG_LOG __Log +#else +#define INFO_LOG(...) +#define PRIM_LOG(...) +#define DEBUG_LOG(...) +#endif + +void DebugLog(const char* _fmt, ...); +void __Log(const char *format, ...); +void __Log(int type, const char *format, ...); +void HandleGLError(); + +#if defined(_MSC_VER) && !defined(__x86_64__) && !defined(_M_X64) +void * memcpy_amd(void *dest, const void *src, size_t n); +unsigned char memcmp_mmx(const void* src1, const void* src2, int cmpsize); +#define memcpy_gc memcpy_amd +#define memcmp_gc memcmp_mmx +#else +#define memcpy_gc memcpy +#define memcmp_gc memcmp +#endif + +#include "main.h" + +inline u8 *Memory_GetPtr(u32 _uAddress) +{ + return g_VideoInitialize.pGetMemoryPointer(_uAddress);//&g_pMemory[_uAddress & RAM_MASK]; +} + +inline u8 Memory_Read_U8(u32 _uAddress) +{ + return *(u8*)g_VideoInitialize.pGetMemoryPointer(_uAddress);//g_pMemory[_uAddress & RAM_MASK]; +} + +inline u16 Memory_Read_U16(u32 _uAddress) +{ + return Common::swap16(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress)); + //return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]); +} + +inline u32 Memory_Read_U32(u32 _uAddress) +{ + return Common::swap32(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress)); + //return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]); +} + +inline float Memory_Read_Float(u32 _uAddress) +{ + union {u32 i; float f;} temp; + temp.i = Memory_Read_U32(_uAddress); + return temp.f; +} + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ImageWrite.h b/Source/Plugins/Plugin_VideoOGL/Src/ImageWrite.h index 468cff6074..9d0e6880cb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ImageWrite.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/ImageWrite.h @@ -1,25 +1,25 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _IMAGEWRITE_H -#define _IMAGEWRITE_H - -bool SaveTGA(const char* filename, int width, int height, void* pdata); -bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height); -bool SaveData(const char* filename, const char* pdata); - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _IMAGEWRITE_H +#define _IMAGEWRITE_H + +bool SaveTGA(const char* filename, int width, int height, void* pdata); +bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height); +bool SaveData(const char* filename, const char* pdata); + #endif // _IMAGEWRITE_H \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.h b/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.h index ca5e23c6e7..8c890ceb8e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Logging/Console.h @@ -1,27 +1,27 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -void startConsoleWin(int width, int height, char* fname); -int aprintf(int a, char *fmt, ...); -void ClearScreen(); -void OpenConsole(); -void CloseConsole(); - -#ifdef _WIN32 - HWND GetConsoleHwnd(void); -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +void startConsoleWin(int width, int height, char* fname); +int aprintf(int a, char *fmt, ...); +void ClearScreen(); +void OpenConsole(); +void CloseConsole(); + +#ifdef _WIN32 + HWND GetConsoleHwnd(void); +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.h b/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.h index c4b39d9570..bf7ea46c05 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Logging/Logging.h @@ -1,21 +1,21 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -// functions -void Logging(int a); - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +// functions +void Logging(int a); + diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.h b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.h index dfccb4815e..727be1893c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.h @@ -1,32 +1,32 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "stdafx.h" - -namespace EmuWindow -{ - extern int g_winstyle; - - HWND GetWnd(); - HWND GetParentWnd(); - HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title); - void Show(); - void Close(); - void SetSize(int displayWidth, int displayHeight); -} +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "stdafx.h" + +namespace EmuWindow +{ + extern int g_winstyle; + + HWND GetWnd(); + HWND GetParentWnd(); + HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title); + void Show(); + void Close(); + void SetSize(int displayWidth, int displayHeight); +} diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.h b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.h index a38461bdb3..188d57e5fe 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderManager.h @@ -1,145 +1,145 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _PIXELSHADERMANAGER_H -#define _PIXELSHADERMANAGER_H - -#include - -#include "BPMemory.h" - -struct FRAGMENTSHADER -{ - FRAGMENTSHADER() : glprogid(0) { } - GLuint glprogid; // opengl program id -#if defined(_DEBUG) || defined(DEBUGFAST) - std::string strprog; -#endif -}; - -class PIXELSHADERUID -{ -public: - u32 values[4+32+6+11]; - u16 tevstages, indstages; - - PIXELSHADERUID() { - memset(values, 0, (4+32+6+11) * 4); - tevstages = indstages = 0; - } - PIXELSHADERUID(const PIXELSHADERUID& r) - { - tevstages = r.tevstages; - indstages = r.indstages; - int N = tevstages + indstages + 3; - _assert_(N <= 4+32+6+11); - for (int i = 0; i < N; ++i) - values[i] = r.values[i]; - } - int GetNumValues() const { - return tevstages + indstages + 3; // numTevStages*3/2+1 - } - bool operator <(const PIXELSHADERUID& _Right) const - { - if (values[0] < _Right.values[0]) - return true; - else if (values[0] > _Right.values[0]) - return false; - int N = GetNumValues(); - for (int i = 1; i < N; ++i) { - if (values[i] < _Right.values[i]) - return true; - else if (values[i] > _Right.values[i]) - return false; - } - return false; - } - bool operator ==(const PIXELSHADERUID& _Right) const - { - if (values[0] != _Right.values[0]) - return false; - int N = GetNumValues(); - for (int i = 1; i < N; ++i) { - if (values[i] != _Right.values[i]) - return false; - } - return true; - } -}; - - -class PixelShaderMngr -{ - struct PSCacheEntry - { - FRAGMENTSHADER shader; - int frameCount; - PSCacheEntry() : frameCount(0) {} - ~PSCacheEntry() {} - void Destroy() { - // printf("Destroying ps %i\n", shader.glprogid); - glDeleteProgramsARB(1, &shader.glprogid); - shader.glprogid = 0; - } - }; - - typedef std::map PSCache; - - static FRAGMENTSHADER* pShaderLast; // last used shader - static PSCache pshaders; - - static void GetPixelShaderId(PIXELSHADERUID&); - static PIXELSHADERUID s_curuid; // the current pixel shader uid (progressively changed as memory is written) - - static void SetPSConstant4f(int const_number, float f1, float f2, float f3, float f4); - static void SetPSConstant4fv(int const_number, const float *f); - - static void SetPSTextureDims(int texid); - -public: - static void Init(); - static void Cleanup(); - static void Shutdown(); - static FRAGMENTSHADER* GetShader(); - static bool CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram); - - static void SetConstants(); // sets pixel shader constants - - // constant management, should be called after memory is committed - static void SetColorChanged(int type, int index); - static void SetAlpha(const AlphaFunc& alpha); - static void SetDestAlpha(const ConstantAlpha& alpha); - static void SetTexDims(int texmapid, u32 width, u32 height, u32 wraps, u32 wrapt); - static void SetZTetureBias(u32 bias); - static void SetIndTexScaleChanged(); - static void SetIndMatrixChanged(int matrixidx); - - static void SetGenModeChanged(); - static void SetTevCombinerChanged(int id); - static void SetTevKSelChanged(int id); - static void SetTevOrderChanged(int id); - static void SetTevIndirectChanged(int id); - static void SetZTetureOpChanged(); - static void SetTexturesUsed(u32 nonpow2tex); - static void SetTexDimsChanged(int texmapid); - - static void SetColorMatrix(const float* pmatrix, const float* pfConstAdd); - static GLuint GetColorMatrixProgram(); -}; - - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _PIXELSHADERMANAGER_H +#define _PIXELSHADERMANAGER_H + +#include + +#include "BPMemory.h" + +struct FRAGMENTSHADER +{ + FRAGMENTSHADER() : glprogid(0) { } + GLuint glprogid; // opengl program id +#if defined(_DEBUG) || defined(DEBUGFAST) + std::string strprog; +#endif +}; + +class PIXELSHADERUID +{ +public: + u32 values[4+32+6+11]; + u16 tevstages, indstages; + + PIXELSHADERUID() { + memset(values, 0, (4+32+6+11) * 4); + tevstages = indstages = 0; + } + PIXELSHADERUID(const PIXELSHADERUID& r) + { + tevstages = r.tevstages; + indstages = r.indstages; + int N = tevstages + indstages + 3; + _assert_(N <= 4+32+6+11); + for (int i = 0; i < N; ++i) + values[i] = r.values[i]; + } + int GetNumValues() const { + return tevstages + indstages + 3; // numTevStages*3/2+1 + } + bool operator <(const PIXELSHADERUID& _Right) const + { + if (values[0] < _Right.values[0]) + return true; + else if (values[0] > _Right.values[0]) + return false; + int N = GetNumValues(); + for (int i = 1; i < N; ++i) { + if (values[i] < _Right.values[i]) + return true; + else if (values[i] > _Right.values[i]) + return false; + } + return false; + } + bool operator ==(const PIXELSHADERUID& _Right) const + { + if (values[0] != _Right.values[0]) + return false; + int N = GetNumValues(); + for (int i = 1; i < N; ++i) { + if (values[i] != _Right.values[i]) + return false; + } + return true; + } +}; + + +class PixelShaderMngr +{ + struct PSCacheEntry + { + FRAGMENTSHADER shader; + int frameCount; + PSCacheEntry() : frameCount(0) {} + ~PSCacheEntry() {} + void Destroy() { + // printf("Destroying ps %i\n", shader.glprogid); + glDeleteProgramsARB(1, &shader.glprogid); + shader.glprogid = 0; + } + }; + + typedef std::map PSCache; + + static FRAGMENTSHADER* pShaderLast; // last used shader + static PSCache pshaders; + + static void GetPixelShaderId(PIXELSHADERUID&); + static PIXELSHADERUID s_curuid; // the current pixel shader uid (progressively changed as memory is written) + + static void SetPSConstant4f(int const_number, float f1, float f2, float f3, float f4); + static void SetPSConstant4fv(int const_number, const float *f); + + static void SetPSTextureDims(int texid); + +public: + static void Init(); + static void Cleanup(); + static void Shutdown(); + static FRAGMENTSHADER* GetShader(); + static bool CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram); + + static void SetConstants(); // sets pixel shader constants + + // constant management, should be called after memory is committed + static void SetColorChanged(int type, int index); + static void SetAlpha(const AlphaFunc& alpha); + static void SetDestAlpha(const ConstantAlpha& alpha); + static void SetTexDims(int texmapid, u32 width, u32 height, u32 wraps, u32 wrapt); + static void SetZTetureBias(u32 bias); + static void SetIndTexScaleChanged(); + static void SetIndMatrixChanged(int matrixidx); + + static void SetGenModeChanged(); + static void SetTevCombinerChanged(int id); + static void SetTevKSelChanged(int id); + static void SetTevOrderChanged(int id); + static void SetTevIndirectChanged(int id); + static void SetZTetureOpChanged(); + static void SetTexturesUsed(u32 nonpow2tex); + static void SetTexDimsChanged(int texmapid); + + static void SetColorMatrix(const float* pmatrix, const float* pfConstAdd); + static GLuint GetColorMatrixProgram(); +}; + + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.h b/Source/Plugins/Plugin_VideoOGL/Src/Render.h index c5c88eb5f5..5b88f7b65d 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.h @@ -1,90 +1,90 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef GCOGL_RENDER -#define GCOGL_RENDER - -#include "TextureMngr.h" - -#include -#include - -extern CGcontext g_cgcontext; -extern CGprofile g_cgvProf, g_cgfProf; - -extern float MValueX, MValueY; -extern int frameCount; - -class Renderer -{ - static void FlushZBufferAlphaToTarget(); - -public: - enum RenderMode - { - RM_Normal=0, // normal target as color0, ztarget as color1 - RM_ZBufferOnly, // zbuffer as color 0 - RM_ZBufferAlpha // zbuffer as color0, also will dump alpha info to regular target once mode is switched - // use stencil buffer to indicate what pixels were written - }; - - static bool Create2(); - static void Shutdown(); - - // initialize opengl standard values (like viewport) - static bool Initialize(); - - static void AddMessage(const char* str, u32 ms); - static void ProcessMessages(); // draw the current messages on the screen - static void RenderText(const char* pstr, int left, int top, u32 color); - static void SetAA(int aa); // sets the anti-aliasing level - - static void ReinitView(int nNewWidth, int nNewHeight); - - static int GetTargetWidth(); - static int GetTargetHeight(); - static bool CanBlendLogicOp(); - static void SetCgErrorOutput(bool bOutput); - - static void ResetGLState(); - static void RestoreGLState(); - static bool IsUsingATIDrawBuffers(); - static bool HaveStencilBuffer(); - - static void SetZBufferRender(); // sets rendering of the zbuffer using MRTs - static u32 GetZBufferTarget(); - - static void SetColorMask(); - static bool SetScissorRect(); - - static void SetRenderMode(RenderMode mode); - static RenderMode GetRenderMode(); - - static void SetRenderTarget(u32 targ); // if targ is 0, sets to original render target - static void SetDepthTarget(u32 targ); - static void SetFramebuffer(u32 fb); - static u32 GetRenderTarget(); - - // Finish up the current frame, print some stats - static void Swap(const TRectangle& rc); - - static void SwapBuffers(); - - static bool SaveRenderTarget(const char* filename, int jpeg); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef GCOGL_RENDER +#define GCOGL_RENDER + +#include "TextureMngr.h" + +#include +#include + +extern CGcontext g_cgcontext; +extern CGprofile g_cgvProf, g_cgfProf; + +extern float MValueX, MValueY; +extern int frameCount; + +class Renderer +{ + static void FlushZBufferAlphaToTarget(); + +public: + enum RenderMode + { + RM_Normal=0, // normal target as color0, ztarget as color1 + RM_ZBufferOnly, // zbuffer as color 0 + RM_ZBufferAlpha // zbuffer as color0, also will dump alpha info to regular target once mode is switched + // use stencil buffer to indicate what pixels were written + }; + + static bool Create2(); + static void Shutdown(); + + // initialize opengl standard values (like viewport) + static bool Initialize(); + + static void AddMessage(const char* str, u32 ms); + static void ProcessMessages(); // draw the current messages on the screen + static void RenderText(const char* pstr, int left, int top, u32 color); + static void SetAA(int aa); // sets the anti-aliasing level + + static void ReinitView(int nNewWidth, int nNewHeight); + + static int GetTargetWidth(); + static int GetTargetHeight(); + static bool CanBlendLogicOp(); + static void SetCgErrorOutput(bool bOutput); + + static void ResetGLState(); + static void RestoreGLState(); + static bool IsUsingATIDrawBuffers(); + static bool HaveStencilBuffer(); + + static void SetZBufferRender(); // sets rendering of the zbuffer using MRTs + static u32 GetZBufferTarget(); + + static void SetColorMask(); + static bool SetScissorRect(); + + static void SetRenderMode(RenderMode mode); + static RenderMode GetRenderMode(); + + static void SetRenderTarget(u32 targ); // if targ is 0, sets to original render target + static void SetDepthTarget(u32 targ); + static void SetFramebuffer(u32 fb); + static u32 GetRenderTarget(); + + // Finish up the current frame, print some stats + static void Swap(const TRectangle& rc); + + static void SwapBuffers(); + + static bool SaveRenderTarget(const char* filename, int jpeg); +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.h b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.h index c3c56089cf..a5a7eda607 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.h @@ -1,38 +1,38 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _TEXTURECONVERTER_H -#define _TEXTURECONVERTER_H - -#include "TextureMngr.h" - -// Converts textures between formats -// TODO: support multiple texture formats -namespace TextureConverter -{ - -void Init(); -void Shutdown(); - -void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc, - u8* destAddr, int dstWidth, int dstHeight); - -void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTexture); - -} - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _TEXTURECONVERTER_H +#define _TEXTURECONVERTER_H + +#include "TextureMngr.h" + +// Converts textures between formats +// TODO: support multiple texture formats +namespace TextureConverter +{ + +void Init(); +void Shutdown(); + +void EncodeToRam(GLuint srcTexture, const TRectangle& sourceRc, + u8* destAddr, int dstWidth, int dstHeight); + +void DecodeToTexture(u8* srcAddr, int srcWidth, int srcHeight, GLuint destTexture); + +} + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.h b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.h index bbc2849b96..3ae72ab7e2 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.h @@ -1,90 +1,90 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _TextureMngr_H -#define _TextureMngr_H - -#include - -#include "GLUtil.h" -#include "BPStructs.h" - -struct TRectangle -{ - int left, top, right, bottom; -}; - -class TextureMngr -{ -public: - struct TCacheEntry - { - TCacheEntry() : texture(0), addr(0), hash(0), w(0), h(0), isRenderTarget(false), isUpsideDown(false), isNonPow2(true), bHaveMipMaps(false) { mode.hex = 0xFCFCFCFC; } - - GLuint texture; - u32 addr; - u32 hash; - u32 paletteHash; - u32 hashoffset; - u32 oldpixel; // used for simple cleanup - TexMode0 mode; // current filter and clamp modes that texture is set to - - int frameCount; - int w,h,fmt; - - bool isRenderTarget; // if render texture, then rendertex is filled with the direct copy of the render target - // later conversions would have to convert properly from rendertexfmt to texfmt - bool isUpsideDown; - bool isNonPow2; // if nonpow2, use GL_TEXTURE_2D, else GL_TEXTURE_RECTANGLE_NV - bool bHaveMipMaps; - - void SetTextureParameters(TexMode0& newmode); - void Destroy(); - void ConvertFromRenderTarget(u32 taddr, int twidth, int theight, int tformat, int tlutaddr, int tlutfmt); - }; - - struct DEPTHTARGET - { - DEPTHTARGET() : targ(0), framecount(0) {} - GLuint targ; - int framecount; - }; - -private: - typedef std::map TexCache; - - static u8 *temp; - static TexCache textures; - static std::map mapDepthTargets; - static int nTex2DEnabled, nTexRECTEnabled; - -public: - - static void Init(); - static void Cleanup(); - static void Shutdown(); - static void Invalidate(); - static TCacheEntry* Load(int texstage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt); - static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, bool bScaleByHalf, TRectangle *source); - - static void EnableTex2D(int stage); - static void EnableTexRECT(int stage); - static void DisableStage(int stage); // sets active texture -}; - -#endif - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _TextureMngr_H +#define _TextureMngr_H + +#include + +#include "GLUtil.h" +#include "BPStructs.h" + +struct TRectangle +{ + int left, top, right, bottom; +}; + +class TextureMngr +{ +public: + struct TCacheEntry + { + TCacheEntry() : texture(0), addr(0), hash(0), w(0), h(0), isRenderTarget(false), isUpsideDown(false), isNonPow2(true), bHaveMipMaps(false) { mode.hex = 0xFCFCFCFC; } + + GLuint texture; + u32 addr; + u32 hash; + u32 paletteHash; + u32 hashoffset; + u32 oldpixel; // used for simple cleanup + TexMode0 mode; // current filter and clamp modes that texture is set to + + int frameCount; + int w,h,fmt; + + bool isRenderTarget; // if render texture, then rendertex is filled with the direct copy of the render target + // later conversions would have to convert properly from rendertexfmt to texfmt + bool isUpsideDown; + bool isNonPow2; // if nonpow2, use GL_TEXTURE_2D, else GL_TEXTURE_RECTANGLE_NV + bool bHaveMipMaps; + + void SetTextureParameters(TexMode0& newmode); + void Destroy(); + void ConvertFromRenderTarget(u32 taddr, int twidth, int theight, int tformat, int tlutaddr, int tlutfmt); + }; + + struct DEPTHTARGET + { + DEPTHTARGET() : targ(0), framecount(0) {} + GLuint targ; + int framecount; + }; + +private: + typedef std::map TexCache; + + static u8 *temp; + static TexCache textures; + static std::map mapDepthTargets; + static int nTex2DEnabled, nTexRECTEnabled; + +public: + + static void Init(); + static void Cleanup(); + static void Shutdown(); + static void Invalidate(); + static TCacheEntry* Load(int texstage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt); + static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, bool bScaleByHalf, TRectangle *source); + + static void EnableTex2D(int stage); + static void EnableTexRECT(int stage); + static void DisableStage(int stage); // sets active texture +}; + +#endif + diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h index c47203c82a..3f430144eb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h @@ -1,100 +1,100 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VERTEXLOADER_H -#define _VERTEXLOADER_H - -#include - -#include "CPMemory.h" -#include "DataReader.h" - -#include "NativeVertexFormat.h" - -class VertexLoaderUID -{ - u32 vid[5]; -public: - VertexLoaderUID() {} - void InitFromCurrentState(int vtx_attr_group) { - vid[0] = g_VtxDesc.Hex & 0xFFFFFFFF; - vid[1] = g_VtxDesc.Hex >> 32; - vid[2] = g_VtxAttr[vtx_attr_group].g0.Hex & ~VAT_0_FRACBITS; - vid[3] = g_VtxAttr[vtx_attr_group].g1.Hex & ~VAT_1_FRACBITS; - vid[4] = g_VtxAttr[vtx_attr_group].g2.Hex & ~VAT_2_FRACBITS; - } - bool operator < (const VertexLoaderUID &other) const { - if (vid[0] < other.vid[0]) - return true; - else if (vid[0] > other.vid[0]) - return false; - for (int i = 1; i < 5; ++i) { - if (vid[i] < other.vid[i]) - return true; - else if (vid[i] > other.vid[i]) - return false; - } - return false; - } -}; - -class VertexLoader -{ -public: - VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr); - ~VertexLoader(); - - int GetVertexSize() const {return m_VertexSize;} - void RunVertices(int vtx_attr_group, int primitive, int count); - - // For debugging / profiling - void AppendToString(std::string *dest); - -private: - enum - { - NRM_ZERO = 0, - NRM_ONE = 1, - NRM_THREE = 3, - }; - - int m_VertexSize; // number of bytes of a raw GC vertex. Computed by CompileVertexTranslator. - - // GC vertex format - TVtxAttr m_VtxAttr; // VAT decoded into easy format - TVtxDesc m_VtxDesc; // Not really used currently - or well it is, but could be easily avoided. - - // PC vertex format - NativeVertexFormat *m_NativeFmt; - int native_stride; - - // Pipeline. To be JIT compiled in the future. - TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower. - int m_numPipelineStages; - - u8 *m_compiledCode; - - int m_numLoadedVertices; - - void SetVAT(u32 _group0, u32 _group1, u32 _group2); - - void CompileVertexTranslator(); - - void WriteCall(TPipelineFunction); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VERTEXLOADER_H +#define _VERTEXLOADER_H + +#include + +#include "CPMemory.h" +#include "DataReader.h" + +#include "NativeVertexFormat.h" + +class VertexLoaderUID +{ + u32 vid[5]; +public: + VertexLoaderUID() {} + void InitFromCurrentState(int vtx_attr_group) { + vid[0] = g_VtxDesc.Hex & 0xFFFFFFFF; + vid[1] = g_VtxDesc.Hex >> 32; + vid[2] = g_VtxAttr[vtx_attr_group].g0.Hex & ~VAT_0_FRACBITS; + vid[3] = g_VtxAttr[vtx_attr_group].g1.Hex & ~VAT_1_FRACBITS; + vid[4] = g_VtxAttr[vtx_attr_group].g2.Hex & ~VAT_2_FRACBITS; + } + bool operator < (const VertexLoaderUID &other) const { + if (vid[0] < other.vid[0]) + return true; + else if (vid[0] > other.vid[0]) + return false; + for (int i = 1; i < 5; ++i) { + if (vid[i] < other.vid[i]) + return true; + else if (vid[i] > other.vid[i]) + return false; + } + return false; + } +}; + +class VertexLoader +{ +public: + VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr); + ~VertexLoader(); + + int GetVertexSize() const {return m_VertexSize;} + void RunVertices(int vtx_attr_group, int primitive, int count); + + // For debugging / profiling + void AppendToString(std::string *dest); + +private: + enum + { + NRM_ZERO = 0, + NRM_ONE = 1, + NRM_THREE = 3, + }; + + int m_VertexSize; // number of bytes of a raw GC vertex. Computed by CompileVertexTranslator. + + // GC vertex format + TVtxAttr m_VtxAttr; // VAT decoded into easy format + TVtxDesc m_VtxDesc; // Not really used currently - or well it is, but could be easily avoided. + + // PC vertex format + NativeVertexFormat *m_NativeFmt; + int native_stride; + + // Pipeline. To be JIT compiled in the future. + TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower. + int m_numPipelineStages; + + u8 *m_compiledCode; + + int m_numLoadedVertices; + + void SetVAT(u32 _group0, u32 _group1, u32 _group2); + + void CompileVertexTranslator(); + + void WriteCall(TPipelineFunction); +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoaderManager.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoaderManager.h index ed07309210..7b224a7a08 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoaderManager.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoaderManager.h @@ -1,43 +1,43 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VERTEXLOADERMANAGER_H -#define _VERTEXLOADERMANAGER_H - -#include "Common.h" - -namespace VertexLoaderManager -{ - void Init(); - void Shutdown(); - - void MarkAllDirty(); - - int GetVertexSize(int vtx_attr_group); - void RunVertices(int vtx_attr_group, int primitive, int count); - - // For debugging - void AppendListToString(std::string *dest); - - // TODO - don't expose these like this. - // static u8* s_pCurBufferPointer; -}; - -// Might move this into its own file later. -void LoadCPReg(u32 SubCmd, u32 Value); - -#endif // _VERTEXLOADERMANAGER_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VERTEXLOADERMANAGER_H +#define _VERTEXLOADERMANAGER_H + +#include "Common.h" + +namespace VertexLoaderManager +{ + void Init(); + void Shutdown(); + + void MarkAllDirty(); + + int GetVertexSize(int vtx_attr_group); + void RunVertices(int vtx_attr_group, int primitive, int count); + + // For debugging + void AppendListToString(std::string *dest); + + // TODO - don't expose these like this. + // static u8* s_pCurBufferPointer; +}; + +// Might move this into its own file later. +void LoadCPReg(u32 SubCmd, u32 Value); + +#endif // _VERTEXLOADERMANAGER_H diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Color.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Color.h index 3df3b0bba7..09e5370429 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Color.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Color.h @@ -1,42 +1,42 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VERTEXLOADERCOLOR_H -#define _VERTEXLOADERCOLOR_H - -void LOADERDECL Color_ReadDirect_24b_888(); -void LOADERDECL Color_ReadDirect_32b_888x(); -void LOADERDECL Color_ReadDirect_16b_565(); -void LOADERDECL Color_ReadDirect_16b_4444(); -void LOADERDECL Color_ReadDirect_24b_6666(); -void LOADERDECL Color_ReadDirect_32b_8888(); - -void LOADERDECL Color_ReadIndex8_16b_565(); -void LOADERDECL Color_ReadIndex8_24b_888(); -void LOADERDECL Color_ReadIndex8_32b_888x(); -void LOADERDECL Color_ReadIndex8_16b_4444(); -void LOADERDECL Color_ReadIndex8_24b_6666(); -void LOADERDECL Color_ReadIndex8_32b_8888(); - -void LOADERDECL Color_ReadIndex16_16b_565(); -void LOADERDECL Color_ReadIndex16_24b_888(); -void LOADERDECL Color_ReadIndex16_32b_888x(); -void LOADERDECL Color_ReadIndex16_16b_4444(); -void LOADERDECL Color_ReadIndex16_24b_6666(); -void LOADERDECL Color_ReadIndex16_32b_8888(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VERTEXLOADERCOLOR_H +#define _VERTEXLOADERCOLOR_H + +void LOADERDECL Color_ReadDirect_24b_888(); +void LOADERDECL Color_ReadDirect_32b_888x(); +void LOADERDECL Color_ReadDirect_16b_565(); +void LOADERDECL Color_ReadDirect_16b_4444(); +void LOADERDECL Color_ReadDirect_24b_6666(); +void LOADERDECL Color_ReadDirect_32b_8888(); + +void LOADERDECL Color_ReadIndex8_16b_565(); +void LOADERDECL Color_ReadIndex8_24b_888(); +void LOADERDECL Color_ReadIndex8_32b_888x(); +void LOADERDECL Color_ReadIndex8_16b_4444(); +void LOADERDECL Color_ReadIndex8_24b_6666(); +void LOADERDECL Color_ReadIndex8_32b_8888(); + +void LOADERDECL Color_ReadIndex16_16b_565(); +void LOADERDECL Color_ReadIndex16_24b_888(); +void LOADERDECL Color_ReadIndex16_32b_888x(); +void LOADERDECL Color_ReadIndex16_16b_4444(); +void LOADERDECL Color_ReadIndex16_24b_6666(); +void LOADERDECL Color_ReadIndex16_32b_8888(); + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Normal.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Normal.h index 37a72a180c..0ef69f1469 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Normal.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Normal.h @@ -1,111 +1,111 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VERTEXLOADER_NORMAL_H -#define _VERTEXLOADER_NORMAL_H - -#include "CommonTypes.h" - -class VertexLoader_Normal -{ -public: - - // Init - static void Init(void); - - // GetSize - static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements, unsigned int _index3); - - // GetFunction - static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements, unsigned int _index3); - -private: - enum ENormalType - { - NRM_NOT_PRESENT = 0, - NRM_DIRECT = 1, - NRM_INDEX8 = 2, - NRM_INDEX16 = 3, - NUM_NRM_TYPE - }; - - enum ENormalFormat - { - FORMAT_UBYTE = 0, - FORMAT_BYTE = 1, - FORMAT_USHORT = 2, - FORMAT_SHORT = 3, - FORMAT_FLOAT = 4, - NUM_NRM_FORMAT - }; - - enum ENormalElements - { - NRM_NBT = 0, - NRM_NBT3 = 1, - NUM_NRM_ELEMENTS - }; - - enum ENormalIndices - { - NRM_INDICES1 = 0, - NRM_INDICES3 = 1, - NUM_NRM_INDICES - }; - - struct Set { - Set() {} - Set(int gc_size_, TPipelineFunction function_) : gc_size(gc_size_), function(function_) {} - int gc_size; - TPipelineFunction function; -// int pc_size; - }; - - static Set m_Table[NUM_NRM_TYPE][NUM_NRM_INDICES][NUM_NRM_ELEMENTS][NUM_NRM_FORMAT]; - - // direct - static void LOADERDECL Normal_DirectByte(); - static void LOADERDECL Normal_DirectShort(); - static void LOADERDECL Normal_DirectFloat(); - static void LOADERDECL Normal_DirectByte3(); - static void LOADERDECL Normal_DirectShort3(); - static void LOADERDECL Normal_DirectFloat3(); - - // index8 - static void LOADERDECL Normal_Index8_Byte(); - static void LOADERDECL Normal_Index8_Short(); - static void LOADERDECL Normal_Index8_Float(); - static void LOADERDECL Normal_Index8_Byte3_Indices1(); - static void LOADERDECL Normal_Index8_Short3_Indices1(); - static void LOADERDECL Normal_Index8_Float3_Indices1(); - static void LOADERDECL Normal_Index8_Byte3_Indices3(); - static void LOADERDECL Normal_Index8_Short3_Indices3(); - static void LOADERDECL Normal_Index8_Float3_Indices3(); - - // index16 - static void LOADERDECL Normal_Index16_Byte(); - static void LOADERDECL Normal_Index16_Short(); - static void LOADERDECL Normal_Index16_Float(); - static void LOADERDECL Normal_Index16_Byte3_Indices1(); - static void LOADERDECL Normal_Index16_Short3_Indices1(); - static void LOADERDECL Normal_Index16_Float3_Indices1(); - static void LOADERDECL Normal_Index16_Byte3_Indices3(); - static void LOADERDECL Normal_Index16_Short3_Indices3(); - static void LOADERDECL Normal_Index16_Float3_Indices3(); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VERTEXLOADER_NORMAL_H +#define _VERTEXLOADER_NORMAL_H + +#include "CommonTypes.h" + +class VertexLoader_Normal +{ +public: + + // Init + static void Init(void); + + // GetSize + static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements, unsigned int _index3); + + // GetFunction + static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements, unsigned int _index3); + +private: + enum ENormalType + { + NRM_NOT_PRESENT = 0, + NRM_DIRECT = 1, + NRM_INDEX8 = 2, + NRM_INDEX16 = 3, + NUM_NRM_TYPE + }; + + enum ENormalFormat + { + FORMAT_UBYTE = 0, + FORMAT_BYTE = 1, + FORMAT_USHORT = 2, + FORMAT_SHORT = 3, + FORMAT_FLOAT = 4, + NUM_NRM_FORMAT + }; + + enum ENormalElements + { + NRM_NBT = 0, + NRM_NBT3 = 1, + NUM_NRM_ELEMENTS + }; + + enum ENormalIndices + { + NRM_INDICES1 = 0, + NRM_INDICES3 = 1, + NUM_NRM_INDICES + }; + + struct Set { + Set() {} + Set(int gc_size_, TPipelineFunction function_) : gc_size(gc_size_), function(function_) {} + int gc_size; + TPipelineFunction function; +// int pc_size; + }; + + static Set m_Table[NUM_NRM_TYPE][NUM_NRM_INDICES][NUM_NRM_ELEMENTS][NUM_NRM_FORMAT]; + + // direct + static void LOADERDECL Normal_DirectByte(); + static void LOADERDECL Normal_DirectShort(); + static void LOADERDECL Normal_DirectFloat(); + static void LOADERDECL Normal_DirectByte3(); + static void LOADERDECL Normal_DirectShort3(); + static void LOADERDECL Normal_DirectFloat3(); + + // index8 + static void LOADERDECL Normal_Index8_Byte(); + static void LOADERDECL Normal_Index8_Short(); + static void LOADERDECL Normal_Index8_Float(); + static void LOADERDECL Normal_Index8_Byte3_Indices1(); + static void LOADERDECL Normal_Index8_Short3_Indices1(); + static void LOADERDECL Normal_Index8_Float3_Indices1(); + static void LOADERDECL Normal_Index8_Byte3_Indices3(); + static void LOADERDECL Normal_Index8_Short3_Indices3(); + static void LOADERDECL Normal_Index8_Float3_Indices3(); + + // index16 + static void LOADERDECL Normal_Index16_Byte(); + static void LOADERDECL Normal_Index16_Short(); + static void LOADERDECL Normal_Index16_Float(); + static void LOADERDECL Normal_Index16_Byte3_Indices1(); + static void LOADERDECL Normal_Index16_Short3_Indices1(); + static void LOADERDECL Normal_Index16_Float3_Indices1(); + static void LOADERDECL Normal_Index16_Byte3_Indices3(); + static void LOADERDECL Normal_Index16_Short3_Indices3(); + static void LOADERDECL Normal_Index16_Float3_Indices3(); +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Position.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Position.h index 31afccb4b3..4874e25ae3 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Position.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_Position.h @@ -1,39 +1,39 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef VERTEXLOADER_POSITION_H -#define VERTEXLOADER_POSITION_H - -void LOADERDECL Pos_ReadDirect_UByte(); -void LOADERDECL Pos_ReadDirect_Byte(); -void LOADERDECL Pos_ReadDirect_UShort(); -void LOADERDECL Pos_ReadDirect_Short(); -void LOADERDECL Pos_ReadDirect_Float(); - -void LOADERDECL Pos_ReadIndex8_UByte(); -void LOADERDECL Pos_ReadIndex8_Byte(); -void LOADERDECL Pos_ReadIndex8_UShort(); -void LOADERDECL Pos_ReadIndex8_Short(); -void LOADERDECL Pos_ReadIndex8_Float(); - -void LOADERDECL Pos_ReadIndex16_UByte(); -void LOADERDECL Pos_ReadIndex16_Byte(); -void LOADERDECL Pos_ReadIndex16_UShort(); -void LOADERDECL Pos_ReadIndex16_Short(); -void LOADERDECL Pos_ReadIndex16_Float(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef VERTEXLOADER_POSITION_H +#define VERTEXLOADER_POSITION_H + +void LOADERDECL Pos_ReadDirect_UByte(); +void LOADERDECL Pos_ReadDirect_Byte(); +void LOADERDECL Pos_ReadDirect_UShort(); +void LOADERDECL Pos_ReadDirect_Short(); +void LOADERDECL Pos_ReadDirect_Float(); + +void LOADERDECL Pos_ReadIndex8_UByte(); +void LOADERDECL Pos_ReadIndex8_Byte(); +void LOADERDECL Pos_ReadIndex8_UShort(); +void LOADERDECL Pos_ReadIndex8_Short(); +void LOADERDECL Pos_ReadIndex8_Float(); + +void LOADERDECL Pos_ReadIndex16_UByte(); +void LOADERDECL Pos_ReadIndex16_Byte(); +void LOADERDECL Pos_ReadIndex16_UShort(); +void LOADERDECL Pos_ReadIndex16_Short(); +void LOADERDECL Pos_ReadIndex16_Float(); + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_TextCoord.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_TextCoord.h index e7572636db..f61eb71c62 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_TextCoord.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader_TextCoord.h @@ -1,53 +1,53 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef VERTEXLOADER_TEXCOORD_H -#define VERTEXLOADER_TEXCOORD_H - -void LOADERDECL TexCoord_Read_Dummy(); -void LOADERDECL TexCoord_ReadDirect_UByte1(); -void LOADERDECL TexCoord_ReadDirect_UByte2(); -void LOADERDECL TexCoord_ReadDirect_Byte1(); -void LOADERDECL TexCoord_ReadDirect_Byte2(); -void LOADERDECL TexCoord_ReadDirect_UShort1(); -void LOADERDECL TexCoord_ReadDirect_UShort2(); -void LOADERDECL TexCoord_ReadDirect_Short1(); -void LOADERDECL TexCoord_ReadDirect_Short2(); -void LOADERDECL TexCoord_ReadDirect_Float1(); -void LOADERDECL TexCoord_ReadDirect_Float2(); -void LOADERDECL TexCoord_ReadIndex8_UByte1(); -void LOADERDECL TexCoord_ReadIndex8_UByte2(); -void LOADERDECL TexCoord_ReadIndex8_Byte1(); -void LOADERDECL TexCoord_ReadIndex8_Byte2(); -void LOADERDECL TexCoord_ReadIndex8_UShort1(); -void LOADERDECL TexCoord_ReadIndex8_UShort2(); -void LOADERDECL TexCoord_ReadIndex8_Short1(); -void LOADERDECL TexCoord_ReadIndex8_Short2(); -void LOADERDECL TexCoord_ReadIndex8_Float1(); -void LOADERDECL TexCoord_ReadIndex8_Float2(); -void LOADERDECL TexCoord_ReadIndex16_UByte1(); -void LOADERDECL TexCoord_ReadIndex16_UByte2(); -void LOADERDECL TexCoord_ReadIndex16_Byte1(); -void LOADERDECL TexCoord_ReadIndex16_Byte2(); -void LOADERDECL TexCoord_ReadIndex16_UShort1(); -void LOADERDECL TexCoord_ReadIndex16_UShort2(); -void LOADERDECL TexCoord_ReadIndex16_Short1(); -void LOADERDECL TexCoord_ReadIndex16_Short2(); -void LOADERDECL TexCoord_ReadIndex16_Float1(); -void LOADERDECL TexCoord_ReadIndex16_Float2(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef VERTEXLOADER_TEXCOORD_H +#define VERTEXLOADER_TEXCOORD_H + +void LOADERDECL TexCoord_Read_Dummy(); +void LOADERDECL TexCoord_ReadDirect_UByte1(); +void LOADERDECL TexCoord_ReadDirect_UByte2(); +void LOADERDECL TexCoord_ReadDirect_Byte1(); +void LOADERDECL TexCoord_ReadDirect_Byte2(); +void LOADERDECL TexCoord_ReadDirect_UShort1(); +void LOADERDECL TexCoord_ReadDirect_UShort2(); +void LOADERDECL TexCoord_ReadDirect_Short1(); +void LOADERDECL TexCoord_ReadDirect_Short2(); +void LOADERDECL TexCoord_ReadDirect_Float1(); +void LOADERDECL TexCoord_ReadDirect_Float2(); +void LOADERDECL TexCoord_ReadIndex8_UByte1(); +void LOADERDECL TexCoord_ReadIndex8_UByte2(); +void LOADERDECL TexCoord_ReadIndex8_Byte1(); +void LOADERDECL TexCoord_ReadIndex8_Byte2(); +void LOADERDECL TexCoord_ReadIndex8_UShort1(); +void LOADERDECL TexCoord_ReadIndex8_UShort2(); +void LOADERDECL TexCoord_ReadIndex8_Short1(); +void LOADERDECL TexCoord_ReadIndex8_Short2(); +void LOADERDECL TexCoord_ReadIndex8_Float1(); +void LOADERDECL TexCoord_ReadIndex8_Float2(); +void LOADERDECL TexCoord_ReadIndex16_UByte1(); +void LOADERDECL TexCoord_ReadIndex16_UByte2(); +void LOADERDECL TexCoord_ReadIndex16_Byte1(); +void LOADERDECL TexCoord_ReadIndex16_Byte2(); +void LOADERDECL TexCoord_ReadIndex16_UShort1(); +void LOADERDECL TexCoord_ReadIndex16_UShort2(); +void LOADERDECL TexCoord_ReadIndex16_Short1(); +void LOADERDECL TexCoord_ReadIndex16_Short2(); +void LOADERDECL TexCoord_ReadIndex16_Float1(); +void LOADERDECL TexCoord_ReadIndex16_Float2(); + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.h index 84e051ec03..451c847a9e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.h @@ -1,46 +1,46 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#ifndef _VERTEXMANAGER_H -#define _VERTEXMANAGER_H - -#include "CPMemory.h" - -// Handles the OpenGL details of drawing lots of vertices quickly. -// Other functionality is moving out. -namespace VertexManager -{ - -bool Init(); -void Shutdown(); - -void ResetBuffer(); - -void AddVertices(int primitive, int numvertices); -void Flush(); // flushes the current buffer - -int GetRemainingSize(); // remaining space in the current buffer. - -void EnableComponents(u32 components); // very implementation specific - D3D9 won't need this one. - -// TODO: move, rename. -extern u8* s_pCurBufferPointer; - -}; - -#endif // _VERTEXMANAGER_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#ifndef _VERTEXMANAGER_H +#define _VERTEXMANAGER_H + +#include "CPMemory.h" + +// Handles the OpenGL details of drawing lots of vertices quickly. +// Other functionality is moving out. +namespace VertexManager +{ + +bool Init(); +void Shutdown(); + +void ResetBuffer(); + +void AddVertices(int primitive, int numvertices); +void Flush(); // flushes the current buffer + +int GetRemainingSize(); // remaining space in the current buffer. + +void EnableComponents(u32 components); // very implementation specific - D3D9 won't need this one. + +// TODO: move, rename. +extern u8* s_pCurBufferPointer; + +}; + +#endif // _VERTEXMANAGER_H diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h index f5f1d4425d..49ef0fb385 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h @@ -1,131 +1,131 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _VERTEXSHADERMANAGER_H -#define _VERTEXSHADERMANAGER_H - -#include - -#include "GLUtil.h" - -struct VERTEXSHADER -{ - VERTEXSHADER() : glprogid(0) {} - GLuint glprogid; // opengl program id - -#if defined(_DEBUG) || defined(DEBUGFAST) - std::string strprog; -#endif -}; - - -class VERTEXSHADERUID -{ -public: - u32 values[9]; - - VERTEXSHADERUID() { - memset(values, 0, sizeof(values)); - } - - VERTEXSHADERUID(const VERTEXSHADERUID& r) { - for (size_t i = 0; i < sizeof(values) / sizeof(u32); ++i) - values[i] = r.values[i]; - } - - int GetNumValues() const { - return (((values[0] >> 23) & 0xf)*3 + 3)/4 + 3; // numTexGens*3/4+1 - } - - bool operator <(const VERTEXSHADERUID& _Right) const - { - if (values[0] < _Right.values[0]) - return true; - else if (values[0] > _Right.values[0]) - return false; - int N = GetNumValues(); - for (int i = 1; i < N; ++i) { - if (values[i] < _Right.values[i]) - return true; - else if (values[i] > _Right.values[i]) - return false; - } - return false; - } - - bool operator ==(const VERTEXSHADERUID& _Right) const - { - if (values[0] != _Right.values[0]) - return false; - int N = GetNumValues(); - for (int i = 1; i < N; ++i) { - if (values[i] != _Right.values[i]) - return false; - } - return true; - } -}; - - -class VertexShaderMngr -{ - struct VSCacheEntry - { - VERTEXSHADER shader; - int frameCount; - VSCacheEntry() : frameCount(0) {} - void Destroy() { - // printf("Destroying vs %i\n", shader.glprogid); - glDeleteProgramsARB(1, &shader.glprogid); - shader.glprogid = 0; - } - }; - - typedef std::map VSCache; - - static VSCache vshaders; - static VERTEXSHADER* pShaderLast; - - static void GetVertexShaderId(VERTEXSHADERUID& uid, u32 components); - - static void SetVSConstant4f(int const_number, float f1, float f2, float f3, float f4); - static void SetVSConstant4fv(int const_number, const float *f); -public: - static void Init(); - static void Cleanup(); - static void Shutdown(); - static VERTEXSHADER* GetShader(u32 components); - static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram); - - // constant management - static void SetConstants(); - - static void SetViewport(float* _Viewport); - static void SetViewportChanged(); - static void SetProjection(float* _pProjection, int constantIndex = -1); - static void InvalidateXFRange(int start, int end); - static void SetTexMatrixChangedA(u32 Value); - static void SetTexMatrixChangedB(u32 Value); - - static float* GetPosNormalMat(); - static float GetPixelAspectRatio(); -}; - -void LoadXFReg(u32 transferSize, u32 address, u32 *pData); -void LoadIndexedXF(u32 val, int array); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _VERTEXSHADERMANAGER_H +#define _VERTEXSHADERMANAGER_H + +#include + +#include "GLUtil.h" + +struct VERTEXSHADER +{ + VERTEXSHADER() : glprogid(0) {} + GLuint glprogid; // opengl program id + +#if defined(_DEBUG) || defined(DEBUGFAST) + std::string strprog; +#endif +}; + + +class VERTEXSHADERUID +{ +public: + u32 values[9]; + + VERTEXSHADERUID() { + memset(values, 0, sizeof(values)); + } + + VERTEXSHADERUID(const VERTEXSHADERUID& r) { + for (size_t i = 0; i < sizeof(values) / sizeof(u32); ++i) + values[i] = r.values[i]; + } + + int GetNumValues() const { + return (((values[0] >> 23) & 0xf)*3 + 3)/4 + 3; // numTexGens*3/4+1 + } + + bool operator <(const VERTEXSHADERUID& _Right) const + { + if (values[0] < _Right.values[0]) + return true; + else if (values[0] > _Right.values[0]) + return false; + int N = GetNumValues(); + for (int i = 1; i < N; ++i) { + if (values[i] < _Right.values[i]) + return true; + else if (values[i] > _Right.values[i]) + return false; + } + return false; + } + + bool operator ==(const VERTEXSHADERUID& _Right) const + { + if (values[0] != _Right.values[0]) + return false; + int N = GetNumValues(); + for (int i = 1; i < N; ++i) { + if (values[i] != _Right.values[i]) + return false; + } + return true; + } +}; + + +class VertexShaderMngr +{ + struct VSCacheEntry + { + VERTEXSHADER shader; + int frameCount; + VSCacheEntry() : frameCount(0) {} + void Destroy() { + // printf("Destroying vs %i\n", shader.glprogid); + glDeleteProgramsARB(1, &shader.glprogid); + shader.glprogid = 0; + } + }; + + typedef std::map VSCache; + + static VSCache vshaders; + static VERTEXSHADER* pShaderLast; + + static void GetVertexShaderId(VERTEXSHADERUID& uid, u32 components); + + static void SetVSConstant4f(int const_number, float f1, float f2, float f3, float f4); + static void SetVSConstant4fv(int const_number, const float *f); +public: + static void Init(); + static void Cleanup(); + static void Shutdown(); + static VERTEXSHADER* GetShader(u32 components); + static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram); + + // constant management + static void SetConstants(); + + static void SetViewport(float* _Viewport); + static void SetViewportChanged(); + static void SetProjection(float* _pProjection, int constantIndex = -1); + static void InvalidateXFRange(int start, int end); + static void SetTexMatrixChangedA(u32 Value); + static void SetTexMatrixChangedB(u32 Value); + + static float* GetPosNormalMat(); + static float GetPixelAspectRatio(); +}; + +void LoadXFReg(u32 transferSize, u32 address, u32 *pData); +void LoadIndexedXF(u32 val, int array); + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/XFB.h b/Source/Plugins/Plugin_VideoOGL/Src/XFB.h index 4a68334fb2..12437a0248 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/XFB.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/XFB.h @@ -1,33 +1,33 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _XFB_H -#define _XFB_H - -#include "TextureMngr.h" - -void XFB_Init(); - -// write the EFB to the XFB -void XFB_Write(u8 *xfb_in_ram, const TRectangle& sourceRc, u32 dstWd, u32 dstHt); - -// draw the XFB to the screen -void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset); - -void XFB_Shutdown(); - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _XFB_H +#define _XFB_H + +#include "TextureMngr.h" + +void XFB_Init(); + +// write the EFB to the XFB +void XFB_Write(u8 *xfb_in_ram, const TRectangle& sourceRc, u32 dstWd, u32 dstHt); + +// draw the XFB to the screen +void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset); + +void XFB_Shutdown(); + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.h b/Source/Plugins/Plugin_VideoOGL/Src/main.h index 050ab5d6a8..2c488e25d5 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.h @@ -1,25 +1,25 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _MAIN_H -#define _MAIN_H - -#include "pluginspecs_video.h" - -extern SVideoInitialize g_VideoInitialize; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _MAIN_H +#define _MAIN_H + +#include "pluginspecs_video.h" + +extern SVideoInitialize g_VideoInitialize; + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h index 4d8c2b208f..481af08f62 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h @@ -1,41 +1,41 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef RasterFont_Header -#define RasterFont_Header - -class RasterFont { -protected: - int fontOffset; - -public: - RasterFont(); - ~RasterFont(void); - static int debug; - - // some useful constants - enum {char_width = 10}; - enum {char_height = 15}; - - // and the happy helper functions - void printString(const char *s, double x, double y, double z=0.0); - void printCenteredString(const char *s, double y, int screen_width, double z=0.0); - - void printMultilineText(const char *text, double x, double y, double z, int bbWidth, int bbHeight); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef RasterFont_Header +#define RasterFont_Header + +class RasterFont { +protected: + int fontOffset; + +public: + RasterFont(); + ~RasterFont(void); + static int debug; + + // some useful constants + enum {char_width = 10}; + enum {char_height = 15}; + + // and the happy helper functions + void printString(const char *s, double x, double y, double z=0.0); + void printCenteredString(const char *s, double y, int screen_width, double z=0.0); + + void printMultilineText(const char *text, double x, double y, double z, int bbWidth, int bbHeight); +}; + +#endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/stdafx.h b/Source/Plugins/Plugin_VideoOGL/Src/stdafx.h index 5fce96353a..3b33194b09 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/stdafx.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/stdafx.h @@ -1,26 +1,26 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once -#define _WIN32_WINNT 0x501 -#ifndef _WIN32_IE -#define _WIN32_IE 0x0500 // Default value is 0x0400 -#endif - -#include -#include - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once +#define _WIN32_WINNT 0x501 +#ifndef _WIN32_IE +#define _WIN32_IE 0x0500 // Default value is 0x0400 +#endif + +#include +#include + diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.h b/Source/Plugins/Plugin_Wiimote/Src/Config.h index ab97f95f6e..f3d87d692f 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.h +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.h @@ -1,41 +1,41 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _CONFIG_H -#define _CONFIG_H - -#define CONF_LOG 1 -#define CONF_PRIMLOG 2 -#define CONF_SAVETEXTURES 4 -#define CONF_SAVETARGETS 8 -#define CONF_SAVESHADERS 16 - -struct Config -{ - Config(); - void Load(); - void Save(); - - // General - bool bSidewaysDPad; - bool bWideScreen; - bool bNunchuckConnected, bClassicControllerConnected; -}; - -extern Config g_Config; - -#endif // _CONFIG_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _CONFIG_H +#define _CONFIG_H + +#define CONF_LOG 1 +#define CONF_PRIMLOG 2 +#define CONF_SAVETEXTURES 4 +#define CONF_SAVETARGETS 8 +#define CONF_SAVESHADERS 16 + +struct Config +{ + Config(); + void Load(); + void Save(); + + // General + bool bSidewaysDPad; + bool bWideScreen; + bool bNunchuckConnected, bClassicControllerConnected; +}; + +extern Config g_Config; + +#endif // _CONFIG_H diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h index afd91ba404..f8f98345b1 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h @@ -1,86 +1,86 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef __CONFIGDIALOG_h__ -#define __CONFIGDIALOG_h__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#undef ConfigDialog_STYLE -#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - - -class ConfigDialog : public wxDialog -{ - public: - ConfigDialog(wxWindow *parent, wxWindowID id = 1, - const wxString &title = wxT("Wii Remote Plugin Configuration"), - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = ConfigDialog_STYLE); - virtual ~ConfigDialog(); - void CloseClick(wxCommandEvent& event); - - private: - DECLARE_EVENT_TABLE(); - - wxBoxSizer* sGeneral; - wxStaticBoxSizer* sbBasic; - wxGridBagSizer* sBasic; - - wxButton *m_About; - wxButton *m_Close; - wxNotebook *m_Notebook; - wxPanel *m_PageEmu, *m_PageReal; - - wxCheckBox *m_SidewaysDPad; // general settings - wxCheckBox *m_WideScreen; - wxCheckBox *m_NunchuckConnected, *m_ClassicControllerConnected; - - enum - { - ID_CLOSE = 1000, - ID_ABOUTOGL, - - ID_NOTEBOOK, - ID_PAGEEMU, - ID_PAGEREAL, - - ID_SIDEWAYSDPAD, - ID_WIDESCREEN, - ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED - }; - - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); - - void AboutClick(wxCommandEvent& event); - void DoExtensionConnectedDisconnected(); - void GeneralSettingsChanged(wxCommandEvent& event); -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef __CONFIGDIALOG_h__ +#define __CONFIGDIALOG_h__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#undef ConfigDialog_STYLE +#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + + +class ConfigDialog : public wxDialog +{ + public: + ConfigDialog(wxWindow *parent, wxWindowID id = 1, + const wxString &title = wxT("Wii Remote Plugin Configuration"), + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = ConfigDialog_STYLE); + virtual ~ConfigDialog(); + void CloseClick(wxCommandEvent& event); + + private: + DECLARE_EVENT_TABLE(); + + wxBoxSizer* sGeneral; + wxStaticBoxSizer* sbBasic; + wxGridBagSizer* sBasic; + + wxButton *m_About; + wxButton *m_Close; + wxNotebook *m_Notebook; + wxPanel *m_PageEmu, *m_PageReal; + + wxCheckBox *m_SidewaysDPad; // general settings + wxCheckBox *m_WideScreen; + wxCheckBox *m_NunchuckConnected, *m_ClassicControllerConnected; + + enum + { + ID_CLOSE = 1000, + ID_ABOUTOGL, + + ID_NOTEBOOK, + ID_PAGEEMU, + ID_PAGEREAL, + + ID_SIDEWAYSDPAD, + ID_WIDESCREEN, + ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED + }; + + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); + + void AboutClick(wxCommandEvent& event); + void DoExtensionConnectedDisconnected(); + void GeneralSettingsChanged(wxCommandEvent& event); +}; + +#endif diff --git a/Source/Plugins/Plugin_Wiimote/Src/Console.h b/Source/Plugins/Plugin_Wiimote/Src/Console.h index caae103b10..15a44b86b7 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Console.h +++ b/Source/Plugins/Plugin_Wiimote/Src/Console.h @@ -1,26 +1,26 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -void startConsoleWin(int width, int height, char* fname); -int wprintf(const char *fmt, ...); -int aprintf(int a, const char *fmt, ...); -void ClearScreen(); - -#ifdef _WIN32 - HWND GetConsoleHwnd(void); -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +void startConsoleWin(int width, int height, char* fname); +int wprintf(const char *fmt, ...); +int aprintf(int a, const char *fmt, ...); +void ClearScreen(); + +#ifdef _WIN32 + HWND GetConsoleHwnd(void); +#endif diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h index 91a85ec4e1..8f47b971ad 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h @@ -1,64 +1,64 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _EMU_DEFINITIONS_ -#define _EMU_DEFINITIONS_ - -#include "pluginspecs_wiimote.h" - -#include -#include -#include "Common.h" -#include "wiimote_hid.h" -#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd - -extern SWiimoteInitialize g_WiimoteInitialize; -//extern void __Log(int log, const char *format, ...); -//extern void __Log(int log, int v, const char *format, ...); - -namespace WiiMoteEmu -{ - -//****************************************************************************** -// Definitions and variable declarations -//****************************************************************************** - -/* Libogc bounding box, in smoothed IR coordinates: 232,284 792,704, however, it was - possible for me to get a better calibration with these values, if they are not - universal for all PCs we have to make a setting for it. */ -#define LEFT 266 -#define TOP 211 -#define RIGHT 752 -#define BOTTOM 728 -#define SENSOR_BAR_RADIUS 200 - -#define wLEFT 332 -#define wTOP 348 -#define wRIGHT 693 -#define wBOTTOM 625 -#define wSENSOR_BAR_RADIUS 200 - -// vars -#define WIIMOTE_EEPROM_SIZE (16*1024) -#define WIIMOTE_REG_SPEAKER_SIZE 10 -#define WIIMOTE_REG_EXT_SIZE 0x100 -#define WIIMOTE_REG_IR_SIZE 0x34 - - -} // namespace - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _EMU_DEFINITIONS_ +#define _EMU_DEFINITIONS_ + +#include "pluginspecs_wiimote.h" + +#include +#include +#include "Common.h" +#include "wiimote_hid.h" +#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd + +extern SWiimoteInitialize g_WiimoteInitialize; +//extern void __Log(int log, const char *format, ...); +//extern void __Log(int log, int v, const char *format, ...); + +namespace WiiMoteEmu +{ + +//****************************************************************************** +// Definitions and variable declarations +//****************************************************************************** + +/* Libogc bounding box, in smoothed IR coordinates: 232,284 792,704, however, it was + possible for me to get a better calibration with these values, if they are not + universal for all PCs we have to make a setting for it. */ +#define LEFT 266 +#define TOP 211 +#define RIGHT 752 +#define BOTTOM 728 +#define SENSOR_BAR_RADIUS 200 + +#define wLEFT 332 +#define wTOP 348 +#define wRIGHT 693 +#define wBOTTOM 625 +#define wSENSOR_BAR_RADIUS 200 + +// vars +#define WIIMOTE_EEPROM_SIZE (16*1024) +#define WIIMOTE_REG_SPEAKER_SIZE 10 +#define WIIMOTE_REG_EXT_SIZE 0x100 +#define WIIMOTE_REG_IR_SIZE 0x34 + + +} // namespace + #endif //_EMU_DEFINITIONS_ \ No newline at end of file diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h index 573dffe268..760af701e6 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h @@ -1,38 +1,38 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef WIIMOTE_EMU_H -#define WIIMOTE_EMU_H - -#include "wiimote_hid.h" -#include - -namespace WiiMoteEmu -{ - -void Initialize(); -void DoState(void* ptr, int mode); -void Shutdown(void); -void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size); -void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ; -void Update(); - -std::string ArrayToString(const u8 *data, u32 size, u32 offset = 0, int line_len = 20); - -}; - -#endif +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef WIIMOTE_EMU_H +#define WIIMOTE_EMU_H + +#include "wiimote_hid.h" +#include + +namespace WiiMoteEmu +{ + +void Initialize(); +void DoState(void* ptr, int mode); +void Shutdown(void); +void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size); +void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ; +void Update(); + +std::string ArrayToString(const u8 *data, u32 size, u32 offset = 0, int line_len = 20); + +}; + +#endif diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h index f86bfef07c..3af7901baf 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.h @@ -1,159 +1,159 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef _EMU_DECLARATIONS_ -#define _EMU_DECLARATIONS_ - -#include "pluginspecs_wiimote.h" - -#include -#include -#include "Common.h" -#include "wiimote_hid.h" -#include "EmuDefinitions.h" -#include "Encryption.h" -#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd - -extern SWiimoteInitialize g_WiimoteInitialize; -//extern void __Log(int log, const char *format, ...); -//extern void __Log(int log, int v, const char *format, ...); - -namespace WiiMoteEmu -{ - -//****************************************************************************** -// Definitions and variable declarations -//****************************************************************************** - - -extern u8 g_Leds; -extern u8 g_IR; - -extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE]; - -extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE]; -extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE]; -extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE]; -extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE]; - -extern u8 g_ReportingMode; -extern u16 g_ReportingChannel; - -extern wiimote_key g_ExtKey; // extension encryption key - - -static const u8 EepromData_0[] = { - 0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30, - 0xA7, 0x74, 0xD3, 0xA1, 0xAA, 0x8B, 0x99, 0xAE, - 0x9E, 0x78, 0x30, 0xA7, 0x74, 0xD3, 0x82, 0x82, - 0x82, 0x15, 0x9C, 0x9C, 0x9E, 0x38, 0x40, 0x3E, - 0x82, 0x82, 0x82, 0x15, 0x9C, 0x9C, 0x9E, 0x38, - 0x40, 0x3E -}; - -static const u8 EepromData_16D0[] = { - 0x00, 0x00, 0x00, 0xFF, 0x11, 0xEE, 0x00, 0x00, - 0x33, 0xCC, 0x44, 0xBB, 0x00, 0x00, 0x66, 0x99, - 0x77, 0x88, 0x00, 0x00, 0x2B, 0x01, 0xE8, 0x13 -}; - - -/* Default calibration for the nunchuck. It should be written to 0x20 - 0x3f of the - extension register. 0x80 is the neutral x and y accelerators and 0xb3 is the - neutral z accelerometer that is adjusted for gravity. */ -static const u8 nunchuck_calibration[] = -{ - 0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00, - 0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43, - 0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00, - 0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43 -}; - -/* Classic Controller calibration. 0x80 is the neutral for the analog triggers and - sticks. The left analog range is 0x1c - 0xe4 and the right is 0x28 - 0xd8. - We use this range because it's closest to the GC controller range. */ -static const u8 classic_calibration[] = -{ - 0xe4,0x1c,0x80,0xe4, 0x1c,0x80,0xd8,0x28, - 0x80,0xd8,0x28,0x80, 0x20,0x20,0x95,0xea, - 0xe4,0x1c,0x80,0xe4, 0x1c,0x80,0xd8,0x28, - 0x80,0xd8,0x28,0x80, 0x20,0x20,0x95,0xea -}; - - - -/* The Nunchuck id. It should be written to the last bytes of the - extension register */ -static const u8 nunchuck_id[] = -{ - 0x00, 0x00, 0xa4, 0x20, 0x00, 0x00 -}; - -/* The Classic Controller id. It should be written to the last bytes of the - extension register */ -static const u8 classic_id[] = -{ - 0x00, 0x00, 0xa4, 0x20, 0x01, 0x01 -}; - -/* The id for nothing inserted */ -static const u8 nothing_id[] = -{ - 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e -}; - -/* The id for a partially inserted extension */ -static const u8 partially_id[] = -{ - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff -}; - - -void HidOutputReport(u16 _channelID, wm_report* sr); - -void WmLeds(u16 _channelID, wm_leds* leds); -void WmReadData(u16 _channelID, wm_read_data* rd); -void WmWriteData(u16 _channelID, wm_write_data* wd); -void WmRequestStatus(u16 _channelID, wm_request_status* rs); -void WmRequestStatus_(u16 _channelID, int a); -void WmDataReporting(u16 _channelID, wm_data_reporting* dr); - -void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size); -void SendReportCoreAccel(u16 _channelID); -void SendReportCoreAccelIr12(u16 _channelID); -void SendReportCore(u16 _channelID); -void SendReportCoreAccelExt16(u16 _channelID); -void SendReportCoreAccelIr10Ext(u16 _channelID); - -int WriteWmReport(u8* dst, u8 channel); -void WmSendAck(u16 _channelID, u8 _reportID, u32 address); - - -void FillReportAcc(wm_accel& _acc); -void FillReportInfo(wm_core& _core); -void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1); -void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1); -void FillReportExtension(wm_extension& _ext); -void FillReportClassicExtension(wm_classic_extension& _ext); - -u32 convert24bit(const u8* src); -u16 convert16bit(const u8* src); -void GetMousePos(float& x, float& y); - -} // namespace - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef _EMU_DECLARATIONS_ +#define _EMU_DECLARATIONS_ + +#include "pluginspecs_wiimote.h" + +#include +#include +#include "Common.h" +#include "wiimote_hid.h" +#include "EmuDefinitions.h" +#include "Encryption.h" +#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd + +extern SWiimoteInitialize g_WiimoteInitialize; +//extern void __Log(int log, const char *format, ...); +//extern void __Log(int log, int v, const char *format, ...); + +namespace WiiMoteEmu +{ + +//****************************************************************************** +// Definitions and variable declarations +//****************************************************************************** + + +extern u8 g_Leds; +extern u8 g_IR; + +extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE]; + +extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE]; +extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE]; +extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE]; +extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE]; + +extern u8 g_ReportingMode; +extern u16 g_ReportingChannel; + +extern wiimote_key g_ExtKey; // extension encryption key + + +static const u8 EepromData_0[] = { + 0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30, + 0xA7, 0x74, 0xD3, 0xA1, 0xAA, 0x8B, 0x99, 0xAE, + 0x9E, 0x78, 0x30, 0xA7, 0x74, 0xD3, 0x82, 0x82, + 0x82, 0x15, 0x9C, 0x9C, 0x9E, 0x38, 0x40, 0x3E, + 0x82, 0x82, 0x82, 0x15, 0x9C, 0x9C, 0x9E, 0x38, + 0x40, 0x3E +}; + +static const u8 EepromData_16D0[] = { + 0x00, 0x00, 0x00, 0xFF, 0x11, 0xEE, 0x00, 0x00, + 0x33, 0xCC, 0x44, 0xBB, 0x00, 0x00, 0x66, 0x99, + 0x77, 0x88, 0x00, 0x00, 0x2B, 0x01, 0xE8, 0x13 +}; + + +/* Default calibration for the nunchuck. It should be written to 0x20 - 0x3f of the + extension register. 0x80 is the neutral x and y accelerators and 0xb3 is the + neutral z accelerometer that is adjusted for gravity. */ +static const u8 nunchuck_calibration[] = +{ + 0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00, + 0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43, + 0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00, + 0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43 +}; + +/* Classic Controller calibration. 0x80 is the neutral for the analog triggers and + sticks. The left analog range is 0x1c - 0xe4 and the right is 0x28 - 0xd8. + We use this range because it's closest to the GC controller range. */ +static const u8 classic_calibration[] = +{ + 0xe4,0x1c,0x80,0xe4, 0x1c,0x80,0xd8,0x28, + 0x80,0xd8,0x28,0x80, 0x20,0x20,0x95,0xea, + 0xe4,0x1c,0x80,0xe4, 0x1c,0x80,0xd8,0x28, + 0x80,0xd8,0x28,0x80, 0x20,0x20,0x95,0xea +}; + + + +/* The Nunchuck id. It should be written to the last bytes of the + extension register */ +static const u8 nunchuck_id[] = +{ + 0x00, 0x00, 0xa4, 0x20, 0x00, 0x00 +}; + +/* The Classic Controller id. It should be written to the last bytes of the + extension register */ +static const u8 classic_id[] = +{ + 0x00, 0x00, 0xa4, 0x20, 0x01, 0x01 +}; + +/* The id for nothing inserted */ +static const u8 nothing_id[] = +{ + 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e +}; + +/* The id for a partially inserted extension */ +static const u8 partially_id[] = +{ + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff +}; + + +void HidOutputReport(u16 _channelID, wm_report* sr); + +void WmLeds(u16 _channelID, wm_leds* leds); +void WmReadData(u16 _channelID, wm_read_data* rd); +void WmWriteData(u16 _channelID, wm_write_data* wd); +void WmRequestStatus(u16 _channelID, wm_request_status* rs); +void WmRequestStatus_(u16 _channelID, int a); +void WmDataReporting(u16 _channelID, wm_data_reporting* dr); + +void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size); +void SendReportCoreAccel(u16 _channelID); +void SendReportCoreAccelIr12(u16 _channelID); +void SendReportCore(u16 _channelID); +void SendReportCoreAccelExt16(u16 _channelID); +void SendReportCoreAccelIr10Ext(u16 _channelID); + +int WriteWmReport(u8* dst, u8 channel); +void WmSendAck(u16 _channelID, u8 _reportID, u32 address); + + +void FillReportAcc(wm_accel& _acc); +void FillReportInfo(wm_core& _core); +void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1); +void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1); +void FillReportExtension(wm_extension& _ext); +void FillReportClassicExtension(wm_classic_extension& _ext); + +u32 convert24bit(const u8* src); +u16 convert16bit(const u8* src); +void GetMousePos(float& x, float& y); + +} // namespace + #endif //_EMU_DECLARATIONS_ \ No newline at end of file diff --git a/Source/Plugins/Plugin_Wiimote/Src/Encryption.h b/Source/Plugins/Plugin_Wiimote/Src/Encryption.h index c43a416976..d94e90385e 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Encryption.h +++ b/Source/Plugins/Plugin_Wiimote/Src/Encryption.h @@ -1,38 +1,38 @@ -// Copyright (C) 2003-2008 Dolphin Project. -// Copyright (C) Hector Martin "marcan" (hector@marcansoft.com) - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#ifndef WIIMOTE_EXTENSION_ENCRYPTION_H -#define WIIMOTE_EXTENSION_ENCRYPTION_H - - -// =================================================== -/* They key structure to use with wiimote_gen_key() */ -// ---------------- -typedef struct { - u8 ft[8]; - u8 sb[8]; -} wiimote_key; - - -void wiimote_encrypt(wiimote_key *key, u8 *data, int addr, u8 len); - -void wiimote_gen_key(wiimote_key *key, u8 *keydata); - - +// Copyright (C) 2003-2008 Dolphin Project. +// Copyright (C) Hector Martin "marcan" (hector@marcansoft.com) + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#ifndef WIIMOTE_EXTENSION_ENCRYPTION_H +#define WIIMOTE_EXTENSION_ENCRYPTION_H + + +// =================================================== +/* They key structure to use with wiimote_gen_key() */ +// ---------------- +typedef struct { + u8 ft[8]; + u8 sb[8]; +} wiimote_key; + + +void wiimote_encrypt(wiimote_key *key, u8 *data, int addr, u8 len); + +void wiimote_gen_key(wiimote_key *key, u8 *keydata); + + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h b/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h index 42515e8f69..7e8c5bbdcf 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_hid.h @@ -1,289 +1,289 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#ifndef WIIMOTE_HID_H -#define WIIMOTE_HID_H - -#include - -#ifdef _MSC_VER -#pragma warning(disable:4200) -#pragma pack(push, 1) -#endif - -//source: HID_010_SPC_PFL/1.0 (official HID specification) - -struct hid_packet { - u8 param : 4; - u8 type : 4; - u8 data[0]; -}; - -#define HID_TYPE_HANDSHAKE 0 -#define HID_TYPE_SET_REPORT 5 -#define HID_TYPE_DATA 0xA - -#define HID_HANDSHAKE_SUCCESS 0 - -#define HID_PARAM_INPUT 1 -#define HID_PARAM_OUTPUT 2 - -//source: http://wiibrew.org/wiki/Wiimote - -struct wm_report { - u8 channel; - u8 data[0]; -}; - -#define WM_LEDS 0x11 -struct wm_leds { - u8 rumble : 1; - u8 : 3; - u8 leds : 4; -}; - -#define WM_DATA_REPORTING 0x12 -struct wm_data_reporting { - u8 rumble : 1; - u8 continuous : 1; - u8 all_the_time : 1; - u8 : 5; - u8 mode; -}; - -#define WM_IR_PIXEL_CLOCK 0x13 -#define WM_IR_LOGIC 0x1A - -#define WM_REQUEST_STATUS 0x15 -struct wm_request_status { - u8 rumble : 1; - u8 : 7; -}; - -#define WM_STATUS_REPORT 0x20 -struct wm_status_report { - u8 padding1[2]; // two 00 - u8 battery_low : 1; - u8 extension : 1; - u8 speaker : 1; - u8 ir : 1; - u8 leds : 4; - u8 padding2[2]; // two 00 - u8 battery; -}; - -#define WM_WRITE_DATA 0x16 -struct wm_write_data -{ - u8 rumble : 1; - u8 space : 2; //see WM_SPACE_* - u8 : 5; - u8 address[3]; - u8 size; - u8 data[16]; -}; - -#define WM_WRITE_DATA_REPLY 0x22 //empty, afaik -struct wm_acknowledge -{ - u8 Channel; - u8 unk0; - u8 unk1; - u8 reportID; - u8 errorID; -}; - - -#define WM_READ_DATA 0x17 -struct wm_read_data { - u8 rumble : 1; - u8 space : 2; //see WM_SPACE_* - u8 : 5; - u8 address[3]; - u8 size[2]; -}; - -#define WM_SPACE_EEPROM 0 -#define WM_SPACE_REGS1 1 -#define WM_SPACE_REGS2 2 -#define WM_SPACE_INVALID 3 - -#define WM_READ_DATA_REPLY 0x21 -struct wm_read_data_reply { - u16 buttons; - u8 error : 4; //see WM_RDERR_* - u8 size : 4; - u16 address; - u8 data[16]; -}; - -#define WM_RDERR_WOREG 7 -#define WM_RDERR_NOMEM 8 - -struct wm_core { - u8 left : 1; - u8 right : 1; - u8 down : 1; - u8 up : 1; - u8 plus : 1; - u8 : 3; - u8 two : 1; - u8 one : 1; - u8 b : 1; - u8 a : 1; - u8 minus : 1; - u8 : 2; - u8 home : 1; -}; - -struct wm_accel { - u8 x, y, z; -}; - -//filled with 0xFF if empty -struct wm_ir_basic -{ - u8 x1; - u8 y1; - u8 x2Hi : 2; - u8 y2Hi : 2; - u8 x1Hi : 2; - u8 y1Hi : 2; - u8 x2; - u8 y2; -}; - -struct wm_ir_extended -{ - u8 x; - u8 y; - u8 size : 4; - u8 xHi : 2; - u8 yHi : 2; -}; - -struct wm_extension -{ - u8 jx; // joystick x, y - u8 jy; - u8 ax; // accelerometer - u8 ay; - u8 az; - u8 bt; // buttons -}; - -struct wm_cc_4 -{ - u8 padding : 1; - u8 bRT : 1; - u8 bP : 1; - u8 bH : 1; - u8 bM : 1; - u8 bLT : 1; - u8 bdD : 1; - u8 bdR : 1; -}; - -struct wm_cc_5 -{ - u8 bdU : 1; - u8 bdL : 1; - u8 bZR : 1; - u8 bX : 1; - u8 bA : 1; - u8 bY : 1; - u8 bB : 1; - u8 bZL : 1; -}; - -struct wm_classic_extension -{ - u8 Lx : 6; // byte 0 - u8 Rx : 2; - u8 Ly : 6; // byte 1 - u8 Rx2 : 2; - u8 Ry : 5; // byte 2 - u8 lT : 2; - u8 Rx3 : 1; - u8 rT : 5; // byte 3 - u8 lT2 : 3; - wm_cc_4 b1; // byte 4 - wm_cc_5 b2; // byte 5 -}; - -#define WM_REPORT_CORE 0x30 -struct wm_report_core { - wm_core c; -}; - -#define WM_REPORT_CORE_ACCEL 0x31 -struct wm_report_core_accel { - wm_core c; - wm_accel a; -}; - -#define WM_REPORT_CORE_EXT8 0x32 - -#define WM_REPORT_CORE_ACCEL_IR12 0x33 -struct wm_report_core_accel_ir12 { - wm_core c; - wm_accel a; - wm_ir_extended ir[4]; -}; - -#define WM_REPORT_CORE_EXT19 0x34 -#define WM_REPORT_CORE_ACCEL_EXT16 0x35 -struct wm_report_core_accel_ext16 -{ - wm_core c; - wm_accel a; - wm_extension ext; - //wm_ir_basic ir[2]; - u8 pad[10]; - -}; - -#define WM_REPORT_CORE_IR10_EXT9 0x36 - -#define WM_REPORT_CORE_ACCEL_IR10_EXT6 0x37 -struct wm_report_core_accel_ir10_ext6 -{ - wm_core c; - wm_accel a; - wm_ir_basic ir[2]; - //u8 ext[6]; - wm_extension ext; -}; - -#define WM_REPORT_EXT21 0x3d // never used? -struct wm_report_ext21 -{ - u8 ext[21]; -}; - -#define WM_REPORT_INTERLEAVE1 0x3e -#define WM_REPORT_INTERLEAVE2 0x3f - -#define WM_SPEAKER_ENABLE 0x14 -#define WM_SPEAKER_MUTE 0x19 - - -#if defined(_MSC_VER) -#pragma pack(pop) -#endif - -#endif //WIIMOTE_HID_H +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#ifndef WIIMOTE_HID_H +#define WIIMOTE_HID_H + +#include + +#ifdef _MSC_VER +#pragma warning(disable:4200) +#pragma pack(push, 1) +#endif + +//source: HID_010_SPC_PFL/1.0 (official HID specification) + +struct hid_packet { + u8 param : 4; + u8 type : 4; + u8 data[0]; +}; + +#define HID_TYPE_HANDSHAKE 0 +#define HID_TYPE_SET_REPORT 5 +#define HID_TYPE_DATA 0xA + +#define HID_HANDSHAKE_SUCCESS 0 + +#define HID_PARAM_INPUT 1 +#define HID_PARAM_OUTPUT 2 + +//source: http://wiibrew.org/wiki/Wiimote + +struct wm_report { + u8 channel; + u8 data[0]; +}; + +#define WM_LEDS 0x11 +struct wm_leds { + u8 rumble : 1; + u8 : 3; + u8 leds : 4; +}; + +#define WM_DATA_REPORTING 0x12 +struct wm_data_reporting { + u8 rumble : 1; + u8 continuous : 1; + u8 all_the_time : 1; + u8 : 5; + u8 mode; +}; + +#define WM_IR_PIXEL_CLOCK 0x13 +#define WM_IR_LOGIC 0x1A + +#define WM_REQUEST_STATUS 0x15 +struct wm_request_status { + u8 rumble : 1; + u8 : 7; +}; + +#define WM_STATUS_REPORT 0x20 +struct wm_status_report { + u8 padding1[2]; // two 00 + u8 battery_low : 1; + u8 extension : 1; + u8 speaker : 1; + u8 ir : 1; + u8 leds : 4; + u8 padding2[2]; // two 00 + u8 battery; +}; + +#define WM_WRITE_DATA 0x16 +struct wm_write_data +{ + u8 rumble : 1; + u8 space : 2; //see WM_SPACE_* + u8 : 5; + u8 address[3]; + u8 size; + u8 data[16]; +}; + +#define WM_WRITE_DATA_REPLY 0x22 //empty, afaik +struct wm_acknowledge +{ + u8 Channel; + u8 unk0; + u8 unk1; + u8 reportID; + u8 errorID; +}; + + +#define WM_READ_DATA 0x17 +struct wm_read_data { + u8 rumble : 1; + u8 space : 2; //see WM_SPACE_* + u8 : 5; + u8 address[3]; + u8 size[2]; +}; + +#define WM_SPACE_EEPROM 0 +#define WM_SPACE_REGS1 1 +#define WM_SPACE_REGS2 2 +#define WM_SPACE_INVALID 3 + +#define WM_READ_DATA_REPLY 0x21 +struct wm_read_data_reply { + u16 buttons; + u8 error : 4; //see WM_RDERR_* + u8 size : 4; + u16 address; + u8 data[16]; +}; + +#define WM_RDERR_WOREG 7 +#define WM_RDERR_NOMEM 8 + +struct wm_core { + u8 left : 1; + u8 right : 1; + u8 down : 1; + u8 up : 1; + u8 plus : 1; + u8 : 3; + u8 two : 1; + u8 one : 1; + u8 b : 1; + u8 a : 1; + u8 minus : 1; + u8 : 2; + u8 home : 1; +}; + +struct wm_accel { + u8 x, y, z; +}; + +//filled with 0xFF if empty +struct wm_ir_basic +{ + u8 x1; + u8 y1; + u8 x2Hi : 2; + u8 y2Hi : 2; + u8 x1Hi : 2; + u8 y1Hi : 2; + u8 x2; + u8 y2; +}; + +struct wm_ir_extended +{ + u8 x; + u8 y; + u8 size : 4; + u8 xHi : 2; + u8 yHi : 2; +}; + +struct wm_extension +{ + u8 jx; // joystick x, y + u8 jy; + u8 ax; // accelerometer + u8 ay; + u8 az; + u8 bt; // buttons +}; + +struct wm_cc_4 +{ + u8 padding : 1; + u8 bRT : 1; + u8 bP : 1; + u8 bH : 1; + u8 bM : 1; + u8 bLT : 1; + u8 bdD : 1; + u8 bdR : 1; +}; + +struct wm_cc_5 +{ + u8 bdU : 1; + u8 bdL : 1; + u8 bZR : 1; + u8 bX : 1; + u8 bA : 1; + u8 bY : 1; + u8 bB : 1; + u8 bZL : 1; +}; + +struct wm_classic_extension +{ + u8 Lx : 6; // byte 0 + u8 Rx : 2; + u8 Ly : 6; // byte 1 + u8 Rx2 : 2; + u8 Ry : 5; // byte 2 + u8 lT : 2; + u8 Rx3 : 1; + u8 rT : 5; // byte 3 + u8 lT2 : 3; + wm_cc_4 b1; // byte 4 + wm_cc_5 b2; // byte 5 +}; + +#define WM_REPORT_CORE 0x30 +struct wm_report_core { + wm_core c; +}; + +#define WM_REPORT_CORE_ACCEL 0x31 +struct wm_report_core_accel { + wm_core c; + wm_accel a; +}; + +#define WM_REPORT_CORE_EXT8 0x32 + +#define WM_REPORT_CORE_ACCEL_IR12 0x33 +struct wm_report_core_accel_ir12 { + wm_core c; + wm_accel a; + wm_ir_extended ir[4]; +}; + +#define WM_REPORT_CORE_EXT19 0x34 +#define WM_REPORT_CORE_ACCEL_EXT16 0x35 +struct wm_report_core_accel_ext16 +{ + wm_core c; + wm_accel a; + wm_extension ext; + //wm_ir_basic ir[2]; + u8 pad[10]; + +}; + +#define WM_REPORT_CORE_IR10_EXT9 0x36 + +#define WM_REPORT_CORE_ACCEL_IR10_EXT6 0x37 +struct wm_report_core_accel_ir10_ext6 +{ + wm_core c; + wm_accel a; + wm_ir_basic ir[2]; + //u8 ext[6]; + wm_extension ext; +}; + +#define WM_REPORT_EXT21 0x3d // never used? +struct wm_report_ext21 +{ + u8 ext[21]; +}; + +#define WM_REPORT_INTERLEAVE1 0x3e +#define WM_REPORT_INTERLEAVE2 0x3f + +#define WM_SPEAKER_ENABLE 0x14 +#define WM_SPEAKER_MUTE 0x19 + + +#if defined(_MSC_VER) +#pragma pack(pop) +#endif + +#endif //WIIMOTE_HID_H diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h index 14edd430d3..92ba15af75 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h @@ -1,34 +1,34 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#ifndef WIIMOTE_REAL_H -#define WIIMOTE_REAL_H - -namespace WiiMoteReal -{ - -int Initialize(); -void DoState(void* ptr, int mode); -void Shutdown(void); -void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size); -void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ; -void Update(); - -}; - +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + +#ifndef WIIMOTE_REAL_H +#define WIIMOTE_REAL_H + +namespace WiiMoteReal +{ + +int Initialize(); +void DoState(void* ptr, int mode); +void Shutdown(void); +void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size); +void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ; +void Update(); + +}; + #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/AboutBox.h b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/AboutBox.h index 458b681776..a9c57ab272 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/AboutBox.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/AboutBox.h @@ -1,92 +1,92 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Project description -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy -// Description: A Dolphin Compatible Input Plugin -// -// Author: Falcon4ever (nJoy@falcon4ever.com) -// Site: www.multigesture.net -// Copyright (C) 2003-2008 Dolphin Project. -// -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef __ABOUTBOX_h__ -#define __ABOUTBOX_h__ - -#ifndef WX_PRECOMP - #include - #include -#else - #include -#endif - -#include -#include -#include -#include - -#undef AboutBox_STYLE -#define AboutBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - -class AboutBox : public wxDialog -{ - private: - DECLARE_EVENT_TABLE(); - - public: - AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = AboutBox_STYLE); - virtual ~AboutBox(); - void OKClick(wxCommandEvent& event); - - private: - wxStaticText *m_thankyoutext; - wxStaticText *m_specialthanks; - wxStaticText *m_pluginversion; - wxButton *m_OK; - wxStaticText *m_version; - wxStaticBox *m_thankyougroup; - wxStaticBox *m_specialthanksgroup; - wxStaticBox *m_pluginversiongroup; - wxStaticBitmap *m_njoylogo; - - private: - enum - { - ID_THANKYOU = 1009, - ID_SPECIALTHANKS = 1008, - ID_PLUGINVERSION = 1007, - ID_OK = 1006, - ID_STATUSV = 1005, - IDG_THANKYOU = 1004, - IDG_SPECIALTHANKS = 1003, - IDG_PLUGINVERSION = 1002, - ID_AWESOMEPICTURE = 1001, - - ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values - }; - - private: - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); -}; - -#endif +////////////////////////////////////////////////////////////////////////////////////////// +// Project description +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +// Name: nJoy +// Description: A Dolphin Compatible Input Plugin +// +// Author: Falcon4ever (nJoy@falcon4ever.com) +// Site: www.multigesture.net +// Copyright (C) 2003-2008 Dolphin Project. +// +////////////////////////////////////////////////////////////////////////////////////////// +// +// Licensetype: GNU General Public License (GPL) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. +// +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ +// +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// +////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef __ABOUTBOX_h__ +#define __ABOUTBOX_h__ + +#ifndef WX_PRECOMP + #include + #include +#else + #include +#endif + +#include +#include +#include +#include + +#undef AboutBox_STYLE +#define AboutBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + +class AboutBox : public wxDialog +{ + private: + DECLARE_EVENT_TABLE(); + + public: + AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = AboutBox_STYLE); + virtual ~AboutBox(); + void OKClick(wxCommandEvent& event); + + private: + wxStaticText *m_thankyoutext; + wxStaticText *m_specialthanks; + wxStaticText *m_pluginversion; + wxButton *m_OK; + wxStaticText *m_version; + wxStaticBox *m_thankyougroup; + wxStaticBox *m_specialthanksgroup; + wxStaticBox *m_pluginversiongroup; + wxStaticBitmap *m_njoylogo; + + private: + enum + { + ID_THANKYOU = 1009, + ID_SPECIALTHANKS = 1008, + ID_PLUGINVERSION = 1007, + ID_OK = 1006, + ID_STATUSV = 1005, + IDG_THANKYOU = 1004, + IDG_SPECIALTHANKS = 1003, + IDG_PLUGINVERSION = 1002, + ID_AWESOMEPICTURE = 1001, + + ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values + }; + + private: + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); +}; + +#endif diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h index df745dfc55..4c450f16fc 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.h @@ -1,240 +1,240 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Project description -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy -// Description: A Dolphin Compatible Input Plugin -// -// Author: Falcon4ever (nJoy@falcon4ever.com) -// Site: www.multigesture.net -// Copyright (C) 2003-2008 Dolphin Project. -// -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef __CONFIGBOX_h__ -#define __CONFIGBOX_h__ - -#ifndef WX_PRECOMP - #include - #include -#else - #include -#endif - -#include -#include -#include -#include -#include -#include - -#undef ConfigBox_STYLE -#define ConfigBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - -class ConfigBox : public wxDialog -{ - private: - DECLARE_EVENT_TABLE(); - - public: - ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigBox_STYLE); - virtual ~ConfigBox(); - - private: - wxButton *m_About; - wxButton *m_OK; - wxButton *m_Cancel; - - wxPanel *m_Controller[4]; - wxNotebook *m_Notebook; - - wxComboBox *m_Joyname[4]; - wxComboBox *m_Controltype[4]; - wxComboBox *m_Deadzone[4]; - - wxCheckBox *m_Joyattach[4]; - - wxStaticBox *m_gJoyname[4]; - wxStaticBox *m_gExtrasettings[4]; - wxStaticBox *m_gControllertype[4]; - - wxTextCtrl *m_JoyShoulderL[4]; - wxTextCtrl *m_JoyShoulderR[4]; - - wxButton *m_bJoyShoulderL[4]; - wxButton *m_bJoyShoulderR[4]; - - wxTextCtrl *m_JoyButtonA[4]; - wxTextCtrl *m_JoyButtonB[4]; - wxTextCtrl *m_JoyButtonX[4]; - wxTextCtrl *m_JoyButtonY[4]; - wxTextCtrl *m_JoyButtonZ[4]; - wxTextCtrl *m_JoyButtonStart[4]; - wxTextCtrl *m_JoyButtonHalfpress[4]; - - wxButton *m_bJoyButtonA[4]; - wxButton *m_bJoyButtonB[4]; - wxButton *m_bJoyButtonX[4]; - wxButton *m_bJoyButtonY[4]; - wxButton *m_bJoyButtonZ[4]; - wxButton *m_bJoyButtonStart[4]; - wxButton *m_bJoyButtonHalfpress[4]; - - wxTextCtrl *m_JoyAnalogMainX[4]; - wxTextCtrl *m_JoyAnalogMainY[4]; - wxTextCtrl *m_JoyAnalogSubX[4]; - wxTextCtrl *m_JoyAnalogSubY[4]; - - wxButton *m_bJoyAnalogMainX[4]; - wxButton *m_bJoyAnalogMainY[4]; - wxButton *m_bJoyAnalogSubX[4]; - wxButton *m_bJoyAnalogSubY[4]; - - wxTextCtrl *m_JoyDpadUp[4]; - wxTextCtrl *m_JoyDpadDown[4]; - wxTextCtrl *m_JoyDpadLeft[4]; - wxTextCtrl *m_JoyDpadRight[4]; - - wxButton *m_bJoyDpadUp[4]; - wxButton *m_bJoyDpadDown[4]; - wxButton *m_bJoyDpadLeft[4]; - wxButton *m_bJoyDpadRight[4]; - - wxStaticText *m_textMainX[4]; - wxStaticText *m_textMainY[4]; - wxStaticText *m_textDpadUp[4]; - wxStaticText *m_textDpadDown[4]; - wxStaticText *m_textDpadLeft[4]; - wxStaticText *m_textDpadRight[4]; - wxStaticText *m_textDeadzone[4]; - wxStaticText *m_textHalfpress[4]; - wxStaticText *m_textSubX[4]; - wxStaticText *m_textSubY[4]; - wxStaticText *m_textWebsite[4]; - - wxTextCtrl *m_PlaceholderBMP[4]; - wxStaticBitmap *m_controllerimage[4]; - - int notebookpage; - private: - enum - { - ID_ABOUT = 1000, - ID_OK, - ID_CANCEL, - ID_NOTEBOOK, - ID_CONTROLLERPAGE1, - ID_CONTROLLERPAGE2, - ID_CONTROLLERPAGE3, - ID_CONTROLLERPAGE4, - - IDC_JOYNAME, - IDC_CONTROLTYPE, - IDC_DEADZONE, - - IDC_JOYATTACH, - IDG_JOYSTICK, - IDG_EXTRASETTINGS, - IDG_CONTROLLERTYPE, - ID_CONTROLLERPICTURE, - - ID_SHOULDER_L = 2000, - ID_SHOULDER_R, - - ID_BUTTON_A, - ID_BUTTON_B, - ID_BUTTON_X, - ID_BUTTON_Y, - ID_BUTTON_Z, - ID_BUTTONSTART, - ID_BUTTONHALFPRESS, - - ID_ANALOG_MAIN_X, - ID_ANALOG_MAIN_Y, - ID_ANALOG_SUB_X, - ID_ANALOG_SUB_Y, - - ID_DPAD_UP, - ID_DPAD_DOWN, - ID_DPAD_LEFT, - ID_DPAD_RIGHT, - - IDB_SHOULDER_L = 3000, - IDB_SHOULDER_R, - - IDB_BUTTON_A, - IDB_BUTTON_B, - IDB_BUTTON_X, - IDB_BUTTON_Y, - IDB_BUTTON_Z, - IDB_BUTTONSTART, - IDB_BUTTONHALFPRESS, - - IDB_ANALOG_MAIN_X, - IDB_ANALOG_MAIN_Y, - IDB_ANALOG_SUB_X, - IDB_ANALOG_SUB_Y, - - IDB_DPAD_UP, - IDB_DPAD_DOWN, - IDB_DPAD_LEFT, - IDB_DPAD_RIGHT, - - IDT_ANALOG_MAIN_X = 4000, - IDT_ANALOG_MAIN_Y, - IDT_DPAD_UP, - IDT_DPAD_DOWN, - IDT_DPAD_LEFT, - IDT_DPAD_RIGHT, - IDT_DEADZONE, - IDT_BUTTONHALFPRESS, - IDT_ANALOG_SUB_X, - IDT_ANALOG_SUB_Y, - IDT_WEBSITE, - - ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values - }; - - private: - void AboutClick(wxCommandEvent& event); - void OKClick(wxCommandEvent& event); - void CancelClick(wxCommandEvent& event); - - void ChangeJoystick(wxCommandEvent& event); - void ChangeControllertype(wxCommandEvent& event); - - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); - - void SetControllerAll(int controller); - void UpdateVisibleItems(int controller); - void GetControllerAll(int controller); - - void NotebookPageChanged(wxNotebookEvent& event); - - void GetButtons(wxCommandEvent& event); - void GetHats(int ID); - void GetAxis(wxCommandEvent& event); - - void SetButtonText(int id, char text[128]); -}; - -#endif +////////////////////////////////////////////////////////////////////////////////////////// +// Project description +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +// Name: nJoy +// Description: A Dolphin Compatible Input Plugin +// +// Author: Falcon4ever (nJoy@falcon4ever.com) +// Site: www.multigesture.net +// Copyright (C) 2003-2008 Dolphin Project. +// +////////////////////////////////////////////////////////////////////////////////////////// +// +// Licensetype: GNU General Public License (GPL) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. +// +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ +// +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// +////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef __CONFIGBOX_h__ +#define __CONFIGBOX_h__ + +#ifndef WX_PRECOMP + #include + #include +#else + #include +#endif + +#include +#include +#include +#include +#include +#include + +#undef ConfigBox_STYLE +#define ConfigBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + +class ConfigBox : public wxDialog +{ + private: + DECLARE_EVENT_TABLE(); + + public: + ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigBox_STYLE); + virtual ~ConfigBox(); + + private: + wxButton *m_About; + wxButton *m_OK; + wxButton *m_Cancel; + + wxPanel *m_Controller[4]; + wxNotebook *m_Notebook; + + wxComboBox *m_Joyname[4]; + wxComboBox *m_Controltype[4]; + wxComboBox *m_Deadzone[4]; + + wxCheckBox *m_Joyattach[4]; + + wxStaticBox *m_gJoyname[4]; + wxStaticBox *m_gExtrasettings[4]; + wxStaticBox *m_gControllertype[4]; + + wxTextCtrl *m_JoyShoulderL[4]; + wxTextCtrl *m_JoyShoulderR[4]; + + wxButton *m_bJoyShoulderL[4]; + wxButton *m_bJoyShoulderR[4]; + + wxTextCtrl *m_JoyButtonA[4]; + wxTextCtrl *m_JoyButtonB[4]; + wxTextCtrl *m_JoyButtonX[4]; + wxTextCtrl *m_JoyButtonY[4]; + wxTextCtrl *m_JoyButtonZ[4]; + wxTextCtrl *m_JoyButtonStart[4]; + wxTextCtrl *m_JoyButtonHalfpress[4]; + + wxButton *m_bJoyButtonA[4]; + wxButton *m_bJoyButtonB[4]; + wxButton *m_bJoyButtonX[4]; + wxButton *m_bJoyButtonY[4]; + wxButton *m_bJoyButtonZ[4]; + wxButton *m_bJoyButtonStart[4]; + wxButton *m_bJoyButtonHalfpress[4]; + + wxTextCtrl *m_JoyAnalogMainX[4]; + wxTextCtrl *m_JoyAnalogMainY[4]; + wxTextCtrl *m_JoyAnalogSubX[4]; + wxTextCtrl *m_JoyAnalogSubY[4]; + + wxButton *m_bJoyAnalogMainX[4]; + wxButton *m_bJoyAnalogMainY[4]; + wxButton *m_bJoyAnalogSubX[4]; + wxButton *m_bJoyAnalogSubY[4]; + + wxTextCtrl *m_JoyDpadUp[4]; + wxTextCtrl *m_JoyDpadDown[4]; + wxTextCtrl *m_JoyDpadLeft[4]; + wxTextCtrl *m_JoyDpadRight[4]; + + wxButton *m_bJoyDpadUp[4]; + wxButton *m_bJoyDpadDown[4]; + wxButton *m_bJoyDpadLeft[4]; + wxButton *m_bJoyDpadRight[4]; + + wxStaticText *m_textMainX[4]; + wxStaticText *m_textMainY[4]; + wxStaticText *m_textDpadUp[4]; + wxStaticText *m_textDpadDown[4]; + wxStaticText *m_textDpadLeft[4]; + wxStaticText *m_textDpadRight[4]; + wxStaticText *m_textDeadzone[4]; + wxStaticText *m_textHalfpress[4]; + wxStaticText *m_textSubX[4]; + wxStaticText *m_textSubY[4]; + wxStaticText *m_textWebsite[4]; + + wxTextCtrl *m_PlaceholderBMP[4]; + wxStaticBitmap *m_controllerimage[4]; + + int notebookpage; + private: + enum + { + ID_ABOUT = 1000, + ID_OK, + ID_CANCEL, + ID_NOTEBOOK, + ID_CONTROLLERPAGE1, + ID_CONTROLLERPAGE2, + ID_CONTROLLERPAGE3, + ID_CONTROLLERPAGE4, + + IDC_JOYNAME, + IDC_CONTROLTYPE, + IDC_DEADZONE, + + IDC_JOYATTACH, + IDG_JOYSTICK, + IDG_EXTRASETTINGS, + IDG_CONTROLLERTYPE, + ID_CONTROLLERPICTURE, + + ID_SHOULDER_L = 2000, + ID_SHOULDER_R, + + ID_BUTTON_A, + ID_BUTTON_B, + ID_BUTTON_X, + ID_BUTTON_Y, + ID_BUTTON_Z, + ID_BUTTONSTART, + ID_BUTTONHALFPRESS, + + ID_ANALOG_MAIN_X, + ID_ANALOG_MAIN_Y, + ID_ANALOG_SUB_X, + ID_ANALOG_SUB_Y, + + ID_DPAD_UP, + ID_DPAD_DOWN, + ID_DPAD_LEFT, + ID_DPAD_RIGHT, + + IDB_SHOULDER_L = 3000, + IDB_SHOULDER_R, + + IDB_BUTTON_A, + IDB_BUTTON_B, + IDB_BUTTON_X, + IDB_BUTTON_Y, + IDB_BUTTON_Z, + IDB_BUTTONSTART, + IDB_BUTTONHALFPRESS, + + IDB_ANALOG_MAIN_X, + IDB_ANALOG_MAIN_Y, + IDB_ANALOG_SUB_X, + IDB_ANALOG_SUB_Y, + + IDB_DPAD_UP, + IDB_DPAD_DOWN, + IDB_DPAD_LEFT, + IDB_DPAD_RIGHT, + + IDT_ANALOG_MAIN_X = 4000, + IDT_ANALOG_MAIN_Y, + IDT_DPAD_UP, + IDT_DPAD_DOWN, + IDT_DPAD_LEFT, + IDT_DPAD_RIGHT, + IDT_DEADZONE, + IDT_BUTTONHALFPRESS, + IDT_ANALOG_SUB_X, + IDT_ANALOG_SUB_Y, + IDT_WEBSITE, + + ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values + }; + + private: + void AboutClick(wxCommandEvent& event); + void OKClick(wxCommandEvent& event); + void CancelClick(wxCommandEvent& event); + + void ChangeJoystick(wxCommandEvent& event); + void ChangeControllertype(wxCommandEvent& event); + + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); + + void SetControllerAll(int controller); + void UpdateVisibleItems(int controller); + void GetControllerAll(int controller); + + void NotebookPageChanged(wxNotebookEvent& event); + + void GetButtons(wxCommandEvent& event); + void GetHats(int ID); + void GetAxis(wxCommandEvent& event); + + void SetButtonText(int id, char text[128]); +}; + +#endif diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h index 9809df7d00..f6418d27c1 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h @@ -1,176 +1,176 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Project description -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy -// Description: A Dolphin Compatible Input Plugin -// -// Author: Falcon4ever (nJoy@falcon4ever.com) -// Site: www.multigesture.net -// Copyright (C) 2003-2008 Dolphin Project. -// -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -// Set this if you want to use the rumble 'hack' for controller one -//#define USE_RUMBLE_DINPUT_HACK - -#ifdef _WIN32 -#define _CRT_SECURE_NO_WARNINGS -#define DIRECTINPUT_VERSION 0x0800 -#define WIN32_LEAN_AND_MEAN -#include -#include - -#ifdef USE_RUMBLE_DINPUT_HACK -#include // used for rumble -#endif - -#endif - -#include -#include -#include -#include - -#ifdef _WIN32 -#define SLEEP(x) Sleep(x) -#else -#include -#include -#define SLEEP(x) usleep(x*1000) -#endif -#ifdef __linux__ -#include -#endif - -#include "GUI/AboutBox.h" -#include "GUI/ConfigBox.h" - -#include "Common.h" -#include "pluginspecs_pad.h" -#include "IniFile.h" - -#ifdef _WIN32 -#pragma comment(lib, "SDL.lib") -#pragma comment(lib, "comctl32.lib") - -// Required for the rumble part -#ifdef USE_RUMBLE_DINPUT_HACK -#pragma comment(lib, "dxguid.lib") -#pragma comment(lib, "dinput8.lib") -#pragma comment(lib, "winmm.lib") -#endif -#endif - -////////////////////////////////////////////////////////////////////////////////////////// -// Define -// ŻŻŻŻŻŻ - -#define INPUT_VERSION "0.3" -#define INPUT_STATE "PUBLIC RELEASE" -#define RELDAY "21" -#define RELMONTH "07" -#define RELYEAR "2008" -#define THANKYOU "`plot`, Absolute0, Aprentice, Bositman, Brice, ChaosCode, CKemu, CoDeX, Dave2001, dn, drk||Raziel, Florin, Gent, Gigaherz, Hacktarux, JegHegy, Linker, Linuzappz, Martin64, Muad, Knuckles, Raziel, Refraction, Rudy_x, Shadowprince, Snake785, Saqib, vEX, yaz0r, Zilmar, Zenogais and ZeZu." - -////////////////////////////////////////////////////////////////////////////////////////// -// Structures -// ŻŻŻŻŻŻŻŻŻŻ - -struct CONTROLLER_STATE{ // GC PAD INFO/STATE - int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons - int dpad; // 1 HAT (8 directions + neutral) - int dpad2[4]; // d-pad using buttons - int axis[4]; // 2 x 2 Axes (Main & Sub) - int halfpress; // ... - SDL_Joystick *joy; // SDL joystick device -}; - -struct CONTROLLER_MAPPING{ // GC PAD MAPPING - int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons - int dpad; // 1 HAT (8 directions + neutral) - int dpad2[4]; // d-pad using buttons - int axis[4]; // 2 x 2 Axes (Main & Sub) - int enabled; // Pad attached? - int deadzone; // Deadzone... what else? - int halfpress; // Halfpress... you know, like not fully pressed ;)... - int ID; // SDL joystick device ID - int controllertype; // Joystick, Joystick no hat or a keyboard (perhaps a mouse later) - int eventnum; // Linux Event Number, Can't be found dynamically yet -}; - -struct CONTROLLER_INFO{ // CONNECTED WINDOWS DEVICES INFO - int NumAxes; // Amount of Axes - int NumButtons; // Amount of Buttons - int NumBalls; // Amount of Balls - int NumHats; // Amount of Hats (POV) - const char *Name; // Joypad/stickname - int ID; // SDL joystick device ID - SDL_Joystick *joy; // SDL joystick device -}; - -enum -{ - CTL_MAIN_X = 0, - CTL_MAIN_Y, - CTL_SUB_X, - CTL_SUB_Y, -}; - -enum -{ - CTL_L_SHOULDER = 0, - CTL_R_SHOULDER, - CTL_A_BUTTON, - CTL_B_BUTTON, - CTL_X_BUTTON, - CTL_Y_BUTTON, - CTL_Z_TRIGGER, - CTL_START -}; - -enum -{ - CTL_TYPE_JOYSTICK = 0, - CTL_TYPE_JOYSTICK_NO_HAT, - CTL_TYPE_JOYSTICK_XBOX360, - CTL_TYPE_KEYBOARD -}; - -enum -{ - CTL_D_PAD_UP = 0, - CTL_D_PAD_DOWN, - CTL_D_PAD_LEFT, - CTL_D_PAD_RIGHT -}; - -////////////////////////////////////////////////////////////////////////////////////////// -// Custom Functions -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ - -void GetJoyState(int controller); -int Search_Devices(); -void DEBUG_INIT(); -void DEBUG_QUIT(); - -void SaveConfig(); -void LoadConfig(); +////////////////////////////////////////////////////////////////////////////////////////// +// Project description +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +// Name: nJoy +// Description: A Dolphin Compatible Input Plugin +// +// Author: Falcon4ever (nJoy@falcon4ever.com) +// Site: www.multigesture.net +// Copyright (C) 2003-2008 Dolphin Project. +// +////////////////////////////////////////////////////////////////////////////////////////// +// +// Licensetype: GNU General Public License (GPL) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. +// +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ +// +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// +////////////////////////////////////////////////////////////////////////////////////////// + +// Set this if you want to use the rumble 'hack' for controller one +//#define USE_RUMBLE_DINPUT_HACK + +#ifdef _WIN32 +#define _CRT_SECURE_NO_WARNINGS +#define DIRECTINPUT_VERSION 0x0800 +#define WIN32_LEAN_AND_MEAN +#include +#include + +#ifdef USE_RUMBLE_DINPUT_HACK +#include // used for rumble +#endif + +#endif + +#include +#include +#include +#include + +#ifdef _WIN32 +#define SLEEP(x) Sleep(x) +#else +#include +#include +#define SLEEP(x) usleep(x*1000) +#endif +#ifdef __linux__ +#include +#endif + +#include "GUI/AboutBox.h" +#include "GUI/ConfigBox.h" + +#include "Common.h" +#include "pluginspecs_pad.h" +#include "IniFile.h" + +#ifdef _WIN32 +#pragma comment(lib, "SDL.lib") +#pragma comment(lib, "comctl32.lib") + +// Required for the rumble part +#ifdef USE_RUMBLE_DINPUT_HACK +#pragma comment(lib, "dxguid.lib") +#pragma comment(lib, "dinput8.lib") +#pragma comment(lib, "winmm.lib") +#endif +#endif + +////////////////////////////////////////////////////////////////////////////////////////// +// Define +// ŻŻŻŻŻŻ + +#define INPUT_VERSION "0.3" +#define INPUT_STATE "PUBLIC RELEASE" +#define RELDAY "21" +#define RELMONTH "07" +#define RELYEAR "2008" +#define THANKYOU "`plot`, Absolute0, Aprentice, Bositman, Brice, ChaosCode, CKemu, CoDeX, Dave2001, dn, drk||Raziel, Florin, Gent, Gigaherz, Hacktarux, JegHegy, Linker, Linuzappz, Martin64, Muad, Knuckles, Raziel, Refraction, Rudy_x, Shadowprince, Snake785, Saqib, vEX, yaz0r, Zilmar, Zenogais and ZeZu." + +////////////////////////////////////////////////////////////////////////////////////////// +// Structures +// ŻŻŻŻŻŻŻŻŻŻ + +struct CONTROLLER_STATE{ // GC PAD INFO/STATE + int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons + int dpad; // 1 HAT (8 directions + neutral) + int dpad2[4]; // d-pad using buttons + int axis[4]; // 2 x 2 Axes (Main & Sub) + int halfpress; // ... + SDL_Joystick *joy; // SDL joystick device +}; + +struct CONTROLLER_MAPPING{ // GC PAD MAPPING + int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons + int dpad; // 1 HAT (8 directions + neutral) + int dpad2[4]; // d-pad using buttons + int axis[4]; // 2 x 2 Axes (Main & Sub) + int enabled; // Pad attached? + int deadzone; // Deadzone... what else? + int halfpress; // Halfpress... you know, like not fully pressed ;)... + int ID; // SDL joystick device ID + int controllertype; // Joystick, Joystick no hat or a keyboard (perhaps a mouse later) + int eventnum; // Linux Event Number, Can't be found dynamically yet +}; + +struct CONTROLLER_INFO{ // CONNECTED WINDOWS DEVICES INFO + int NumAxes; // Amount of Axes + int NumButtons; // Amount of Buttons + int NumBalls; // Amount of Balls + int NumHats; // Amount of Hats (POV) + const char *Name; // Joypad/stickname + int ID; // SDL joystick device ID + SDL_Joystick *joy; // SDL joystick device +}; + +enum +{ + CTL_MAIN_X = 0, + CTL_MAIN_Y, + CTL_SUB_X, + CTL_SUB_Y, +}; + +enum +{ + CTL_L_SHOULDER = 0, + CTL_R_SHOULDER, + CTL_A_BUTTON, + CTL_B_BUTTON, + CTL_X_BUTTON, + CTL_Y_BUTTON, + CTL_Z_TRIGGER, + CTL_START +}; + +enum +{ + CTL_TYPE_JOYSTICK = 0, + CTL_TYPE_JOYSTICK_NO_HAT, + CTL_TYPE_JOYSTICK_XBOX360, + CTL_TYPE_KEYBOARD +}; + +enum +{ + CTL_D_PAD_UP = 0, + CTL_D_PAD_DOWN, + CTL_D_PAD_LEFT, + CTL_D_PAD_RIGHT +}; + +////////////////////////////////////////////////////////////////////////////////////////// +// Custom Functions +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ + +void GetJoyState(int controller); +int Search_Devices(); +void DEBUG_INIT(); +void DEBUG_QUIT(); + +void SaveConfig(); +void LoadConfig(); diff --git a/Source/Plugins/Plugin_nJoy_Testing/Src/GUI/AboutBox.h b/Source/Plugins/Plugin_nJoy_Testing/Src/GUI/AboutBox.h index 458b681776..a9c57ab272 100644 --- a/Source/Plugins/Plugin_nJoy_Testing/Src/GUI/AboutBox.h +++ b/Source/Plugins/Plugin_nJoy_Testing/Src/GUI/AboutBox.h @@ -1,92 +1,92 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Project description -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy -// Description: A Dolphin Compatible Input Plugin -// -// Author: Falcon4ever (nJoy@falcon4ever.com) -// Site: www.multigesture.net -// Copyright (C) 2003-2008 Dolphin Project. -// -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef __ABOUTBOX_h__ -#define __ABOUTBOX_h__ - -#ifndef WX_PRECOMP - #include - #include -#else - #include -#endif - -#include -#include -#include -#include - -#undef AboutBox_STYLE -#define AboutBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - -class AboutBox : public wxDialog -{ - private: - DECLARE_EVENT_TABLE(); - - public: - AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = AboutBox_STYLE); - virtual ~AboutBox(); - void OKClick(wxCommandEvent& event); - - private: - wxStaticText *m_thankyoutext; - wxStaticText *m_specialthanks; - wxStaticText *m_pluginversion; - wxButton *m_OK; - wxStaticText *m_version; - wxStaticBox *m_thankyougroup; - wxStaticBox *m_specialthanksgroup; - wxStaticBox *m_pluginversiongroup; - wxStaticBitmap *m_njoylogo; - - private: - enum - { - ID_THANKYOU = 1009, - ID_SPECIALTHANKS = 1008, - ID_PLUGINVERSION = 1007, - ID_OK = 1006, - ID_STATUSV = 1005, - IDG_THANKYOU = 1004, - IDG_SPECIALTHANKS = 1003, - IDG_PLUGINVERSION = 1002, - ID_AWESOMEPICTURE = 1001, - - ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values - }; - - private: - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); -}; - -#endif +////////////////////////////////////////////////////////////////////////////////////////// +// Project description +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +// Name: nJoy +// Description: A Dolphin Compatible Input Plugin +// +// Author: Falcon4ever (nJoy@falcon4ever.com) +// Site: www.multigesture.net +// Copyright (C) 2003-2008 Dolphin Project. +// +////////////////////////////////////////////////////////////////////////////////////////// +// +// Licensetype: GNU General Public License (GPL) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. +// +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ +// +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// +////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef __ABOUTBOX_h__ +#define __ABOUTBOX_h__ + +#ifndef WX_PRECOMP + #include + #include +#else + #include +#endif + +#include +#include +#include +#include + +#undef AboutBox_STYLE +#define AboutBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + +class AboutBox : public wxDialog +{ + private: + DECLARE_EVENT_TABLE(); + + public: + AboutBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("About: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = AboutBox_STYLE); + virtual ~AboutBox(); + void OKClick(wxCommandEvent& event); + + private: + wxStaticText *m_thankyoutext; + wxStaticText *m_specialthanks; + wxStaticText *m_pluginversion; + wxButton *m_OK; + wxStaticText *m_version; + wxStaticBox *m_thankyougroup; + wxStaticBox *m_specialthanksgroup; + wxStaticBox *m_pluginversiongroup; + wxStaticBitmap *m_njoylogo; + + private: + enum + { + ID_THANKYOU = 1009, + ID_SPECIALTHANKS = 1008, + ID_PLUGINVERSION = 1007, + ID_OK = 1006, + ID_STATUSV = 1005, + IDG_THANKYOU = 1004, + IDG_SPECIALTHANKS = 1003, + IDG_PLUGINVERSION = 1002, + ID_AWESOMEPICTURE = 1001, + + ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values + }; + + private: + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); +}; + +#endif diff --git a/Source/Plugins/Plugin_nJoy_Testing/Src/GUI/ConfigBox.h b/Source/Plugins/Plugin_nJoy_Testing/Src/GUI/ConfigBox.h index bfc0e3a176..2dd1872676 100644 --- a/Source/Plugins/Plugin_nJoy_Testing/Src/GUI/ConfigBox.h +++ b/Source/Plugins/Plugin_nJoy_Testing/Src/GUI/ConfigBox.h @@ -1,242 +1,242 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Project description -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy -// Description: A Dolphin Compatible Input Plugin -// -// Author: Falcon4ever (nJoy@falcon4ever.com) -// Site: www.multigesture.net -// Copyright (C) 2003-2008 Dolphin Project. -// -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef __CONFIGBOX_h__ -#define __CONFIGBOX_h__ - -#ifndef WX_PRECOMP - #include - #include -#else - #include -#endif - -#include -#include -#include -#include -#include -#include - -#undef ConfigBox_STYLE -#define ConfigBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX - -class ConfigBox : public wxDialog -{ - private: - DECLARE_EVENT_TABLE(); - - public: - ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigBox_STYLE); - virtual ~ConfigBox(); - - private: - wxButton *m_About; - wxButton *m_OK; - wxButton *m_Cancel; - - wxPanel *m_Controller[4]; - wxNotebook *m_Notebook; - - wxComboBox *m_Joyname[4]; - wxComboBox *m_Controltype[4]; - wxComboBox *m_Deadzone[4]; - - wxCheckBox *m_Joyattach[4]; - - wxStaticBox *m_gJoyname[4]; - wxStaticBox *m_gExtrasettings[4]; - wxStaticBox *m_gControllertype[4]; - - wxTextCtrl *m_JoyShoulderL[4]; - wxTextCtrl *m_JoyShoulderR[4]; - - wxButton *m_bJoyShoulderL[4]; - wxButton *m_bJoyShoulderR[4]; - - wxTextCtrl *m_JoyButtonA[4]; - wxTextCtrl *m_JoyButtonB[4]; - wxTextCtrl *m_JoyButtonX[4]; - wxTextCtrl *m_JoyButtonY[4]; - wxTextCtrl *m_JoyButtonZ[4]; - wxTextCtrl *m_JoyButtonStart[4]; - wxTextCtrl *m_JoyButtonHalfpress[4]; - - wxButton *m_bJoyButtonA[4]; - wxButton *m_bJoyButtonB[4]; - wxButton *m_bJoyButtonX[4]; - wxButton *m_bJoyButtonY[4]; - wxButton *m_bJoyButtonZ[4]; - wxButton *m_bJoyButtonStart[4]; - wxButton *m_bJoyButtonCalibrate[4]; - wxButton *m_bJoyButtonHalfpress[4]; - - wxTextCtrl *m_JoyAnalogMainX[4]; - wxTextCtrl *m_JoyAnalogMainY[4]; - wxTextCtrl *m_JoyAnalogSubX[4]; - wxTextCtrl *m_JoyAnalogSubY[4]; - - wxButton *m_bJoyAnalogMainX[4]; - wxButton *m_bJoyAnalogMainY[4]; - wxButton *m_bJoyAnalogSubX[4]; - wxButton *m_bJoyAnalogSubY[4]; - - wxTextCtrl *m_JoyDpadUp[4]; - wxTextCtrl *m_JoyDpadDown[4]; - wxTextCtrl *m_JoyDpadLeft[4]; - wxTextCtrl *m_JoyDpadRight[4]; - - wxButton *m_bJoyDpadUp[4]; - wxButton *m_bJoyDpadDown[4]; - wxButton *m_bJoyDpadLeft[4]; - wxButton *m_bJoyDpadRight[4]; - - wxStaticText *m_textMainX[4]; - wxStaticText *m_textMainY[4]; - wxStaticText *m_textDpadUp[4]; - wxStaticText *m_textDpadDown[4]; - wxStaticText *m_textDpadLeft[4]; - wxStaticText *m_textDpadRight[4]; - wxStaticText *m_textDeadzone[4]; - wxStaticText *m_textHalfpress[4]; - wxStaticText *m_textSubX[4]; - wxStaticText *m_textSubY[4]; - wxStaticText *m_textWebsite[4]; - - wxTextCtrl *m_PlaceholderBMP[4]; - wxStaticBitmap *m_controllerimage[4]; - - int notebookpage; - private: - enum - { - ID_ABOUT = 1000, - ID_OK, - ID_CANCEL, - ID_NOTEBOOK, - ID_CONTROLLERPAGE1, - ID_CONTROLLERPAGE2, - ID_CONTROLLERPAGE3, - ID_CONTROLLERPAGE4, - - IDC_JOYNAME, - IDC_CONTROLTYPE, - IDC_DEADZONE, - - IDC_JOYATTACH, - IDG_JOYSTICK, - IDG_EXTRASETTINGS, - IDG_CONTROLLERTYPE, - ID_CONTROLLERPICTURE, - - ID_SHOULDER_L = 2000, - ID_SHOULDER_R, - - ID_BUTTON_A, - ID_BUTTON_B, - ID_BUTTON_X, - ID_BUTTON_Y, - ID_BUTTON_Z, - ID_BUTTONSTART, - ID_BUTTONHALFPRESS, - - ID_ANALOG_MAIN_X, - ID_ANALOG_MAIN_Y, - ID_ANALOG_SUB_X, - ID_ANALOG_SUB_Y, - - ID_DPAD_UP, - ID_DPAD_DOWN, - ID_DPAD_LEFT, - ID_DPAD_RIGHT, - - IDB_SHOULDER_L = 3000, - IDB_SHOULDER_R, - - IDB_BUTTON_A, - IDB_BUTTON_B, - IDB_BUTTON_X, - IDB_BUTTON_Y, - IDB_BUTTON_Z, - IDB_BUTTONSTART, - IDB_BUTTONHALFPRESS, - - IDB_ANALOG_MAIN_X, - IDB_ANALOG_MAIN_Y, - IDB_ANALOG_SUB_X, - IDB_ANALOG_SUB_Y, - - IDB_DPAD_UP, - IDB_DPAD_DOWN, - IDB_DPAD_LEFT, - IDB_DPAD_RIGHT, - - IDT_ANALOG_MAIN_X = 4000, - IDT_ANALOG_MAIN_Y, - IDT_DPAD_UP, - IDT_DPAD_DOWN, - IDT_DPAD_LEFT, - IDT_DPAD_RIGHT, - IDT_DEADZONE, - IDT_BUTTONHALFPRESS, - IDT_ANALOG_SUB_X, - IDT_ANALOG_SUB_Y, - IDT_WEBSITE, - ID_BUTTONCALIBRATE, - - ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values - }; - - private: - void AboutClick(wxCommandEvent& event); - void OKClick(wxCommandEvent& event); - void CancelClick(wxCommandEvent& event); - - void ChangeJoystick(wxCommandEvent& event); - void ChangeControllertype(wxCommandEvent& event); - - void OnClose(wxCloseEvent& event); - void CreateGUIControls(); - - void SetControllerAll(int controller); - void UpdateVisibleItems(int controller); - void GetControllerAll(int controller); - - void NotebookPageChanged(wxNotebookEvent& event); - - void Calibrate(wxCommandEvent& event); - void GetInputs(wxCommandEvent& event); - void GetHats(int ID); - - void SetButtonText(int id, char text[128]); -}; - -#endif +////////////////////////////////////////////////////////////////////////////////////////// +// Project description +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +// Name: nJoy +// Description: A Dolphin Compatible Input Plugin +// +// Author: Falcon4ever (nJoy@falcon4ever.com) +// Site: www.multigesture.net +// Copyright (C) 2003-2008 Dolphin Project. +// +////////////////////////////////////////////////////////////////////////////////////////// +// +// Licensetype: GNU General Public License (GPL) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. +// +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ +// +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// +////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef __CONFIGBOX_h__ +#define __CONFIGBOX_h__ + +#ifndef WX_PRECOMP + #include + #include +#else + #include +#endif + +#include +#include +#include +#include +#include +#include + +#undef ConfigBox_STYLE +#define ConfigBox_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX + +class ConfigBox : public wxDialog +{ + private: + DECLARE_EVENT_TABLE(); + + public: + ConfigBox(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Configure: nJoy Input Plugin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigBox_STYLE); + virtual ~ConfigBox(); + + private: + wxButton *m_About; + wxButton *m_OK; + wxButton *m_Cancel; + + wxPanel *m_Controller[4]; + wxNotebook *m_Notebook; + + wxComboBox *m_Joyname[4]; + wxComboBox *m_Controltype[4]; + wxComboBox *m_Deadzone[4]; + + wxCheckBox *m_Joyattach[4]; + + wxStaticBox *m_gJoyname[4]; + wxStaticBox *m_gExtrasettings[4]; + wxStaticBox *m_gControllertype[4]; + + wxTextCtrl *m_JoyShoulderL[4]; + wxTextCtrl *m_JoyShoulderR[4]; + + wxButton *m_bJoyShoulderL[4]; + wxButton *m_bJoyShoulderR[4]; + + wxTextCtrl *m_JoyButtonA[4]; + wxTextCtrl *m_JoyButtonB[4]; + wxTextCtrl *m_JoyButtonX[4]; + wxTextCtrl *m_JoyButtonY[4]; + wxTextCtrl *m_JoyButtonZ[4]; + wxTextCtrl *m_JoyButtonStart[4]; + wxTextCtrl *m_JoyButtonHalfpress[4]; + + wxButton *m_bJoyButtonA[4]; + wxButton *m_bJoyButtonB[4]; + wxButton *m_bJoyButtonX[4]; + wxButton *m_bJoyButtonY[4]; + wxButton *m_bJoyButtonZ[4]; + wxButton *m_bJoyButtonStart[4]; + wxButton *m_bJoyButtonCalibrate[4]; + wxButton *m_bJoyButtonHalfpress[4]; + + wxTextCtrl *m_JoyAnalogMainX[4]; + wxTextCtrl *m_JoyAnalogMainY[4]; + wxTextCtrl *m_JoyAnalogSubX[4]; + wxTextCtrl *m_JoyAnalogSubY[4]; + + wxButton *m_bJoyAnalogMainX[4]; + wxButton *m_bJoyAnalogMainY[4]; + wxButton *m_bJoyAnalogSubX[4]; + wxButton *m_bJoyAnalogSubY[4]; + + wxTextCtrl *m_JoyDpadUp[4]; + wxTextCtrl *m_JoyDpadDown[4]; + wxTextCtrl *m_JoyDpadLeft[4]; + wxTextCtrl *m_JoyDpadRight[4]; + + wxButton *m_bJoyDpadUp[4]; + wxButton *m_bJoyDpadDown[4]; + wxButton *m_bJoyDpadLeft[4]; + wxButton *m_bJoyDpadRight[4]; + + wxStaticText *m_textMainX[4]; + wxStaticText *m_textMainY[4]; + wxStaticText *m_textDpadUp[4]; + wxStaticText *m_textDpadDown[4]; + wxStaticText *m_textDpadLeft[4]; + wxStaticText *m_textDpadRight[4]; + wxStaticText *m_textDeadzone[4]; + wxStaticText *m_textHalfpress[4]; + wxStaticText *m_textSubX[4]; + wxStaticText *m_textSubY[4]; + wxStaticText *m_textWebsite[4]; + + wxTextCtrl *m_PlaceholderBMP[4]; + wxStaticBitmap *m_controllerimage[4]; + + int notebookpage; + private: + enum + { + ID_ABOUT = 1000, + ID_OK, + ID_CANCEL, + ID_NOTEBOOK, + ID_CONTROLLERPAGE1, + ID_CONTROLLERPAGE2, + ID_CONTROLLERPAGE3, + ID_CONTROLLERPAGE4, + + IDC_JOYNAME, + IDC_CONTROLTYPE, + IDC_DEADZONE, + + IDC_JOYATTACH, + IDG_JOYSTICK, + IDG_EXTRASETTINGS, + IDG_CONTROLLERTYPE, + ID_CONTROLLERPICTURE, + + ID_SHOULDER_L = 2000, + ID_SHOULDER_R, + + ID_BUTTON_A, + ID_BUTTON_B, + ID_BUTTON_X, + ID_BUTTON_Y, + ID_BUTTON_Z, + ID_BUTTONSTART, + ID_BUTTONHALFPRESS, + + ID_ANALOG_MAIN_X, + ID_ANALOG_MAIN_Y, + ID_ANALOG_SUB_X, + ID_ANALOG_SUB_Y, + + ID_DPAD_UP, + ID_DPAD_DOWN, + ID_DPAD_LEFT, + ID_DPAD_RIGHT, + + IDB_SHOULDER_L = 3000, + IDB_SHOULDER_R, + + IDB_BUTTON_A, + IDB_BUTTON_B, + IDB_BUTTON_X, + IDB_BUTTON_Y, + IDB_BUTTON_Z, + IDB_BUTTONSTART, + IDB_BUTTONHALFPRESS, + + IDB_ANALOG_MAIN_X, + IDB_ANALOG_MAIN_Y, + IDB_ANALOG_SUB_X, + IDB_ANALOG_SUB_Y, + + IDB_DPAD_UP, + IDB_DPAD_DOWN, + IDB_DPAD_LEFT, + IDB_DPAD_RIGHT, + + IDT_ANALOG_MAIN_X = 4000, + IDT_ANALOG_MAIN_Y, + IDT_DPAD_UP, + IDT_DPAD_DOWN, + IDT_DPAD_LEFT, + IDT_DPAD_RIGHT, + IDT_DEADZONE, + IDT_BUTTONHALFPRESS, + IDT_ANALOG_SUB_X, + IDT_ANALOG_SUB_Y, + IDT_WEBSITE, + ID_BUTTONCALIBRATE, + + ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values + }; + + private: + void AboutClick(wxCommandEvent& event); + void OKClick(wxCommandEvent& event); + void CancelClick(wxCommandEvent& event); + + void ChangeJoystick(wxCommandEvent& event); + void ChangeControllertype(wxCommandEvent& event); + + void OnClose(wxCloseEvent& event); + void CreateGUIControls(); + + void SetControllerAll(int controller); + void UpdateVisibleItems(int controller); + void GetControllerAll(int controller); + + void NotebookPageChanged(wxNotebookEvent& event); + + void Calibrate(wxCommandEvent& event); + void GetInputs(wxCommandEvent& event); + void GetHats(int ID); + + void SetButtonText(int id, char text[128]); +}; + +#endif diff --git a/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.h b/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.h index ed60b64d71..9f91cf47e5 100644 --- a/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.h +++ b/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.h @@ -1,183 +1,183 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Project description -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy -// Description: A Dolphin Compatible Input Plugin -// -// Author: Falcon4ever (nJoy@falcon4ever.com) -// Site: www.multigesture.net -// Copyright (C) 2003-2008 Dolphin Project. -// -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -// Set this if you want to use the rumble 'hack' for controller one -//#define USE_RUMBLE_DINPUT_HACK - -#ifdef _WIN32 -#define _CRT_SECURE_NO_WARNINGS -#define DIRECTINPUT_VERSION 0x0800 -#define WIN32_LEAN_AND_MEAN -#include -#include - -#ifdef USE_RUMBLE_DINPUT_HACK -#include // used for rumble -#endif - -#endif - -#include -#include -#include -#include - -#ifdef _WIN32 -#define SLEEP(x) Sleep(x) -#else -#include -#include -#define SLEEP(x) usleep(x*1000) -#endif -#ifdef __linux__ -#include -#endif - -#include "GUI/AboutBox.h" -#include "GUI/ConfigBox.h" - -#include "Common.h" -#include "pluginspecs_pad.h" -#include "IniFile.h" - -#ifdef _WIN32 -#pragma comment(lib, "SDL.lib") -#pragma comment(lib, "comctl32.lib") - -// Required for the rumble part -#ifdef USE_RUMBLE_DINPUT_HACK -#pragma comment(lib, "dxguid.lib") -#pragma comment(lib, "dinput8.lib") -#pragma comment(lib, "winmm.lib") -#endif -#endif - -////////////////////////////////////////////////////////////////////////////////////////// -// Define -// ŻŻŻŻŻŻ - -#define INPUT_VERSION "0.4" -#define INPUT_STATE "TESTING" -#define RELDAY "01" -#define RELMONTH "12" -#define RELYEAR "2008" -#define THANKYOU "`plot`, Absolute0, Aprentice, Bositman, Brice, ChaosCode, CKemu, CoDeX, Dave2001, dn, drk||Raziel, Florin, Gent, Gigaherz, Hacktarux, JegHegy, Linker, Linuzappz, Martin64, Muad, Knuckles, Raziel, Refraction, Rudy_x, Shadowprince, Snake785, Saqib, vEX, yaz0r, Zilmar, Zenogais and ZeZu." - -////////////////////////////////////////////////////////////////////////////////////////// -// Structures -// ŻŻŻŻŻŻŻŻŻŻ -#define MAX_AXISES 12 // If more than 12 is needed. Up it -class sCalibration -{ - public: - sCalibration() - { - Min = 0; - Max = 0; - } - Sint16 Min; - Sint16 Max; -}; // Simple Calibration Data -struct CONTROLLER_STATE{ // GC PAD INFO/STATE - int buttons[12]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons - int dpad; // 1 HAT (8 directions + neutral) - int dpad2[4]; // d-pad using buttons - int halfpress; // ... - SDL_Joystick *joy; // SDL joystick device -}; - -struct CONTROLLER_MAPPING{ // GC PAD MAPPING - std::string buttons[12];// Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons - sCalibration sData[MAX_AXISES]; // Calibration Data - int dpad; // 1 HAT (8 directions + neutral) - int dpad2[4]; // d-pad using buttons - int enabled; // Pad attached? - int deadzone; // Deadzone... what else? - int halfpress; // Halfpress... you know, like not fully pressed ;)... - int ID; // SDL joystick device ID - int controllertype; // Joystick, Joystick no hat or a keyboard (perhaps a mouse later) - int eventnum; // Linux Event Number, Can't be found dynamically yet -}; - -struct CONTROLLER_INFO{ // CONNECTED WINDOWS DEVICES INFO - int NumAxes; // Amount of Axes - int NumButtons; // Amount of Buttons - int NumBalls; // Amount of Balls - int NumHats; // Amount of Hats (POV) - const char *Name; // Joypad/stickname - int ID; // SDL joystick device ID - SDL_Joystick *joy; // SDL joystick device -}; - -enum -{ - CTL_L_SHOULDER = 0, - CTL_R_SHOULDER, - CTL_A_BUTTON, - CTL_B_BUTTON, - CTL_X_BUTTON, - CTL_Y_BUTTON, - CTL_Z_TRIGGER, - CTL_START, - CTL_MAIN_X, - CTL_MAIN_Y, - CTL_SUB_X, - CTL_SUB_Y, - CTRL_END, -}; - -enum -{ - CTL_TYPE_JOYSTICK = 0, - CTL_TYPE_JOYSTICK_NO_HAT, - CTL_TYPE_JOYSTICK_XBOX360, - CTL_TYPE_KEYBOARD -}; - -enum -{ - CTL_D_PAD_UP = 0, - CTL_D_PAD_DOWN, - CTL_D_PAD_LEFT, - CTL_D_PAD_RIGHT -}; - -////////////////////////////////////////////////////////////////////////////////////////// -// Custom Functions -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ - -void GetJoyState(int controller); -int Search_Devices(); -void DEBUG_INIT(); -void DEBUG_QUIT(); - -void SaveConfig(); -void LoadConfig(); +////////////////////////////////////////////////////////////////////////////////////////// +// Project description +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +// Name: nJoy +// Description: A Dolphin Compatible Input Plugin +// +// Author: Falcon4ever (nJoy@falcon4ever.com) +// Site: www.multigesture.net +// Copyright (C) 2003-2008 Dolphin Project. +// +////////////////////////////////////////////////////////////////////////////////////////// +// +// Licensetype: GNU General Public License (GPL) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. +// +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ +// +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ +// +////////////////////////////////////////////////////////////////////////////////////////// + +// Set this if you want to use the rumble 'hack' for controller one +//#define USE_RUMBLE_DINPUT_HACK + +#ifdef _WIN32 +#define _CRT_SECURE_NO_WARNINGS +#define DIRECTINPUT_VERSION 0x0800 +#define WIN32_LEAN_AND_MEAN +#include +#include + +#ifdef USE_RUMBLE_DINPUT_HACK +#include // used for rumble +#endif + +#endif + +#include +#include +#include +#include + +#ifdef _WIN32 +#define SLEEP(x) Sleep(x) +#else +#include +#include +#define SLEEP(x) usleep(x*1000) +#endif +#ifdef __linux__ +#include +#endif + +#include "GUI/AboutBox.h" +#include "GUI/ConfigBox.h" + +#include "Common.h" +#include "pluginspecs_pad.h" +#include "IniFile.h" + +#ifdef _WIN32 +#pragma comment(lib, "SDL.lib") +#pragma comment(lib, "comctl32.lib") + +// Required for the rumble part +#ifdef USE_RUMBLE_DINPUT_HACK +#pragma comment(lib, "dxguid.lib") +#pragma comment(lib, "dinput8.lib") +#pragma comment(lib, "winmm.lib") +#endif +#endif + +////////////////////////////////////////////////////////////////////////////////////////// +// Define +// ŻŻŻŻŻŻ + +#define INPUT_VERSION "0.4" +#define INPUT_STATE "TESTING" +#define RELDAY "01" +#define RELMONTH "12" +#define RELYEAR "2008" +#define THANKYOU "`plot`, Absolute0, Aprentice, Bositman, Brice, ChaosCode, CKemu, CoDeX, Dave2001, dn, drk||Raziel, Florin, Gent, Gigaherz, Hacktarux, JegHegy, Linker, Linuzappz, Martin64, Muad, Knuckles, Raziel, Refraction, Rudy_x, Shadowprince, Snake785, Saqib, vEX, yaz0r, Zilmar, Zenogais and ZeZu." + +////////////////////////////////////////////////////////////////////////////////////////// +// Structures +// ŻŻŻŻŻŻŻŻŻŻ +#define MAX_AXISES 12 // If more than 12 is needed. Up it +class sCalibration +{ + public: + sCalibration() + { + Min = 0; + Max = 0; + } + Sint16 Min; + Sint16 Max; +}; // Simple Calibration Data +struct CONTROLLER_STATE{ // GC PAD INFO/STATE + int buttons[12]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons + int dpad; // 1 HAT (8 directions + neutral) + int dpad2[4]; // d-pad using buttons + int halfpress; // ... + SDL_Joystick *joy; // SDL joystick device +}; + +struct CONTROLLER_MAPPING{ // GC PAD MAPPING + std::string buttons[12];// Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons + sCalibration sData[MAX_AXISES]; // Calibration Data + int dpad; // 1 HAT (8 directions + neutral) + int dpad2[4]; // d-pad using buttons + int enabled; // Pad attached? + int deadzone; // Deadzone... what else? + int halfpress; // Halfpress... you know, like not fully pressed ;)... + int ID; // SDL joystick device ID + int controllertype; // Joystick, Joystick no hat or a keyboard (perhaps a mouse later) + int eventnum; // Linux Event Number, Can't be found dynamically yet +}; + +struct CONTROLLER_INFO{ // CONNECTED WINDOWS DEVICES INFO + int NumAxes; // Amount of Axes + int NumButtons; // Amount of Buttons + int NumBalls; // Amount of Balls + int NumHats; // Amount of Hats (POV) + const char *Name; // Joypad/stickname + int ID; // SDL joystick device ID + SDL_Joystick *joy; // SDL joystick device +}; + +enum +{ + CTL_L_SHOULDER = 0, + CTL_R_SHOULDER, + CTL_A_BUTTON, + CTL_B_BUTTON, + CTL_X_BUTTON, + CTL_Y_BUTTON, + CTL_Z_TRIGGER, + CTL_START, + CTL_MAIN_X, + CTL_MAIN_Y, + CTL_SUB_X, + CTL_SUB_Y, + CTRL_END, +}; + +enum +{ + CTL_TYPE_JOYSTICK = 0, + CTL_TYPE_JOYSTICK_NO_HAT, + CTL_TYPE_JOYSTICK_XBOX360, + CTL_TYPE_KEYBOARD +}; + +enum +{ + CTL_D_PAD_UP = 0, + CTL_D_PAD_DOWN, + CTL_D_PAD_LEFT, + CTL_D_PAD_RIGHT +}; + +////////////////////////////////////////////////////////////////////////////////////////// +// Custom Functions +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ + +void GetJoyState(int controller); +int Search_Devices(); +void DEBUG_INIT(); +void DEBUG_QUIT(); + +void SaveConfig(); +void LoadConfig();