DEV9: initial merge complete

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-10-03 17:31:30 +02:00 committed by refractionpcsx2
parent b3ae282522
commit a2e2ed1ecf
15 changed files with 56 additions and 105 deletions

View File

@ -29,7 +29,6 @@ include(BuildParameters)
# SearchForStuff be done before SelectPcsx2Plugins
include(SearchForStuff)
include(SelectPcsx2Plugins)
include(macros/GlibCompileResourcesSupport)
# Must be done after SearchForStuff
get_git_version_info()

View File

@ -1,3 +1,6 @@
include(macros/GlibCompileResourcesSupport)
if (openSUSE)
# openSUSE don't install wx in a standard library system
# path. Let's bypass the dynamic linker and hardcode the path.
@ -310,7 +313,7 @@ set(pcsx2DEV9Sources
DEV9/Linux/Config.cpp
DEV9/Linux/Linux.cpp
DEV9/Linux/net.cpp
${pcsx2DEV9UISources}
#${pcsx2DEV9UISources}
)
# DEV9 headers
@ -320,7 +323,7 @@ set(pcsx2DEV9Headers
DEV9/net.h
DEV9/pcap_io.h
DEV9/smap.h
${pcsx2DEV9UIHeaders}
#${pcsx2DEV9UIHeaders}
)

View File

@ -82,17 +82,6 @@ u8 eeprom[] = {
u32 *iopPC;
const unsigned char version = PS2E_DEV9_VERSION;
const unsigned char revision = 0;
const unsigned char build = 4; // increase that with each version
static const char *libraryName = "GiGaHeRz's DEV9 Driver"
#ifdef _DEBUG
"(debug)"
#endif
;
#ifdef _WIN32
HANDLE hEeprom;
HANDLE mapping;
@ -101,22 +90,6 @@ int hEeprom;
int mapping;
#endif
EXPORT_C_(u32)
PS2EgetLibType() {
return PS2E_LT_DEV9;
}
EXPORT_C_(const char*)
PS2EgetLibName() {
return libraryName;
}
EXPORT_C_(u32)
PS2EgetLibVersion2(u32 type) {
return (version<<16) | (revision<<8) | build;
}
std::string s_strIniPath = "inis";
std::string s_strLogPath = "logs";
// Warning: The below log function is SLOW. Better fix it before attempting to use it.
@ -157,8 +130,7 @@ void LogInit()
DEV9Log.Open(LogFile);
}
EXPORT_C_(s32)
DEV9init()
s32 DEV9init()
{
#ifdef DEV9_LOG_ENABLE
@ -242,16 +214,14 @@ DEV9init()
return 0;
}
EXPORT_C_(void)
DEV9shutdown() {
void DEV9shutdown() {
DEV9_LOG("DEV9shutdown\n");
#ifdef DEV9_LOG_ENABLE
DEV9Log.Close();
#endif
}
EXPORT_C_(s32)
DEV9open(void *pDsp)
s32 DEV9open(void *pDsp)
{
DEV9_LOG("DEV9open\n");
LoadConf();
@ -266,8 +236,7 @@ DEV9open(void *pDsp)
return _DEV9open();
}
EXPORT_C_(void)
DEV9close()
void DEV9close()
{
DEV9_LOG("DEV9close\n");
#ifdef ENABLE_ATA
@ -276,8 +245,7 @@ DEV9close()
_DEV9close();
}
EXPORT_C_(int)
_DEV9irqHandler(void)
int DEV9irqHandler(void)
{
//dev9Ru16(SPD_R_INTR_STAT)|= dev9.irqcause;
DEV9_LOG("_DEV9irqHandler %x, %x\n", dev9.irqcause, dev9Ru16(SPD_R_INTR_MASK));
@ -286,11 +254,6 @@ _DEV9irqHandler(void)
return 0;
}
EXPORT_C_(DEV9handler)
DEV9irqHandler(void) {
return (DEV9handler)_DEV9irqHandler;
}
void _DEV9irq(int cause, int cycles)
{
DEV9_LOG("_DEV9irq %x, %x\n", cause, dev9Ru16(SPD_R_INTR_MASK));
@ -298,14 +261,13 @@ void _DEV9irq(int cause, int cycles)
dev9.irqcause|= cause;
if(cycles<1)
DEV9irq(1);
dev9Irq(1);
else
DEV9irq(cycles);
dev9Irq(cycles);
}
EXPORT_C_(u8)
DEV9read8(u32 addr) {
u8 DEV9read8(u32 addr) {
if (!config.ethEnable & !config.hddEnable)
return 0;
@ -372,8 +334,7 @@ EXPORT_C_(u8)
return hard;
}
EXPORT_C_(u16)
DEV9read16(u32 addr)
u16 DEV9read16(u32 addr)
{
if (!config.ethEnable & !config.hddEnable)
return 0;
@ -438,8 +399,7 @@ DEV9read16(u32 addr)
return hard;
}
EXPORT_C_(u32)
DEV9read32(u32 addr)
u32 DEV9read32(u32 addr)
{
if (!config.ethEnable & !config.hddEnable)
return 0;
@ -474,8 +434,7 @@ DEV9read32(u32 addr)
// return hard;
}
EXPORT_C_(void)
DEV9write8(u32 addr, u8 value)
void DEV9write8(u32 addr, u8 value)
{
if (!config.ethEnable & !config.hddEnable)
return;
@ -585,8 +544,7 @@ DEV9write8(u32 addr, u8 value)
DEV9_LOG("*Known 8bit write at address %lx value %x\n", addr, value);
}
EXPORT_C_(void)
DEV9write16(u32 addr, u16 value)
void DEV9write16(u32 addr, u16 value)
{
if (!config.ethEnable & !config.hddEnable)
return;
@ -610,7 +568,7 @@ DEV9write16(u32 addr, u16 value)
if ((dev9Ru16(SPD_R_INTR_MASK)!=value) && ((dev9Ru16(SPD_R_INTR_MASK)|value) & dev9.irqcause))
{
DEV9_LOG("SPD_R_INTR_MASK16=0x%X , checking for masked/unmasked interrupts\n",value);
DEV9irq(1);
dev9Irq(1);
}
break;
@ -629,8 +587,7 @@ DEV9write16(u32 addr, u16 value)
DEV9_LOG("*Known 16bit write at address %lx value %x\n", addr, value);
}
EXPORT_C_(void)
DEV9write32(u32 addr, u32 value)
void DEV9write32(u32 addr, u32 value)
{
if (!config.ethEnable & !config.hddEnable)
return;
@ -667,8 +624,7 @@ DEV9write32(u32 addr, u32 value)
DEV9_LOG("*Known 32bit write at address %lx value %lx\n", addr, value);
}
EXPORT_C_(void)
DEV9readDMA8Mem(u32 *pMem, int size)
void DEV9readDMA8Mem(u32 *pMem, int size)
{
if (!config.ethEnable & !config.hddEnable)
return;
@ -682,8 +638,7 @@ DEV9readDMA8Mem(u32 *pMem, int size)
#endif
}
EXPORT_C_(void)
DEV9writeDMA8Mem(u32* pMem, int size)
void DEV9writeDMA8Mem(u32* pMem, int size)
{
if (!config.ethEnable & !config.hddEnable)
return;
@ -698,35 +653,21 @@ DEV9writeDMA8Mem(u32* pMem, int size)
}
//plugin interface
EXPORT_C_(void)
DEV9irqCallback(void (*callback)(int cycles)) {
DEV9irq = callback;
}
EXPORT_C_(void)
DEV9async(u32 cycles)
void DEV9async(u32 cycles)
{
smap_async(cycles);
}
// extended funcs
EXPORT_C_(s32)
DEV9test() {
return 0;
}
EXPORT_C_(void)
DEV9setSettingsDir(const char* dir)
void DEV9setSettingsDir(const char* dir)
{
// Grab the ini directory.
// TODO: Use
s_strIniPath = (dir == NULL) ? "inis" : dir;
}
EXPORT_C_(void)
DEV9setLogDir(const char* dir)
void DEV9setLogDir(const char* dir)
{
// Get the path to the log directory.
s_strLogPath = (dir == NULL) ? "logs" : dir;

View File

@ -122,7 +122,6 @@ EXTERN int ThreadRun;
s32 _DEV9open();
void _DEV9close();
EXTERN DEV9callback DEV9irq;
//void DEV9thread();
EXTERN PluginLog DEV9Log;
@ -636,13 +635,22 @@ static flash_info_t devices[] = {
#define FLASH_REGSIZE 0x20
EXPORT_C_(void)
FLASHinit();
EXPORT_C_(u32)
FLASHread32(u32 addr, int size);
EXPORT_C_(void)
FLASHwrite32(u32 addr, u32 value, int size);
extern void dev9Irq(int cycles);
void FLASHinit();
u32 FLASHread32(u32 addr, int size);
void FLASHwrite32(u32 addr, u32 value, int size);
void _DEV9irq(int cause, int cycles);
int DEV9irqHandler(void);
void DEV9async(u32 cycles);
void DEV9writeDMA8Mem(u32* pMem, int size);
void DEV9readDMA8Mem(u32 *pMem, int size);
u8 DEV9read8(u32 addr);
u16 DEV9read16(u32 addr);
u32 DEV9read32(u32 addr);
void DEV9write8(u32 addr, u8 value);
void DEV9write16(u32 addr, u16 value);
void DEV9write32(u32 addr, u32 value);
int emu_printf(const char *fmt, ...);

View File

@ -22,11 +22,11 @@
#include <pwd.h>
#include <string.h>
#include "Config.h"
#include "../Config.h"
#include "../DEV9.h"
#include "pcap.h"
#include "pcap_io.h"
#include "net.h"
#include "../pcap_io.h"
#include "../net.h"
static GtkBuilder * builder;

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "net.h"
#include "../net.h"
#include "../DEV9.h"
#include <pthread.h>

View File

@ -57,8 +57,7 @@ static const char* getCmdName(u32 cmd){
}
}
EXPORT_C_(void)
FLASHinit(){
void FLASHinit(){
FILE *fd;
id= FLASH_ID_64MBIT;
@ -82,8 +81,7 @@ FLASHinit(){
memset(file, 0xFF, CARD_SIZE_ECC);
}
EXPORT_C_(u32)
FLASHread32(u32 addr, int size) {
u32 FLASHread32(u32 addr, int size) {
u32 value, refill= 0;
switch(addr) {
@ -148,8 +146,7 @@ EXPORT_C_(u32)
}
}
EXPORT_C_(void)
FLASHwrite32(u32 addr, u32 value, int size) {
void FLASHwrite32(u32 addr, u32 value, int size) {
switch(addr & 0x1FFFFFFF) {
case FLASH_R_DATA:

View File

@ -21,6 +21,7 @@
#include "PrecompiledHeader.h"
#include "IopCommon.h"
#include "SPU2/spu2.h"
#include "DEV9/DEV9.h"
#include <math.h>
@ -514,11 +515,8 @@ void psxRcntUpdate()
else
c -= difference;
psxNextCounter = c;
if (DEV9async)
{
DEV9async(1);
}
if (USBasync)
DEV9async(1);
if(USBasync)
{
const s32 difference = psxRegs.cycle - psxCounters[7].sCycleT;
s32 c = psxCounters[7].CycleT;

View File

@ -18,6 +18,7 @@
#include "SPU2/spu2.h"
#include "Sif.h"
#include "DEV9/DEV9.h"
using namespace R3000A;

View File

@ -42,5 +42,4 @@ extern void spu2DMA7Irq();
extern void iopIntcIrq( uint irqType );
extern void iopTestIntc();
extern DEV9handler dev9Handler;
extern USBhandler usbHandler;

View File

@ -15,12 +15,13 @@
#include "PrecompiledHeader.h"
#include "IopCommon.h"
#include "DEV9/DEV9.h"
using namespace R3000A;
void dev9Interrupt()
{
if ((dev9Handler != NULL) && (dev9Handler() != 1)) return;
if (DEV9irqHandler() != 1) return;
iopIntcIrq(13);
}

View File

@ -18,6 +18,7 @@
#include "IopCommon.h"
#include "ps2/pgif.h" // for PSX kernel TTY in iopMemWrite32
#include "SPU2/spu2.h"
#include "DEV9/DEV9.h"
uptr *psxMemWLUT = NULL;
const uptr *psxMemRLUT = NULL;

View File

@ -41,6 +41,7 @@ BIOS
#include "GS.h"
#include "VUmicro.h"
#include "MTVU.h"
#include "DEV9/DEV9.h"
#include "ps2/HwInternal.h"
#include "ps2/BiosTools.h"

View File

@ -21,6 +21,7 @@
#include "CDVD/CdRom.h"
#include "FW.h"
#include "SPU2/spu2.h"
#include "DEV9/DEV9.h"
#include "ps2/pgif.h"
#include "Mdec.h"

View File

@ -20,6 +20,7 @@
#include "FW.h"
#include "CDVD/CdRom.h"
#include "SPU2/spu2.h"
#include "DEV9/DEV9.h"
#include "ps2/pgif.h"
#include "Mdec.h"