set svn:eol-style=native for **.h
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1438 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e6fe5ec42f
commit
30c883bcfc
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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 <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <string>
|
||||
|
||||
enum CPUVendor
|
||||
{
|
||||
VENDOR_INTEL = 0,
|
||||
VENDOR_AMD = 1,
|
||||
VENDOR_OTHER = 2,
|
||||
};
|
||||
|
||||
struct CPUInfo
|
||||
{
|
||||
CPUVendor vendor;
|
||||
|
||||
char cpu_string[0x21];
|
||||
char brand_string[0x41];
|
||||
bool OS64bit;
|
||||
bool CPU64bit;
|
||||
bool Mode64bit;
|
||||
|
||||
bool hyper_threaded;
|
||||
int num_cores;
|
||||
|
||||
bool bSSE;
|
||||
bool bSSE2;
|
||||
bool bSSE3;
|
||||
bool bSSSE3;
|
||||
bool bPOPCNT;
|
||||
bool bSSE4_1;
|
||||
bool bSSE4_2;
|
||||
bool bLZCNT;
|
||||
bool bSSE4A;
|
||||
bool bLAHFSAHF64;
|
||||
bool bLongMode;
|
||||
|
||||
void Detect();
|
||||
std::string Summarize();
|
||||
};
|
||||
|
||||
|
||||
extern CPUInfo cpu_info;
|
||||
|
||||
inline void DetectCPU() {cpu_info.Detect();}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
enum CPUVendor
|
||||
{
|
||||
VENDOR_INTEL = 0,
|
||||
VENDOR_AMD = 1,
|
||||
VENDOR_OTHER = 2,
|
||||
};
|
||||
|
||||
struct CPUInfo
|
||||
{
|
||||
CPUVendor vendor;
|
||||
|
||||
char cpu_string[0x21];
|
||||
char brand_string[0x41];
|
||||
bool OS64bit;
|
||||
bool CPU64bit;
|
||||
bool Mode64bit;
|
||||
|
||||
bool hyper_threaded;
|
||||
int num_cores;
|
||||
|
||||
bool bSSE;
|
||||
bool bSSE2;
|
||||
bool bSSE3;
|
||||
bool bSSSE3;
|
||||
bool bPOPCNT;
|
||||
bool bSSE4_1;
|
||||
bool bSSE4_2;
|
||||
bool bLZCNT;
|
||||
bool bSSE4A;
|
||||
bool bLAHFSAHF64;
|
||||
bool bLongMode;
|
||||
|
||||
void Detect();
|
||||
std::string Summarize();
|
||||
};
|
||||
|
||||
|
||||
extern CPUInfo cpu_info;
|
||||
|
||||
inline void DetectCPU() {cpu_info.Detect();}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
template <class T>
|
||||
struct LinkedListItem : public T
|
||||
{
|
||||
LinkedListItem<T> *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<class T>
|
||||
void Do(std::map<unsigned int, T> &x) {
|
||||
// TODO
|
||||
PanicAlert("Do(map<>) does not yet work.");
|
||||
}
|
||||
|
||||
// Store vectors.
|
||||
template<class T>
|
||||
void Do(std::vector<T> &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<class T>
|
||||
void DoArray(T *x, int count) {
|
||||
DoVoid((void *)x, sizeof(T) * count);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Do(T &x) {
|
||||
DoVoid((void *)&x, sizeof(x));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void DoLinkedList(LinkedListItem<T> **list_start) {
|
||||
// TODO
|
||||
PanicAlert("Do(vector<>) does not yet work.");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CChunkFileReader
|
||||
{
|
||||
public:
|
||||
template<class T>
|
||||
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<class T>
|
||||
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 <stdio.h>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
template <class T>
|
||||
struct LinkedListItem : public T
|
||||
{
|
||||
LinkedListItem<T> *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<class T>
|
||||
void Do(std::map<unsigned int, T> &x) {
|
||||
// TODO
|
||||
PanicAlert("Do(map<>) does not yet work.");
|
||||
}
|
||||
|
||||
// Store vectors.
|
||||
template<class T>
|
||||
void Do(std::vector<T> &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<class T>
|
||||
void DoArray(T *x, int count) {
|
||||
DoVoid((void *)x, sizeof(T) * count);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void Do(T &x) {
|
||||
DoVoid((void *)&x, sizeof(x));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void DoLinkedList(LinkedListItem<T> **list_start) {
|
||||
// TODO
|
||||
PanicAlert("Do(vector<>) does not yet work.");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CChunkFileReader
|
||||
{
|
||||
public:
|
||||
template<class T>
|
||||
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<class T>
|
||||
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
|
||||
|
|
|
@ -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 <crtdbg.h>
|
||||
#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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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<class T>
|
||||
inline T min(const T& a, const T& b) {return a > b ? b : a;}
|
||||
template<class T>
|
||||
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 <byteswap.h>
|
||||
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 <bool> struct CompileTimeAssert;
|
||||
template<> struct CompileTimeAssert<true> {};
|
||||
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 <crtdbg.h>
|
||||
#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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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<class T>
|
||||
inline T min(const T& a, const T& b) {return a > b ? b : a;}
|
||||
template<class T>
|
||||
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 <byteswap.h>
|
||||
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 <bool> struct CompileTimeAssert;
|
||||
template<> struct CompileTimeAssert<true> {};
|
||||
CompileTimeAssert<_SECURE_SCL==0> x;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // #ifndef _COMMON_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 <string>
|
||||
#include <vector>
|
||||
|
||||
// Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner.
|
||||
|
||||
void GetAllRemovableDrives(std::vector<std::string> *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 <string>
|
||||
#include <vector>
|
||||
|
||||
// Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner.
|
||||
|
||||
void GetAllRemovableDrives(std::vector<std::string> *drives);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 <windows.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
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 <windows.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
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
|
||||
|
|
|
@ -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 <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#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 <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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 <string>
|
||||
#include <vector>
|
||||
|
||||
class CFileSearch
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::vector<std::string>XStringVector;
|
||||
|
||||
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 <string>
|
||||
#include <vector>
|
||||
|
||||
class CFileSearch
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::vector<std::string>XStringVector;
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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 <string>
|
||||
#include <vector>
|
||||
|
||||
#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<FSTEntry> 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 <string>
|
||||
#include <vector>
|
||||
|
||||
#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<FSTEntry> 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
|
||||
|
|
|
@ -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 T, int N>
|
||||
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 T, int N>
|
||||
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
|
|
@ -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
|
||||
|
|
|
@ -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 <string>
|
||||
#include <vector>
|
||||
|
||||
#include "StringUtil.h"
|
||||
|
||||
class Section
|
||||
{
|
||||
public:
|
||||
Section();
|
||||
Section(const std::string& _name);
|
||||
Section(const Section& other);
|
||||
std::vector<std::string>lines;
|
||||
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<std::string>& newValues);
|
||||
|
||||
void SetLines(const char* sectionName, const std::vector<std::string> &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<std::string>& values);
|
||||
|
||||
bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const;
|
||||
bool GetLines(const char* sectionName, std::vector<std::string>& 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<Section>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 <string>
|
||||
#include <vector>
|
||||
|
||||
#include "StringUtil.h"
|
||||
|
||||
class Section
|
||||
{
|
||||
public:
|
||||
Section();
|
||||
Section(const std::string& _name);
|
||||
Section(const Section& other);
|
||||
std::vector<std::string>lines;
|
||||
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<std::string>& newValues);
|
||||
|
||||
void SetLines(const char* sectionName, const std::vector<std::string> &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<std::string>& values);
|
||||
|
||||
bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const;
|
||||
bool GetLines(const char* sectionName, std::vector<std::string>& 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<Section>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
|
||||
|
|
|
@ -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 <map>
|
||||
|
||||
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 <map>
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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 <xmmintrin.h>
|
||||
|
||||
/*
|
||||
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 <xmmintrin.h>
|
||||
|
||||
/*
|
||||
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
|
||||
|
|
|
@ -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 <windows.h>
|
||||
#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 <windows.h>
|
||||
#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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <stdarg.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#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<size_t Count>
|
||||
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<std::string>& 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 <stdarg.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#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<size_t Count>
|
||||
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<std::string>& 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
|
||||
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
|
||||
#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<class T>
|
||||
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 <stdio.h>
|
||||
|
||||
#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<class T>
|
||||
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
|
||||
|
|
|
@ -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 <windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#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 <windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <stdio.h>
|
||||
|
||||
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 <stdio.h>
|
||||
|
||||
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
|
||||
|
|
|
@ -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 <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <vector>
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If 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 <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#define SVN_REV $WCREV$
|
||||
#define SVN_REV $WCREV$
|
||||
#define SVN_REV_STR "$WCREV$"
|
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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 <windows.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include "Common.h"
|
||||
#include "ActionReplay.h"
|
||||
|
||||
extern int total;
|
||||
extern const char *filter;
|
||||
|
||||
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &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 <windows.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include "Common.h"
|
||||
#include "ActionReplay.h"
|
||||
|
||||
extern int total;
|
||||
extern const char *filter;
|
||||
|
||||
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops);
|
||||
|
||||
#endif //_ARDECRYPT_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<AREntry> 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<AREntry> 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_
|
||||
|
|
|
@ -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 <string>
|
||||
|
||||
#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 <string>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <vector>
|
||||
#include <string>
|
||||
|
||||
#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 <vector>
|
||||
#include <string>
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -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 <windows.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
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 <windows.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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 <string>
|
||||
|
||||
#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 <string>
|
||||
|
||||
#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
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
#ifndef _DEBUGINTERFACE_H
|
||||
#define _DEBUGINTERFACE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
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 <string>
|
||||
|
||||
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
|
||||
|
|
|
@ -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 <vector>
|
||||
#include <string>
|
||||
|
||||
#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<TBreakPoint> TBreakPoints;
|
||||
typedef std::vector<TMemCheck> 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 <vector>
|
||||
#include <string>
|
||||
|
||||
#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<TBreakPoint> TBreakPoints;
|
||||
typedef std::vector<TMemCheck> 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
|
||||
|
||||
|
|
|
@ -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 <vector>
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace Debugger
|
||||
{
|
||||
|
||||
struct CallstackEntry
|
||||
{
|
||||
std::string Name;
|
||||
u32 vAddress;
|
||||
};
|
||||
|
||||
bool GetCallstack(std::vector<CallstackEntry> &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 <vector>
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace Debugger
|
||||
{
|
||||
|
||||
struct CallstackEntry
|
||||
{
|
||||
std::string Name;
|
||||
u32 vAddress;
|
||||
};
|
||||
|
||||
bool GetCallstack(std::vector<CallstackEntry> &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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
#ifndef _PPCDEBUGINTERFACE_H
|
||||
#define _PPCDEBUGINTERFACE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#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 <string>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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<DOL_NUM_TEXT; i++)
|
||||
{
|
||||
if(m_dolheader.textOffset[i] != 0)
|
||||
{
|
||||
u8* pTemp = new u8[m_dolheader.textSize[i]];
|
||||
|
||||
fseek(pStream, m_dolheader.textOffset[i], SEEK_SET);
|
||||
fread(pTemp, 1, m_dolheader.textSize[i], pStream);
|
||||
|
||||
for (size_t num=0; num<m_dolheader.textSize[i]; num++)
|
||||
CMemory::Write_U8(pTemp[num], m_dolheader.textAddress[i] + num);
|
||||
|
||||
delete [] pTemp;
|
||||
}
|
||||
}
|
||||
|
||||
// load all data sections
|
||||
for(int i=0; i<DOL_NUM_DATA; i++)
|
||||
{
|
||||
if(m_dolheader.dataOffset[i] != 0)
|
||||
{
|
||||
u8* pTemp = new u8[m_dolheader.dataSize[i]];
|
||||
|
||||
fseek(pStream, m_dolheader.dataOffset[i], SEEK_SET);
|
||||
fread(pTemp, 1, m_dolheader.dataSize[i], pStream);
|
||||
|
||||
for (size_t num=0; num<m_dolheader.dataSize[i]; num++)
|
||||
CMemory::Write_U8(pTemp[num], m_dolheader.dataAddress[i] + num);
|
||||
|
||||
delete [] pTemp;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(pStream);
|
||||
m_bInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
_u32 GetEntryPoint(void)
|
||||
{
|
||||
return m_dolheader.entryPoint;
|
||||
}
|
||||
|
||||
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;
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If 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<DOL_NUM_TEXT; i++)
|
||||
{
|
||||
if(m_dolheader.textOffset[i] != 0)
|
||||
{
|
||||
u8* pTemp = new u8[m_dolheader.textSize[i]];
|
||||
|
||||
fseek(pStream, m_dolheader.textOffset[i], SEEK_SET);
|
||||
fread(pTemp, 1, m_dolheader.textSize[i], pStream);
|
||||
|
||||
for (size_t num=0; num<m_dolheader.textSize[i]; num++)
|
||||
CMemory::Write_U8(pTemp[num], m_dolheader.textAddress[i] + num);
|
||||
|
||||
delete [] pTemp;
|
||||
}
|
||||
}
|
||||
|
||||
// load all data sections
|
||||
for(int i=0; i<DOL_NUM_DATA; i++)
|
||||
{
|
||||
if(m_dolheader.dataOffset[i] != 0)
|
||||
{
|
||||
u8* pTemp = new u8[m_dolheader.dataSize[i]];
|
||||
|
||||
fseek(pStream, m_dolheader.dataOffset[i], SEEK_SET);
|
||||
fread(pTemp, 1, m_dolheader.dataSize[i], pStream);
|
||||
|
||||
for (size_t num=0; num<m_dolheader.dataSize[i]; num++)
|
||||
CMemory::Write_U8(pTemp[num], m_dolheader.dataAddress[i] + num);
|
||||
|
||||
delete [] pTemp;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(pStream);
|
||||
m_bInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
_u32 GetEntryPoint(void)
|
||||
{
|
||||
return m_dolheader.entryPoint;
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
|
@ -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 _HLE_H
|
||||
#define _HLE_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace HLE
|
||||
{
|
||||
void PatchFunctions();
|
||||
void Patch(u32 pc, const char *func_name);
|
||||
void Execute(u32 _CurrentPC, u32 _Instruction);
|
||||
}
|
||||
|
||||
#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_H
|
||||
#define _HLE_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace HLE
|
||||
{
|
||||
void PatchFunctions();
|
||||
void Patch(u32 pc, const char *func_name);
|
||||
void Execute(u32 _CurrentPC, u32 _Instruction);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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 HLE_MISC_H
|
||||
#define HLE_MISC_H
|
||||
|
||||
namespace HLE_Misc
|
||||
{
|
||||
void Pass();
|
||||
void PanicAlert();
|
||||
void UnimplementedFunction();
|
||||
void UnimplementedFunctionTrue();
|
||||
void UnimplementedFunctionFalse();
|
||||
void GXPeekZ();
|
||||
void GXPeekARGB();
|
||||
void SMB_EvilVecCosine();
|
||||
void SMB_EvilNormalize();
|
||||
void SMB_sqrt_internal();
|
||||
void SMB_rsqrt_internal();
|
||||
void SMB_atan2();
|
||||
void SMB_evil_vec_setlength();
|
||||
}
|
||||
|
||||
#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_MISC_H
|
||||
#define HLE_MISC_H
|
||||
|
||||
namespace HLE_Misc
|
||||
{
|
||||
void Pass();
|
||||
void PanicAlert();
|
||||
void UnimplementedFunction();
|
||||
void UnimplementedFunctionTrue();
|
||||
void UnimplementedFunctionFalse();
|
||||
void GXPeekZ();
|
||||
void GXPeekARGB();
|
||||
void SMB_EvilVecCosine();
|
||||
void SMB_EvilNormalize();
|
||||
void SMB_sqrt_internal();
|
||||
void SMB_rsqrt_internal();
|
||||
void SMB_atan2();
|
||||
void SMB_evil_vec_setlength();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 HLE_OS_H
|
||||
#define HLE_OS_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace HLE_OS
|
||||
{
|
||||
void HLE_vprintf();
|
||||
void HLE_printf();
|
||||
void HLE_OSReport();
|
||||
void HLE_OSPanic();
|
||||
}
|
||||
|
||||
#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_OS_H
|
||||
#define HLE_OS_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace HLE_OS
|
||||
{
|
||||
void HLE_vprintf();
|
||||
void HLE_printf();
|
||||
void HLE_OSReport();
|
||||
void HLE_OSPanic();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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/
|
||||
|
||||
// See CPP file for comments.
|
||||
|
||||
#ifndef _AUDIOINTERFACE_H
|
||||
#define _AUDIOINTERFACE_H
|
||||
|
||||
#include "CommonTypes.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
namespace AudioInterface
|
||||
{
|
||||
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
void Update();
|
||||
|
||||
// Calls by DSP plugin
|
||||
u32 Callback_GetStreaming(short* _pDestBuffer, u32 _numSamples);
|
||||
|
||||
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
|
||||
void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
|
||||
|
||||
// Get the audio rates (48000 or 32000 only)
|
||||
u32 GetAISampleRate();
|
||||
u32 GetDSPSampleRate();
|
||||
|
||||
} // 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/
|
||||
|
||||
// See CPP file for comments.
|
||||
|
||||
#ifndef _AUDIOINTERFACE_H
|
||||
#define _AUDIOINTERFACE_H
|
||||
|
||||
#include "CommonTypes.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
namespace AudioInterface
|
||||
{
|
||||
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
void Update();
|
||||
|
||||
// Calls by DSP plugin
|
||||
u32 Callback_GetStreaming(short* _pDestBuffer, u32 _numSamples);
|
||||
|
||||
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
|
||||
void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
|
||||
|
||||
// Get the audio rates (48000 or 32000 only)
|
||||
u32 GetAISampleRate();
|
||||
u32 GetDSPSampleRate();
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 _CPU_H
|
||||
#define _CPU_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace Common {
|
||||
class Event;
|
||||
}
|
||||
|
||||
class CCPU
|
||||
{
|
||||
public:
|
||||
// init
|
||||
static void Init();
|
||||
|
||||
// shutdown
|
||||
static void Shutdown();
|
||||
|
||||
// starts the CPU
|
||||
static void Run();
|
||||
|
||||
// causes shutdown
|
||||
static void Stop();
|
||||
// Reset
|
||||
static void Reset();
|
||||
|
||||
// StepOpcode (Steps one Opcode)
|
||||
static void StepOpcode(Common::Event *event = 0);
|
||||
|
||||
// one step only
|
||||
static void SingleStep();
|
||||
|
||||
// Enable or Disable Stepping
|
||||
static void EnableStepping(const bool _bStepping);
|
||||
|
||||
// is stepping ?
|
||||
static bool IsStepping();
|
||||
|
||||
// break
|
||||
static void Break();
|
||||
};
|
||||
|
||||
#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 _CPU_H
|
||||
#define _CPU_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace Common {
|
||||
class Event;
|
||||
}
|
||||
|
||||
class CCPU
|
||||
{
|
||||
public:
|
||||
// init
|
||||
static void Init();
|
||||
|
||||
// shutdown
|
||||
static void Shutdown();
|
||||
|
||||
// starts the CPU
|
||||
static void Run();
|
||||
|
||||
// causes shutdown
|
||||
static void Stop();
|
||||
// Reset
|
||||
static void Reset();
|
||||
|
||||
// StepOpcode (Steps one Opcode)
|
||||
static void StepOpcode(Common::Event *event = 0);
|
||||
|
||||
// one step only
|
||||
static void SingleStep();
|
||||
|
||||
// Enable or Disable Stepping
|
||||
static void EnableStepping(const bool _bStepping);
|
||||
|
||||
// is stepping ?
|
||||
static bool IsStepping();
|
||||
|
||||
// break
|
||||
static void Break();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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/
|
||||
// Sets up and maintains interprocess communication to make it possible
|
||||
// to easily compare any two cpu cores by running two instances of DolphinHLE and
|
||||
// comparing them to each other.
|
||||
//
|
||||
|
||||
#ifndef _CPUCOMPARE_H
|
||||
#define _CPUCOMPARE_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace CPUCompare
|
||||
{
|
||||
// start the server
|
||||
void StartServer();
|
||||
|
||||
// connect as client
|
||||
void ConnectAsClient();
|
||||
|
||||
// stop
|
||||
void Stop();
|
||||
|
||||
// sync
|
||||
int Sync();
|
||||
|
||||
// IsEnabled
|
||||
bool IsEnabled();
|
||||
|
||||
// IsServer
|
||||
bool IsServer();
|
||||
|
||||
void SetBlockStart(u32 addr);
|
||||
}
|
||||
|
||||
#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/
|
||||
// Sets up and maintains interprocess communication to make it possible
|
||||
// to easily compare any two cpu cores by running two instances of DolphinHLE and
|
||||
// comparing them to each other.
|
||||
//
|
||||
|
||||
#ifndef _CPUCOMPARE_H
|
||||
#define _CPUCOMPARE_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
namespace CPUCompare
|
||||
{
|
||||
// start the server
|
||||
void StartServer();
|
||||
|
||||
// connect as client
|
||||
void ConnectAsClient();
|
||||
|
||||
// stop
|
||||
void Stop();
|
||||
|
||||
// sync
|
||||
int Sync();
|
||||
|
||||
// IsEnabled
|
||||
bool IsEnabled();
|
||||
|
||||
// IsServer
|
||||
bool IsServer();
|
||||
|
||||
void SetBlockStart(u32 addr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 _COMMANDPROCESSOR_H
|
||||
#define _COMMANDPROCESSOR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "pluginspecs_video.h"
|
||||
class PointerWrap;
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#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 <windows.h>
|
||||
#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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <string>
|
||||
|
||||
#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 <string>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <string>
|
||||
#include <queue>
|
||||
#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<SBuffer> InBuffer;
|
||||
std::vector<SBuffer> 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<NumberInBuffer; i++)
|
||||
{
|
||||
u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
|
||||
u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
|
||||
|
||||
LOGV(WII_IPC_HLE, 1, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i);
|
||||
|
||||
std::string Temp;
|
||||
for (u32 j=0; j<InBufferSize; j++)
|
||||
{
|
||||
char Buffer[128];
|
||||
sprintf(Buffer, "%02x ", Memory::Read_U8(InBuffer+j));
|
||||
Temp.append(Buffer);
|
||||
}
|
||||
|
||||
LOGV(WII_IPC_HLE, 1, " Buffer: %s", Temp.c_str());
|
||||
}
|
||||
|
||||
|
||||
for (u32 i = 0; i < NumberOutBuffer; i++)
|
||||
{
|
||||
#ifdef LOGGING
|
||||
u32 OutBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
|
||||
u32 OutBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
|
||||
#endif
|
||||
|
||||
Memory::Write_U32(1, _CommandAddress + 0x4);
|
||||
|
||||
LOGV(WII_IPC_HLE, 1, "%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i);
|
||||
LOGV(WII_IPC_HLE, 1, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize);
|
||||
|
||||
#ifdef LOGGING
|
||||
DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, 1);
|
||||
#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 _WII_IPC_HLE_DEVICE_H_
|
||||
#define _WII_IPC_HLE_DEVICE_H_
|
||||
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#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<SBuffer> InBuffer;
|
||||
std::vector<SBuffer> 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<NumberInBuffer; i++)
|
||||
{
|
||||
u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
|
||||
u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
|
||||
|
||||
LOGV(WII_IPC_HLE, 1, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i);
|
||||
|
||||
std::string Temp;
|
||||
for (u32 j=0; j<InBufferSize; j++)
|
||||
{
|
||||
char Buffer[128];
|
||||
sprintf(Buffer, "%02x ", Memory::Read_U8(InBuffer+j));
|
||||
Temp.append(Buffer);
|
||||
}
|
||||
|
||||
LOGV(WII_IPC_HLE, 1, " Buffer: %s", Temp.c_str());
|
||||
}
|
||||
|
||||
|
||||
for (u32 i = 0; i < NumberOutBuffer; i++)
|
||||
{
|
||||
#ifdef LOGGING
|
||||
u32 OutBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
|
||||
u32 OutBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
|
||||
#endif
|
||||
|
||||
Memory::Write_U32(1, _CommandAddress + 0x4);
|
||||
|
||||
LOGV(WII_IPC_HLE, 1, "%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i);
|
||||
LOGV(WII_IPC_HLE, 1, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize);
|
||||
|
||||
#ifdef LOGGING
|
||||
DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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 _WII_IPC_HLE_DEVICE_DI_H_
|
||||
#define _WII_IPC_HLE_DEVICE_DI_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class IVolume;
|
||||
class IFileSystem;
|
||||
}
|
||||
|
||||
class CWII_IPC_HLE_Device_di : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_di();
|
||||
|
||||
bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
bool IOCtl(u32 _CommandAddress);
|
||||
bool IOCtlV(u32 _CommandAddress);
|
||||
|
||||
private:
|
||||
|
||||
u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize);
|
||||
|
||||
DiscIO::IVolume* m_pVolume;
|
||||
DiscIO::IFileSystem* m_pFileSystem;
|
||||
};
|
||||
|
||||
#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_DI_H_
|
||||
#define _WII_IPC_HLE_DEVICE_DI_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class IVolume;
|
||||
class IFileSystem;
|
||||
}
|
||||
|
||||
class CWII_IPC_HLE_Device_di : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_di();
|
||||
|
||||
bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
bool IOCtl(u32 _CommandAddress);
|
||||
bool IOCtlV(u32 _CommandAddress);
|
||||
|
||||
private:
|
||||
|
||||
u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize);
|
||||
|
||||
DiscIO::IVolume* m_pVolume;
|
||||
DiscIO::IFileSystem* m_pFileSystem;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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_HLE_DEVICE_ERROR_H_
|
||||
#define _WII_IPC_HLE_DEVICE_ERROR_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_Error : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_Error(u32 _DeviceID, const std::string& _rDeviceName ) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_Error()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
PanicAlert("CWII_IPC_HLE_Device_Error");
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#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_ERROR_H_
|
||||
#define _WII_IPC_HLE_DEVICE_ERROR_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_Error : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_Error(u32 _DeviceID, const std::string& _rDeviceName ) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_Error()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
PanicAlert("CWII_IPC_HLE_Device_Error");
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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 _WII_IPC_HLE_DEVICE_FILEIO_H_
|
||||
#define _WII_IPC_HLE_DEVICE_FILEIO_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_FileIO();
|
||||
|
||||
bool Close(u32 _CommandAddress);
|
||||
bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
bool Seek(u32 _CommandAddress);
|
||||
bool Read(u32 _CommandAddress);
|
||||
bool Write(u32 _CommandAddress);
|
||||
bool IOCtl(u32 _CommandAddress);
|
||||
bool ReturnFileHandle();
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
ISFS_FUNCNULL = 0,
|
||||
ISFS_FUNCGETSTAT = 1,
|
||||
ISFS_FUNCREADDIR = 2,
|
||||
ISFS_FUNCGETATTR = 3,
|
||||
ISFS_FUNCGETUSAGE = 4,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ISFS_IOCTL_FORMAT = 1,
|
||||
ISFS_IOCTL_GETSTATS = 2,
|
||||
ISFS_IOCTL_CREATEDIR = 3,
|
||||
ISFS_IOCTL_READDIR = 4,
|
||||
ISFS_IOCTL_SETATTR = 5,
|
||||
ISFS_IOCTL_GETATTR = 6,
|
||||
ISFS_IOCTL_DELETE = 7,
|
||||
ISFS_IOCTL_RENAME = 8,
|
||||
ISFS_IOCTL_CREATEFILE = 9,
|
||||
ISFS_IOCTL_SETFILEVERCTRL = 10,
|
||||
ISFS_IOCTL_GETFILESTATS = 11,
|
||||
ISFS_IOCTL_GETUSAGE = 12,
|
||||
ISFS_IOCTL_SHUTDOWN = 13,
|
||||
};
|
||||
|
||||
FILE* m_pFileHandle;
|
||||
u64 m_FileLength;
|
||||
|
||||
std::string m_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 _WII_IPC_HLE_DEVICE_FILEIO_H_
|
||||
#define _WII_IPC_HLE_DEVICE_FILEIO_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_FileIO(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_FileIO();
|
||||
|
||||
bool Close(u32 _CommandAddress);
|
||||
bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
bool Seek(u32 _CommandAddress);
|
||||
bool Read(u32 _CommandAddress);
|
||||
bool Write(u32 _CommandAddress);
|
||||
bool IOCtl(u32 _CommandAddress);
|
||||
bool ReturnFileHandle();
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
ISFS_FUNCNULL = 0,
|
||||
ISFS_FUNCGETSTAT = 1,
|
||||
ISFS_FUNCREADDIR = 2,
|
||||
ISFS_FUNCGETATTR = 3,
|
||||
ISFS_FUNCGETUSAGE = 4,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ISFS_IOCTL_FORMAT = 1,
|
||||
ISFS_IOCTL_GETSTATS = 2,
|
||||
ISFS_IOCTL_CREATEDIR = 3,
|
||||
ISFS_IOCTL_READDIR = 4,
|
||||
ISFS_IOCTL_SETATTR = 5,
|
||||
ISFS_IOCTL_GETATTR = 6,
|
||||
ISFS_IOCTL_DELETE = 7,
|
||||
ISFS_IOCTL_RENAME = 8,
|
||||
ISFS_IOCTL_CREATEFILE = 9,
|
||||
ISFS_IOCTL_SETFILEVERCTRL = 10,
|
||||
ISFS_IOCTL_GETFILESTATS = 11,
|
||||
ISFS_IOCTL_GETUSAGE = 12,
|
||||
ISFS_IOCTL_SHUTDOWN = 13,
|
||||
};
|
||||
|
||||
FILE* m_pFileHandle;
|
||||
u64 m_FileLength;
|
||||
|
||||
std::string m_Filename;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,227 +1,227 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
|
||||
// =======================================================
|
||||
// File description
|
||||
// -------------
|
||||
/* Here we handle /dev/es requests. We have cases for these functions, the exact
|
||||
DevKitPro name is en parenthesis:
|
||||
|
||||
0x20 GetTitleID (ES_GetTitleID) (Input: none, Output: 8 bytes)
|
||||
0x1d GetDataDir (ES_GetDataDir) (Input: 8 bytes, Output: 30 bytes)
|
||||
|
||||
0x1b DiGetTicketView (Input: none, Output: 216 bytes)
|
||||
0x16 GetConsumption (Input: 8 bytes, Output: 0 bytes, 4 bytes) // there are two output buffers
|
||||
|
||||
0x12 GetNumTicketViews (ES_GetNumTicketViews) (Input: 8 bytes, Output: 4 bytes)
|
||||
0x14 GetTMDViewSize (ES_GetTMDViewSize) (Input: ?, Output: ?) // I don't get this anymore,
|
||||
it used to come after 0x12
|
||||
|
||||
but only the first two are correctly supported. For the other four we ignore any potential
|
||||
input and only write zero to the out buffer. However, most games only use first two,
|
||||
but some Nintendo developed games use the other ones to:
|
||||
|
||||
0x1b: Mario Galaxy, Mario Kart, SSBB
|
||||
0x16: Mario Galaxy, Mario Kart, SSBB
|
||||
0x12: Mario Kart
|
||||
0x14: Mario Kart: But only if we don't return a zeroed out buffer for the 0x12 question,
|
||||
and instead answer for example 1 will this question appear.
|
||||
|
||||
*/
|
||||
// =============
|
||||
|
||||
|
||||
|
||||
#ifndef _WII_IPC_HLE_DEVICE_ES_H_
|
||||
#define _WII_IPC_HLE_DEVICE_ES_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
#include "../VolumeHandler.h"
|
||||
|
||||
// http://wiibrew.org/index.php?title=/dev/es
|
||||
|
||||
class CWII_IPC_HLE_Device_es : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
IOCTL_ES_ADDTICKET = 0x01,
|
||||
IOCTL_ES_ADDTITLESTART = 0x02,
|
||||
IOCTL_ES_ADDCONTENTSTART = 0x03,
|
||||
IOCTL_ES_ADDCONTENTDATA = 0x04,
|
||||
IOCTL_ES_ADDCONTENTFINISH = 0x05,
|
||||
IOCTL_ES_ADDTITLEFINISH = 0x06,
|
||||
IOCTL_ES_LAUNCH = 0x08,
|
||||
IOCTL_ES_OPENCONTENT = 0x09,
|
||||
IOCTL_ES_READCONTENT = 0x0A,
|
||||
IOCTL_ES_CLOSECONTENT = 0x0B,
|
||||
IOCTL_ES_GETTITLECOUNT = 0x0E,
|
||||
IOCTL_ES_GETTITLES = 0x0F,
|
||||
IOCTL_ES_GETVIEWCNT = 0x12,
|
||||
IOCTL_ES_GETVIEWS = 0x13,
|
||||
IOCTL_ES_GETTMDVIEWCNT = 0x14,
|
||||
IOCTL_ES_GETCONSUMPTION = 0x16,
|
||||
IOCTL_ES_DIGETTICKETVIEW = 0x1b,
|
||||
IOCTL_ES_DIVERIFY = 0x1C,
|
||||
IOCTL_ES_GETTITLEDIR = 0x1D,
|
||||
IOCTL_ES_GETTITLEID = 0x20,
|
||||
IOCTL_ES_SEEKCONTENT = 0x23,
|
||||
IOCTL_ES_ADDTMD = 0x2B,
|
||||
IOCTL_ES_ADDTITLECANCEL = 0x2F,
|
||||
IOCTL_ES_GETSTOREDCONTENTCNT = 0x32,
|
||||
IOCTL_ES_GETSTOREDCONTENTS = 0x33,
|
||||
IOCTL_ES_GETSTOREDTMDSIZE = 0x34,
|
||||
IOCTL_ES_GETSTOREDTMD = 0x35,
|
||||
IOCTL_ES_GETSHAREDCONTENTCNT = 0x36,
|
||||
IOCTL_ES_GETSHAREDCONTENTS = 0x37,
|
||||
};
|
||||
|
||||
|
||||
CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_es()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool Close(u32 _CommandAddress)
|
||||
{
|
||||
LOG(WII_IPC_ES, "ES: Close");
|
||||
Memory::Write_U32(0, _CommandAddress + 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IOCtlV(u32 _CommandAddress)
|
||||
{
|
||||
SIOCtlVBuffer Buffer(_CommandAddress);
|
||||
|
||||
LOG(WII_IPC_ES, "%s (0x%x)", GetDeviceName().c_str(), Buffer.Parameter);
|
||||
|
||||
// Prepare the out buffer(s) with zeroes as a safety precaution
|
||||
// to avoid returning bad values
|
||||
for(u32 i = 0; i < Buffer.NumberPayloadBuffer; i++)
|
||||
{
|
||||
Memory::Memset(Buffer.PayloadBuffer[i].m_Address, 0,
|
||||
Buffer.PayloadBuffer[i].m_Size);
|
||||
}
|
||||
|
||||
switch(Buffer.Parameter)
|
||||
{
|
||||
case IOCTL_ES_GETTITLEDIR: // 0x1d
|
||||
{
|
||||
/* I changed reading the TitleID from disc to reading from the
|
||||
InBuffer, if it fails it's because of some kind of memory error
|
||||
that we would want to fix anyway */
|
||||
u32 TitleID = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
|
||||
if (TitleID == 0) TitleID = 0xF00DBEEF;
|
||||
|
||||
char* pTitleID = (char*)&TitleID;
|
||||
char* Path = (char*)Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
|
||||
sprintf(Path, "/00010000/%08x/data", TitleID);
|
||||
|
||||
LOG(WII_IPC_ES, "ES: IOCTL_ES_GETTITLEDIR: %s)", Path);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETTITLEID: // 0x20
|
||||
{
|
||||
u32 TitleID = VolumeHandler::Read32(0);
|
||||
if (TitleID == 0) TitleID = 0xF00DBEEF;
|
||||
|
||||
/* This seems to be the right address to write the Title ID to
|
||||
because then it shows up in the InBuffer of IOCTL_ES_GETTITLEDIR
|
||||
that is called right after this. I have not seen that this
|
||||
have any effect by itself, it probably only matters as an input to
|
||||
IOCTL_ES_GETTITLEDIR. This values is not stored in 0x3180 or anywhere
|
||||
else as I have seen, it's just used as an input buffer in the following
|
||||
IOCTL_ES_GETTITLEDIR call and then forgotten. */
|
||||
Memory::Write_U32(TitleID, Buffer.PayloadBuffer[0].m_Address);
|
||||
LOG(WII_IPC_ES, "ES: IOCTL_ES_GETTITLEID: 0x%x", TitleID);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETVIEWCNT: // 0x12 (Input: 8 bytes, Output: 4 bytes)
|
||||
{
|
||||
if(Buffer.NumberInBuffer)
|
||||
u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
|
||||
|
||||
// Should we write something here?
|
||||
//Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address);
|
||||
|
||||
//DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4,
|
||||
// LogTypes::WII_IPC_NET);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETTMDVIEWCNT: // 0x14
|
||||
{
|
||||
if(Buffer.NumberInBuffer)
|
||||
u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
|
||||
|
||||
// Should we write something here?
|
||||
//Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETCONSUMPTION: // (Input: 8 bytes, Output: 0 bytes, 4 bytes)
|
||||
//DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4,
|
||||
// LogTypes::WII_IPC_NET);
|
||||
break;
|
||||
case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes)
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETTITLECOUNT:
|
||||
{
|
||||
u32 OutBuffer = Memory::Read_U32(Buffer.PayloadBuffer[0].m_Address);
|
||||
|
||||
Memory::Write_U32(0, OutBuffer);
|
||||
|
||||
LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es command:"
|
||||
" IOCTL_ES_GETTITLECOUNT: 0x%x", OutBuffer);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
_dbg_assert_msg_(WII_IPC_HLE, 0, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
|
||||
|
||||
DumpCommands(_CommandAddress, 8);
|
||||
LOG(WII_IPC_HLE, "CWII_IPC_HLE_Device_es command:"
|
||||
"Parameter: 0x%08x", Buffer.Parameter);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Write return value (0 means OK)
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#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/
|
||||
|
||||
|
||||
|
||||
// =======================================================
|
||||
// File description
|
||||
// -------------
|
||||
/* Here we handle /dev/es requests. We have cases for these functions, the exact
|
||||
DevKitPro name is en parenthesis:
|
||||
|
||||
0x20 GetTitleID (ES_GetTitleID) (Input: none, Output: 8 bytes)
|
||||
0x1d GetDataDir (ES_GetDataDir) (Input: 8 bytes, Output: 30 bytes)
|
||||
|
||||
0x1b DiGetTicketView (Input: none, Output: 216 bytes)
|
||||
0x16 GetConsumption (Input: 8 bytes, Output: 0 bytes, 4 bytes) // there are two output buffers
|
||||
|
||||
0x12 GetNumTicketViews (ES_GetNumTicketViews) (Input: 8 bytes, Output: 4 bytes)
|
||||
0x14 GetTMDViewSize (ES_GetTMDViewSize) (Input: ?, Output: ?) // I don't get this anymore,
|
||||
it used to come after 0x12
|
||||
|
||||
but only the first two are correctly supported. For the other four we ignore any potential
|
||||
input and only write zero to the out buffer. However, most games only use first two,
|
||||
but some Nintendo developed games use the other ones to:
|
||||
|
||||
0x1b: Mario Galaxy, Mario Kart, SSBB
|
||||
0x16: Mario Galaxy, Mario Kart, SSBB
|
||||
0x12: Mario Kart
|
||||
0x14: Mario Kart: But only if we don't return a zeroed out buffer for the 0x12 question,
|
||||
and instead answer for example 1 will this question appear.
|
||||
|
||||
*/
|
||||
// =============
|
||||
|
||||
|
||||
|
||||
#ifndef _WII_IPC_HLE_DEVICE_ES_H_
|
||||
#define _WII_IPC_HLE_DEVICE_ES_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
#include "../VolumeHandler.h"
|
||||
|
||||
// http://wiibrew.org/index.php?title=/dev/es
|
||||
|
||||
class CWII_IPC_HLE_Device_es : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
IOCTL_ES_ADDTICKET = 0x01,
|
||||
IOCTL_ES_ADDTITLESTART = 0x02,
|
||||
IOCTL_ES_ADDCONTENTSTART = 0x03,
|
||||
IOCTL_ES_ADDCONTENTDATA = 0x04,
|
||||
IOCTL_ES_ADDCONTENTFINISH = 0x05,
|
||||
IOCTL_ES_ADDTITLEFINISH = 0x06,
|
||||
IOCTL_ES_LAUNCH = 0x08,
|
||||
IOCTL_ES_OPENCONTENT = 0x09,
|
||||
IOCTL_ES_READCONTENT = 0x0A,
|
||||
IOCTL_ES_CLOSECONTENT = 0x0B,
|
||||
IOCTL_ES_GETTITLECOUNT = 0x0E,
|
||||
IOCTL_ES_GETTITLES = 0x0F,
|
||||
IOCTL_ES_GETVIEWCNT = 0x12,
|
||||
IOCTL_ES_GETVIEWS = 0x13,
|
||||
IOCTL_ES_GETTMDVIEWCNT = 0x14,
|
||||
IOCTL_ES_GETCONSUMPTION = 0x16,
|
||||
IOCTL_ES_DIGETTICKETVIEW = 0x1b,
|
||||
IOCTL_ES_DIVERIFY = 0x1C,
|
||||
IOCTL_ES_GETTITLEDIR = 0x1D,
|
||||
IOCTL_ES_GETTITLEID = 0x20,
|
||||
IOCTL_ES_SEEKCONTENT = 0x23,
|
||||
IOCTL_ES_ADDTMD = 0x2B,
|
||||
IOCTL_ES_ADDTITLECANCEL = 0x2F,
|
||||
IOCTL_ES_GETSTOREDCONTENTCNT = 0x32,
|
||||
IOCTL_ES_GETSTOREDCONTENTS = 0x33,
|
||||
IOCTL_ES_GETSTOREDTMDSIZE = 0x34,
|
||||
IOCTL_ES_GETSTOREDTMD = 0x35,
|
||||
IOCTL_ES_GETSHAREDCONTENTCNT = 0x36,
|
||||
IOCTL_ES_GETSHAREDCONTENTS = 0x37,
|
||||
};
|
||||
|
||||
|
||||
CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_es()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool Close(u32 _CommandAddress)
|
||||
{
|
||||
LOG(WII_IPC_ES, "ES: Close");
|
||||
Memory::Write_U32(0, _CommandAddress + 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IOCtlV(u32 _CommandAddress)
|
||||
{
|
||||
SIOCtlVBuffer Buffer(_CommandAddress);
|
||||
|
||||
LOG(WII_IPC_ES, "%s (0x%x)", GetDeviceName().c_str(), Buffer.Parameter);
|
||||
|
||||
// Prepare the out buffer(s) with zeroes as a safety precaution
|
||||
// to avoid returning bad values
|
||||
for(u32 i = 0; i < Buffer.NumberPayloadBuffer; i++)
|
||||
{
|
||||
Memory::Memset(Buffer.PayloadBuffer[i].m_Address, 0,
|
||||
Buffer.PayloadBuffer[i].m_Size);
|
||||
}
|
||||
|
||||
switch(Buffer.Parameter)
|
||||
{
|
||||
case IOCTL_ES_GETTITLEDIR: // 0x1d
|
||||
{
|
||||
/* I changed reading the TitleID from disc to reading from the
|
||||
InBuffer, if it fails it's because of some kind of memory error
|
||||
that we would want to fix anyway */
|
||||
u32 TitleID = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
|
||||
if (TitleID == 0) TitleID = 0xF00DBEEF;
|
||||
|
||||
char* pTitleID = (char*)&TitleID;
|
||||
char* Path = (char*)Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
|
||||
sprintf(Path, "/00010000/%08x/data", TitleID);
|
||||
|
||||
LOG(WII_IPC_ES, "ES: IOCTL_ES_GETTITLEDIR: %s)", Path);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETTITLEID: // 0x20
|
||||
{
|
||||
u32 TitleID = VolumeHandler::Read32(0);
|
||||
if (TitleID == 0) TitleID = 0xF00DBEEF;
|
||||
|
||||
/* This seems to be the right address to write the Title ID to
|
||||
because then it shows up in the InBuffer of IOCTL_ES_GETTITLEDIR
|
||||
that is called right after this. I have not seen that this
|
||||
have any effect by itself, it probably only matters as an input to
|
||||
IOCTL_ES_GETTITLEDIR. This values is not stored in 0x3180 or anywhere
|
||||
else as I have seen, it's just used as an input buffer in the following
|
||||
IOCTL_ES_GETTITLEDIR call and then forgotten. */
|
||||
Memory::Write_U32(TitleID, Buffer.PayloadBuffer[0].m_Address);
|
||||
LOG(WII_IPC_ES, "ES: IOCTL_ES_GETTITLEID: 0x%x", TitleID);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETVIEWCNT: // 0x12 (Input: 8 bytes, Output: 4 bytes)
|
||||
{
|
||||
if(Buffer.NumberInBuffer)
|
||||
u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
|
||||
|
||||
// Should we write something here?
|
||||
//Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address);
|
||||
|
||||
//DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4,
|
||||
// LogTypes::WII_IPC_NET);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETTMDVIEWCNT: // 0x14
|
||||
{
|
||||
if(Buffer.NumberInBuffer)
|
||||
u32 InBuffer = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
|
||||
|
||||
// Should we write something here?
|
||||
//Memory::Write_U32(0, Buffer.PayloadBuffer[0].m_Address);
|
||||
}
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETCONSUMPTION: // (Input: 8 bytes, Output: 0 bytes, 4 bytes)
|
||||
//DumpCommands(Buffer.InBuffer[0].m_Address, Buffer.InBuffer[0].m_Size / 4,
|
||||
// LogTypes::WII_IPC_NET);
|
||||
break;
|
||||
case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes)
|
||||
break;
|
||||
|
||||
case IOCTL_ES_GETTITLECOUNT:
|
||||
{
|
||||
u32 OutBuffer = Memory::Read_U32(Buffer.PayloadBuffer[0].m_Address);
|
||||
|
||||
Memory::Write_U32(0, OutBuffer);
|
||||
|
||||
LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es command:"
|
||||
" IOCTL_ES_GETTITLECOUNT: 0x%x", OutBuffer);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
_dbg_assert_msg_(WII_IPC_HLE, 0, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
|
||||
|
||||
DumpCommands(_CommandAddress, 8);
|
||||
LOG(WII_IPC_HLE, "CWII_IPC_HLE_Device_es command:"
|
||||
"Parameter: 0x%08x", Buffer.Parameter);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Write return value (0 means OK)
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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 _WII_IPC_HLE_DEVICE_FS_H_
|
||||
#define _WII_IPC_HLE_DEVICE_FS_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_fs : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
virtual ~CWII_IPC_HLE_Device_fs();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
|
||||
#if 0
|
||||
virtual bool Close(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Close()", m_Name.c_str()); return true; }
|
||||
virtual bool 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; }
|
||||
#endif
|
||||
|
||||
virtual bool IOCtl(u32 _CommandAddress);
|
||||
|
||||
virtual bool IOCtlV(u32 _CommandAddress);
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
GET_STATS = 0x02,
|
||||
CREATE_DIR = 0x03,
|
||||
IOCTL_READ_DIR = 0x04,
|
||||
SET_ATTR = 0x05,
|
||||
GET_ATTR = 0x06,
|
||||
DELETE_FILE = 0x07,
|
||||
RENAME_FILE = 0x08,
|
||||
CREATE_FILE = 0x09,
|
||||
IOCTL_GETUSAGE = 0x0C
|
||||
};
|
||||
|
||||
s32 ExecuteCommand(u32 Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
|
||||
};
|
||||
|
||||
#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_FS_H_
|
||||
#define _WII_IPC_HLE_DEVICE_FS_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_fs : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
virtual ~CWII_IPC_HLE_Device_fs();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
|
||||
#if 0
|
||||
virtual bool Close(u32 _CommandAddress) { _dbg_assert_msg_(WII_IPC_HLE, 0, "%s is not able to run Close()", m_Name.c_str()); return true; }
|
||||
virtual bool 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; }
|
||||
#endif
|
||||
|
||||
virtual bool IOCtl(u32 _CommandAddress);
|
||||
|
||||
virtual bool IOCtlV(u32 _CommandAddress);
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
GET_STATS = 0x02,
|
||||
CREATE_DIR = 0x03,
|
||||
IOCTL_READ_DIR = 0x04,
|
||||
SET_ATTR = 0x05,
|
||||
GET_ATTR = 0x06,
|
||||
DELETE_FILE = 0x07,
|
||||
RENAME_FILE = 0x08,
|
||||
CREATE_FILE = 0x09,
|
||||
IOCTL_GETUSAGE = 0x0C
|
||||
};
|
||||
|
||||
s32 ExecuteCommand(u32 Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,126 +1,126 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, 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_NET_H_
|
||||
#define _WII_IPC_HLE_DEVICE_NET_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_net_kd_request : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_net_kd_request();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
virtual bool Close(u32 _CommandAddress);
|
||||
virtual bool IOCtl(u32 _CommandAddress);
|
||||
|
||||
private:
|
||||
|
||||
s32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
|
||||
};
|
||||
|
||||
// **************************************************************************************
|
||||
|
||||
class CWII_IPC_HLE_Device_net_kd_time : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_net_kd_time(u32 _DeviceID, const std::string& _rDeviceName) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_net_kd_time()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str());
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool Close(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
LOG(WII_IPC_NET, "%s - IOCtl: Close", GetDeviceName().c_str());
|
||||
Memory::Write_U32(0, _CommandAddress + 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IOCtl(u32 _CommandAddress)
|
||||
{
|
||||
#ifdef LOGGING
|
||||
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
|
||||
u32 Buffer1 = Memory::Read_U32(_CommandAddress +0x10);
|
||||
u32 BufferSize1 = Memory::Read_U32(_CommandAddress +0x14);
|
||||
u32 Buffer2 = Memory::Read_U32(_CommandAddress +0x18);
|
||||
u32 BufferSize2 = Memory::Read_U32(_CommandAddress +0x1C);
|
||||
#endif
|
||||
|
||||
// write return value
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
|
||||
LOG(WII_IPC_NET, "%s - IOCtl:\n"
|
||||
" Parameter: 0x%x (0x17 could be some kind of Sync RTC) \n"
|
||||
" Buffer1: 0x%08x\n"
|
||||
" BufferSize1: 0x%08x\n"
|
||||
" Buffer2: 0x%08x\n"
|
||||
" BufferSize2: 0x%08x\n",
|
||||
GetDeviceName().c_str(), Parameter, Buffer1, BufferSize1, Buffer2, BufferSize2);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// **************************************************************************************
|
||||
|
||||
class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_net_ip_top() {}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str());
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// **************************************************************************************
|
||||
|
||||
class CWII_IPC_HLE_Device_net_ncd_manage : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_net_ncd_manage(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_net_ncd_manage();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
virtual bool IOCtlV(u32 _CommandAddress);
|
||||
|
||||
};
|
||||
|
||||
#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_NET_H_
|
||||
#define _WII_IPC_HLE_DEVICE_NET_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_net_kd_request : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_net_kd_request(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_net_kd_request();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
virtual bool Close(u32 _CommandAddress);
|
||||
virtual bool IOCtl(u32 _CommandAddress);
|
||||
|
||||
private:
|
||||
|
||||
s32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize);
|
||||
};
|
||||
|
||||
// **************************************************************************************
|
||||
|
||||
class CWII_IPC_HLE_Device_net_kd_time : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_net_kd_time(u32 _DeviceID, const std::string& _rDeviceName) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_net_kd_time()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str());
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool Close(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
LOG(WII_IPC_NET, "%s - IOCtl: Close", GetDeviceName().c_str());
|
||||
Memory::Write_U32(0, _CommandAddress + 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IOCtl(u32 _CommandAddress)
|
||||
{
|
||||
#ifdef LOGGING
|
||||
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
|
||||
u32 Buffer1 = Memory::Read_U32(_CommandAddress +0x10);
|
||||
u32 BufferSize1 = Memory::Read_U32(_CommandAddress +0x14);
|
||||
u32 Buffer2 = Memory::Read_U32(_CommandAddress +0x18);
|
||||
u32 BufferSize2 = Memory::Read_U32(_CommandAddress +0x1C);
|
||||
#endif
|
||||
|
||||
// write return value
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
|
||||
LOG(WII_IPC_NET, "%s - IOCtl:\n"
|
||||
" Parameter: 0x%x (0x17 could be some kind of Sync RTC) \n"
|
||||
" Buffer1: 0x%08x\n"
|
||||
" BufferSize1: 0x%08x\n"
|
||||
" Buffer2: 0x%08x\n"
|
||||
" BufferSize2: 0x%08x\n",
|
||||
GetDeviceName().c_str(), Parameter, Buffer1, BufferSize1, Buffer2, BufferSize2);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// **************************************************************************************
|
||||
|
||||
class CWII_IPC_HLE_Device_net_ip_top : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_net_ip_top(u32 _DeviceID, const std::string& _rDeviceName) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_net_ip_top() {}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
LOG(WII_IPC_NET, "%s - IOCtl: Open", GetDeviceName().c_str());
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// **************************************************************************************
|
||||
|
||||
class CWII_IPC_HLE_Device_net_ncd_manage : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_net_ncd_manage(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_net_ncd_manage();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
virtual bool IOCtlV(u32 _CommandAddress);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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/
|
||||
|
||||
// PRELIMINARY - doesn't work yet
|
||||
|
||||
#ifndef _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_
|
||||
#define _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class IVolume;
|
||||
class IFileSystem;
|
||||
}
|
||||
|
||||
class CWII_IPC_HLE_Device_sdio_slot0 : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_sdio_slot0();
|
||||
|
||||
bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
bool IOCtl(u32 _CommandAddress);
|
||||
bool IOCtlV(u32 _CommandAddress);
|
||||
|
||||
private:
|
||||
|
||||
u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize);
|
||||
};
|
||||
|
||||
#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/
|
||||
|
||||
// PRELIMINARY - doesn't work yet
|
||||
|
||||
#ifndef _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_
|
||||
#define _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
class IVolume;
|
||||
class IFileSystem;
|
||||
}
|
||||
|
||||
class CWII_IPC_HLE_Device_sdio_slot0 : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_sdio_slot0();
|
||||
|
||||
bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
bool IOCtl(u32 _CommandAddress);
|
||||
bool IOCtlV(u32 _CommandAddress);
|
||||
|
||||
private:
|
||||
|
||||
u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,193 +1,193 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, 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_STM_H_
|
||||
#define _WII_IPC_HLE_DEVICE_STM_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
enum
|
||||
{
|
||||
IOCTL_STM_EVENTHOOK = 0x1000,
|
||||
IOCTL_STM_GET_IDLEMODE = 0x3001,
|
||||
IOCTL_STM_RELEASE_EH = 0x3002,
|
||||
IOCTL_STM_HOTRESET = 0x2001,
|
||||
IOCTL_STM_HOTRESET_FOR_PD = 0x2002,
|
||||
IOCTL_STM_SHUTDOWN = 0x2003,
|
||||
IOCTL_STM_IDLE = 0x2004,
|
||||
IOCTL_STM_WAKEUP = 0x2005,
|
||||
IOCTL_STM_VIDIMMING = 0x5001,
|
||||
IOCTL_STM_LEDFLASH = 0x6001,
|
||||
IOCTL_STM_LEDMODE = 0x6002,
|
||||
IOCTL_STM_READVER = 0x7001,
|
||||
IOCTL_STM_READDDRREG = 0x4001,
|
||||
IOCTL_STM_READDDRREG2 = 0x4002,
|
||||
};
|
||||
|
||||
|
||||
// =======================================================
|
||||
// The /device/stm/immediate class
|
||||
// -------------
|
||||
class CWII_IPC_HLE_Device_stm_immediate : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_stm_immediate(u32 _DeviceID, const std::string& _rDeviceName) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_stm_immediate()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
LOGV(WII_IPC_SD, 0, "STM: Open");
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IOCtl(u32 _CommandAddress)
|
||||
{
|
||||
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
|
||||
u32 BufferIn = Memory::Read_U32(_CommandAddress +0x10);
|
||||
u32 BufferInSize = Memory::Read_U32(_CommandAddress +0x14);
|
||||
u32 BufferOut = Memory::Read_U32(_CommandAddress +0x18);
|
||||
u32 BufferOutSize = Memory::Read_U32(_CommandAddress +0x1C);
|
||||
|
||||
// Prepare the out buffer(s) with zeroes as a safety precaution
|
||||
// to avoid returning bad values
|
||||
Memory::Memset(BufferOut, 0, BufferOutSize);
|
||||
u32 ReturnValue = 0;
|
||||
|
||||
switch(Parameter)
|
||||
{
|
||||
case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes)
|
||||
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " IOCTL_STM_VIDIMMING");
|
||||
//DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_SD);
|
||||
//Memory::Write_U32(1, BufferOut);
|
||||
//ReturnValue = 1;
|
||||
break;
|
||||
|
||||
case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes)
|
||||
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " IOCTL_STM_LEDMODE");
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
_dbg_assert_msg_(WII_IPC_SD, 0, "CWII_IPC_HLE_Device_stm_immediate: 0x%x", Parameter);
|
||||
|
||||
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " Parameter: 0x%x\n", Parameter);
|
||||
LOG(WII_IPC_SD, " InBuffer: 0x%08x\n", BufferIn);
|
||||
LOG(WII_IPC_SD, " InBufferSize: 0x%08x\n", BufferInSize);
|
||||
LOG(WII_IPC_SD, " OutBuffer: 0x%08x\n", BufferOut);
|
||||
LOG(WII_IPC_SD, " OutBufferSize: 0x%08x\n", BufferOutSize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Write return value to the IPC call
|
||||
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
|
||||
|
||||
// Generate true or false reply for the main UpdateInterrupts() function
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// =======================================================
|
||||
// The /device/stm/eventhook class
|
||||
// -------------
|
||||
class CWII_IPC_HLE_Device_stm_eventhook : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_stm_eventhook(u32 _DeviceID, const std::string& _rDeviceName)
|
||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
, m_EventHookAddress(0)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_stm_eventhook()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress + 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IOCtl(u32 _CommandAddress)
|
||||
{
|
||||
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
|
||||
u32 BufferIn = Memory::Read_U32(_CommandAddress +0x10);
|
||||
u32 BufferInSize = Memory::Read_U32(_CommandAddress +0x14);
|
||||
u32 BufferOut = Memory::Read_U32(_CommandAddress +0x18);
|
||||
u32 BufferOutSize = Memory::Read_U32(_CommandAddress +0x1C);
|
||||
|
||||
// Prepare the out buffer(s) with zeroes as a safety precaution
|
||||
// to avoid returning bad values
|
||||
Memory::Memset(BufferOut, 0, BufferOutSize);
|
||||
u32 ReturnValue = 0;
|
||||
|
||||
// write return value
|
||||
switch (Parameter)
|
||||
{
|
||||
case IOCTL_STM_EVENTHOOK:
|
||||
{
|
||||
m_EventHookAddress = _CommandAddress;
|
||||
|
||||
LOG(WII_IPC_SD, "%s registers event hook:\n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " 0x1000 - IOCTL_STM_EVENTHOOK\n", Parameter);
|
||||
LOG(WII_IPC_SD, " BufferIn: 0x%08x\n", BufferIn);
|
||||
LOG(WII_IPC_SD, " BufferInSize: 0x%08x\n", BufferInSize);
|
||||
LOG(WII_IPC_SD, " BufferOut: 0x%08x\n", BufferOut);
|
||||
LOG(WII_IPC_SD, " BufferOutSize: 0x%08x\n", BufferOutSize);
|
||||
|
||||
DumpCommands(BufferIn, BufferInSize/4, LogTypes::WII_IPC_SD);
|
||||
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
_dbg_assert_msg_(WII_IPC_SD, 0, "CWII_IPC_HLE_Device_stm_eventhook: 0x%x", Parameter);
|
||||
LOG(WII_IPC_SD, "%s registers event hook:\n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " Parameter: 0x%x\n", Parameter);
|
||||
LOG(WII_IPC_SD, " BufferIn: 0x%08x\n", BufferIn);
|
||||
LOG(WII_IPC_SD, " BufferInSize: 0x%08x\n", BufferInSize);
|
||||
LOG(WII_IPC_SD, " BufferOut: 0x%08x\n", BufferOut);
|
||||
LOG(WII_IPC_SD, " BufferOutSize: 0x%08x\n", BufferOutSize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Write return value to the IPC call, 0 means success
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
|
||||
// Generate true or false reply for the main UpdateInterrupts() function
|
||||
return false;
|
||||
}
|
||||
|
||||
// STATE_TO_SAVE
|
||||
u32 m_EventHookAddress;
|
||||
};
|
||||
|
||||
|
||||
#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_STM_H_
|
||||
#define _WII_IPC_HLE_DEVICE_STM_H_
|
||||
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
|
||||
enum
|
||||
{
|
||||
IOCTL_STM_EVENTHOOK = 0x1000,
|
||||
IOCTL_STM_GET_IDLEMODE = 0x3001,
|
||||
IOCTL_STM_RELEASE_EH = 0x3002,
|
||||
IOCTL_STM_HOTRESET = 0x2001,
|
||||
IOCTL_STM_HOTRESET_FOR_PD = 0x2002,
|
||||
IOCTL_STM_SHUTDOWN = 0x2003,
|
||||
IOCTL_STM_IDLE = 0x2004,
|
||||
IOCTL_STM_WAKEUP = 0x2005,
|
||||
IOCTL_STM_VIDIMMING = 0x5001,
|
||||
IOCTL_STM_LEDFLASH = 0x6001,
|
||||
IOCTL_STM_LEDMODE = 0x6002,
|
||||
IOCTL_STM_READVER = 0x7001,
|
||||
IOCTL_STM_READDDRREG = 0x4001,
|
||||
IOCTL_STM_READDDRREG2 = 0x4002,
|
||||
};
|
||||
|
||||
|
||||
// =======================================================
|
||||
// The /device/stm/immediate class
|
||||
// -------------
|
||||
class CWII_IPC_HLE_Device_stm_immediate : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_stm_immediate(u32 _DeviceID, const std::string& _rDeviceName) :
|
||||
IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_stm_immediate()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
LOGV(WII_IPC_SD, 0, "STM: Open");
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress+4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IOCtl(u32 _CommandAddress)
|
||||
{
|
||||
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
|
||||
u32 BufferIn = Memory::Read_U32(_CommandAddress +0x10);
|
||||
u32 BufferInSize = Memory::Read_U32(_CommandAddress +0x14);
|
||||
u32 BufferOut = Memory::Read_U32(_CommandAddress +0x18);
|
||||
u32 BufferOutSize = Memory::Read_U32(_CommandAddress +0x1C);
|
||||
|
||||
// Prepare the out buffer(s) with zeroes as a safety precaution
|
||||
// to avoid returning bad values
|
||||
Memory::Memset(BufferOut, 0, BufferOutSize);
|
||||
u32 ReturnValue = 0;
|
||||
|
||||
switch(Parameter)
|
||||
{
|
||||
case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes)
|
||||
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " IOCTL_STM_VIDIMMING");
|
||||
//DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_SD);
|
||||
//Memory::Write_U32(1, BufferOut);
|
||||
//ReturnValue = 1;
|
||||
break;
|
||||
|
||||
case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes)
|
||||
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " IOCTL_STM_LEDMODE");
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
_dbg_assert_msg_(WII_IPC_SD, 0, "CWII_IPC_HLE_Device_stm_immediate: 0x%x", Parameter);
|
||||
|
||||
LOG(WII_IPC_SD, "%s - IOCtl: \n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " Parameter: 0x%x\n", Parameter);
|
||||
LOG(WII_IPC_SD, " InBuffer: 0x%08x\n", BufferIn);
|
||||
LOG(WII_IPC_SD, " InBufferSize: 0x%08x\n", BufferInSize);
|
||||
LOG(WII_IPC_SD, " OutBuffer: 0x%08x\n", BufferOut);
|
||||
LOG(WII_IPC_SD, " OutBufferSize: 0x%08x\n", BufferOutSize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Write return value to the IPC call
|
||||
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
|
||||
|
||||
// Generate true or false reply for the main UpdateInterrupts() function
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// =======================================================
|
||||
// The /device/stm/eventhook class
|
||||
// -------------
|
||||
class CWII_IPC_HLE_Device_stm_eventhook : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
||||
CWII_IPC_HLE_Device_stm_eventhook(u32 _DeviceID, const std::string& _rDeviceName)
|
||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
, m_EventHookAddress(0)
|
||||
{}
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_stm_eventhook()
|
||||
{}
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode)
|
||||
{
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress + 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IOCtl(u32 _CommandAddress)
|
||||
{
|
||||
u32 Parameter = Memory::Read_U32(_CommandAddress +0x0C);
|
||||
u32 BufferIn = Memory::Read_U32(_CommandAddress +0x10);
|
||||
u32 BufferInSize = Memory::Read_U32(_CommandAddress +0x14);
|
||||
u32 BufferOut = Memory::Read_U32(_CommandAddress +0x18);
|
||||
u32 BufferOutSize = Memory::Read_U32(_CommandAddress +0x1C);
|
||||
|
||||
// Prepare the out buffer(s) with zeroes as a safety precaution
|
||||
// to avoid returning bad values
|
||||
Memory::Memset(BufferOut, 0, BufferOutSize);
|
||||
u32 ReturnValue = 0;
|
||||
|
||||
// write return value
|
||||
switch (Parameter)
|
||||
{
|
||||
case IOCTL_STM_EVENTHOOK:
|
||||
{
|
||||
m_EventHookAddress = _CommandAddress;
|
||||
|
||||
LOG(WII_IPC_SD, "%s registers event hook:\n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " 0x1000 - IOCTL_STM_EVENTHOOK\n", Parameter);
|
||||
LOG(WII_IPC_SD, " BufferIn: 0x%08x\n", BufferIn);
|
||||
LOG(WII_IPC_SD, " BufferInSize: 0x%08x\n", BufferInSize);
|
||||
LOG(WII_IPC_SD, " BufferOut: 0x%08x\n", BufferOut);
|
||||
LOG(WII_IPC_SD, " BufferOutSize: 0x%08x\n", BufferOutSize);
|
||||
|
||||
DumpCommands(BufferIn, BufferInSize/4, LogTypes::WII_IPC_SD);
|
||||
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
_dbg_assert_msg_(WII_IPC_SD, 0, "CWII_IPC_HLE_Device_stm_eventhook: 0x%x", Parameter);
|
||||
LOG(WII_IPC_SD, "%s registers event hook:\n", GetDeviceName().c_str());
|
||||
LOG(WII_IPC_SD, " Parameter: 0x%x\n", Parameter);
|
||||
LOG(WII_IPC_SD, " BufferIn: 0x%08x\n", BufferIn);
|
||||
LOG(WII_IPC_SD, " BufferInSize: 0x%08x\n", BufferInSize);
|
||||
LOG(WII_IPC_SD, " BufferOut: 0x%08x\n", BufferOut);
|
||||
LOG(WII_IPC_SD, " BufferOutSize: 0x%08x\n", BufferOutSize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Write return value to the IPC call, 0 means success
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
|
||||
// Generate true or false reply for the main UpdateInterrupts() function
|
||||
return false;
|
||||
}
|
||||
|
||||
// STATE_TO_SAVE
|
||||
u32 m_EventHookAddress;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,220 +1,220 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, 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 <vector>
|
||||
#include <queue>
|
||||
|
||||
#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<CWII_IPC_HLE_WiiMote> 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<SQueuedEvent> CEventQueue;
|
||||
typedef std::queue<ACLFrame> 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 <vector>
|
||||
#include <queue>
|
||||
|
||||
#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<CWII_IPC_HLE_WiiMote> 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<SQueuedEvent> CEventQueue;
|
||||
typedef std::queue<ACLFrame> 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
|
||||
|
||||
|
|
|
@ -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 <map>
|
||||
#include "hci.h"
|
||||
#include <string>
|
||||
|
||||
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<u32, SChannel> 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 <map>
|
||||
#include "hci.h"
|
||||
#include <string>
|
||||
|
||||
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<u32, SChannel> 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
|
||||
|
|
|
@ -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<SAttrib> 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<SAttrib> CAttribTable;
|
||||
|
||||
const CAttribTable& GetAttribTable();
|
||||
|
||||
const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -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 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<PatchEntry> entries;
|
||||
bool active;
|
||||
};
|
||||
|
||||
int GetSpeedhackCycles(u32 addr);
|
||||
void LoadPatchSection(const char *section, std::vector<Patch> &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<PatchEntry> entries;
|
||||
bool active;
|
||||
};
|
||||
|
||||
int GetSpeedhackCycles(u32 addr);
|
||||
void LoadPatchSection(const char *section, std::vector<Patch> &patches, IniFile &ini);
|
||||
void LoadPatches(const char *gameID);
|
||||
void ApplyFramePatches();
|
||||
void ApplyARPatches();
|
||||
} // namespace
|
||||
|
||||
#endif //_PATCHENGINE_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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <string.h>
|
||||
|
||||
#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 <string.h>
|
||||
|
||||
#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
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue