mirror of https://github.com/PCSX2/pcsx2.git
FW: including back some references
This commit is contained in:
parent
0fdef7b7d7
commit
4a3e67d143
|
@ -48,8 +48,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LilyPad", "plugins\LilyPad\
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "USBnull", "plugins\USBnull\Windows\USBnull.vcxproj", "{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FWnull", "plugins\FWnull\Windows\FWnull.vcxproj", "{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DEV9null", "plugins\dev9null\Windows\DEV9null.vcxproj", "{04439C5F-05FB-4A9C-AAD1-5388C25377DB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x86emitter", "common\build\x86emitter\x86emitter.vcxproj", "{A51123F5-9505-4EAE-85E7-D320290A272C}"
|
||||
|
@ -238,26 +236,6 @@ Global
|
|||
{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release|Win32.Build.0 = Release|Win32
|
||||
{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release|x64.ActiveCfg = Release|x64
|
||||
{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release|x64.Build.0 = Release|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Debug|x64.Build.0 = Debug|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Devel|Win32.ActiveCfg = Release|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Devel|Win32.Build.0 = Release|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Devel|x64.ActiveCfg = Release|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Devel|x64.Build.0 = Release|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release AVX2|Win32.ActiveCfg = Release|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release AVX2|Win32.Build.0 = Release|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release AVX2|x64.ActiveCfg = Release|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release AVX2|x64.Build.0 = Release|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSE4|Win32.ActiveCfg = Release|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSE4|Win32.Build.0 = Release|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSE4|x64.ActiveCfg = Release|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSE4|x64.Build.0 = Release|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release|Win32.Build.0 = Release|Win32
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release|x64.ActiveCfg = Release|x64
|
||||
{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release|x64.Build.0 = Release|x64
|
||||
{04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
|
|
@ -56,6 +56,7 @@ set(pcsx2Sources
|
|||
GameDatabase.cpp
|
||||
Dump.cpp
|
||||
Elfheader.cpp
|
||||
FW.cpp
|
||||
FiFo.cpp
|
||||
FPU.cpp
|
||||
Gif.cpp
|
||||
|
@ -135,6 +136,7 @@ set(pcsx2Headers
|
|||
Dump.h
|
||||
GameDatabase.h
|
||||
Elfheader.h
|
||||
FW.h
|
||||
Gif.h
|
||||
Gif_Unit.h
|
||||
GS.h
|
||||
|
|
|
@ -0,0 +1,312 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be 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 PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include "FW.h"
|
||||
#include "svnrev.h"
|
||||
#include "null/config.inl"
|
||||
|
||||
const u8 version = PS2E_FW_VERSION;
|
||||
const u8 revision = 0;
|
||||
const u8 build = 7; // increase that with each version
|
||||
|
||||
static char libraryName[256];
|
||||
|
||||
string s_strIniPath = "inis";
|
||||
string s_strLogPath = "logs";
|
||||
|
||||
u8 phyregs[16];
|
||||
s8 *fwregs;
|
||||
|
||||
void (*FWirq)();
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWconfigure()
|
||||
{
|
||||
const std::string ini_path = s_strIniPath + "/FWnull.ini";
|
||||
LoadConfig(ini_path);
|
||||
ConfigureLogging();
|
||||
SaveConfig(ini_path);
|
||||
}
|
||||
|
||||
void LogInit()
|
||||
{
|
||||
const std::string LogFile(s_strLogPath + "/FWnull.log");
|
||||
g_plugin_log.Open(LogFile);
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWsetLogDir(const char *dir)
|
||||
{
|
||||
// Get the path to the log directory.
|
||||
s_strLogPath = (dir == NULL) ? "logs" : dir;
|
||||
|
||||
// Reload the log file after updated the path
|
||||
g_plugin_log.Close();
|
||||
LogInit();
|
||||
}
|
||||
|
||||
EXPORT_C_(u32)
|
||||
PS2EgetLibType()
|
||||
{
|
||||
return PS2E_LT_FW;
|
||||
}
|
||||
|
||||
EXPORT_C_(const char *)
|
||||
PS2EgetLibName()
|
||||
{
|
||||
snprintf(libraryName, 255, "FWnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");
|
||||
return libraryName;
|
||||
}
|
||||
|
||||
EXPORT_C_(u32)
|
||||
PS2EgetLibVersion2(u32 type)
|
||||
{
|
||||
return (version << 16) | (revision << 8) | build;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWinit()
|
||||
{
|
||||
LoadConfig(s_strIniPath + "/FWnull.ini");
|
||||
LogInit();
|
||||
g_plugin_log.WriteLn("FWnull plugin version %d,%d", revision, build);
|
||||
g_plugin_log.WriteLn("Initializing FWnull");
|
||||
|
||||
memset(phyregs, 0, sizeof(phyregs));
|
||||
// Initializing our registers.
|
||||
fwregs = (s8 *)calloc(0x10000, 1);
|
||||
if (fwregs == NULL) {
|
||||
g_plugin_log.Message("Error allocating Memory");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWshutdown()
|
||||
{
|
||||
// Freeing the registers.
|
||||
free(fwregs);
|
||||
fwregs = NULL;
|
||||
|
||||
g_plugin_log.Close();
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWopen(void *pDsp)
|
||||
{
|
||||
g_plugin_log.WriteLn("Opening FWnull.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWclose()
|
||||
{
|
||||
// Close the plugin.
|
||||
g_plugin_log.WriteLn("Closing FWnull.");
|
||||
}
|
||||
|
||||
void PHYWrite()
|
||||
{
|
||||
u8 reg = (PHYACC >> 8) & 0xf;
|
||||
u8 data = PHYACC & 0xff;
|
||||
|
||||
phyregs[reg] = data;
|
||||
|
||||
PHYACC &= ~0x4000ffff;
|
||||
}
|
||||
|
||||
void PHYRead()
|
||||
{
|
||||
u8 reg = (PHYACC >> 24) & 0xf;
|
||||
|
||||
PHYACC &= ~0x80000000;
|
||||
|
||||
PHYACC |= phyregs[reg] | (reg << 8);
|
||||
|
||||
if (fwRu32(0x8424) & 0x40000000) //RRx interrupt mask
|
||||
{
|
||||
fwRu32(0x8420) |= 0x40000000;
|
||||
FWirq();
|
||||
}
|
||||
}
|
||||
EXPORT_C_(u32)
|
||||
FWread32(u32 addr)
|
||||
{
|
||||
u32 ret = 0;
|
||||
|
||||
switch (addr) {
|
||||
//Node ID Register the top part is default, bottom part i got from my ps2
|
||||
case 0x1f808400:
|
||||
ret = /*(0x3ff << 22) | 1;*/ 0xffc00001;
|
||||
break;
|
||||
// Control Register 2
|
||||
case 0x1f808410:
|
||||
ret = fwRu32(addr); //SCLK OK (Needs to be set when FW is "Ready"
|
||||
break;
|
||||
//Interrupt 0 Register
|
||||
case 0x1f808420:
|
||||
ret = fwRu32(addr);
|
||||
break;
|
||||
|
||||
//Dunno what this is, but my home console always returns this value 0x10000001
|
||||
//Seems to be related to the Node ID however (does some sort of compare/check)
|
||||
case 0x1f80847c:
|
||||
ret = 0x10000001;
|
||||
break;
|
||||
|
||||
// Include other relevant 32 bit addresses we need to catch here.
|
||||
default:
|
||||
// By default, read fwregs.
|
||||
ret = fwRu32(addr);
|
||||
break;
|
||||
}
|
||||
|
||||
g_plugin_log.WriteLn("FW read mem 0x%x: 0x%x", addr, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWwrite32(u32 addr, u32 value)
|
||||
{
|
||||
switch (addr) {
|
||||
// Include other memory locations we want to catch here.
|
||||
// For example:
|
||||
//
|
||||
// case 0x1f808400:
|
||||
// case 0x1f808414:
|
||||
// case 0x1f808420:
|
||||
// case 0x1f808428:
|
||||
// case 0x1f808430:
|
||||
//
|
||||
|
||||
//PHY access
|
||||
case 0x1f808414:
|
||||
//If in read mode (top bit set) we read the PHY register requested then set the RRx interrupt if it's enabled
|
||||
//Im presuming we send that back to pcsx2 then. This register stores the result, plus whatever was written (minus the read/write flag
|
||||
fwRu32(addr) = value; //R/W Bit cleaned in underneath function
|
||||
if (value & 0x40000000) //Writing to PHY
|
||||
{
|
||||
PHYWrite();
|
||||
} else if (value & 0x80000000) //Reading from PHY
|
||||
{
|
||||
PHYRead();
|
||||
}
|
||||
break;
|
||||
|
||||
//Control Register 0
|
||||
case 0x1f808408:
|
||||
//This enables different functions of the link interface
|
||||
//Just straight writes, should brobably struct these later.
|
||||
//Default written settings (on unreal tournament) are
|
||||
//Urcv M = 1
|
||||
//RSP 0 = 1
|
||||
//Retlim = 0xF
|
||||
//Cyc Tmr En = 1
|
||||
//Bus ID Rst = 1
|
||||
//Rcv Self ID = 1
|
||||
fwRu32(addr) = value;
|
||||
// if((value & 0x800000) && (fwRu32(0x842C) & 0x2))
|
||||
// {
|
||||
// fwRu32(0x8428) |= 0x2;
|
||||
// FWirq();
|
||||
// }
|
||||
fwRu32(addr) &= ~0x800000;
|
||||
break;
|
||||
//Control Register 2
|
||||
case 0x1f808410: // fwRu32(addr) = value; break;
|
||||
//Ignore writes to this for now, apart from 0x2 which is Link Power Enable
|
||||
//0x8 is SCLK OK (Ready) which should be set for emulation
|
||||
fwRu32(addr) = 0x8 /*| value & 0x2*/;
|
||||
break;
|
||||
//Interrupt 0 Register
|
||||
case 0x1f808420:
|
||||
//Interrupt 1 Register
|
||||
case 0x1f808428:
|
||||
//Interrupt 2 Register
|
||||
case 0x1f808430:
|
||||
//Writes of 1 clear the corresponding bits
|
||||
fwRu32(addr) &= ~value;
|
||||
break;
|
||||
//Interrupt 0 Register Mask
|
||||
case 0x1f808424:
|
||||
//Interrupt 1 Register Mask
|
||||
case 0x1f80842C:
|
||||
//Interrupt 2 Register Mask
|
||||
case 0x1f808434:
|
||||
//These are direct writes (as it's a mask!)
|
||||
fwRu32(addr) = value;
|
||||
break;
|
||||
//DMA Control and Status Register 0
|
||||
case 0x1f8084B8:
|
||||
fwRu32(addr) = value;
|
||||
break;
|
||||
//DMA Control and Status Register 1
|
||||
case 0x1f808538:
|
||||
fwRu32(addr) = value;
|
||||
break;
|
||||
default:
|
||||
// By default, just write it to fwregs.
|
||||
fwRu32(addr) = value;
|
||||
break;
|
||||
}
|
||||
g_plugin_log.WriteLn("FW write mem 0x%x: 0x%x", addr, value);
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWirqCallback(void (*callback)())
|
||||
{
|
||||
// Register FWirq, so we can trigger an interrupt with it later.
|
||||
FWirq = callback;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
FWsetSettingsDir(const char *dir)
|
||||
{
|
||||
// Find out from pcsx2 where we are supposed to put our ini file.
|
||||
s_strIniPath = (dir == NULL) ? "inis" : dir;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWfreeze(int mode, freezeData *data)
|
||||
{
|
||||
// This should store or retrieve any information, for if emulation
|
||||
// gets suspended, or for savestates.
|
||||
switch (mode) {
|
||||
case FREEZE_LOAD:
|
||||
// Load previously saved data.
|
||||
break;
|
||||
case FREEZE_SAVE:
|
||||
// Save data.
|
||||
break;
|
||||
case FREEZE_SIZE:
|
||||
// return the size of the data.
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
FWtest()
|
||||
{
|
||||
// 0 if the plugin works, non-0 if it doesn't.
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2020 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be 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 PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define FWdefs
|
||||
#include "PS2Edefs.h"
|
||||
#include "PS2Eext.h"
|
||||
|
||||
// Our main memory storage, and defines for accessing it.
|
||||
extern s8 *fwregs;
|
||||
#define fwRs32(mem) (*(s32 *)&fwregs[(mem)&0xffff])
|
||||
#define fwRu32(mem) (*(u32 *)&fwregs[(mem)&0xffff])
|
||||
|
||||
//PHY Access Address for ease of use :P
|
||||
#define PHYACC fwRu32(0x8414)
|
||||
|
||||
extern void (*FWirq)();
|
||||
|
|
@ -189,6 +189,7 @@
|
|||
<ClCompile Include="..\..\gui\Panels\MemoryCardListView.cpp" />
|
||||
<ClCompile Include="..\..\IopGte.cpp" />
|
||||
<ClCompile Include="..\..\IPC.cpp" />
|
||||
<ClCompile Include="..\..\FW.cpp" />
|
||||
<ClCompile Include="..\..\IPU\IPUdma.cpp" />
|
||||
<ClCompile Include="..\..\IPU\IPUdither.cpp" />
|
||||
<ClCompile Include="..\..\Linux\LnxConsolePipe.cpp">
|
||||
|
@ -439,6 +440,7 @@
|
|||
<ClInclude Include="..\..\gui\Panels\MemoryCardPanels.h" />
|
||||
<ClInclude Include="..\..\IopGte.h" />
|
||||
<ClInclude Include="..\..\IPC.h" />
|
||||
<ClInclude Include="..\..\FW.h" />
|
||||
<ClInclude Include="..\..\IPU\IPUdma.h" />
|
||||
<ClInclude Include="..\..\Mdec.h" />
|
||||
<ClInclude Include="..\..\Patch.h" />
|
||||
|
|
|
@ -892,6 +892,9 @@
|
|||
<ClCompile Include="..\..\IPC.cpp">
|
||||
<Filter>System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\FW.cpp">
|
||||
<Filter>System</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\Patch.h">
|
||||
|
@ -1350,6 +1353,9 @@
|
|||
<ClInclude Include="..\..\IPC.h">
|
||||
<Filter>System\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\FW.h">
|
||||
<Filter>System\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\wxResources.rc">
|
||||
|
|
Loading…
Reference in New Issue