mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-16 02:59:49 +01:00
Merge branch 'master' of github.com:hrydgard/ppsspp
This commit is contained in:
commit
c4cf35f782
35 files changed
+786
-366
No files matched your search
@@ -60,3 +60,8 @@ local.properties
|
||||
# For vim
|
||||
*.swp
|
||||
tags
|
||||
|
||||
libat3plusdecoder.dylib
|
||||
libat3plusdecoder.so
|
||||
at3plusdecoder.dll
|
||||
at3plusdecoder64.dll
|
||||
@@ -92,6 +92,7 @@ endif()
|
||||
include_directories("${CMAKE_SOURCE_DIR}")
|
||||
|
||||
if(BLACKBERRY)
|
||||
set(CMAKE_SYSTEM_NAME "QNX")
|
||||
add_definitions(-DBLACKBERRY)
|
||||
if(BLACKBERRY VERSION_GREATER 10)
|
||||
add_definitions(-DBLACKBERRY10)
|
||||
@@ -160,6 +161,7 @@ if(NOT MSVC)
|
||||
|
||||
if(IOS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
|
||||
set(CMAKE_OSX_ARCHITECTURES "armv7")
|
||||
elseif(APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -U__STRICT_ANSI__")
|
||||
# Karen/angelXwind: --macosx-version-min=10.7 is needed in order to produce binaries that OS X 10.7 Lion can execute. However, it seems that PPSSPP won't support 10.6 or lower without getting rid of -stdlib=libc++ ...which probably won't end well. So I guess PPSSPP will strictly be a 10.7+ app.
|
||||
|
||||
@@ -182,10 +182,8 @@ bool isVFP4 = false;
|
||||
bVFPv3 = CheckCPUFeature("vfpv3");
|
||||
bTLS = CheckCPUFeature("tls");
|
||||
bVFPv4 = CheckCPUFeature("vfpv4");
|
||||
// On some buggy kernels(Qualcomm) they show that they support VFPv4 but not IDIVa
|
||||
// All VFPv4 CPUs will support IDIVa
|
||||
bIDIVa = bVFPv4 || CheckCPUFeature("idiva");
|
||||
bIDIVt = bVFPv4 || CheckCPUFeature("idivt");
|
||||
bIDIVa = CheckCPUFeature("idiva");
|
||||
bIDIVt = CheckCPUFeature("idivt");
|
||||
// These two require ARMv8 or higher
|
||||
bFP = CheckCPUFeature("fp");
|
||||
bASIMD = CheckCPUFeature("asimd");
|
||||
|
||||
+6
-8
@@ -25,18 +25,12 @@
|
||||
|
||||
Config g_Config;
|
||||
|
||||
|
||||
#ifdef IOS
|
||||
extern bool isJailed;
|
||||
#endif
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
}
|
||||
|
||||
Config::~Config()
|
||||
{
|
||||
}
|
||||
Config::Config() { }
|
||||
Config::~Config() { }
|
||||
|
||||
void Config::Load(const char *iniFileName)
|
||||
{
|
||||
@@ -123,6 +117,7 @@ void Config::Load(const char *iniFileName)
|
||||
graphics->Get("TexScalingLevel", &iTexScalingLevel, 1);
|
||||
graphics->Get("TexScalingType", &iTexScalingType, 0);
|
||||
graphics->Get("TexDeposterize", &bTexDeposterize, false);
|
||||
graphics->Get("VSyncInterval", &iVSyncInterval, 0);
|
||||
|
||||
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
|
||||
sound->Get("Enable", &bEnableSound, true);
|
||||
@@ -142,6 +137,7 @@ void Config::Load(const char *iniFileName)
|
||||
control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false);
|
||||
control->Get("ForceInputDevice", &iForceInputDevice, -1);
|
||||
control->Get("RightStickBind", &iRightStickBind, 0);
|
||||
control->Get("TouchButtonOpacity", &iTouchButtonOpacity, 65);
|
||||
|
||||
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
||||
pspConfig->Get("NickName", &sNickName, "shadow");
|
||||
@@ -221,6 +217,7 @@ void Config::Save()
|
||||
graphics->Set("TexScalingLevel", iTexScalingLevel);
|
||||
graphics->Set("TexScalingType", iTexScalingType);
|
||||
graphics->Set("TexDeposterize", bTexDeposterize);
|
||||
graphics->Set("VSyncInterval", iVSyncInterval);
|
||||
|
||||
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
|
||||
sound->Set("Enable", bEnableSound);
|
||||
@@ -234,6 +231,7 @@ void Config::Save()
|
||||
control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
|
||||
control->Set("ForceInputDevice", iForceInputDevice);
|
||||
control->Set("RightStickBind", iRightStickBind);
|
||||
control->Set("TouchButtonOpacity", iTouchButtonOpacity);
|
||||
|
||||
|
||||
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
||||
|
||||
+3
-1
@@ -67,6 +67,7 @@ public:
|
||||
bool bPartialStretch;
|
||||
#endif
|
||||
bool bStretchToDisplay;
|
||||
int iVSyncInterval;
|
||||
int iFrameSkip;
|
||||
|
||||
int iWindowX;
|
||||
@@ -89,7 +90,7 @@ public:
|
||||
// Sound
|
||||
bool bEnableSound;
|
||||
bool bEnableAtrac3plus;
|
||||
|
||||
|
||||
// UI
|
||||
bool bShowTouchControls;
|
||||
bool bShowDebuggerOnLoad;
|
||||
@@ -108,6 +109,7 @@ public:
|
||||
// Control
|
||||
std::map<int,int> iMappingMap; // Can be used differently depending on systems
|
||||
int iForceInputDevice;
|
||||
int iTouchButtonOpacity;
|
||||
|
||||
// SystemParam
|
||||
std::string sNickName;
|
||||
|
||||
+71
-56
@@ -19,7 +19,18 @@ void trim2(std::string& str);
|
||||
|
||||
void __CheatInit() {
|
||||
//Moved createFullPath to CheatInit from the constructor because it spams the log and constantly checks if exists. In here, only checks once.
|
||||
activeCheatFile = CHEATS_DIR + "/" + g_paramSFO.GetValueString("DISC_ID").c_str() + ".ini";
|
||||
std::string gameTitle = g_paramSFO.GetValueString("DISC_ID") + " - " + g_paramSFO.GetValueString("TITLE");
|
||||
//These 3 statements clean up the title, which sometimes contain characters that will cause problems when creating the .ini
|
||||
if (gameTitle.find("™")!= std::string::npos) {
|
||||
gameTitle.erase (gameTitle.find("™"), std::string::npos);
|
||||
}
|
||||
while (gameTitle.find("/")!= std::string::npos) {
|
||||
gameTitle.replace (gameTitle.find("/"),1," ");
|
||||
}
|
||||
if (gameTitle.find(":")!= std::string::npos) {
|
||||
gameTitle.replace (gameTitle.find(":"),1," ");
|
||||
}
|
||||
activeCheatFile = CHEATS_DIR + "/" + gameTitle +".ini";
|
||||
|
||||
File::CreateFullPath(CHEATS_DIR);
|
||||
if (g_Config.bEnableCheats) {
|
||||
@@ -47,7 +58,7 @@ void __CheatShutdown() {
|
||||
void hleCheat(u64 userdata, int cyclesLate) {
|
||||
CoreTiming::ScheduleEvent(msToCycles(77), CheatEvent, 0);
|
||||
|
||||
if (g_Config.bReloadCheats == true) {
|
||||
if (g_Config.bReloadCheats == true) { //Checks if the "reload cheats" button has been pressed.
|
||||
cheatEngine->CreateCodeList();
|
||||
g_Config.bReloadCheats = false;
|
||||
}
|
||||
@@ -63,13 +74,62 @@ CWCheatEngine::CWCheatEngine() {
|
||||
void CWCheatEngine::Exit() {
|
||||
exit2 = true;
|
||||
}
|
||||
void CWCheatEngine::CreateCodeList() {
|
||||
parts = makeCodeParts();
|
||||
void CWCheatEngine::CreateCodeList() { //Creates code list to be used in function GetNextCode
|
||||
initialCodesList = GetCodesList();
|
||||
std::string currentcode, codename;
|
||||
std::vector<std::string> codelist;
|
||||
|
||||
for (size_t i = 0; i < initialCodesList.size(); i ++) {
|
||||
|
||||
if (initialCodesList[i].substr(0,3) == "_C1") {
|
||||
cheatEnabled = true;
|
||||
codename = initialCodesList[i];
|
||||
codename.erase (codename.begin(), codename.begin()+4);
|
||||
codeNameList.push_back(codename); //Import names for GUI
|
||||
continue;
|
||||
}
|
||||
if (initialCodesList[i].substr(0,2) == "_L") {
|
||||
if (cheatEnabled == true) {
|
||||
currentcode = initialCodesList[i];
|
||||
currentcode.erase(currentcode.begin(), currentcode.begin() + 3);
|
||||
codelist.push_back(currentcode);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (initialCodesList[i].substr(0,3) == "_C0") {
|
||||
cheatEnabled = false;
|
||||
codename = initialCodesList[i];
|
||||
codename.erase (codename.begin(), codename.begin()+4);
|
||||
codeNameList.push_back(codename); //Import names for GUI
|
||||
continue;
|
||||
}
|
||||
}
|
||||
parts = makeCodeParts(codelist);
|
||||
}
|
||||
std::vector<int> CWCheatEngine::GetNextCode() {
|
||||
inline std::vector<std::string> makeCodeParts(std::vector<std::string> CodesList) { //Takes a single code line and creates a two-part vector for all codes. Feeds to CreateCodeList
|
||||
std::string currentcode;
|
||||
std::vector<std::string> finalList;
|
||||
char split_char = '\n';
|
||||
char empty = ' ';
|
||||
for (size_t i = 0; i < CodesList.size(); i++) {
|
||||
currentcode = CodesList[i];
|
||||
for (size_t j=0; j < currentcode.length(); j++) {
|
||||
if (currentcode[j] == empty) {
|
||||
currentcode[j] = '\n';
|
||||
}
|
||||
}
|
||||
trim2(currentcode);
|
||||
std::istringstream iss(currentcode);
|
||||
std::string each;
|
||||
while (std::getline(iss, each, split_char)) {
|
||||
finalList.push_back(each);
|
||||
}
|
||||
}
|
||||
return finalList;
|
||||
}
|
||||
std::vector<int> CWCheatEngine::GetNextCode() { // Feeds a size-2 vector of ints to Run() which contains the address and value of one cheat.
|
||||
std::string code1;
|
||||
std::string code2;
|
||||
std::string modifier = "_L";
|
||||
std::vector<std::string> splitCode;
|
||||
std::vector<int> finalCode;
|
||||
std::string modifier2 = "0";
|
||||
@@ -90,11 +150,7 @@ std::vector<int> CWCheatEngine::GetNextCode() {
|
||||
int var2 = (int) parseHexLong(splitCode[1]);
|
||||
finalCode.push_back(var1);
|
||||
finalCode.push_back(var2);
|
||||
if (splitCode[0].substr(0,2) == modifier) {
|
||||
splitCode[0] = splitCode[0].substr(3);
|
||||
break;
|
||||
}
|
||||
else if (splitCode[0].substr(0,1) == modifier2) {
|
||||
if (splitCode[0].substr(0,1) == modifier2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -113,19 +169,10 @@ void CWCheatEngine::SkipAllCodes() {
|
||||
currentCode = codes.size();
|
||||
}
|
||||
|
||||
int CWCheatEngine::GetAddress(int value) {
|
||||
// The User space base address has to be added to given value
|
||||
int CWCheatEngine::GetAddress(int value) { //Returns static address used by ppsspp. Some games may not like this, and causes cheats to not work without offset
|
||||
return (value + 0x08800000) & 0x3FFFFFFF;
|
||||
}
|
||||
|
||||
void CWCheatEngine::AddCheatLine(std::string& line) {
|
||||
std::string cheatCodes;
|
||||
if (cheatCodes.length() <= 0) {
|
||||
cheatCodes = line;
|
||||
} else {
|
||||
cheatCodes += "\n" + line;
|
||||
}
|
||||
}
|
||||
|
||||
inline void trim2(std::string& str) {
|
||||
size_t pos = str.find_last_not_of(' ');
|
||||
@@ -137,43 +184,13 @@ inline void trim2(std::string& str) {
|
||||
else str.erase(str.begin(), str.end());
|
||||
}
|
||||
|
||||
inline std::vector<std::string> makeCodeParts() {
|
||||
CWCheatEngine cheats;
|
||||
std::string currentcode;
|
||||
std::vector<std::string> finalList;
|
||||
std::vector<std::string> CodesList = cheats.GetCodesList();
|
||||
char split_char = '\n';
|
||||
char empty = ' ';
|
||||
for (size_t i = 0; i < CodesList.size(); i++) {
|
||||
currentcode = CodesList[i];
|
||||
for (size_t j=0; j < currentcode.length(); j++) {
|
||||
if (currentcode[j] == empty) {
|
||||
currentcode[j] = '\n';
|
||||
}
|
||||
}
|
||||
trim2(currentcode);
|
||||
std::istringstream iss(currentcode);
|
||||
std::string each;
|
||||
while (std::getline(iss, each, split_char)) {
|
||||
finalList.push_back(each);
|
||||
}
|
||||
}
|
||||
return finalList;
|
||||
}
|
||||
|
||||
std::vector<std::string> CWCheatEngine::GetCodesList() {
|
||||
std::vector<std::string> CWCheatEngine::GetCodesList() { //Reads the entire cheat list from the appropriate .ini.
|
||||
std::string line;
|
||||
|
||||
std::string skip = "//";
|
||||
std::vector<std::string> codesList; // Read from INI here
|
||||
std::ifstream list(activeCheatFile.c_str());
|
||||
for (int i = 0; !list.eof(); i ++) {
|
||||
getline(list, line, '\n');
|
||||
if (line.substr(0,2) == skip) {
|
||||
line.clear();
|
||||
} else {
|
||||
codesList.push_back(line);
|
||||
}
|
||||
codesList.push_back(line);
|
||||
}
|
||||
for(size_t i = 0; i < codesList.size(); i++) {
|
||||
trim2(codesList[i]);
|
||||
@@ -182,10 +199,8 @@ std::vector<std::string> CWCheatEngine::GetCodesList() {
|
||||
}
|
||||
|
||||
void CWCheatEngine::Run() {
|
||||
CWCheatEngine cheats;
|
||||
exit2 = false;
|
||||
while (!exit2) {
|
||||
codes = cheats.GetCodesList(); // UI Member
|
||||
currentCode = 0;
|
||||
|
||||
while (true) {
|
||||
@@ -274,7 +289,7 @@ void CWCheatEngine::Run() {
|
||||
}
|
||||
case 0x4: // 32-bit patch code
|
||||
code = GetNextCode();
|
||||
if (code[0] != NULL) {
|
||||
if (code[0] != 0) {
|
||||
int data = code[0];
|
||||
int dataAdd = code[1];
|
||||
|
||||
|
||||
+5
-9
@@ -12,7 +12,7 @@
|
||||
void __CheatInit();
|
||||
void __CheatShutdown();
|
||||
|
||||
std::vector<std::string> makeCodeParts();
|
||||
std::vector<std::string> makeCodeParts(std::vector<std::string> CodesList);
|
||||
|
||||
class CWCheatEngine {
|
||||
public:
|
||||
@@ -24,19 +24,15 @@ public:
|
||||
void Exit();
|
||||
void Run();
|
||||
std::vector<int> GetNextCode();
|
||||
|
||||
|
||||
private:
|
||||
void SkipCodes(int count);
|
||||
void SkipAllCodes();
|
||||
|
||||
bool cheatsOn, exit2, cheatEnabled;
|
||||
int GetAddress(int value);
|
||||
std::vector<std::string> codeNameList;
|
||||
|
||||
static uint64_t const serialVersionUID = 6791588139795694296ULL;
|
||||
static const int cheatsThreadSleepMillis = 5;
|
||||
|
||||
bool cheatsOn;
|
||||
std::vector<std::string> codes;
|
||||
std::vector<std::string> codes, initialCodesList, parts;
|
||||
size_t currentCode;
|
||||
bool exit2;
|
||||
std::vector<std::string> parts;
|
||||
};
|
||||
@@ -174,8 +174,8 @@ void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo)
|
||||
}
|
||||
PPGeDrawTextWrapped(text.c_str(), 240.0f, y, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF));
|
||||
float sy = 122.0f - h2, ey = 150.0f + h2;
|
||||
PPGeDrawRect(30.0f, sy, 450.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawRect(30.0f, ey, 450.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawRect(15.0f, sy, 465.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawRect(15.0f, ey, 465.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF));
|
||||
}
|
||||
|
||||
int PSPMsgDialog::Update()
|
||||
|
||||
@@ -795,7 +795,7 @@ int PSPOskDialog::Update()
|
||||
|
||||
selectedChar = (selectedChar + (numKeyCols[currentKeyboard] * numKeyRows[currentKeyboard])) % (numKeyCols[currentKeyboard] * numKeyRows[currentKeyboard]);
|
||||
|
||||
if (IsButtonPressed(CTRL_CROSS) && g_Config.bButtonPreference || IsButtonPressed(CTRL_CIRCLE) && !g_Config.bButtonPreference)
|
||||
if ((IsButtonPressed(CTRL_CROSS) && g_Config.bButtonPreference) || (IsButtonPressed(CTRL_CIRCLE) && !g_Config.bButtonPreference))
|
||||
{
|
||||
inputChars = CombinationString(true);
|
||||
}
|
||||
@@ -816,7 +816,7 @@ int PSPOskDialog::Update()
|
||||
|
||||
selectedChar = selectedRow * numKeyCols[currentKeyboard] + selectedExtra;
|
||||
}
|
||||
else if (IsButtonPressed(CTRL_CIRCLE) && g_Config.bButtonPreference || IsButtonPressed(CTRL_CROSS) && !g_Config.bButtonPreference)
|
||||
else if ((IsButtonPressed(CTRL_CIRCLE) && g_Config.bButtonPreference) || (IsButtonPressed(CTRL_CROSS) && !g_Config.bButtonPreference))
|
||||
{
|
||||
if (inputChars.size() > 0)
|
||||
{
|
||||
|
||||
+174
-59
@@ -19,10 +19,11 @@
|
||||
// to keep games happy anyway. So, no ATRAC3 music until someone has reverse engineered Atrac3+.
|
||||
|
||||
|
||||
#include "HLE.h"
|
||||
#include "../MIPS/MIPS.h"
|
||||
#include "../CoreTiming.h"
|
||||
#include "ChunkFile.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
|
||||
#include "sceKernel.h"
|
||||
#include "sceUtility.h"
|
||||
@@ -276,11 +277,23 @@ struct Atrac {
|
||||
|
||||
};
|
||||
|
||||
std::map<int, Atrac *> atracMap;
|
||||
u8 nextAtracID;
|
||||
const int PSP_NUM_ATRAC_IDS = 6;
|
||||
static bool atracInited = true;
|
||||
static Atrac *atracIDs[PSP_NUM_ATRAC_IDS];
|
||||
static int atracIDTypes[PSP_NUM_ATRAC_IDS];
|
||||
|
||||
void __AtracInit() {
|
||||
nextAtracID = 0;
|
||||
atracInited = true;
|
||||
memset(atracIDs, 0, sizeof(atracIDs));
|
||||
|
||||
// Start with 2 of each in this order.
|
||||
atracIDTypes[0] = PSP_MODE_AT_3_PLUS;
|
||||
atracIDTypes[1] = PSP_MODE_AT_3_PLUS;
|
||||
atracIDTypes[2] = PSP_MODE_AT_3;
|
||||
atracIDTypes[3] = PSP_MODE_AT_3;
|
||||
atracIDTypes[4] = 0;
|
||||
atracIDTypes[5] = 0;
|
||||
|
||||
#ifdef USE_FFMPEG
|
||||
avcodec_register_all();
|
||||
av_register_all();
|
||||
@@ -290,44 +303,60 @@ void __AtracInit() {
|
||||
}
|
||||
|
||||
void __AtracDoState(PointerWrap &p) {
|
||||
p.Do(atracMap);
|
||||
p.Do(nextAtracID);
|
||||
p.Do(atracInited);
|
||||
for (int i = 0; i < PSP_NUM_ATRAC_IDS; ++i) {
|
||||
bool valid = atracIDs[i] != NULL;
|
||||
p.Do(valid);
|
||||
if (valid) {
|
||||
p.Do(atracIDs[i]);
|
||||
} else {
|
||||
delete atracIDs[i];
|
||||
atracIDs[i] = NULL;
|
||||
}
|
||||
}
|
||||
p.DoArray(atracIDTypes, PSP_NUM_ATRAC_IDS);
|
||||
|
||||
p.DoMarker("sceAtrac");
|
||||
}
|
||||
|
||||
void __AtracShutdown() {
|
||||
for (auto it = atracMap.begin(), end = atracMap.end(); it != end; ++it) {
|
||||
delete it->second;
|
||||
for (size_t i = 0; i < ARRAY_SIZE(atracIDs); ++i) {
|
||||
delete atracIDs[i];
|
||||
atracIDs[i] = NULL;
|
||||
}
|
||||
atracMap.clear();
|
||||
|
||||
Atrac3plus_Decoder::Shutdown();
|
||||
}
|
||||
|
||||
Atrac *getAtrac(int atracID) {
|
||||
if (atracMap.find(atracID) == atracMap.end()) {
|
||||
if (atracID < 0 || atracID >= PSP_NUM_ATRAC_IDS) {
|
||||
return NULL;
|
||||
}
|
||||
return atracMap[atracID];
|
||||
return atracIDs[atracID];
|
||||
}
|
||||
|
||||
int createAtrac(Atrac *atrac) {
|
||||
int id;
|
||||
do {
|
||||
id= nextAtracID;
|
||||
nextAtracID = (nextAtracID + 1) & 0x3f;
|
||||
} while (atracMap.find(id) != atracMap.end());
|
||||
atracMap[id] = atrac;
|
||||
atrac->atracID = id;
|
||||
return id;
|
||||
}
|
||||
|
||||
void deleteAtrac(int atracID) {
|
||||
if (atracMap.find(atracID) != atracMap.end()) {
|
||||
delete atracMap[atracID];
|
||||
atracMap.erase(atracID);
|
||||
int createAtrac(Atrac *atrac, int codecType) {
|
||||
for (int i = 0; i < (int)ARRAY_SIZE(atracIDs); ++i) {
|
||||
if (atracIDTypes[i] == codecType && atracIDs[i] == 0) {
|
||||
atracIDs[i] = atrac;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return ATRAC_ERROR_NO_ATRACID;
|
||||
}
|
||||
|
||||
int deleteAtrac(int atracID) {
|
||||
if (atracID >= 0 && atracID < PSP_NUM_ATRAC_IDS) {
|
||||
if (atracIDs[atracID] != NULL) {
|
||||
delete atracIDs[atracID];
|
||||
atracIDs[atracID] = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ATRAC_ERROR_BAD_ATRACID;
|
||||
}
|
||||
|
||||
int getCodecType(int addr) {
|
||||
@@ -453,17 +482,22 @@ void Atrac::Analyze()
|
||||
}
|
||||
}
|
||||
|
||||
u32 sceAtracGetAtracID(int codecType)
|
||||
{
|
||||
INFO_LOG(HLE, "sceAtracGetAtracID(%i)", codecType);
|
||||
if (codecType < 0x1000 || codecType > 0x1001)
|
||||
u32 sceAtracGetAtracID(int codecType) {
|
||||
if (codecType != PSP_MODE_AT_3 && codecType > PSP_MODE_AT_3_PLUS) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracGetAtracID(%i): invalid codecType", codecType);
|
||||
return ATRAC_ERROR_INVALID_CODECTYPE;
|
||||
}
|
||||
|
||||
int atracID = createAtrac(new Atrac);
|
||||
Atrac *atrac = getAtrac(atracID);
|
||||
if (!atrac)
|
||||
return ATRAC_ERROR_NO_ATRACID;
|
||||
Atrac *atrac = new Atrac();
|
||||
atrac->codeType = codecType;
|
||||
int atracID = createAtrac(atrac, codecType);
|
||||
if (atracID < 0) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracGetAtracID(%i): no free ID", codecType);
|
||||
delete atrac;
|
||||
return atracID;
|
||||
}
|
||||
|
||||
INFO_LOG(HLE, "%d=sceAtracGetAtracID(%i)", atracID, codecType);
|
||||
return atracID;
|
||||
}
|
||||
|
||||
@@ -884,8 +918,7 @@ u32 sceAtracGetStreamDataInfo(int atracID, u32 writeAddr, u32 writableBytesAddr,
|
||||
u32 sceAtracReleaseAtracID(int atracID)
|
||||
{
|
||||
INFO_LOG(HLE, "sceAtracReleaseAtracID(%i)", atracID);
|
||||
deleteAtrac(atracID);
|
||||
return 0;
|
||||
return deleteAtrac(atracID);
|
||||
}
|
||||
|
||||
u32 sceAtracResetPlayPosition(int atracID, int sample, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf)
|
||||
@@ -1133,7 +1166,6 @@ u32 sceAtracSetData(int atracID, u32 buffer, u32 bufferSize)
|
||||
|
||||
int sceAtracSetDataAndGetID(u32 buffer, u32 bufferSize)
|
||||
{
|
||||
INFO_LOG(HLE, "sceAtracSetDataAndGetID(%08x, %08x)", buffer, bufferSize);
|
||||
int codecType = getCodecType(buffer);
|
||||
|
||||
Atrac *atrac = new Atrac();
|
||||
@@ -1141,7 +1173,13 @@ int sceAtracSetDataAndGetID(u32 buffer, u32 bufferSize)
|
||||
atrac->first.size = bufferSize;
|
||||
atrac->Analyze();
|
||||
atrac->atracOutputChannels = 2;
|
||||
int atracID = createAtrac(atrac);
|
||||
int atracID = createAtrac(atrac, codecType);
|
||||
if (atracID < 0) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracSetDataAndGetID(%08x, %08x): no free ID", buffer, bufferSize);
|
||||
delete atrac;
|
||||
return atracID;
|
||||
}
|
||||
INFO_LOG(HLE, "%d=sceAtracSetDataAndGetID(%08x, %08x)", atracID, buffer, bufferSize);
|
||||
int ret = _AtracSetData(atracID, buffer, bufferSize, true);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -1150,9 +1188,10 @@ int sceAtracSetDataAndGetID(u32 buffer, u32 bufferSize)
|
||||
|
||||
int sceAtracSetHalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfBufferSize)
|
||||
{
|
||||
INFO_LOG(HLE, "sceAtracSetHalfwayBufferAndGetID(%08x, %08x, %08x)", halfBuffer, readSize, halfBufferSize);
|
||||
if (readSize > halfBufferSize)
|
||||
if (readSize > halfBufferSize) {
|
||||
ERROR_LOG(HLE, "sceAtracSetHalfwayBufferAndGetID(%08x, %08x, %08x): incorrect read size", halfBuffer, readSize, halfBufferSize);
|
||||
return ATRAC_ERROR_INCORRECT_READ_SIZE;
|
||||
}
|
||||
int codecType = getCodecType(halfBuffer);
|
||||
|
||||
Atrac *atrac = new Atrac();
|
||||
@@ -1160,7 +1199,13 @@ int sceAtracSetHalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfBuffe
|
||||
atrac->first.size = readSize;
|
||||
atrac->Analyze();
|
||||
atrac->atracOutputChannels = 2;
|
||||
int atracID = createAtrac(atrac);
|
||||
int atracID = createAtrac(atrac, codecType);
|
||||
if (atracID < 0) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracSetHalfwayBufferAndGetID(%08x, %08x, %08x): no free ID", halfBuffer, readSize, halfBufferSize);
|
||||
delete atrac;
|
||||
return atracID;
|
||||
}
|
||||
INFO_LOG(HLE, "%d=sceAtracSetHalfwayBufferAndGetID(%08x, %08x, %08x)", atracID, halfBuffer, readSize, halfBufferSize);
|
||||
int ret = _AtracSetData(atracID, halfBuffer, halfBufferSize, true);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -1190,10 +1235,52 @@ u32 sceAtracSetLoopNum(int atracID, int loopNum)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceAtracReinit()
|
||||
int sceAtracReinit(int at3Count, int at3plusCount)
|
||||
{
|
||||
ERROR_LOG(HLE, "UNIMPL sceAtracReinit(..)");
|
||||
return 0;
|
||||
for (int i = 0; i < PSP_NUM_ATRAC_IDS; ++i) {
|
||||
if (atracIDs[i] != NULL) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracReinit(%d, %d): cannot reinit while IDs in use", at3Count, at3plusCount);
|
||||
return SCE_KERNEL_ERROR_BUSY;
|
||||
}
|
||||
}
|
||||
|
||||
memset(atracIDTypes, 0, sizeof(atracIDTypes));
|
||||
int next = 0;
|
||||
int space = PSP_NUM_ATRAC_IDS;
|
||||
|
||||
// This seems to deinit things. Mostly, it cause a reschedule on next deinit (but -1, -1 does not.)
|
||||
if (at3Count == 0 && at3plusCount == 0) {
|
||||
INFO_LOG(HLE, "sceAtracReinit(%d, %d): deinit", at3Count, at3plusCount);
|
||||
atracInited = false;
|
||||
return hleDelayResult(0, "atrac reinit", 200);
|
||||
}
|
||||
|
||||
// First, ATRAC3+. These IDs seem to cost double (probably memory.)
|
||||
// Intentionally signed. 9999 tries to allocate, -1 does not.
|
||||
for (int i = 0; i < at3plusCount; ++i) {
|
||||
space -= 2;
|
||||
if (space >= 0) {
|
||||
atracIDTypes[next++] = PSP_MODE_AT_3_PLUS;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < at3Count; ++i) {
|
||||
space -= 1;
|
||||
if (space >= 0) {
|
||||
atracIDTypes[next++] = PSP_MODE_AT_3;
|
||||
}
|
||||
}
|
||||
|
||||
// If we ran out of space, we still initialize some, but return an error.
|
||||
int result = space >= 0 ? 0 : SCE_KERNEL_ERROR_OUT_OF_MEMORY;
|
||||
if (atracInited || next == 0) {
|
||||
INFO_LOG(HLE, "sceAtracReinit(%d, %d)", at3Count, at3plusCount);
|
||||
atracInited = true;
|
||||
return result;
|
||||
} else {
|
||||
INFO_LOG(HLE, "sceAtracReinit(%d, %d): init", at3Count, at3plusCount);
|
||||
atracInited = true;
|
||||
return hleDelayResult(result, "atrac reinit", 400);
|
||||
}
|
||||
}
|
||||
|
||||
int sceAtracGetOutputChannel(int atracID, u32 outputChanPtr)
|
||||
@@ -1250,7 +1337,6 @@ u32 sceAtracSetMOutData(int atracID, u32 buffer, u32 bufferSize)
|
||||
|
||||
int sceAtracSetMOutDataAndGetID(u32 buffer, u32 bufferSize)
|
||||
{
|
||||
INFO_LOG(HLE, "sceAtracSetMOutDataAndGetID(%08x, %08x)", buffer, bufferSize);
|
||||
int codecType = getCodecType(buffer);
|
||||
|
||||
Atrac *atrac = new Atrac();
|
||||
@@ -1258,7 +1344,13 @@ int sceAtracSetMOutDataAndGetID(u32 buffer, u32 bufferSize)
|
||||
atrac->first.size = bufferSize;
|
||||
atrac->Analyze();
|
||||
atrac->atracOutputChannels = 1;
|
||||
int atracID = createAtrac(atrac);
|
||||
int atracID = createAtrac(atrac, codecType);
|
||||
if (atracID < 0) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracSetMOutDataAndGetID(%08x, %08x): no free ID", buffer, bufferSize);
|
||||
delete atrac;
|
||||
return atracID;
|
||||
}
|
||||
INFO_LOG(HLE, "%d=sceAtracSetMOutDataAndGetID(%08x, %08x)", atracID, buffer, bufferSize);
|
||||
int ret = _AtracSetData(atracID, buffer, bufferSize, true);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -1267,9 +1359,10 @@ int sceAtracSetMOutDataAndGetID(u32 buffer, u32 bufferSize)
|
||||
|
||||
int sceAtracSetMOutHalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfBufferSize)
|
||||
{
|
||||
INFO_LOG(HLE, "sceAtracSetMOutHalfwayBufferAndGetID(%08x, %08x, %08x)", halfBuffer, readSize, halfBufferSize);
|
||||
if (readSize > halfBufferSize)
|
||||
if (readSize > halfBufferSize) {
|
||||
ERROR_LOG(HLE, "sceAtracSetMOutDataAndGetID(%08x, %08x, %08x): incorrect read size", halfBuffer, readSize, halfBufferSize);
|
||||
return ATRAC_ERROR_INCORRECT_READ_SIZE;
|
||||
}
|
||||
int codecType = getCodecType(halfBuffer);
|
||||
|
||||
Atrac *atrac = new Atrac();
|
||||
@@ -1277,7 +1370,13 @@ int sceAtracSetMOutHalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfB
|
||||
atrac->first.size = readSize;
|
||||
atrac->Analyze();
|
||||
atrac->atracOutputChannels = 1;
|
||||
int atracID = createAtrac(atrac);
|
||||
int atracID = createAtrac(atrac, codecType);
|
||||
if (atracID < 0) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracSetMOutDataAndGetID(%08x, %08x, %08x): no free ID", halfBuffer, readSize, halfBufferSize);
|
||||
delete atrac;
|
||||
return atracID;
|
||||
}
|
||||
INFO_LOG(HLE, "sceAtracSetMOutHalfwayBufferAndGetID(%08x, %08x, %08x)", atracID, halfBuffer, readSize, halfBufferSize);
|
||||
int ret = _AtracSetData(atracID, halfBuffer, halfBufferSize, true);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -1286,14 +1385,20 @@ int sceAtracSetMOutHalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfB
|
||||
|
||||
int sceAtracSetAA3DataAndGetID(u32 buffer, int bufferSize, int fileSize, u32 metadataSizeAddr)
|
||||
{
|
||||
ERROR_LOG(HLE, "UNIMPL sceAtracSetAA3DataAndGetID(%08x, %i, %i, %08x)", buffer, bufferSize, fileSize, metadataSizeAddr);
|
||||
int codecType = getCodecType(buffer);
|
||||
|
||||
Atrac *atrac = new Atrac();
|
||||
atrac->first.addr = buffer;
|
||||
atrac->first.size = bufferSize;
|
||||
atrac->Analyze();
|
||||
return createAtrac(atrac);
|
||||
int atracID = createAtrac(atrac, codecType);
|
||||
if (atracID < 0) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracSetAA3DataAndGetID(%08x, %i, %i, %08x): no free ID", buffer, bufferSize, fileSize, metadataSizeAddr);
|
||||
delete atrac;
|
||||
return atracID;
|
||||
}
|
||||
ERROR_LOG(HLE, "UNIMPL %d=sceAtracSetAA3DataAndGetID(%08x, %i, %i, %08x)", atracID, buffer, bufferSize, fileSize, metadataSizeAddr);
|
||||
return atracID;
|
||||
}
|
||||
|
||||
int _AtracGetIDByContext(u32 contextAddr) {
|
||||
@@ -1596,19 +1701,29 @@ int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesConsumedA
|
||||
|
||||
int sceAtracSetAA3HalfwayBufferAndGetID(u32 halfBuffer, u32 readSize, u32 halfBufferSize)
|
||||
{
|
||||
ERROR_LOG(HLE, "UNIMPL sceAtracSetAA3HalfwayBufferAndGetID(%08x, %08x, %08x)", halfBuffer, readSize, halfBufferSize);
|
||||
if (readSize > halfBufferSize)
|
||||
if (readSize > halfBufferSize) {
|
||||
ERROR_LOG(HLE, "sceAtracSetAA3HalfwayBufferAndGetID(%08x, %08x, %08x): invalid read size", halfBuffer, readSize, halfBufferSize);
|
||||
return ATRAC_ERROR_INCORRECT_READ_SIZE;
|
||||
}
|
||||
|
||||
if (readSize < 0 || halfBufferSize < 0)
|
||||
if (readSize < 0 || halfBufferSize < 0) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracSetAA3HalfwayBufferAndGetID(%08x, %08x, %08x): invalid buffer size", halfBuffer, readSize, halfBufferSize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int codecType = getCodecType(halfBuffer);
|
||||
Atrac *atrac = new Atrac();
|
||||
atrac->first.addr = halfBuffer;
|
||||
atrac->first.size = halfBufferSize;
|
||||
atrac->Analyze();
|
||||
return createAtrac(atrac);
|
||||
int atracID = createAtrac(atrac, codecType);
|
||||
if (atracID < 0) {
|
||||
ERROR_LOG_REPORT(HLE, "sceAtracSetAA3HalfwayBufferAndGetID(%08x, %08x, %08x): no free ID", halfBuffer, readSize, halfBufferSize);
|
||||
delete atrac;
|
||||
return atracID;
|
||||
}
|
||||
ERROR_LOG(HLE, "UNIMPL %d=sceAtracSetAA3HalfwayBufferAndGetID(%08x, %08x, %08x)", atracID, halfBuffer, readSize, halfBufferSize);
|
||||
return createAtrac(atrac, codecType);
|
||||
}
|
||||
|
||||
const HLEFunction sceAtrac3plus[] =
|
||||
@@ -1637,7 +1752,7 @@ const HLEFunction sceAtrac3plus[] =
|
||||
{0x7a20e7af,WrapI_UU<sceAtracSetDataAndGetID>,"sceAtracSetDataAndGetID"},
|
||||
{0xd1f59fdb,WrapU_V<sceAtracStartEntry>,"sceAtracStartEntry"},
|
||||
{0x868120b5,WrapU_II<sceAtracSetLoopNum>,"sceAtracSetLoopNum"},
|
||||
{0x132f1eca,WrapI_V<sceAtracReinit>,"sceAtracReinit"},
|
||||
{0x132f1eca,WrapI_II<sceAtracReinit>,"sceAtracReinit"},
|
||||
{0xeca32a99,WrapI_I<sceAtracIsSecondBufferNeeded>,"sceAtracIsSecondBufferNeeded"},
|
||||
{0x0fae370e,WrapI_UUU<sceAtracSetHalfwayBufferAndGetID>,"sceAtracSetHalfwayBufferAndGetID"},
|
||||
{0x2DD3E298,WrapU_IIU<sceAtracGetBufferInfoForReseting>,"sceAtracGetBufferInfoForResetting"},
|
||||
|
||||
+14
-3
@@ -121,6 +121,9 @@ static double fps = 0.0;
|
||||
static double fpsHistory[120];
|
||||
static size_t fpsHistoryPos = 0;
|
||||
static size_t fpsHistoryValid = 0;
|
||||
static int lastNumFlips = 0;
|
||||
static int numFlips = 0;
|
||||
static float flips = 0.0f;
|
||||
|
||||
void hleEnterVblank(u64 userdata, int cyclesLate);
|
||||
void hleLeaveVblank(u64 userdata, int cyclesLate);
|
||||
@@ -214,7 +217,8 @@ void __DisplayFireVblank() {
|
||||
}
|
||||
|
||||
void __DisplayGetFPS(float *out_vps, float *out_fps) {
|
||||
*out_vps = *out_fps = fps;
|
||||
*out_vps = fps;
|
||||
*out_fps = flips;
|
||||
}
|
||||
|
||||
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) {
|
||||
@@ -239,9 +243,12 @@ void CalculateFPS()
|
||||
|
||||
if (now >= lastFpsTime + 1.0)
|
||||
{
|
||||
fps = (gpuStats.numFrames - lastFpsFrame) / (now - lastFpsTime);
|
||||
double frames = (gpuStats.numFrames - lastFpsFrame);
|
||||
fps = frames / (now - lastFpsTime);
|
||||
flips = 60.0 * (double) (numFlips - lastNumFlips) / frames;
|
||||
|
||||
lastFpsFrame = gpuStats.numFrames;
|
||||
lastFpsFrame = gpuStats.numFrames;
|
||||
lastNumFlips = numFlips;
|
||||
lastFpsTime = now;
|
||||
|
||||
fpsHistory[fpsHistoryPos++] = fps;
|
||||
@@ -503,6 +510,10 @@ u32 sceDisplaySetFramebuf(u32 topaddr, int linesize, int pixelformat, int sync)
|
||||
fbstate.pspFramebufLinesize = linesize;
|
||||
}
|
||||
|
||||
if (topaddr != framebuf.topaddr) {
|
||||
++numFlips;
|
||||
}
|
||||
|
||||
if (sync == PSP_DISPLAY_SETBUF_IMMEDIATE) {
|
||||
// Write immediately to the current framebuffer parameters
|
||||
if (topaddr != 0) {
|
||||
|
||||
+130
-45
@@ -97,7 +97,12 @@ typedef s32 SceMode;
|
||||
typedef s64 SceOff;
|
||||
typedef u64 SceIores;
|
||||
|
||||
int asyncNotifyEvent = -1;
|
||||
const int PSP_COUNT_FDS = 64;
|
||||
// TODO: Should be 3, and stdin/stdout/stderr are special values aliased to 0?
|
||||
const int PSP_MIN_FD = 4;
|
||||
static int asyncNotifyEvent = -1;
|
||||
static SceUID fds[PSP_COUNT_FDS];
|
||||
|
||||
u32 ioErrorCode = 0;
|
||||
|
||||
#define SCE_STM_FDIR 0x1000
|
||||
@@ -213,12 +218,43 @@ public:
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void __IoCompleteAsyncIO(SceUID id);
|
||||
void __IoCompleteAsyncIO(int fd);
|
||||
|
||||
static void TellFsThreadEnded (SceUID threadID) {
|
||||
pspFileSystem.ThreadEnded(threadID);
|
||||
}
|
||||
|
||||
FileNode *__IoGetFd(int fd, u32 &error) {
|
||||
if (fd < 0 || fd >= PSP_COUNT_FDS) {
|
||||
error = ERROR_KERNEL_BAD_FILE_DESCRIPTOR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return kernelObjects.Get<FileNode>(fds[fd], error);
|
||||
}
|
||||
|
||||
int __IoAllocFd(FileNode *f) {
|
||||
// The PSP takes the lowest available id after stderr/etc.
|
||||
for (int possible = PSP_MIN_FD; possible < PSP_COUNT_FDS; ++possible) {
|
||||
if (fds[possible] == 0) {
|
||||
fds[possible] = f->GetUID();
|
||||
return possible;
|
||||
}
|
||||
}
|
||||
|
||||
// Bugger, out of fds...
|
||||
return SCE_KERNEL_ERROR_MFILE;
|
||||
}
|
||||
|
||||
void __IoFreeFd(int fd, u32 &error) {
|
||||
if (fd < PSP_MIN_FD || fd >= PSP_COUNT_FDS) {
|
||||
error = ERROR_KERNEL_BAD_FILE_DESCRIPTOR;
|
||||
} else {
|
||||
error = kernelObjects.Destroy<FileNode>(fds[fd]);
|
||||
fds[fd] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Async IO seems to work roughly like this:
|
||||
// 1. Game calls SceIo*Async() to start the process.
|
||||
// 2. This runs a thread with a customizable priority.
|
||||
@@ -236,7 +272,7 @@ static void TellFsThreadEnded (SceUID threadID) {
|
||||
// For now, let's at least delay the callback mnotification.
|
||||
void __IoAsyncNotify(u64 userdata, int cyclesLate) {
|
||||
SceUID threadID = userdata >> 32;
|
||||
SceUID fd = (SceUID) (userdata & 0xFFFFFFFF);
|
||||
int fd = (int) (userdata & 0xFFFFFFFF);
|
||||
__IoCompleteAsyncIO(fd);
|
||||
|
||||
u32 error;
|
||||
@@ -245,14 +281,14 @@ void __IoAsyncNotify(u64 userdata, int cyclesLate) {
|
||||
if (waitID == fd && error == 0) {
|
||||
__KernelResumeThreadFromWait(threadID, 0);
|
||||
|
||||
FileNode *f = kernelObjects.Get<FileNode>(fd, error);
|
||||
FileNode *f = __IoGetFd(fd, error);
|
||||
if (Memory::IsValidAddress(address) && f) {
|
||||
Memory::Write_U64((u64) f->asyncResult, address);
|
||||
}
|
||||
|
||||
// If this was a sceIoCloseAsync, we should close it at this point.
|
||||
if (f->closePending) {
|
||||
kernelObjects.Destroy<FileNode>(fd);
|
||||
__IoFreeFd(fd, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,9 +316,12 @@ void __IoInit() {
|
||||
pspFileSystem.Mount("flash0:", flash0);
|
||||
|
||||
__KernelListenThreadEnd(&TellFsThreadEnded);
|
||||
|
||||
memset(fds, 0, sizeof(fds));
|
||||
}
|
||||
|
||||
void __IoDoState(PointerWrap &p) {
|
||||
p.DoArray(fds, ARRAY_SIZE(fds));
|
||||
p.Do(asyncNotifyEvent);
|
||||
CoreTiming::RestoreRegisterEvent(asyncNotifyEvent, "IoAsyncNotify", __IoAsyncNotify);
|
||||
}
|
||||
@@ -292,9 +331,9 @@ void __IoShutdown() {
|
||||
|
||||
u32 __IoGetFileHandleFromId(u32 id, u32 &outError)
|
||||
{
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, outError);
|
||||
FileNode *f = __IoGetFd(id, outError);
|
||||
if (!f) {
|
||||
return -1;
|
||||
return (u32)-1;
|
||||
}
|
||||
return f->handle;
|
||||
}
|
||||
@@ -342,9 +381,9 @@ u32 sceKernelStderr() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
void __IoCompleteAsyncIO(SceUID id) {
|
||||
void __IoCompleteAsyncIO(int fd) {
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(fd, error);
|
||||
if (f) {
|
||||
if (f->callbackID) {
|
||||
__KernelNotifyCallback(THREAD_CALLBACK_IO, f->callbackID, f->callbackArg);
|
||||
@@ -384,7 +423,7 @@ void __IoGetStat(SceIoStat *stat, PSPFileInfo &info) {
|
||||
stat->st_private[0] = info.startSector;
|
||||
}
|
||||
|
||||
void __IoSchedAsync(FileNode *f, SceUID fd, int usec) {
|
||||
void __IoSchedAsync(FileNode *f, int fd, int usec) {
|
||||
u64 param = ((u64)__KernelGetCurThread()) << 32 | fd;
|
||||
CoreTiming::ScheduleEvent(usToCycles(usec), asyncNotifyEvent, param);
|
||||
|
||||
@@ -478,7 +517,7 @@ int __IoRead(int id, u32 data_addr, int size) {
|
||||
}
|
||||
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
if(!(f->openMode & FILEACCESS_READ))
|
||||
{
|
||||
@@ -520,7 +559,7 @@ u32 sceIoRead(int id, u32 data_addr, int size) {
|
||||
|
||||
u32 sceIoReadAsync(int id, u32 data_addr, int size) {
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
f->asyncResult = __IoRead(id, data_addr, size);
|
||||
// TODO: Not sure what the correct delay is (and technically we shouldn't read into the buffer yet...)
|
||||
@@ -542,7 +581,7 @@ int __IoWrite(int id, void *data_ptr, int size) {
|
||||
return size;
|
||||
}
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
if(!(f->openMode & FILEACCESS_WRITE)) {
|
||||
return ERROR_KERNEL_BAD_FILE_DESCRIPTOR;
|
||||
@@ -574,7 +613,7 @@ u32 sceIoWrite(int id, u32 data_addr, int size) {
|
||||
|
||||
u32 sceIoWriteAsync(int id, u32 data_addr, int size) {
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
f->asyncResult = __IoWrite(id, Memory::GetPointer(data_addr), size);
|
||||
// TODO: Not sure what the correct delay is (and technically we shouldn't read into the buffer yet...)
|
||||
@@ -591,7 +630,7 @@ u32 sceIoGetDevType(int id)
|
||||
{
|
||||
ERROR_LOG_REPORT(HLE, "UNIMPL sceIoGetDevType(%d)", id);
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
int result;
|
||||
if (f)
|
||||
result = PSP_DEV_TYPE_ALIAS;
|
||||
@@ -607,7 +646,7 @@ u32 sceIoCancel(int id)
|
||||
{
|
||||
ERROR_LOG_REPORT(HLE, "UNIMPL sceIoCancel(%d)", id);
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
// TODO: Cancel the async operation if possible?
|
||||
} else {
|
||||
@@ -643,7 +682,7 @@ u32 npdrmLseek(FileNode *f, s32 where, FileMove whence)
|
||||
|
||||
s64 __IoLseek(SceUID id, s64 offset, int whence) {
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
FileMove seek = FILEMOVE_BEGIN;
|
||||
|
||||
@@ -700,7 +739,7 @@ u32 sceIoLseek32(int id, int offset, int whence) {
|
||||
|
||||
u32 sceIoLseekAsync(int id, s64 offset, int whence) {
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get<FileNode>(id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
f->asyncResult = __IoLseek(id, offset, whence);
|
||||
// Educated guess at timing.
|
||||
@@ -716,7 +755,7 @@ u32 sceIoLseekAsync(int id, s64 offset, int whence) {
|
||||
|
||||
u32 sceIoLseek32Async(int id, int offset, int whence) {
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get<FileNode>(id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
f->asyncResult = __IoLseek(id, offset, whence);
|
||||
// Educated guess at timing.
|
||||
@@ -785,18 +824,24 @@ u32 sceIoOpen(const char* filename, int flags, int mode) {
|
||||
}
|
||||
}
|
||||
|
||||
SceUID id = f->GetUID();
|
||||
DEBUG_LOG(HLE, "%i=sceIoOpen(%s, %08x, %08x)", id, filename, flags, mode);
|
||||
// Timing is not accurate, aiming low for now.
|
||||
return hleDelayResult(id, "file opened", 100);
|
||||
int id = __IoAllocFd(f);
|
||||
if (id < 0) {
|
||||
ERROR_LOG(HLE, "%08x=sceIoOpen(%s, %08x, %08x): out of fds", id, filename, flags, mode);
|
||||
kernelObjects.Destroy<FileNode>(f->GetUID());
|
||||
return id;
|
||||
} else {
|
||||
DEBUG_LOG(HLE, "%i=sceIoOpen(%s, %08x, %08x)", id, filename, flags, mode);
|
||||
// Timing is not accurate, aiming low for now.
|
||||
return hleDelayResult(id, "file opened", 100);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sceIoClose(int id) {
|
||||
u32 error;
|
||||
DEBUG_LOG(HLE, "sceIoClose(%d)", id);
|
||||
FileNode *f = kernelObjects.Get<FileNode>(id, error);
|
||||
__IoFreeFd(id, error);
|
||||
// Timing is not accurate, aiming low for now.
|
||||
return hleDelayResult(kernelObjects.Destroy<FileNode>(id), "file closed", 100);
|
||||
return hleDelayResult(error, "file closed", 100);
|
||||
}
|
||||
|
||||
u32 sceIoRemove(const char *filename) {
|
||||
@@ -1197,7 +1242,7 @@ int sceIoCloseAsync(int id)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceIoCloseAsync(%d)", id);
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get<FileNode>(id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f)
|
||||
{
|
||||
f->closePending = true;
|
||||
@@ -1215,7 +1260,7 @@ u32 sceIoSetAsyncCallback(int id, u32 clbckId, u32 clbckArg)
|
||||
DEBUG_LOG(HLE, "sceIoSetAsyncCallback(%d, %i, %08x)", id, clbckId, clbckArg);
|
||||
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f)
|
||||
{
|
||||
f->callbackID = clbckId;
|
||||
@@ -1236,7 +1281,7 @@ u32 sceIoOpenAsync(const char *filename, int flags, int mode)
|
||||
sceKernelResumeDispatchThread(1);
|
||||
|
||||
FileNode *f = __IoOpen(filename, flags, mode);
|
||||
SceUID fd;
|
||||
int fd;
|
||||
|
||||
// We have to return an fd here, which may have been destroyed when we reach Wait if it failed.
|
||||
if (f == NULL)
|
||||
@@ -1244,16 +1289,26 @@ u32 sceIoOpenAsync(const char *filename, int flags, int mode)
|
||||
ERROR_LOG(HLE, "ERROR_ERRNO_FILE_NOT_FOUND=sceIoOpenAsync(%s, %08x, %08x) - file not found", filename, flags, mode);
|
||||
|
||||
f = new FileNode();
|
||||
fd = kernelObjects.Create(f);
|
||||
f->handle = fd;
|
||||
f->handle = kernelObjects.Create(f);
|
||||
f->fullpath = filename;
|
||||
f->asyncResult = ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
f->closePending = true;
|
||||
|
||||
fd = __IoAllocFd(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
fd = f->GetUID();
|
||||
DEBUG_LOG(HLE, "%x=sceIoOpenAsync(%s, %08x, %08x)", fd, filename, flags, mode);
|
||||
fd = __IoAllocFd(f);
|
||||
if (fd >= 0) {
|
||||
DEBUG_LOG(HLE, "%x=sceIoOpenAsync(%s, %08x, %08x)", fd, filename, flags, mode);
|
||||
f->asyncResult = fd;
|
||||
}
|
||||
}
|
||||
|
||||
if (fd < 0) {
|
||||
ERROR_LOG(HLE, "%08x=sceIoOpenAsync(%s, %08x, %08x): out of fds", fd, filename, flags, mode);
|
||||
kernelObjects.Destroy<FileNode>(f->GetUID());
|
||||
return fd;
|
||||
}
|
||||
|
||||
// TODO: Timing is very inconsistent. From ms0, 10ms - 20ms depending on filesize/dir depth? From umd, can take > 1s.
|
||||
@@ -1266,7 +1321,7 @@ u32 sceIoOpenAsync(const char *filename, int flags, int mode)
|
||||
u32 sceIoGetAsyncStat(int id, u32 poll, u32 address)
|
||||
{
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f)
|
||||
{
|
||||
if (f->pendingAsyncResult) {
|
||||
@@ -1286,7 +1341,7 @@ u32 sceIoGetAsyncStat(int id, u32 poll, u32 address)
|
||||
f->hasAsyncResult = false;
|
||||
|
||||
if (f->closePending) {
|
||||
kernelObjects.Destroy<FileNode>(id);
|
||||
__IoFreeFd(id, error);
|
||||
}
|
||||
} else {
|
||||
WARN_LOG(HLE, "SCE_KERNEL_ERROR_NOASYNC = sceIoGetAsyncStat(%i, %i, %08x)", id, poll, address);
|
||||
@@ -1303,7 +1358,7 @@ u32 sceIoGetAsyncStat(int id, u32 poll, u32 address)
|
||||
|
||||
int sceIoWaitAsync(int id, u32 address) {
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
if (f->pendingAsyncResult) {
|
||||
DEBUG_LOG(HLE, "%lli = sceIoWaitAsync(%i, %08x): waiting", f->asyncResult, id, address);
|
||||
@@ -1314,7 +1369,7 @@ int sceIoWaitAsync(int id, u32 address) {
|
||||
f->hasAsyncResult = false;
|
||||
|
||||
if (f->closePending) {
|
||||
kernelObjects.Destroy<FileNode>(id);
|
||||
__IoFreeFd(id, error);
|
||||
}
|
||||
} else {
|
||||
WARN_LOG(HLE, "SCE_KERNEL_ERROR_NOASYNC = sceIoWaitAsync(%i, %08x)", id, address);
|
||||
@@ -1330,7 +1385,7 @@ int sceIoWaitAsync(int id, u32 address) {
|
||||
int sceIoWaitAsyncCB(int id, u32 address) {
|
||||
// Should process callbacks here
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
hleCheckCurrentCallbacks();
|
||||
if (f->pendingAsyncResult) {
|
||||
@@ -1342,7 +1397,7 @@ int sceIoWaitAsyncCB(int id, u32 address) {
|
||||
f->hasAsyncResult = false;
|
||||
|
||||
if (f->closePending) {
|
||||
kernelObjects.Destroy<FileNode>(id);
|
||||
__IoFreeFd(id, error);
|
||||
}
|
||||
} else {
|
||||
WARN_LOG(HLE, "SCE_KERNEL_ERROR_NOASYNC = sceIoWaitAsyncCB(%i, %08x)", id, address);
|
||||
@@ -1357,7 +1412,7 @@ int sceIoWaitAsyncCB(int id, u32 address) {
|
||||
|
||||
u32 sceIoPollAsync(int id, u32 address) {
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
if (f->pendingAsyncResult) {
|
||||
DEBUG_LOG(HLE, "%lli = sceIoPollAsync(%i, %08x): not ready", f->asyncResult, id, address);
|
||||
@@ -1368,11 +1423,11 @@ u32 sceIoPollAsync(int id, u32 address) {
|
||||
f->hasAsyncResult = false;
|
||||
|
||||
if (f->closePending) {
|
||||
kernelObjects.Destroy<FileNode>(id);
|
||||
__IoFreeFd(id, error);
|
||||
}
|
||||
return 0; //completed
|
||||
} else {
|
||||
WARN_LOG(HLE, "SCE_KERNEL_ERROR_NOASYNC = sceIoWaitAsyncCB(%i, %08x)", id, address);
|
||||
WARN_LOG(HLE, "SCE_KERNEL_ERROR_NOASYNC = sceIoPollAsync(%i, %08x)", id, address);
|
||||
return SCE_KERNEL_ERROR_NOASYNC;
|
||||
}
|
||||
} else {
|
||||
@@ -1465,7 +1520,7 @@ u32 sceIoDclose(int id) {
|
||||
int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen)
|
||||
{
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get<FileNode>(id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (error) {
|
||||
ERROR_LOG(HLE, "UNIMPL %08x=sceIoIoctl id: %08x, cmd %08x, bad file", error, id, cmd);
|
||||
return error;
|
||||
@@ -1596,7 +1651,7 @@ u32 sceIoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 ou
|
||||
u32 sceIoIoctlAsync(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen)
|
||||
{
|
||||
u32 error;
|
||||
FileNode *f = kernelObjects.Get < FileNode > (id, error);
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (f) {
|
||||
DEBUG_LOG(HLE, "sceIoIoctlAsync(%08x, %08x, %08x, %08x, %08x, %08x)", id, cmd, indataPtr, inlen, outdataPtr, outlen);
|
||||
f->asyncResult = __IoIoctl(id, cmd, indataPtr, inlen, outdataPtr, outlen);
|
||||
@@ -1609,8 +1664,38 @@ u32 sceIoIoctlAsync(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u
|
||||
}
|
||||
|
||||
u32 sceIoGetFdList(u32 outAddr, int outSize, u32 fdNumAddr) {
|
||||
ERROR_LOG_REPORT(HLE, "UNIMPL sceIoGetFdList(%08x, %i, %08x)", outAddr, outSize, fdNumAddr);
|
||||
return 0;
|
||||
WARN_LOG(HLE, "sceIoGetFdList(%08x, %i, %08x)", outAddr, outSize, fdNumAddr);
|
||||
|
||||
PSPPointer<SceUID> out;
|
||||
out = outAddr;
|
||||
int count = 0;
|
||||
|
||||
// Always have the first three.
|
||||
for (int i = 0; i < PSP_MIN_FD; ++i) {
|
||||
// TODO: Technically it seems like these are fixed ids > PSP_COUNT_FDS.
|
||||
if (count < outSize && out.Valid()) {
|
||||
out[count] = i;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
|
||||
for (int i = PSP_MIN_FD; i < PSP_COUNT_FDS; ++i) {
|
||||
if (fds[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
if (count < outSize && out.Valid()) {
|
||||
out[count] = i;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
|
||||
if (Memory::IsValidAddress(fdNumAddr))
|
||||
Memory::Write_U32(count, fdNumAddr);
|
||||
if (count >= outSize) {
|
||||
return outSize;
|
||||
} else {
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
// Presumably lets you hook up stderr to a MsgPipe.
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include "native/base/stringutil.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/HLETables.h"
|
||||
#include "Core/Reporting.h"
|
||||
@@ -971,30 +972,41 @@ bool __KernelLoadExec(const char *filename, SceKernelLoadExecParam *param, std::
|
||||
//TODO: second param
|
||||
int sceKernelLoadExec(const char *filename, u32 paramPtr)
|
||||
{
|
||||
std::string exec_filename = filename;
|
||||
SceKernelLoadExecParam *param = 0;
|
||||
if (paramPtr)
|
||||
{
|
||||
param = (SceKernelLoadExecParam*)Memory::GetPointer(paramPtr);
|
||||
if (paramPtr) {
|
||||
param = (SceKernelLoadExecParam *)Memory::GetPointer(paramPtr);
|
||||
}
|
||||
|
||||
PSPFileInfo info = pspFileSystem.GetFileInfo(exec_filename);
|
||||
|
||||
// If there's an EBOOT.BIN, redirect to that instead.
|
||||
if (info.exists && endsWith(exec_filename, "/BOOT.BIN")) {
|
||||
std::string eboot_filename = exec_filename.substr(0, exec_filename.length() - strlen("BOOT.BIN")) + "EBOOT.BIN";
|
||||
|
||||
PSPFileInfo eboot_info = pspFileSystem.GetFileInfo(eboot_filename);
|
||||
if (eboot_info.exists) {
|
||||
exec_filename = eboot_filename;
|
||||
info = eboot_info;
|
||||
}
|
||||
}
|
||||
|
||||
PSPFileInfo info = pspFileSystem.GetFileInfo(filename);
|
||||
|
||||
if (!info.exists) {
|
||||
ERROR_LOG(LOADER, "sceKernelLoadExec(%s, ...): File does not exist", filename);
|
||||
return SCE_KERNEL_ERROR_NOFILE;
|
||||
}
|
||||
|
||||
s64 size = (s64)info.size;
|
||||
if (!size)
|
||||
{
|
||||
if (!size) {
|
||||
ERROR_LOG(LOADER, "sceKernelLoadExec(%s, ...): File is size 0", filename);
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_OBJECT;
|
||||
}
|
||||
|
||||
DEBUG_LOG(HLE,"sceKernelLoadExec(name=%s,...)", filename);
|
||||
DEBUG_LOG(HLE, "sceKernelLoadExec(name=%s,...): loading %s", filename, exec_filename.c_str());
|
||||
std::string error_string;
|
||||
if (!__KernelLoadExec(filename, param, &error_string)) {
|
||||
if (!__KernelLoadExec(exec_filename.c_str(), param, &error_string)) {
|
||||
ERROR_LOG(HLE, "sceKernelLoadExec failed: %s", error_string.c_str());
|
||||
Core_UpdateState(CORE_ERROR);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
+179
-76
@@ -20,11 +20,14 @@
|
||||
#include "../MIPS/MIPS.h"
|
||||
|
||||
#include "sceKernel.h"
|
||||
#include "sceKernelThread.h"
|
||||
#include "sceUtility.h"
|
||||
|
||||
static bool netInited;
|
||||
static bool netAdhocInited;
|
||||
|
||||
static u32 adhocctlHandlerCount;
|
||||
|
||||
enum {
|
||||
ERROR_NET_BUFFER_TOO_SMALL = 0x80400706,
|
||||
|
||||
@@ -42,52 +45,88 @@ enum {
|
||||
ERROR_NET_ADHOC_TIMEOUT = 0x80410715,
|
||||
ERROR_NET_ADHOC_NO_ENTRY = 0x80410716,
|
||||
ERROR_NET_ADHOC_CONNECTION_REFUSED = 0x80410718,
|
||||
|
||||
ERROR_NET_ADHOC_INVALID_MATCHING_ID = 0x80410807,
|
||||
ERROR_NET_ADHOC_MATCHING_ALREADY_INITIALIZED = 0x80410812,
|
||||
ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED = 0x80410813,
|
||||
|
||||
ERROR_NET_ADHOCCTL_WLAN_SWITCH_OFF = 0x80410b03,
|
||||
ERROR_NET_ADHOCCTL_ALREADY_INITIALIZED = 0x80410b07,
|
||||
ERROR_NET_ADHOCCTL_NOT_INITIALIZED = 0x80410b08,
|
||||
ERROR_NET_ADHOCCTL_DISCONNECTED = 0x80410b09,
|
||||
ERROR_NET_ADHOCCTL_BUSY = 0x80410b10,
|
||||
ERROR_NET_ADHOCCTL_TOO_MANY_HANDLERS = 0x80410b12,
|
||||
};
|
||||
|
||||
//these might come in handy in the future, if PPSSPP ever supports wifi/ad-hoc
|
||||
struct SceNetAdhocctlParams
|
||||
{
|
||||
// These might come in handy in the future, if PPSSPP ever supports wifi/ad-hoc..
|
||||
struct SceNetAdhocctlParams {
|
||||
int channel; //which ad-hoc channel to connect to
|
||||
char name[8]; //connection name
|
||||
u8 bssid[6]; //BSSID of the connection?
|
||||
char nickname[128]; //PSP's nickname?
|
||||
};
|
||||
|
||||
struct ProductStruct
|
||||
{
|
||||
int unknown; //unknown, set to 0
|
||||
char product[9]; //Product name?
|
||||
struct ProductStruct {
|
||||
int unknown; // Unknown, set to 0
|
||||
char product[9]; // Game ID (Example: ULUS10000)
|
||||
};
|
||||
|
||||
struct SceNetMallocStat {
|
||||
int pool; // Pointer to the pool?
|
||||
int maximum; // Maximum size of the pool?
|
||||
int free; // How much memory is free
|
||||
};
|
||||
|
||||
static struct SceNetMallocStat netMallocStat;
|
||||
|
||||
struct AdhocctlHandler
|
||||
{
|
||||
u32 entryPoint;
|
||||
u32 argument;
|
||||
u32 id;
|
||||
};
|
||||
|
||||
static std::vector<AdhocctlHandler> adhocctlHandlers;
|
||||
|
||||
void __NetInit() {
|
||||
netInited = false;
|
||||
netAdhocInited = false;
|
||||
}
|
||||
|
||||
|
||||
void __NetShutdown() {
|
||||
|
||||
}
|
||||
|
||||
void __UpdateAdhocctlHandlers(int flag, int error) {
|
||||
u32 args[3] = { 0, 0, 0 };
|
||||
for(std::vector<AdhocctlHandler>::iterator it = adhocctlHandlers.begin(); it < adhocctlHandlers.end(); it++) {
|
||||
args[0] = flag;
|
||||
args[1] = error;
|
||||
args[2] = it->argument;
|
||||
|
||||
__KernelDirectMipsCall(it->entryPoint, NULL, args, 3, true);
|
||||
}
|
||||
}
|
||||
|
||||
// This feels like a dubious proposition, mostly...
|
||||
void __NetDoState(PointerWrap &p) {
|
||||
p.Do(netInited);
|
||||
p.Do(netAdhocInited);
|
||||
p.Do(adhocctlHandlers);
|
||||
p.Do(adhocctlHandlerCount);
|
||||
p.Do(netMallocStat);
|
||||
p.DoMarker("net");
|
||||
}
|
||||
|
||||
// TODO: should that struct actually be initialized here?
|
||||
void sceNetInit() {
|
||||
ERROR_LOG(HLE,"UNIMPL sceNetInit(poolsize=%d, calloutpri=%i, calloutstack=%d, netintrpri=%i, netintrstack=%d)", PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
|
||||
netInited = true;
|
||||
RETURN(0); //ERROR
|
||||
memset(&netMallocStat, 0, sizeof(netMallocStat));
|
||||
netMallocStat.maximum = PARAM(0);
|
||||
netMallocStat.free = PARAM(0);
|
||||
netMallocStat.pool = 0;
|
||||
|
||||
RETURN(0); //ERROR <- The Dax: Why is it an error when it returns 0 on success?
|
||||
}
|
||||
|
||||
u32 sceNetTerm() {
|
||||
@@ -101,6 +140,7 @@ u32 sceNetAdhocInit() {
|
||||
if (netAdhocInited)
|
||||
return ERROR_NET_ADHOC_ALREADY_INITIALIZED;
|
||||
netAdhocInited = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -109,17 +149,16 @@ u32 sceNetAdhocctlInit(int stackSize, int prio, u32 productAddr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sceWlanGetEtherAddr(u32 addrAddr)
|
||||
{
|
||||
u32 sceWlanGetEtherAddr(u32 addrAddr) {
|
||||
static const u8 fakeEtherAddr[6] = { 1, 2, 3, 4, 5, 6 };
|
||||
DEBUG_LOG(HLE, "sceWlanGetEtherAddr(%08x)", addrAddr);
|
||||
for (int i = 0; i < 6; i++)
|
||||
Memory::Write_U8(fakeEtherAddr[i], addrAddr + i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sceWlanDevIsPowerOn()
|
||||
{
|
||||
u32 sceWlanDevIsPowerOn() {
|
||||
DEBUG_LOG(HLE, "UNTESTED 0=sceWlanDevIsPowerOn()");
|
||||
return 0;
|
||||
}
|
||||
@@ -129,19 +168,47 @@ u32 sceWlanGetSwitchState() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//handler probably shouldn't be an int...
|
||||
u32 sceNetAdhocctlAddHandler(int handler, void *unknown) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlAddHandler(%x, %x)", handler, unknown);
|
||||
return 0;
|
||||
// TODO: How many handlers can the PSP actually have for Adhocctl?
|
||||
// TODO: Should we allow the same handler to be added more than once?
|
||||
u32 sceNetAdhocctlAddHandler(u32 handlerPtr, u32 handlerArg) {
|
||||
bool foundHandler = false;
|
||||
struct AdhocctlHandler handler;
|
||||
memset(&handler, 0, sizeof(handler));
|
||||
handler.entryPoint = handlerPtr;
|
||||
handler.argument = handlerArg;
|
||||
handler.id = -1;
|
||||
|
||||
for(std::vector<AdhocctlHandler>::iterator it = adhocctlHandlers.begin(); it < adhocctlHandlers.end(); it++) {
|
||||
if(it->entryPoint == handlerPtr) {
|
||||
foundHandler = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!foundHandler && Memory::IsValidAddress(handlerPtr)) {
|
||||
handler.id = adhocctlHandlerCount > 0? ++adhocctlHandlerCount : 0;
|
||||
adhocctlHandlers.push_back(handler);
|
||||
WARN_LOG(HLE, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): added handler %d", handlerPtr, handlerArg, handler.id);
|
||||
}
|
||||
else
|
||||
ERROR_LOG(HLE, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): Same handler already exists", handlerPtr, handlerArg);
|
||||
|
||||
|
||||
return handler.id;
|
||||
}
|
||||
|
||||
u32 sceNetAdhocctlDisconnect() {
|
||||
DEBUG_LOG(HLE, "UNIMPL sceNetAdhocctlDisconnect()");
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlDisconnect()");
|
||||
__UpdateAdhocctlHandlers(0, ERROR_NET_ADHOCCTL_WLAN_SWITCH_OFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sceNetAdhocctlDelHandler(int handler) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlDelHandler(%x)", handler);
|
||||
u32 sceNetAdhocctlDelHandler(u32 handlerID) {
|
||||
WARN_LOG(HLE, "UNTESTED sceNetAdhocctlDelHandler(%x)", handlerID);
|
||||
adhocctlHandlers.erase(adhocctlHandlers.begin() + handlerID);
|
||||
adhocctlHandlerCount = adhocctlHandlerCount > 0? --adhocctlHandlerCount : adhocctlHandlerCount;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -160,50 +227,61 @@ int sceNetAdhocTerm() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//homebrew SDK claims it's a void function, but tests seem to indicate otherwise
|
||||
// Homebrew SDK claims it's a void function, but tests seem to indicate otherwise
|
||||
int sceNetEtherNtostr(const char *mac, u32 bufferPtr) {
|
||||
DEBUG_LOG(HLE, "UNTESTED sceNetEtherNtostr(%s, %x)", mac, bufferPtr);
|
||||
int len = strlen(mac);
|
||||
for (int i = 0; i < len; i++)
|
||||
Memory::Write_U8(mac[i], bufferPtr + i);
|
||||
if(Memory::IsValidAddress(bufferPtr)) {
|
||||
int len = strlen(mac);
|
||||
for (int i = 0; i < len; i++)
|
||||
Memory::Write_U8(mac[i], bufferPtr + i);
|
||||
}
|
||||
else
|
||||
ERROR_LOG(HLE, "UNTESTED sceNetEtherNtostr(%s, %x): Tried to write to an invalid pointer", mac, bufferPtr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//write SCE_KERNEL_ERROR_ERRNO_NOT_CONNECTED to attempt to stop games from spamming wifi syscalls...
|
||||
// Seems to always return 0, and write 0 to the pointer..
|
||||
// TODO: Eventually research what possible states there are
|
||||
int sceNetAdhocctlGetState(u32 ptrToStatus) {
|
||||
DEBUG_LOG(HLE, "UNTESTED sceNetAdhocctlGetState(%x)", ptrToStatus);
|
||||
Memory::Write_U32(SCE_KERNEL_ERROR_ERRNO_NOT_CONNECTED, ptrToStatus);
|
||||
WARN_LOG(HLE, "UNTESTED sceNetAdhocctlGetState(%x)", ptrToStatus);
|
||||
if(Memory::IsValidAddress(ptrToStatus))
|
||||
Memory::Write_U32(0, ptrToStatus);
|
||||
else
|
||||
ERROR_LOG(HLE, "UNTESTED sceNetAdhocctlGetState(%x): Tried to write invalid location", ptrToStatus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//always return -1 since we don't have any real networking...
|
||||
// Always return -1 since we don't have any real networking...
|
||||
int sceNetAdhocPdpCreate(const char *mac, u32 port, int bufferSize, u32 unknown) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocPdpCreate(%s, %x, %x, %x)", mac, port, bufferSize, unknown);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//SHOULD be int sceNetAdhocctlGetParameter(struct SceNetAdhocctlParams *params), but I don't want
|
||||
//to mess up the function wrappers..
|
||||
int sceNetAdhocctlGetParameter() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlGetParameter()");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//SHOULD be int sceNetAdhocctlGetAdhocId(struct productStruct * product), but I don't want
|
||||
//to mess up the function wrappers..
|
||||
int sceNetAdhocctlGetAdhocId() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlGetAdhocId()");
|
||||
return -1;
|
||||
// TODO: Should we really write the struct if we're disconnected?
|
||||
int sceNetAdhocctlGetParameter(u32 paramAddr) {
|
||||
ERROR_LOG(HLE, "UNTESTED %x=sceNetAdhocctlGetParameter(%x)", 0, paramAddr);
|
||||
struct SceNetAdhocctlParams params;
|
||||
params.channel = 0;
|
||||
for(int i = 0; i < 6; i++)
|
||||
params.bssid[i] = i + 1;
|
||||
strcpy(params.name, "");
|
||||
strcpy(params.nickname, "");
|
||||
|
||||
if(Memory::IsValidAddress(paramAddr))
|
||||
Memory::WriteStruct(paramAddr, ¶ms);
|
||||
|
||||
return ERROR_NET_ADHOCCTL_DISCONNECTED;
|
||||
}
|
||||
|
||||
//return -1 packets since we don't have networking yet
|
||||
// Return -1 packets since we don't have networking yet..
|
||||
int sceNetAdhocPdpRecv(int id, const char *mac, u32 port, void *data, void *dataLength, u32 timeout, int nonBlock) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocPdpRecv(%d, %d, %d, %x, %x, %d, %d)", id, mac, port, data, dataLength, timeout, nonBlock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Assuming < 0 for failure, homebrew SDK doesn't have much to say about this one
|
||||
// Assuming < 0 for failure, homebrew SDK doesn't have much to say about this one..
|
||||
int sceNetAdhocSetSocketAlert(int id, int flag) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocSetSocketAlert(%d, %d)", id, flag);
|
||||
return -1;
|
||||
@@ -214,20 +292,58 @@ int sceNetAdhocPdpDelete(int id, int unknown) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const HLEFunction sceNet[] =
|
||||
{
|
||||
int sceNetAdhocctlGetAdhocId(u32 productStructAddr) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlGetAdhocId(%x)", productStructAddr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceNetAdhocctlScan() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlScan()");
|
||||
__UpdateAdhocctlHandlers(0, ERROR_NET_ADHOCCTL_WLAN_SWITCH_OFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceNetAdhocctlGetScanInfo() {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlGetScanInfo()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceNetAdhocctlConnect(u32 ptrToGroupName) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocctlConnect(%x)", ptrToGroupName);
|
||||
__UpdateAdhocctlHandlers(0, ERROR_NET_ADHOCCTL_WLAN_SWITCH_OFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Write static data since we don't actually manage any memory for sceNet* yet.
|
||||
int sceNetGetMallocStat(u32 statPtr) {
|
||||
ERROR_LOG(HLE, "UNTESTED sceNetGetMallocStat(%x)", statPtr);
|
||||
if(Memory::IsValidAddress(statPtr))
|
||||
Memory::WriteStruct(statPtr, &netMallocStat);
|
||||
else
|
||||
ERROR_LOG(HLE, "UNTESTED sceNetGetMallocStat(%x): tried to request invalid address!", statPtr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceNetAdhocMatchingInit(u32 memsize) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocMatchingInit(%08x)", memsize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const HLEFunction sceNet[] = {
|
||||
{0x39AF39A6, sceNetInit, "sceNetInit"},
|
||||
{0x281928A9, WrapU_V<sceNetTerm>, "sceNetTerm"},
|
||||
{0x89360950, WrapI_CU<sceNetEtherNtostr>, "sceNetEtherNtostr"},
|
||||
{0x0bf0a3ae, 0, "sceNetGetLocalEtherAddr"},
|
||||
{0xd27961c9, 0, "sceNetEtherStrton"},
|
||||
{0x50647530, 0, "sceNetFreeThreadinfo"},
|
||||
{0xcc393e48, 0, "sceNetGetMallocStat"},
|
||||
{0xcc393e48, WrapI_U<sceNetGetMallocStat>, "sceNetGetMallocStat"},
|
||||
{0xad6844c6, 0, "sceNetThreadAbort"},
|
||||
};
|
||||
|
||||
const HLEFunction sceNetAdhoc[] =
|
||||
{
|
||||
const HLEFunction sceNetAdhoc[] = {
|
||||
{0xE1D621D7, WrapU_V<sceNetAdhocInit>, "sceNetAdhocInit"},
|
||||
{0xA62C6F57, WrapI_V<sceNetAdhocTerm>, "sceNetAdhocTerm"},
|
||||
{0x0AD043ED, 0, "sceNetAdhocctlConnect"},
|
||||
@@ -256,13 +372,7 @@ const HLEFunction sceNetAdhoc[] =
|
||||
{0x4d2ce199, 0, "sceNetAdhocGetSocketAlert"},
|
||||
};
|
||||
|
||||
int sceNetAdhocMatchingInit(u32 memsize) {
|
||||
ERROR_LOG(HLE, "UNIMPL sceNetAdhocMatchingInit(%08x)", memsize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const HLEFunction sceNetAdhocMatching[] =
|
||||
{
|
||||
const HLEFunction sceNetAdhocMatching[] = {
|
||||
{0x2a2a1e07, WrapI_U<sceNetAdhocMatchingInit>, "sceNetAdhocMatchingInit"},
|
||||
{0x7945ecda, WrapI_V<sceNetAdhocMatchingTerm>, "sceNetAdhocMatchingTerm"},
|
||||
{0xca5eda6f, 0, "sceNetAdhocMatchingCreate"},
|
||||
@@ -281,19 +391,18 @@ const HLEFunction sceNetAdhocMatching[] =
|
||||
{0x9c5cfb7d, 0, "sceNetAdhocMatchingGetPoolStat"},
|
||||
};
|
||||
|
||||
const HLEFunction sceNetAdhocctl[] =
|
||||
{
|
||||
const HLEFunction sceNetAdhocctl[] = {
|
||||
{0xE26F226E, WrapU_IIU<sceNetAdhocctlInit>, "sceNetAdhocctlInit"},
|
||||
{0x9D689E13, WrapI_V<sceNetAdhocctlTerm>, "sceNetAdhocctlTerm"},
|
||||
{0x20B317A0, WrapU_IV<sceNetAdhocctlAddHandler>, "sceNetAdhocctlAddHandler"},
|
||||
{0x6402490B, WrapU_I<sceNetAdhocctlDelHandler>, "sceNetAdhocctlDelHandler"},
|
||||
{0x20B317A0, WrapU_UU<sceNetAdhocctlAddHandler>, "sceNetAdhocctlAddHandler"},
|
||||
{0x6402490B, WrapU_U<sceNetAdhocctlDelHandler>, "sceNetAdhocctlDelHandler"},
|
||||
{0x34401D65, WrapU_V<sceNetAdhocctlDisconnect>, "sceNetAdhocctlDisconnect"},
|
||||
{0x0ad043ed, 0, "sceNetAdhocctlConnect"},
|
||||
{0x08fff7a0, 0, "sceNetAdhocctlScan"},
|
||||
{0x0ad043ed, WrapI_U<sceNetAdhocctlConnect>, "sceNetAdhocctlConnect"},
|
||||
{0x08fff7a0, WrapI_V<sceNetAdhocctlScan>, "sceNetAdhocctlScan"},
|
||||
{0x75ecd386, WrapI_U<sceNetAdhocctlGetState>, "sceNetAdhocctlGetState"},
|
||||
{0x8916c003, 0, "sceNetAdhocctlGetNameByAddr"},
|
||||
{0xded9d28e, WrapI_V<sceNetAdhocctlGetParameter>, "sceNetAdhocctlGetParameter"},
|
||||
{0x81aee1be, 0, "sceNetAdhocctlGetScanInfo"},
|
||||
{0xded9d28e, WrapI_U<sceNetAdhocctlGetParameter>, "sceNetAdhocctlGetParameter"},
|
||||
{0x81aee1be, WrapI_V<sceNetAdhocctlGetScanInfo>, "sceNetAdhocctlGetScanInfo"},
|
||||
{0x5e7f79c9, 0, "sceNetAdhocctlJoin"},
|
||||
{0x8db83fdc, 0, "sceNetAdhocctlGetPeerInfo"},
|
||||
{0xec0635c1, 0, "sceNetAdhocctlCreate"},
|
||||
@@ -301,14 +410,13 @@ const HLEFunction sceNetAdhocctl[] =
|
||||
{0x1ff89745, 0, "sceNetAdhocctlJoinEnterGameMode"},
|
||||
{0xcf8e084d, 0, "sceNetAdhocctlExitGameMode"},
|
||||
{0xe162cb14, 0, "sceNetAdhocctlGetPeerList"},
|
||||
{0x362cbe8f, WrapI_V<sceNetAdhocctlGetAdhocId>, "sceNetAdhocctlGetAdhocId"},
|
||||
{0x362cbe8f, WrapI_U<sceNetAdhocctlGetAdhocId>, "sceNetAdhocctlGetAdhocId"},
|
||||
{0x5a014ce0, 0, "sceNetAdhocctlGetGameModeInfo"},
|
||||
{0x99560abe, 0, "sceNetAdhocctlGetAddrByName"},
|
||||
{0xb0b80e80, 0, "sceNetAdhocctlCreateEnterGameModeMin"},
|
||||
};
|
||||
|
||||
const HLEFunction sceNetResolver[] =
|
||||
{
|
||||
const HLEFunction sceNetResolver[] = {
|
||||
{0x224c5f44, 0, "sceNetResolverStartNtoA"},
|
||||
{0x244172af, 0, "sceNetResolverCreate"},
|
||||
{0x94523e09, 0, "sceNetResolverDelete"},
|
||||
@@ -322,8 +430,7 @@ const HLEFunction sceNetResolver[] =
|
||||
{0x4ee99358, 0, "sceNetResolverPollAsync"},
|
||||
};
|
||||
|
||||
const HLEFunction sceNetInet[] =
|
||||
{
|
||||
const HLEFunction sceNetInet[] = {
|
||||
{0x17943399, 0, "sceNetInetInit"},
|
||||
{0x2fe71fe7, 0, "sceNetInetSetsockopt"},
|
||||
{0x410b34aa, 0, "sceNetInetConnect"},
|
||||
@@ -357,8 +464,7 @@ const HLEFunction sceNetInet[] =
|
||||
{0x39b0c7d3, 0, "sceNetInetGetUdpcbstat"},
|
||||
};
|
||||
|
||||
const HLEFunction sceNetApctl[] =
|
||||
{
|
||||
const HLEFunction sceNetApctl[] = {
|
||||
{0xCFB957C6, 0, "sceNetApctlConnect"},
|
||||
{0x24fe91a1, 0, "sceNetApctlDisconnect"},
|
||||
{0x5deac81b, 0, "sceNetApctlGetState"},
|
||||
@@ -372,15 +478,13 @@ const HLEFunction sceNetApctl[] =
|
||||
{0x2935c45b, 0, "sceNetApctlGetBSSDescEntry2"},
|
||||
};
|
||||
|
||||
const HLEFunction sceWlanDrv[] =
|
||||
{
|
||||
const HLEFunction sceWlanDrv[] = {
|
||||
{0xd7763699, WrapU_V<sceWlanGetSwitchState>, "sceWlanGetSwitchState"},
|
||||
{0x0c622081, WrapU_U<sceWlanGetEtherAddr>, "sceWlanGetEtherAddr"},
|
||||
{0x93440B11, WrapU_V<sceWlanDevIsPowerOn>, "sceWlanDevIsPowerOn"},
|
||||
};
|
||||
|
||||
void Register_sceNet()
|
||||
{
|
||||
void Register_sceNet() {
|
||||
RegisterModule("sceNet", ARRAY_SIZE(sceNet), sceNet);
|
||||
RegisterModule("sceNetAdhoc", ARRAY_SIZE(sceNetAdhoc), sceNetAdhoc);
|
||||
RegisterModule("sceNetAdhocMatching", ARRAY_SIZE(sceNetAdhocMatching), sceNetAdhocMatching);
|
||||
@@ -390,7 +494,6 @@ void Register_sceNet()
|
||||
RegisterModule("sceNetApctl", ARRAY_SIZE(sceNetApctl), sceNetApctl);
|
||||
}
|
||||
|
||||
void Register_sceWlanDrv()
|
||||
{
|
||||
void Register_sceWlanDrv() {
|
||||
RegisterModule("sceWlanDrv", ARRAY_SIZE(sceWlanDrv), sceWlanDrv);
|
||||
}
|
||||
+5
-1
@@ -148,7 +148,11 @@ u32 sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loop) {
|
||||
}
|
||||
|
||||
if (size <= 0 || (size & 0xF) != 0) {
|
||||
WARN_LOG(HLE, "%s: invalid size %d", __FUNCTION__, size);
|
||||
if (size == 0) {
|
||||
DEBUG_LOG(HLE, "%s: invalid size %d", __FUNCTION__, size);
|
||||
} else {
|
||||
WARN_LOG(HLE, "%s: invalid size %d", __FUNCTION__, size);
|
||||
}
|
||||
return ERROR_SAS_INVALID_SIZE;
|
||||
}
|
||||
|
||||
|
||||
+23
-8
@@ -1,4 +1,4 @@
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
@@ -11,17 +11,31 @@
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/HW/atrac3plus.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_MAC
|
||||
#define MACOSX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern std::string externalDirectory;
|
||||
|
||||
namespace Atrac3plus_Decoder {
|
||||
|
||||
#ifdef _WIN32
|
||||
bool IsSupported() {
|
||||
#if (defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))) || defined(ARMEABI) || defined(ARMEABI_V7A) || defined(MACOSX)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
HMODULE hlib = 0;
|
||||
#else
|
||||
static void *so;
|
||||
@@ -43,6 +57,8 @@ namespace Atrac3plus_Decoder {
|
||||
#else
|
||||
return "at3plusdecoder.dll";
|
||||
#endif
|
||||
#elif defined(__APPLE__)
|
||||
return "libat3plusdecoder.dylib";
|
||||
#else
|
||||
return "libat3plusdecoder.so";
|
||||
#endif
|
||||
@@ -67,7 +83,7 @@ namespace Atrac3plus_Decoder {
|
||||
// Other platforms can't.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool IsInstalled() {
|
||||
return File::Exists(GetInstalledFilename());
|
||||
}
|
||||
@@ -105,8 +121,8 @@ namespace Atrac3plus_Decoder {
|
||||
// Okay, we're screwed. Let's bail.
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef _M_X64
|
||||
hlib = LoadLibraryA(GetInstalledFilename().c_str());
|
||||
@@ -121,7 +137,6 @@ namespace Atrac3plus_Decoder {
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
|
||||
std::string filename = GetInstalledFilename();
|
||||
|
||||
ILOG("Attempting to load atrac3plus decoder from %s", filename.c_str());
|
||||
@@ -149,7 +164,7 @@ namespace Atrac3plus_Decoder {
|
||||
}
|
||||
|
||||
int Shutdown() {
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
if (hlib) {
|
||||
FreeLibrary(hlib);
|
||||
hlib = 0;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define _ATRAC3PLUS_DECODER_
|
||||
|
||||
namespace Atrac3plus_Decoder {
|
||||
|
||||
bool IsSupported();
|
||||
bool IsInstalled();
|
||||
bool CanAutoInstall();
|
||||
bool DoAutoInstall();
|
||||
@@ -88,4 +88,4 @@ namespace Atrac3plus_Decoder {
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _ATRAC3PLUS_DECODER_
|
||||
#endif // _ATRAC3PLUS_DECODER_
|
||||
@@ -172,8 +172,10 @@ static const u8 flushBeforeCommandList[] = {
|
||||
};
|
||||
|
||||
GLES_GPU::GLES_GPU()
|
||||
: resized_(false)
|
||||
{
|
||||
: resized_(false) {
|
||||
lastVsync_ = g_Config.iVSyncInterval;
|
||||
glstate.SetVSyncInterval(g_Config.iVSyncInterval);
|
||||
|
||||
shaderManager_ = new ShaderManager();
|
||||
transformDraw_.SetShaderManager(shaderManager_);
|
||||
transformDraw_.SetTextureCache(&textureCache_);
|
||||
@@ -251,6 +253,15 @@ void GLES_GPU::DumpNextFrame() {
|
||||
}
|
||||
|
||||
void GLES_GPU::BeginFrame() {
|
||||
// Turn off vsync when unthrottled
|
||||
int desiredVSyncInterval = g_Config.iVSyncInterval;
|
||||
if (PSP_CoreParameter().unthrottle)
|
||||
desiredVSyncInterval = 0;
|
||||
if (desiredVSyncInterval != lastVsync_) {
|
||||
glstate.SetVSyncInterval(desiredVSyncInterval);
|
||||
lastVsync_ = desiredVSyncInterval;
|
||||
}
|
||||
|
||||
textureCache_.StartFrame();
|
||||
transformDraw_.DecimateTrackedVertexArrays();
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ private:
|
||||
|
||||
u8 *flushBeforeCommand_;
|
||||
bool resized_;
|
||||
int lastVsync_;
|
||||
|
||||
std::string reportingPrimaryInfo_;
|
||||
std::string reportingFullInfo_;
|
||||
|
||||
@@ -40,6 +40,7 @@ static const char tex_fs[] =
|
||||
"varying vec2 v_texcoord0;\n"
|
||||
"void main() {\n"
|
||||
" gl_FragColor = texture2D(sampler0, v_texcoord0);\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
"}\n";
|
||||
|
||||
static const char basic_vs[] =
|
||||
|
||||
+17
-15
@@ -514,7 +514,7 @@ void TextureCache::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Config.bLinearFiltering) {
|
||||
if (g_Config.bLinearFiltering && !gstate.isColorTestEnabled()) {
|
||||
magFilt |= 1;
|
||||
minFilt |= 1;
|
||||
}
|
||||
@@ -523,7 +523,7 @@ void TextureCache::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
|
||||
magFilt &= 1;
|
||||
minFilt &= 1;
|
||||
}
|
||||
|
||||
|
||||
if (force || entry.minFilt != minFilt) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, MinFiltGL[minFilt]);
|
||||
entry.minFilt = minFilt;
|
||||
@@ -809,27 +809,29 @@ void TextureCache::LoadClut() {
|
||||
u32 clutAddr = GetClutAddr();
|
||||
clutTotalBytes_ = (gstate.loadclut & 0x3f) * 32;
|
||||
if (Memory::IsValidAddress(clutAddr)) {
|
||||
Memory::Memcpy((u8 *)clutBufRaw_, clutAddr, clutTotalBytes_);
|
||||
Memory::Memcpy(clutBufRaw_, clutAddr, clutTotalBytes_);
|
||||
} else {
|
||||
memset(clutBufRaw_, 0xFF, clutTotalBytes_);
|
||||
clutHash_ = 0;
|
||||
}
|
||||
// Reload the clut next time.
|
||||
clutLastFormat_ = 0xFF;
|
||||
clutLastFormat_ = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void TextureCache::UpdateCurrentClut() {
|
||||
// 0xFF is an invalid format, it means not yet hashed or updated.
|
||||
if (clutLastFormat_ == 0xFF) {
|
||||
// QuickClutHash is not quite good enough apparently.
|
||||
// clutHash_ = QuickClutHash((const u8 *)clutBufRaw_, clutTotalBytes_);
|
||||
clutHash_ = CityHash32((const char *)clutBufRaw_, clutTotalBytes_);
|
||||
}
|
||||
const GEPaletteFormat clutFormat = (GEPaletteFormat)(gstate.clutformat & 3);
|
||||
const u32 clutBase = (gstate.clutformat & 0x1f0000) >> 12;
|
||||
const u32 clutBaseBytes = clutBase * (clutFormat == GE_CMODE_32BIT_ABGR8888 ? sizeof(u32) : sizeof(u16));
|
||||
// Technically, these extra bytes weren't loaded, but hopefully it was loaded earlier.
|
||||
// If not, we're going to hash random data, which hopefully doesn't cause a performance issue.
|
||||
const u32 clutExtendedBytes = clutTotalBytes_ + clutBaseBytes;
|
||||
|
||||
// QuickClutHash is not quite good enough apparently.
|
||||
// clutHash_ = QuickClutHash((const u8 *)clutBufRaw_, clutExtendedBytes);
|
||||
clutHash_ = CityHash32((const char *)clutBufRaw_, clutExtendedBytes);
|
||||
|
||||
GEPaletteFormat clutFormat = (GEPaletteFormat)(gstate.clutformat & 3);
|
||||
// Avoid a copy when we don't need to convert colors.
|
||||
if (clutFormat != GE_CMODE_32BIT_ABGR8888) {
|
||||
ConvertColors(clutBufConverted_, clutBufRaw_, getClutDestFormat(clutFormat), clutTotalBytes_ / sizeof(u16));
|
||||
ConvertColors(clutBufConverted_, clutBufRaw_, getClutDestFormat(clutFormat), clutExtendedBytes / sizeof(u16));
|
||||
clutBuf_ = clutBufConverted_;
|
||||
} else {
|
||||
clutBuf_ = clutBufRaw_;
|
||||
@@ -855,7 +857,7 @@ void TextureCache::UpdateCurrentClut() {
|
||||
}
|
||||
}
|
||||
|
||||
clutLastFormat_ = clutFormat;
|
||||
clutLastFormat_ = gstate.clutformat;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -888,7 +890,7 @@ void TextureCache::SetTexture() {
|
||||
u32 clutformat, cluthash;
|
||||
if (hasClut) {
|
||||
clutformat = gstate.clutformat & 3;
|
||||
if (clutLastFormat_ != clutformat) {
|
||||
if (clutLastFormat_ != gstate.clutformat) {
|
||||
// We update here because the clut format can be specified after the load.
|
||||
UpdateCurrentClut();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
|
||||
SimpleBuf<u32> tmpTexBufRearrange;
|
||||
|
||||
u8 clutLastFormat_;
|
||||
u32 clutLastFormat_;
|
||||
u32 *clutBufRaw_;
|
||||
u32 *clutBufConverted_;
|
||||
u32 *clutBuf_;
|
||||
|
||||
+10
-6
@@ -233,12 +233,15 @@ void EmuScreen::update(InputState &input) {
|
||||
__CtrlSetAnalog(rightstick_x, rightstick_x, 1);
|
||||
|
||||
if (PSP_CoreParameter().fpsLimit != 2) {
|
||||
// Don't really need to show these, it's pretty obvious what unthrottle does,
|
||||
// in contrast to the three state toggle
|
||||
/*
|
||||
if (input.pad_buttons_down & PAD_BUTTON_UNTHROTTLE) {
|
||||
osm.Show(s->T("unlimited", "Speed: unlimited!"), 1.0, 0x50E0FF);
|
||||
}
|
||||
if (input.pad_buttons_up & PAD_BUTTON_UNTHROTTLE) {
|
||||
osm.Show(s->T("standard", "Speed: standard"), 1.0);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if (input.pad_buttons & PAD_BUTTON_UNTHROTTLE) {
|
||||
PSP_CoreParameter().unthrottle = true;
|
||||
@@ -249,22 +252,22 @@ void EmuScreen::update(InputState &input) {
|
||||
if (PSP_CoreParameter().fpsLimit != 0 && PSP_CoreParameter().fpsLimit != 1 && PSP_CoreParameter().fpsLimit != 2) {
|
||||
PSP_CoreParameter().fpsLimit = 0;
|
||||
}
|
||||
|
||||
//Toggle between 3 different states of fpsLimit
|
||||
if (input.pad_buttons_down & PAD_BUTTON_LEFT_THUMB) {
|
||||
if (PSP_CoreParameter().fpsLimit == 0) {
|
||||
PSP_CoreParameter().fpsLimit = 1;
|
||||
osm.Show(s->T("fixed", "Speed: fixed"), 1.0);
|
||||
}
|
||||
else if (PSP_CoreParameter().fpsLimit == 1){
|
||||
else if (PSP_CoreParameter().fpsLimit == 1) {
|
||||
PSP_CoreParameter().fpsLimit = 2;
|
||||
osm.Show(s->T("unlimited", "Speed: unlimited!"), 1.0, 0x50E0FF);
|
||||
}
|
||||
else if (PSP_CoreParameter().fpsLimit == 2){
|
||||
else if (PSP_CoreParameter().fpsLimit == 2) {
|
||||
PSP_CoreParameter().fpsLimit = 0;
|
||||
osm.Show(s->T("standard", "Speed: standard"), 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (input.pad_buttons_down & (PAD_BUTTON_MENU | PAD_BUTTON_BACK | PAD_BUTTON_RIGHT_THUMB)) {
|
||||
if (g_Config.bBufferedRendering)
|
||||
@@ -313,8 +316,9 @@ void EmuScreen::render() {
|
||||
|
||||
ui_draw2d.Begin(UIShader_Get(), DBMODE_NORMAL);
|
||||
|
||||
float touchOpacity = g_Config.iTouchButtonOpacity / 100.0f;
|
||||
if (g_Config.bShowTouchControls)
|
||||
DrawGamepad(ui_draw2d);
|
||||
DrawGamepad(ui_draw2d, touchOpacity);
|
||||
|
||||
DrawWatermark();
|
||||
|
||||
@@ -337,7 +341,7 @@ void EmuScreen::render() {
|
||||
float vps, fps;
|
||||
__DisplayGetFPS(&vps, &fps);
|
||||
char fpsbuf[256];
|
||||
sprintf(fpsbuf, "VPS: %0.1f", vps);
|
||||
sprintf(fpsbuf, "VPS: %0.1f\nFPS: %0.1f", vps, fps);
|
||||
ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 8, 12, 0xc0000000, ALIGN_TOPRIGHT);
|
||||
ui_draw2d.DrawText(UBUNTU24, fpsbuf, dp_xres - 10, 10, 0xFF3fFF3f, ALIGN_TOPRIGHT);
|
||||
}
|
||||
|
||||
+6
-4
@@ -16,8 +16,9 @@
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "GamepadEmu.h"
|
||||
#include "base/colorutil.h"
|
||||
#include "ui/virtual_input.h"
|
||||
#include "../../Core/Config.h"
|
||||
#include "Core/Config.h"
|
||||
#include "ui_atlas.h"
|
||||
|
||||
TouchButton buttonX(&ui_atlas, I_ROUND, I_CROSS, PAD_BUTTON_A);
|
||||
@@ -112,10 +113,11 @@ void UpdateGamepad(InputState &input_state)
|
||||
leftStick.update(input_state);
|
||||
}
|
||||
|
||||
void DrawGamepad(DrawBuffer &db)
|
||||
void DrawGamepad(DrawBuffer &db, float opacity)
|
||||
{
|
||||
uint32_t color = 0xa0c0b080;
|
||||
uint32_t colorOverlay = 0xa0FFFFFF;
|
||||
uint32_t color = colorAlpha(0xc0b080, opacity);
|
||||
uint32_t colorOverlay = colorAlpha(0xFFFFFF, opacity);
|
||||
|
||||
buttonO.draw(db, color, colorOverlay);
|
||||
buttonX.draw(db, color, colorOverlay);
|
||||
buttonTri.draw(db, color, colorOverlay);
|
||||
|
||||
+1
-1
@@ -22,4 +22,4 @@
|
||||
|
||||
void LayoutGamepad(int w, int h);
|
||||
void UpdateGamepad(InputState &input_state);
|
||||
void DrawGamepad(DrawBuffer &db);
|
||||
void DrawGamepad(DrawBuffer &db, float opacity);
|
||||
+44
-21
@@ -209,7 +209,7 @@ void MenuScreen::render() {
|
||||
if (frames_ > 200) // seems the above goes nuts after a while...
|
||||
xoff = -20;
|
||||
|
||||
int w = LARGE_BUTTON_WIDTH + 60;
|
||||
int w = LARGE_BUTTON_WIDTH + 70;
|
||||
|
||||
ui_draw2d.DrawTextShadow(UBUNTU48, "PPSSPP", dp_xres + xoff - w/2, 75, 0xFFFFFFFF, ALIGN_HCENTER | ALIGN_BOTTOM);
|
||||
ui_draw2d.SetFontScale(0.7f, 0.7f);
|
||||
@@ -674,7 +674,7 @@ void DeveloperScreen::render() {
|
||||
}
|
||||
|
||||
if (UIButton(GEN_ID, vlinear, w, 0, d->T("Save language ini"), ALIGN_LEFT)) {
|
||||
i18nrepo.SaveIni(g_Config.languageIni);
|
||||
i18nrepo.SaveIni(g_Config.languageIni);
|
||||
}
|
||||
|
||||
if (UIButton(GEN_ID, vlinear, w, 0, d->T("Run CPU tests"), ALIGN_LEFT)) {
|
||||
@@ -711,20 +711,17 @@ void AudioScreen::render() {
|
||||
int stride = 40;
|
||||
int columnw = 400;
|
||||
UICheckBox(GEN_ID, x, y += stride, a->T("Enable Sound"), ALIGN_TOPLEFT, &g_Config.bEnableSound);
|
||||
if (Atrac3plus_Decoder::IsInstalled() && g_Config.bEnableSound) {
|
||||
UICheckBox(GEN_ID, x + 60, y += stride, a->T("Enable Atrac3+"), ALIGN_TOPLEFT, &g_Config.bEnableAtrac3plus);
|
||||
if (Atrac3plus_Decoder::IsSupported()) {
|
||||
if (Atrac3plus_Decoder::IsInstalled() && g_Config.bEnableSound) {
|
||||
UICheckBox(GEN_ID, x + 60, y += stride, a->T("Enable Atrac3+"), ALIGN_TOPLEFT, &g_Config.bEnableAtrac3plus);
|
||||
}
|
||||
|
||||
VLinear vlinear(30, 200, 20);
|
||||
if (UIButton(GEN_ID, vlinear, 400, 0, a->T("Download Atrac3+ plugin"), ALIGN_LEFT)) {
|
||||
screenManager()->push(new PluginScreen());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if (defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))) || defined(ARMEABI) || defined(ARMEABI_V7A)
|
||||
|
||||
VLinear vlinear(30, 300, 20);
|
||||
if (!Atrac3plus_Decoder::IsInstalled() && UIButton(GEN_ID, vlinear, 400, 0, a->T("Download Atrac3+ plugin"), ALIGN_LEFT)) {
|
||||
screenManager()->push(new PluginScreen());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
UIEnd();
|
||||
}
|
||||
|
||||
@@ -765,6 +762,11 @@ void GraphicsScreenP1::render() {
|
||||
UICheckBox(GEN_ID, x, y += stride, gs->T("Stream VBO"), ALIGN_TOPLEFT, &g_Config.bUseVBO);
|
||||
#endif
|
||||
UICheckBox(GEN_ID, x, y += stride, gs->T("Mipmapping"), ALIGN_TOPLEFT, &g_Config.bMipMap);
|
||||
#ifdef _WIN32
|
||||
bool Vsync = g_Config.iVSyncInterval != 0;
|
||||
UICheckBox(GEN_ID, x, y += stride, gs->T("VSync"), ALIGN_TOPLEFT, &Vsync);
|
||||
g_Config.iVSyncInterval = Vsync ? 1 : 0;
|
||||
#endif
|
||||
UICheckBox(GEN_ID, x, y += stride, gs->T("Display Raw Framebuffer"), ALIGN_TOPLEFT, &g_Config.bDisplayFramebuffer);
|
||||
if (UICheckBox(GEN_ID, x, y += stride, gs->T("Buffered Rendering"), ALIGN_TOPLEFT, &g_Config.bBufferedRendering)) {
|
||||
if (gpu)
|
||||
@@ -974,17 +976,28 @@ void LanguageScreen::render() {
|
||||
I18NCategory *g = GetI18NCategory("General");
|
||||
I18NCategory *l = GetI18NCategory("Language");
|
||||
|
||||
ui_draw2d.SetFontScale(1.5f, 1.5f);
|
||||
ui_draw2d.DrawText(UBUNTU24, s->T("Language"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER);
|
||||
ui_draw2d.SetFontScale(1.0f, 1.0f);
|
||||
bool small = dp_xres < 720;
|
||||
|
||||
if (!small) {
|
||||
ui_draw2d.SetFontScale(1.5f, 1.5f);
|
||||
ui_draw2d.DrawText(UBUNTU24, s->T("Language"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER);
|
||||
ui_draw2d.SetFontScale(1.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) {
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
}
|
||||
|
||||
VGrid vlang(50, 100, dp_yres - 50, 10, 10);
|
||||
int buttonW = LARGE_BUTTON_WIDTH - 50;
|
||||
|
||||
if (small) {
|
||||
buttonW = LARGE_BUTTON_WIDTH - 70;
|
||||
}
|
||||
|
||||
VGrid vlang(20, small ? 20 : 100, dp_yres - 50, 10, 10);
|
||||
std::string text;
|
||||
|
||||
|
||||
for (size_t i = 0; i < langs_.size(); i++) {
|
||||
std::string code;
|
||||
size_t dot = langs_[i].name.find('.');
|
||||
@@ -1029,7 +1042,7 @@ void LanguageScreen::render() {
|
||||
}
|
||||
}
|
||||
|
||||
if (UIButton(GEN_ID_LOOP(i), vlang, LARGE_BUTTON_WIDTH - 30, 0, buttonTitle.c_str(), ALIGN_TOPLEFT)) {
|
||||
if (UIButton(GEN_ID_LOOP(i), vlang, buttonW, 0, buttonTitle.c_str(), ALIGN_TOPLEFT)) {
|
||||
std::string oldLang = g_Config.languageIni;
|
||||
g_Config.languageIni = code;
|
||||
|
||||
@@ -1133,7 +1146,13 @@ void ControlsScreen::render() {
|
||||
if (g_Config.bShowTouchControls) {
|
||||
UICheckBox(GEN_ID, x, y += stride, c->T("Large Controls"), ALIGN_TOPLEFT, &g_Config.bLargeControls);
|
||||
UICheckBox(GEN_ID, x, y += stride, c->T("Show Analog Stick"), ALIGN_TOPLEFT, &g_Config.bShowAnalogStick);
|
||||
}
|
||||
// This will be a slider in the new UI later
|
||||
bool bTransparent = g_Config.iTouchButtonOpacity < 30;
|
||||
bool prev = bTransparent;
|
||||
UICheckBox(GEN_ID, x, y += stride, c->T("Transparent Buttons"), ALIGN_TOPLEFT, &bTransparent);
|
||||
if (bTransparent != prev)
|
||||
g_Config.iTouchButtonOpacity = bTransparent ? 15 : 65;
|
||||
}
|
||||
UICheckBox(GEN_ID, x, y += stride, c->T("Tilt", "Tilt to Analog (horizontal)"), ALIGN_TOPLEFT, &g_Config.bAccelerometerToAnalogHoriz);
|
||||
|
||||
// Button to KeyMapping screen
|
||||
@@ -1349,7 +1368,11 @@ void FileSelectScreen::render() {
|
||||
currentDirectory_ = getDir(currentDirectory_);
|
||||
updateListing();
|
||||
}
|
||||
ui_draw2d.DrawTextShadow(UBUNTU24, currentDirectory_.c_str(), 20 + SMALL_BUTTON_WIDTH, 10 + 25, 0xFFFFFFFF, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
if (UIButton(GEN_ID, Pos(SMALL_BUTTON_WIDTH + 20,10), SMALL_BUTTON_WIDTH, 0, g->T("Home"), ALIGN_TOPLEFT)) {
|
||||
currentDirectory_ = g_Config.externalDirectory;
|
||||
updateListing();
|
||||
}
|
||||
ui_draw2d.DrawTextShadow(UBUNTU24, currentDirectory_.c_str(), 30 + SMALL_BUTTON_WIDTH*2, 10 + 25, 0xFFFFFFFF, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
if (UIButton(GEN_ID, Pos(dp_xres - 10, 10), SMALL_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT)) {
|
||||
g_Config.Save();
|
||||
screenManager()->switchScreen(new MenuScreen());
|
||||
|
||||
+2
-1
@@ -234,6 +234,7 @@ void NativeInit(int argc, const char *argv[],
|
||||
|
||||
config_filename = user_data_path + "/ppsspp.ini";
|
||||
g_Config.Load(config_filename.c_str());
|
||||
g_Config.externalDirectory = external_directory;
|
||||
#endif
|
||||
|
||||
const char *fileToLog = 0;
|
||||
@@ -356,7 +357,7 @@ void NativeInitGraphics() {
|
||||
screenManager = new ScreenManager();
|
||||
|
||||
if (boot_filename.empty()) {
|
||||
#if (defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))) || defined(ARMEABI) || defined(ARMEABI_V7A)
|
||||
#if (defined(_WIN32) && (defined(_M_IX86) || defined(_M_X64))) || defined(ARMEABI) || defined(ARMEABI_V7A) || (defined(MACOSX) && defined(_M_IX64))
|
||||
if (Atrac3plus_Decoder::CanAutoInstall()) {
|
||||
Atrac3plus_Decoder::DoAutoInstall();
|
||||
screenManager->switchScreen(new LogoScreen(boot_filename));
|
||||
|
||||
+15
-2
@@ -25,6 +25,13 @@
|
||||
#include "UI/ui_atlas.h"
|
||||
#include "Core/HW/atrac3plus.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "TargetConditionals.h"
|
||||
#if TARGET_OS_MAC
|
||||
#define MACOSX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void DrawBackground(float alpha);
|
||||
|
||||
void PluginScreen::DrawBackground(UIContext &dc)
|
||||
@@ -108,17 +115,23 @@ void PluginScreen::update(InputState &input) {
|
||||
abi = "armeabi";
|
||||
#elif defined(ARMEABI_V7A)
|
||||
abi = "armeabi-v7a";
|
||||
#elif defined(MACOSX)
|
||||
abi = "MacOSX64";
|
||||
#endif
|
||||
const char *notSupportedText = p->T("SorryNoDownload", "Sorry, there is no automatic download of the decoder\navailable for this platform.");
|
||||
if (!abi.empty()) {
|
||||
at3plusdecoderUrl_ = root->getString(abi.c_str(), "");
|
||||
if (at3plusdecoderUrl_.empty()) {
|
||||
buttonDownload_->SetEnabled(false);
|
||||
tvDescription_->SetText(notSupportedText);
|
||||
} else {
|
||||
buttonDownload_->SetEnabled(true);
|
||||
const char *notInstalledText = p->T("To download and install", "To download and install Mai's Atrac3+ decoding support, click Download.\n");
|
||||
const char *reInstallText = p->T("Already installed", "Mai's Atrac3+ decoder already installed.\nWould you like to redownload and reinstall it?\n");
|
||||
const char *notInstalledText = p->T("To download and install", "To download and install Mai's Atrac3+ decoding\n support, click Download.");
|
||||
const char *reInstallText = p->T("Already installed", "Mai's Atrac3+ decoder already installed.\nWould you like to redownload and reinstall it?");
|
||||
tvDescription_->SetText(Atrac3plus_Decoder::IsInstalled() ? reInstallText : notInstalledText);
|
||||
}
|
||||
} else {
|
||||
tvDescription_->SetText(notSupportedText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-16
@@ -8,29 +8,21 @@
|
||||
|
||||
#include "OpenGLBase.h"
|
||||
|
||||
static HDC hDC=NULL; // Private GDI Device Context
|
||||
static HGLRC hRC=NULL; // Permanent Rendering Context
|
||||
static HWND hWnd=NULL; // Holds Our Window Handle
|
||||
static HINSTANCE hInstance; // Holds The Instance Of The Application
|
||||
static HDC hDC; // Private GDI Device Context
|
||||
static HGLRC hRC; // Permanent Rendering Context
|
||||
static HWND hWnd; // Holds Our Window Handle
|
||||
|
||||
static int xres, yres;
|
||||
|
||||
// TODO: Make config?
|
||||
static bool enableGLDebug = false;
|
||||
|
||||
|
||||
//typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int );
|
||||
//static PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0;
|
||||
|
||||
void setVSync(int interval=1)
|
||||
void GL_SetVSyncInterval(int interval=1)
|
||||
{
|
||||
const char *extensions = (const char *)glGetString( GL_EXTENSIONS );
|
||||
|
||||
if( wglSwapIntervalEXT )
|
||||
wglSwapIntervalEXT(interval);
|
||||
}
|
||||
|
||||
// Resize And Initialize The GL Window
|
||||
void GL_Resized() {
|
||||
if (!hWnd)
|
||||
return;
|
||||
@@ -39,8 +31,6 @@ void GL_Resized() {
|
||||
xres = rc.right - rc.left; //account for border :P
|
||||
yres = rc.bottom - rc.top;
|
||||
|
||||
//swidth=width; // Set Scissor Width To Window Width
|
||||
//sheight=height; // Set Scissor Height To Window Height
|
||||
if (yres == 0)
|
||||
yres = 1;
|
||||
glstate.viewport.set(0, 0, xres, yres);
|
||||
@@ -105,7 +95,6 @@ bool GL_Init(HWND window, std::string *error_message) {
|
||||
hWnd = window;
|
||||
GLuint PixelFormat;
|
||||
|
||||
hInstance = GetModuleHandle(NULL);
|
||||
static const PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
|
||||
1, // Version Number
|
||||
@@ -205,7 +194,7 @@ bool GL_Init(HWND window, std::string *error_message) {
|
||||
glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]);
|
||||
|
||||
glstate.Initialize();
|
||||
setVSync(0);
|
||||
GL_SetVSyncInterval(0);
|
||||
if (enableGLDebug && glewIsSupported("GL_ARB_debug_output")) {
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)&DebugCallbackARB, 0); // print debug output to stderr
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
bool GL_Init(HWND window, std::string *error_message);
|
||||
|
||||
void GL_Shutdown();
|
||||
void GL_Resized();
|
||||
void GL_SwapBuffers();
|
||||
@@ -586,6 +586,10 @@ namespace MainWindow
|
||||
g_Config.bMipMap = !g_Config.bMipMap;
|
||||
break;
|
||||
|
||||
case ID_OPTIONS_VSYNC:
|
||||
g_Config.iVSyncInterval = !g_Config.iVSyncInterval;
|
||||
break;
|
||||
|
||||
case ID_TEXTURESCALING_OFF:
|
||||
setTexScalingLevel(1);
|
||||
break;
|
||||
@@ -897,6 +901,7 @@ namespace MainWindow
|
||||
CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.bShowFPSCounter);
|
||||
CHECKITEM(ID_OPTIONS_FRAMESKIP, g_Config.iFrameSkip != 0);
|
||||
CHECKITEM(ID_OPTIONS_MIPMAP, g_Config.bMipMap);
|
||||
CHECKITEM(ID_OPTIONS_VSYNC, g_Config.iVSyncInterval != 0);
|
||||
CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost);
|
||||
CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound);
|
||||
CHECKITEM(ID_TEXTURESCALING_DEPOSTERIZE, g_Config.bTexDeposterize);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+17
-11
@@ -5,19 +5,25 @@
|
||||
android:versionName="0.7.6"
|
||||
android:installLocation="auto" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11"/>
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000"></uses-feature>
|
||||
<uses-feature android:name="android.hardware.screen.landscape" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="archos.permission.FULLSCREEN.FULL" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name">
|
||||
<uses-feature android:name="android.hardware.screen.landscape" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="archos.permission.FULLSCREEN.FULL" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"/>
|
||||
|
||||
<application
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name">
|
||||
<activity
|
||||
android:name=".PpssppActivity"
|
||||
android:label="@string/app_name"
|
||||
|
||||
+1
-1
Submodule native updated: 5d098ca88b...4c2f26ff35.
Reference in new issue
Block a user