Merge remote-tracking branch 'upstream/master'

Conflicts:
	UI/GameSettingsScreen.cpp
	UI/MenuScreens.cpp
	Windows/ppsspp.rc
This commit is contained in:
raven02 2013-07-22 00:03:54 +08:00
commit 0216f52359
33 changed files with 854 additions and 342 deletions

View File

@ -62,6 +62,7 @@ void Config::Load(const char *iniFileName)
general->Get("EnableCheats", &bEnableCheats, false);
general->Get("MaxRecent", &iMaxRecent, 12);
general->Get("ScreenshotsAsPNG", &bScreenshotsAsPNG, false);
general->Get("StateSlot", &iCurrentStateSlot, 0);
// Fix issue from switching from uint (hex in .ini) to int (dec)
if (iMaxRecent == 0)
@ -127,7 +128,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);
graphics->Get("VSyncInterval", &bVSync, false);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Get("Enable", &bEnableSound, true);
@ -213,6 +214,7 @@ void Config::Save()
general->Set("MaxRecent", iMaxRecent);
general->Set("EnableCheats", bEnableCheats);
general->Set("ScreenshotsAsPNG", bScreenshotsAsPNG);
general->Set("StateSlot", iCurrentStateSlot);
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
cpu->Set("Jit", bJit);
@ -246,7 +248,7 @@ void Config::Save()
graphics->Set("TexScalingLevel", iTexScalingLevel);
graphics->Set("TexScalingType", iTexScalingType);
graphics->Set("TexDeposterize", bTexDeposterize);
graphics->Set("VSyncInterval", iVSyncInterval);
graphics->Set("VSyncInterval", bVSync);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Set("Enable", bEnableSound);

View File

@ -71,7 +71,7 @@ public:
bool bPartialStretch;
#endif
bool bStretchToDisplay;
int iVSyncInterval;
bool bVSync;
int iFrameSkip;
int iWindowX;
@ -92,6 +92,7 @@ public:
int iFpsLimit;
int iForceMaxEmulatedFPS;
int iMaxRecent;
int iCurrentStateSlot;
bool bEnableCheats;
bool bReloadCheats;
bool bFramebuffersToMem;

View File

@ -131,13 +131,13 @@ int PSPMsgDialog::Init(unsigned int paramAddr)
return 0;
}
void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo)
void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo, bool hasOK)
{
float WRAP_WIDTH = 300.0f;
if (UTF8StringNonASCIICount(text.c_str()) > 3)
WRAP_WIDTH = 372.0f;
float y = 130.0f;
float y = 140.0f;
float h;
int n;
PPGeMeasureText(0, &h, &n, text.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH);
@ -163,7 +163,7 @@ void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo)
PPGeMeasureText(&w, &h, 0, choiceText, FONT_SCALE);
w = w / 2.0f + 5.0f;
h /= 2.0f;
float y2 = y + h2 + 10.0f;
float y2 = y + h2;
h2 += h + 4.0f;
y = 132.0f - h;
PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x6DCFCFCF));
@ -177,24 +177,27 @@ void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo)
else if (IsButtonPressed(CTRL_RIGHT) && yesnoChoice == 1) {
yesnoChoice = 0;
}
} else {
}
if (hasOK) {
I18NCategory *d = GetI18NCategory("Dialog");
float x, w;
x = 240.0f;
w = 15.0f;
h /= 2.0f;
float y2 = y + h2 + 10.0f;
float y2 = y + h2;
h2 += h + 4.0f;
y = 132.0f - h;
PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x6DCFCFCF));
PPGeDrawText(d->T("OK"), 240.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
PPGeDrawText(d->T("OK"), 239.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF));
}
PPGeDrawTextWrapped(text.c_str(), 241.0f, y+2, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
PPGeDrawTextWrapped(text.c_str(), 240.0f, y, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF));
float sy = 125.0f - h2, ey = 145.0f + h2;
PPGeDrawRect(50.0f, sy, 420.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawRect(50.0f, ey, 420.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawRect(40.0f, sy, 440.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawRect(40.0f, ey, 440.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF));
}
int PSPMsgDialog::Update()
@ -235,7 +238,7 @@ int PSPMsgDialog::Update()
PPGeDrawRect(0, 0, 480, 272, CalcFadedColor(0xC0C8B2AC));
if ((flag & DS_MSG) || (flag & DS_ERRORMSG))
DisplayMessage(msgText, (flag & DS_YESNO) != 0);
DisplayMessage(msgText, (flag & DS_YESNO) != 0, (flag & DS_OK) != 0);
if (flag & (DS_OK | DS_VALIDBUTTON))
DisplayButtons(DS_BUTTON_OK);

View File

@ -66,7 +66,7 @@ public:
int Abort();
private :
void DisplayMessage(std::string text, bool hasYesNo = false);
void DisplayMessage(std::string text, bool hasYesNo = false, bool hasOK = false);
enum Flags
{

View File

@ -408,9 +408,13 @@ void PSPSaveDialog::DisplaySaveDataInfo1()
std::string saveTitleTxt = saveTitle;
std::string saveDetailTxt = saveDetail;
PPGeDrawText(titleTxt.c_str(), 181, 138, PPGE_ALIGN_BOTTOM, 0.6f, CalcFadedColor(0x80000000));
PPGeDrawText(titleTxt.c_str(), 180, 136, PPGE_ALIGN_BOTTOM, 0.6f, CalcFadedColor(0xFFC0C0C0));
PPGeDrawText(timeTxt.c_str(), 181, 139, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000));
PPGeDrawText(timeTxt.c_str(), 180, 137, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(saveTitleTxt.c_str(), 176, 162, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(0x80000000));
PPGeDrawText(saveTitleTxt.c_str(), 175, 159, PPGE_ALIGN_LEFT, 0.55f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(saveDetailTxt.c_str(), 176, 183, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000));
PPGeDrawText(saveDetailTxt.c_str(), 175, 181, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
}
}
@ -464,6 +468,7 @@ void PSPSaveDialog::DisplaySaveDataInfo2()
}
snprintf(txt, 1024, "%s\n%s %s\n%lld KB", saveTitle, date, hour_time, sizeK);
std::string saveinfoTxt = txt;
PPGeDrawText(saveinfoTxt.c_str(), 9, 202, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0x80000000));
PPGeDrawText(saveinfoTxt.c_str(), 8, 200, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
}
}
@ -500,7 +505,9 @@ void PSPSaveDialog::DisplayMessage(std::string text, bool hasYesNo)
h2 += h + 4.0f;
y = 132.0f - h;
PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x40C0C0C0));
PPGeDrawText(d->T("Yes"), 303.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
PPGeDrawText(d->T("Yes"), 302.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(yesColor));
PPGeDrawText(d->T("No"), 367.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
PPGeDrawText(d->T("No"), 366.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(noColor));
if (IsButtonPressed(CTRL_LEFT) && yesnoChoice == 0) {
yesnoChoice = 1;
@ -509,6 +516,7 @@ void PSPSaveDialog::DisplayMessage(std::string text, bool hasYesNo)
yesnoChoice = 0;
}
}
PPGeDrawTextWrapped(text.c_str(), 335.0f, y+2, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
PPGeDrawTextWrapped(text.c_str(), 334.0f, y, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF));
float sy = 122.0f - h2, ey = 150.0f + h2;
PPGeDrawRect(202.0f, sy, 466.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF));

View File

@ -16,137 +16,479 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "util/text/utf8.h"
#include "util/text/utf16.h"
#include "util/text/shiftjis.h"
#include "Core/HLE/HLE.h"
#include "Core/Reporting.h"
int sceCccSetTable(u32 jis2ucs, u32 ucs2jis)
typedef PSPPointer<char> PSPCharPointer;
typedef PSPPointer<u16> PSPWCharPointer;
static u16 errorUTF8;
static u16 errorUTF16;
static u16 errorSJIS;
// These tables point directly to PSP memory and map all 64k possible u16 values.
static PSPWCharPointer ucs2jisTable;
static PSPWCharPointer jis2ucsTable;
void __CccInit()
{
// Both tables jis2ucs and ucs2jis have a size of 0x20000 bytes
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccSetTable(%08x, %08x)", jis2ucs, ucs2jis);
return 0;
errorUTF8 = 0;
errorUTF16 = 0;
errorSJIS = 0;
ucs2jisTable = 0;
jis2ucsTable = 0;
}
void __CccDoState(PointerWrap &p)
{
p.Do(errorUTF8);
p.Do(errorUTF16);
p.Do(errorSJIS);
p.Do(ucs2jisTable);
p.Do(jis2ucsTable);
p.DoMarker("sceCcc");
}
u32 __CccUCStoJIS(u32 c, u32 alt)
{
// JIS can only be 16-bit at most, UCS can be 32 (even if the table only supports UCS-2.)
alt &= 0xFFFF;
// If it's outside the table or blank in the table, return alt.
if (c > 0xFFFF || ucs2jisTable[c] == 0)
return alt;
return ucs2jisTable[c];
}
u32 __CccJIStoUCS(u32 c, u32 alt)
{
// JIS can only be 16-bit at most, UCS can be 32 (even if the table only supports UCS-2.)
c &= 0xFFFF;
if (jis2ucsTable[c] == 0)
return alt;
return jis2ucsTable[c];
}
void sceCccSetTable(u32 jis2ucs, u32 ucs2jis)
{
// Both tables jis2ucs and ucs2jis have a size of 0x20000 bytes.
DEBUG_LOG(HLE, "sceCccSetTable(%08x, %08x)", jis2ucs, ucs2jis);
ucs2jisTable = ucs2jis;
jis2ucsTable = jis2ucs;
}
int sceCccUTF8toUTF16(u32 dstAddr, int dstSize, u32 srcAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccUTF8toUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
return 0;
PSPCharPointer src;
PSPWCharPointer dst;
dst = dstAddr;
src = srcAddr;
if (!dst.IsValid() || !src.IsValid())
{
ERROR_LOG(HLE, "sceCccUTF8toUTF16(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccUTF8toUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
UTF8 utf(src);
int n = 0;
while (u32 c = utf.next())
{
dst += UTF16LE::encode(dst, c);
n++;
}
return n;
}
int sceCccUTF8toSJIS(u32 dstAddr, int dstSize, u32 srcAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccUTF8toSJIS(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
Memory::Memcpy(dstAddr, Memory::GetCharPointer(srcAddr), dstSize);
return 0;
PSPCharPointer dst, src;
dst = dstAddr;
src = srcAddr;
if (!dst.IsValid() || !src.IsValid())
{
ERROR_LOG(HLE, "sceCccUTF8toSJIS(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr);
return 0;
}
if (!jis2ucsTable.IsValid())
{
ERROR_LOG(HLE, "sceCccUTF8toSJIS(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccUTF8toSJIS(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
UTF8 utf(src);
int n = 0;
while (u32 c = utf.next())
{
dst += ShiftJIS::encode(dst, __CccUCStoJIS(c, errorSJIS));
n++;
}
return n;
}
int sceCccUTF16toUTF8(u32 dstAddr, int dstSize, u32 srcAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccUTF16toUTF8(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
return 0;
PSPWCharPointer src;
PSPCharPointer dst;
dst = dstAddr;
src = srcAddr;
if (!dst.IsValid() || !src.IsValid())
{
ERROR_LOG(HLE, "sceCccUTF16toUTF8(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr);
return 0;
}
if (!jis2ucsTable.IsValid())
{
ERROR_LOG(HLE, "sceCccUTF16toUTF8(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccUTF16toUTF8(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
UTF16LE utf(src);
int n = 0;
while (u32 c = utf.next())
{
dst += UTF8::encode(dst, c);
n++;
}
return n;
}
int sceCccUTF16toSJIS(u32 dstAddr, int dstSize, u32 srcAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccUTF16toSJIS(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
return 0;
PSPWCharPointer src;
PSPCharPointer dst;
dst = dstAddr;
src = srcAddr;
if (!dst.IsValid() || !src.IsValid())
{
ERROR_LOG(HLE, "sceCccUTF16toSJIS(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr);
return 0;
}
if (!jis2ucsTable.IsValid())
{
ERROR_LOG(HLE, "sceCccUTF16toSJIS(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccUTF16toSJIS(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
UTF16LE utf(src);
int n = 0;
while (u32 c = utf.next())
{
dst += ShiftJIS::encode(dst, __CccUCStoJIS(c, errorSJIS));
n++;
}
return n;
}
int sceCccSJIStoUTF8(u32 dstAddr, int dstSize, u32 srcAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccSJIStoUTF8(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
// TODO: Use the tables set in sceCccSetTable()?
// Some characters are the same, so let's copy which is better than doing nothing.
Memory::Memcpy(dstAddr, Memory::GetCharPointer(srcAddr), dstSize);
return 0;
PSPCharPointer dst, src;
dst = dstAddr;
src = srcAddr;
if (!dst.IsValid() || !src.IsValid())
{
ERROR_LOG(HLE, "sceCccSJIStoUTF8(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr);
return 0;
}
if (!jis2ucsTable.IsValid())
{
ERROR_LOG(HLE, "sceCccSJIStoUTF8(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccSJIStoUTF8(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
ShiftJIS sjis(src);
int n = 0;
while (u32 c = sjis.next())
{
dst += UTF8::encode(dst, __CccJIStoUCS(c, errorUTF8));
n++;
}
return n;
}
int sceCccSJIStoUTF16(u32 dstAddr, int dstSize, u32 srcAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccSJIStoUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
return 0;
PSPCharPointer src;
PSPWCharPointer dst;
dst = dstAddr;
src = srcAddr;
if (!dst.IsValid() || !src.IsValid())
{
ERROR_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr);
return 0;
}
if (!jis2ucsTable.IsValid())
{
ERROR_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccSJIStoUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr);
ShiftJIS sjis(src);
int n = 0;
while (u32 c = sjis.next())
{
dst += UTF16LE::encode(dst, __CccJIStoUCS(c, errorUTF16));
n++;
}
return n;
}
int sceCccStrlenUTF8(u32 strAddr)
{
DEBUG_LOG(HLE, "sceCccStrlenUTF8(%08x)", strAddr);
return u8_strlen(Memory::GetCharPointer(strAddr));
PSPCharPointer str;
str = strAddr;
if (!str.IsValid())
{
ERROR_LOG(HLE, "sceCccStrlenUTF8(%08x): invalid pointer", strAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccStrlenUTF8(%08x): invalid pointer", strAddr);
return UTF8(str).length();
}
int sceCccStrlenUTF16(u32 strAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccStrlenUTF16(%08x)", strAddr);
return 0;
PSPWCharPointer str;
str = strAddr;
if (!str.IsValid())
{
ERROR_LOG(HLE, "sceCccStrlenUTF16(%08x): invalid pointer", strAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccStrlenUTF16(%08x): invalid pointer", strAddr);
return UTF16LE(str).length();
}
int sceCccStrlenSJIS(u32 strAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccStrlenSJIS(%08x)", strAddr);
return 0;
PSPCharPointer str;
str = strAddr;
if (!str.IsValid())
{
ERROR_LOG(HLE, "sceCccStrlenSJIS(%08x): invalid pointer", strAddr);
return 0;
}
DEBUG_LOG(HLE, "sceCccStrlenSJIS(%08x): invalid pointer", strAddr);
return ShiftJIS(str).length();
}
int sceCccEncodeUTF8(u32 dstAddr, u32 ucs)
int sceCccEncodeUTF8(u32 dstAddrAddr, u32 ucs)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccEncodeUTF8(%08x, U+%04x)", dstAddr, ucs);
return 0;
PSPPointer<PSPCharPointer> dstp;
dstp = dstAddrAddr;
if (!dstp.IsValid() || !dstp->IsValid())
{
ERROR_LOG(HLE, "sceCccEncodeUTF8(%08x, U+%04x): invalid pointer", dstAddrAddr, ucs);
return 0;
}
DEBUG_LOG(HLE, "sceCccEncodeUTF8(%08x, U+%04x)", dstAddrAddr, ucs);
*dstp += UTF8::encode(*dstp, ucs);
return dstp->ptr;
}
int sceCccEncodeUTF16(u32 dstAddr, u32 ucs)
int sceCccEncodeUTF16(u32 dstAddrAddr, u32 ucs)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccEncodeUTF8(%08x, U+%04x)", dstAddr, ucs);
return 0;
PSPPointer<PSPWCharPointer> dstp;
dstp = dstAddrAddr;
if (!dstp.IsValid() || !dstp->IsValid())
{
ERROR_LOG(HLE, "sceCccEncodeUTF16(%08x, U+%04x): invalid pointer", dstAddrAddr, ucs);
return 0;
}
DEBUG_LOG(HLE, "sceCccEncodeUTF16(%08x, U+%04x)", dstAddrAddr, ucs);
*dstp += UTF16LE::encode(*dstp, ucs);
return dstp->ptr;
}
int sceCccEncodeSJIS(u32 dstAddr, u32 ucs)
int sceCccEncodeSJIS(u32 dstAddrAddr, u32 jis)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccEncodeSJIS(%08x, U+%04x)", dstAddr, ucs);
return 0;
PSPPointer<PSPCharPointer> dstp;
dstp = dstAddrAddr;
if (!dstp.IsValid() || !dstp->IsValid())
{
ERROR_LOG(HLE, "sceCccEncodeSJIS(%08x, U+%04x): invalid pointer", dstAddrAddr, jis);
return 0;
}
DEBUG_LOG(HLE, "sceCccEncodeSJIS(%08x, U+%04x)", dstAddrAddr, jis);
*dstp += ShiftJIS::encode(*dstp, jis);
return dstp->ptr;
}
int sceCccDecodeUTF8(u32 dstAddrAddr)
{
DEBUG_LOG(HLE, "sceCccDecodeUTF8(%08x)", dstAddrAddr);
PSPPointer<const char **> dst;
dst = dstAddrAddr;
PSPPointer<PSPCharPointer> dstp;
dstp = dstAddrAddr;
int result = 0;
if (dst.IsValid())
{
int size = 0;
result = u8_nextchar(**dst, &size);
*dst += size;
if (!dstp.IsValid() || !dstp->IsValid()) {
ERROR_LOG(HLE, "sceCccDecodeUTF8(%08x): invalid pointer", dstAddrAddr);
// Should crash?
return 0;
}
DEBUG_LOG(HLE, "sceCccDecodeUTF8(%08x)", dstAddrAddr);
UTF8 utf(*dstp);
int result = utf.next();
*dstp += utf.byteIndex();
if (result == UTF8::INVALID)
return errorUTF8;
return result;
}
int sceCccDecodeUTF16(u32 dstAddrAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccDecodeUTF16(%08x)", dstAddrAddr);
return 0;
PSPPointer<PSPWCharPointer> dstp;
dstp = dstAddrAddr;
if (!dstp.IsValid() || !dstp->IsValid()) {
ERROR_LOG(HLE, "sceCccDecodeUTF16(%08x): invalid pointer", dstAddrAddr);
// Should crash?
return 0;
}
DEBUG_LOG(HLE, "sceCccDecodeUTF16(%08x)", dstAddrAddr);
// TODO: Does it do any detection of BOM?
UTF16LE utf(*dstp);
int result = utf.next();
*dstp += utf.byteIndex();
if (result == UTF16LE::INVALID)
return errorUTF16;
return result;
}
int sceCccDecodeSJIS(u32 dstAddrAddr)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccDecodeSJIS(%08x)", dstAddrAddr);
return 0;
PSPPointer<PSPCharPointer> dstp;
dstp = dstAddrAddr;
if (!dstp.IsValid() || !dstp->IsValid()) {
ERROR_LOG(HLE, "sceCccDecodeSJIS(%08x): invalid pointer", dstAddrAddr);
// Should crash?
return 0;
}
DEBUG_LOG(HLE, "sceCccDecodeSJIS(%08x)", dstAddrAddr);
ShiftJIS sjis(*dstp);
int result = sjis.next();
*dstp += sjis.byteIndex();
if (result == ShiftJIS::INVALID)
return errorSJIS;
return result;
}
int sceCccUCStoJIS()
int sceCccIsValidUTF8(u32 c)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccUCStoJIS(?)");
return 0;
WARN_LOG(HLE, "UNIMPL sceCccIsValidUTF8(%08x)", c);
return c != 0;
}
int sceCccJIStoUCS()
int sceCccIsValidUTF16(u32 c)
{
ERROR_LOG_REPORT(HLE, "UNIMPL sceCccUCStoJIS(?)");
return 0;
WARN_LOG(HLE, "UNIMPL sceCccIsValidUTF16(%08x)", c);
return c != 0;
}
int sceCccIsValidSJIS(u32 c)
{
WARN_LOG(HLE, "UNIMPL sceCccIsValidSJIS(%08x)", c);
return c != 0;
}
int sceCccIsValidUCS2(u32 c)
{
WARN_LOG(HLE, "UNIMPL sceCccIsValidUCS2(%08x)", c);
return c != 0;
}
int sceCccIsValidUCS4(u32 c)
{
WARN_LOG(HLE, "UNIMPL sceCccIsValidUCS4(%08x)", c);
return c != 0;
}
int sceCccIsValidJIS(u32 c)
{
WARN_LOG(HLE, "UNIMPL sceCccIsValidJIS(%08x)", c);
return c != 0;
}
u32 sceCccSetErrorCharUTF8(u32 c)
{
DEBUG_LOG(HLE, "sceCccSetErrorCharUTF8(%08x)", c);
int result = errorUTF8;
errorUTF8 = c;
return result;
}
u32 sceCccSetErrorCharUTF16(u32 c)
{
DEBUG_LOG(HLE, "sceCccSetErrorCharUTF16(%08x)", c);
int result = errorUTF16;
errorUTF16 = c;
return result;
}
u32 sceCccSetErrorCharSJIS(u32 c)
{
DEBUG_LOG(HLE, "sceCccSetErrorCharSJIS(%04x)", c);
int result = errorSJIS;
errorSJIS = c;
return result;
}
u32 sceCccUCStoJIS(u32 c, u32 alt)
{
if (ucs2jisTable.IsValid())
{
DEBUG_LOG(HLE, "sceCccUCStoJIS(%08x, %08x)", c, alt);
return __CccUCStoJIS(c, alt);
}
else
{
ERROR_LOG(HLE, "sceCccUCStoJIS(%08x, %08x): table not loaded", c, alt);
return alt;
}
}
u32 sceCccJIStoUCS(u32 c, u32 alt)
{
if (jis2ucsTable.IsValid())
{
DEBUG_LOG(HLE, "sceCccUCStoJIS(%08x, %08x)", c, alt);
return __CccJIStoUCS(c, alt);
}
else
{
ERROR_LOG(HLE, "sceCccUCStoJIS(%08x, %08x): table not loaded", c, alt);
return alt;
}
}
const HLEFunction sceCcc[] =
{
{0xB4D1CBBF, WrapI_UU<sceCccSetTable>, "sceCccSetTable"},
{0xB4D1CBBF, WrapV_UU<sceCccSetTable>, "sceCccSetTable"},
{0x00D1378F, WrapI_UIU<sceCccUTF8toUTF16>, "sceCccUTF8toUTF16"},
{0x6F82EE03, WrapI_UIU<sceCccUTF8toSJIS>, "sceCccUTF8toSJIS"},
{0x41B724A5, WrapI_UIU<sceCccUTF16toUTF8>, "sceCccUTF16toUTF8"},
@ -162,17 +504,17 @@ const HLEFunction sceCcc[] =
{0xc6a8bee2, WrapI_U<sceCccDecodeUTF8>, "sceCccDecodeUTF8"},
{0xe0cf8091, WrapI_U<sceCccDecodeUTF16>, "sceCccDecodeUTF16"},
{0x953e6c10, WrapI_U<sceCccDecodeSJIS>, "sceCccDecodeSJIS"},
{0x90521ac5, 0, "sceCccIsValidUTF8"},
{0xcc0a8bda, 0, "sceCccIsValidUTF16"},
{0x67bf0d19, 0, "sceCccIsValidSJIS"},
{0x76e33e9c, 0, "sceCccIsValidUCS2"},
{0xd2b18485, 0, "sceCccIsValidUCS4"},
{0xa2d5d209, 0, "sceCccIsValidJIS"},
{0x17e1d813, 0, "sceCccSetErrorCharUTF8"},
{0xb8476cf4, 0, "sceCccSetErrorCharUTF16"},
{0xc56949ad, 0, "sceCccSetErrorCharSJIS"},
{0x70ecaa10, WrapI_V<sceCccUCStoJIS>, "sceCccUCStoJIS"},
{0xfb7846e2, WrapI_V<sceCccJIStoUCS>, "sceCccJIStoUCS"},
{0x90521ac5, WrapI_U<sceCccIsValidUTF8>, "sceCccIsValidUTF8"},
{0xcc0a8bda, WrapI_U<sceCccIsValidUTF16>, "sceCccIsValidUTF16"},
{0x67bf0d19, WrapI_U<sceCccIsValidSJIS>, "sceCccIsValidSJIS"},
{0x76e33e9c, WrapI_U<sceCccIsValidUCS2>, "sceCccIsValidUCS2"},
{0xd2b18485, WrapI_U<sceCccIsValidUCS4>, "sceCccIsValidUCS4"},
{0xa2d5d209, WrapI_U<sceCccIsValidJIS>, "sceCccIsValidJIS"},
{0x17e1d813, WrapU_U<sceCccSetErrorCharUTF8>, "sceCccSetErrorCharUTF8"},
{0xb8476cf4, WrapU_U<sceCccSetErrorCharUTF16>, "sceCccSetErrorCharUTF16"},
{0xc56949ad, WrapU_U<sceCccSetErrorCharSJIS>, "sceCccSetErrorCharSJIS"},
{0x70ecaa10, WrapU_UU<sceCccUCStoJIS>, "sceCccUCStoJIS"},
{0xfb7846e2, WrapU_UU<sceCccJIStoUCS>, "sceCccJIStoUCS"},
};
void Register_sceCcc()

View File

@ -19,4 +19,8 @@
#include "HLE.h"
class PointerWrap;
void Register_sceCcc();
void __CccInit();
void __CccDoState(PointerWrap &p);

View File

@ -149,8 +149,8 @@ void __CtrlPeekAnalog(int stick, float *x, float *y)
{
std::lock_guard<std::recursive_mutex> guard(ctrlMutex);
*x = (ctrlCurrent.analog[stick][0] - 127.5f) / 127.5f;
*y = -(ctrlCurrent.analog[stick][1] - 127.5f) / 127.5f;
*x = (ctrlCurrent.analog[stick][CTRL_ANALOG_X] - 127.5f) / 127.5f;
*y = -(ctrlCurrent.analog[stick][CTRL_ANALOG_Y] - 127.5f) / 127.5f;
}

View File

@ -37,6 +37,7 @@
#include "__sceAudio.h"
#include "sceAtrac.h"
#include "sceAudio.h"
#include "sceCcc.h"
#include "sceCtrl.h"
#include "sceDisplay.h"
#include "sceFont.h"
@ -107,6 +108,7 @@ void __KernelInit()
__AudioInit();
__SasInit();
__AtracInit();
__CccInit();
__DisplayInit();
__GeInit();
__PowerInit();
@ -194,6 +196,7 @@ void __KernelDoState(PointerWrap &p)
__AtracDoState(p);
__AudioDoState(p);
__CccDoState(p);
__CtrlDoState(p);
__DisplayDoState(p);
__FontDoState(p);

View File

@ -94,36 +94,33 @@ EmuFileType Identify_File(std::string &filename)
{
return FILETYPE_PSP_ELF;
}
else
return FILETYPE_UNKNOWN_ELF;
return FILETYPE_UNKNOWN_ELF;
}
else if (id == 'PBP\x00')
{
if (psar_id == 'MUPN') {
return FILETYPE_PSP_ISO_NP;
} else {
// Let's check if we got pointed to a PBP within such a directory.
// If so we just move up and return the directory itself as the game.
std::string path = getDir(filename);
// If loading from memstick...
size_t pos = path.find("/PSP/GAME/");
if (pos != std::string::npos) {
filename = path;
return FILETYPE_PSP_PBP_DIRECTORY;
}
}
// Let's check if we got pointed to a PBP within such a directory.
// If so we just move up and return the directory itself as the game.
std::string path = getDir(filename);
// If loading from memstick...
size_t pos = path.find("/PSP/GAME/");
if (pos != std::string::npos) {
filename = path;
return FILETYPE_PSP_PBP_DIRECTORY;
}
return FILETYPE_PSP_PBP;
}
else
else if (!strcasecmp(extension.c_str(),".pbp"))
{
if (!strcasecmp(extension.c_str(),".pbp"))
{
ERROR_LOG(LOADER, "A PBP with the wrong magic number?");
return FILETYPE_PSP_PBP;
}
else if (!strcasecmp(extension.c_str(),".bin"))
{
return FILETYPE_UNKNOWN_BIN;
}
ERROR_LOG(LOADER, "A PBP with the wrong magic number?");
return FILETYPE_PSP_PBP;
}
else if (!strcasecmp(extension.c_str(),".bin"))
{
return FILETYPE_UNKNOWN_BIN;
}
return FILETYPE_UNKNOWN;
}

View File

@ -25,11 +25,6 @@
#include "HDRemaster.h"
// Enable memory checks in the Debug/DebugFast builds, but NOT in release
#if defined(_DEBUG) || defined(DEBUGFAST)
#define ENABLE_MEM_CHECK
#endif
// PPSSPP is very aggressive about trying to do memory accesses directly, for speed.
// This can be a problem when debugging though, as stray memory reads and writes will
// crash the whole emulator.
@ -39,11 +34,6 @@
//#define SAFE_MEMORY
#endif
#ifdef __SYMBIAN32__
//#define SAFE_MEMORY
#endif
// Global declarations
class PointerWrap;

View File

@ -24,9 +24,6 @@
#include "MIPS/MIPS.h"
// TODO: Fix this
#undef ENABLE_MEM_CHECK
namespace Memory
{
@ -154,14 +151,6 @@ u8 Read_U8(const u32 _Address)
{
u8 _var = 0;
ReadFromHardware<u8>(_var, _Address);
#ifdef ENABLE_MEM_CHECK
TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
mc->Action(&PowerPC::debug_interface, _var, _Address, false, 1, PC);
}
#endif
return (u8)_var;
}
@ -169,14 +158,6 @@ u16 Read_U16(const u32 _Address)
{
u16 _var = 0;
ReadFromHardware<u16>(_var, _Address);
#ifdef ENABLE_MEM_CHECK
TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
mc->Action(&PowerPC::debug_interface, _var, _Address, false, 2, PC);
}
#endif
return (u16)_var;
}
@ -184,14 +165,6 @@ u32 Read_U32(const u32 _Address)
{
u32 _var = 0;
ReadFromHardware<u32>(_var, _Address);
#ifdef ENABLE_MEM_CHECK
TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
mc->Action(&PowerPC::debug_interface, _var, _Address, false, 4, PC);
}
#endif
return _var;
}
@ -199,14 +172,6 @@ u64 Read_U64(const u32 _Address)
{
u64 _var = 0;
ReadFromHardware<u64>(_var, _Address);
#ifdef ENABLE_MEM_CHECK
TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
mc->Action(&PowerPC::debug_interface, (u32)_var, _Address, false, 8, PC);
}
#endif
return _var;
}
@ -222,56 +187,22 @@ u32 Read_U16_ZX(const u32 _Address)
void Write_U8(const u8 _Data, const u32 _Address)
{
#ifdef ENABLE_MEM_CHECK
TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
mc->Action(&PowerPC::debug_interface, _Data,_Address,true,1,PC);
}
#endif
WriteToHardware<u8>(_Address, _Data);
}
void Write_U16(const u16 _Data, const u32 _Address)
{
#ifdef ENABLE_MEM_CHECK
TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
mc->Action(&PowerPC::debug_interface, _Data,_Address,true,2,PC);
}
#endif
WriteToHardware<u16>(_Address, _Data);
}
void Write_U32(const u32 _Data, const u32 _Address)
{
#ifdef ENABLE_MEM_CHECK
TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
mc->Action(&PowerPC::debug_interface, _Data,_Address,true,4,PC);
}
#endif
WriteToHardware<u32>(_Address, _Data);
}
void Write_U64(const u64 _Data, const u32 _Address)
{
#ifdef ENABLE_MEM_CHECK
TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address);
if (mc)
{
mc->numHits++;
mc->Action(&PowerPC::debug_interface, (u32)_Data,_Address,true,8,PC);
}
#endif
WriteToHardware<u64>(_Address, _Data);
}

View File

@ -170,12 +170,12 @@ static const u8 flushBeforeCommandList[] = {
GLES_GPU::GLES_GPU()
: resized_(false) {
lastVsync_ = g_Config.iVSyncInterval;
lastVsync_ = g_Config.bVSync;
if (gl_extensions.EXT_swap_control_tear) {
// See http://developer.download.nvidia.com/opengl/specs/WGL_EXT_swap_control_tear.txt
glstate.SetVSyncInterval(-g_Config.iVSyncInterval);
glstate.SetVSyncInterval(g_Config.bVSync ? -1 :0);
} else {
glstate.SetVSyncInterval(g_Config.iVSyncInterval);
glstate.SetVSyncInterval(g_Config.bVSync ? 1 : 0);
}
shaderManager_ = new ShaderManager();
@ -257,7 +257,7 @@ void GLES_GPU::DumpNextFrame() {
void GLES_GPU::BeginFrame() {
// Turn off vsync when unthrottled
int desiredVSyncInterval = g_Config.iVSyncInterval;
int desiredVSyncInterval = g_Config.bVSync;
if ((PSP_CoreParameter().unthrottle) || (PSP_CoreParameter().fpsLimit == 1))
desiredVSyncInterval = 0;
if (desiredVSyncInterval != lastVsync_) {

View File

@ -28,6 +28,7 @@
#endif
#include "FragmentShaderGenerator.h"
#include "Framebuffer.h"
#include "../ge_constants.h"
#include "../GPUState.h"
#include <cstdio>
@ -202,10 +203,16 @@ void GenerateFragmentShader(char *buffer) {
}
if (enableAlphaTest) {
WRITE(p, "float roundTo255th(in float x) { float y = x + (0.49/255.0); return y - fract(y * 255.0) * (1.0 / 255.0); }\n");
if (gstate_c.gpuVendor == GPU_VENDOR_POWERVR)
WRITE(p, "float roundTo255th(in float x) { float y = x + (0.5/255.0); return y - fract(y * 255.0) * (1.0 / 255.0); }\n");
else
WRITE(p, "float roundAndScaleTo255f(in float x) { return floor(x * 255.0 + 0.5); }\n");
}
if (enableColorTest) {
WRITE(p, "vec3 roundTo255thv(in vec3 x) { vec3 y = x + (0.5/255.0); return y - fract(y * 255.0) * (1.0 / 255.0); }\n");
if (gstate_c.gpuVendor == GPU_VENDOR_POWERVR)
WRITE(p, "vec3 roundTo255thv(in vec3 x) { vec3 y = x + (0.5/255.0); return y - fract(y * 255.0) * (1.0 / 255.0); }\n");
else
WRITE(p, "vec3 roundAndScaleTo255v(in vec3 x) { return floor(x * 255.0 + 0.5); }\n");
}
WRITE(p, "void main() {\n");
@ -272,7 +279,10 @@ void GenerateFragmentShader(char *buffer) {
int alphaTestFunc = gstate.alphatest & 7;
const char *alphaTestFuncs[] = { "#", "#", " != ", " == ", " >= ", " > ", " <= ", " < " }; // never/always don't make sense
if (alphaTestFuncs[alphaTestFunc][0] != '#') {
WRITE(p, " if (roundTo255th(v.a) %s u_alphacolorref.a) discard;\n", alphaTestFuncs[alphaTestFunc]);
if (gstate_c.gpuVendor == GPU_VENDOR_POWERVR)
WRITE(p, " if (roundTo255th(v.a) %s u_alphacolorref.a) discard;\n", alphaTestFuncs[alphaTestFunc]);
else
WRITE(p, " if (roundAndScaleTo255f(v.a) %s u_alphacolorref.a) discard;\n", alphaTestFuncs[alphaTestFunc]);
}
}
@ -290,7 +300,10 @@ void GenerateFragmentShader(char *buffer) {
const char *colorTestFuncs[] = { "#", "#", " != ", " == " }; // never/always don't make sense
int colorTestMask = gstate.colormask;
if (colorTestFuncs[colorTestFunc][0] != '#') {
WRITE(p, "if (roundTo255thv(v.rgb) %s u_alphacolorref.rgb) discard;\n", colorTestFuncs[colorTestFunc]);
if (gstate_c.gpuVendor == GPU_VENDOR_POWERVR)
WRITE(p, "if (roundTo255thv(v.rgb) %s u_alphacolorref.rgb) discard;\n", colorTestFuncs[colorTestFunc]);
else
WRITE(p, "if (roundAndScaleTo255v(v.rgb) %s u_alphacolorref.rgb) discard;\n", colorTestFuncs[colorTestFunc]);
}
}

View File

@ -191,14 +191,18 @@ FramebufferManager::FramebufferManager() :
|| vendor == "Intel Corporation"
|| vendor == "Tungsten Graphics, Inc") { // We'll assume this last one means Intel
gpuVendor = GPU_VENDOR_INTEL;
} else if(vendor == "ARM") {
} else if(vendor == "ARM")
gpuVendor = GPU_VENDOR_ARM;
} else {
else if(vendor == "Imagination Technologies")
gpuVendor = GPU_VENDOR_POWERVR;
else if(vendor == "Qualcomm")
gpuVendor = GPU_VENDOR_ADRENO;
else
gpuVendor = GPU_VENDOR_UNKNOWN;
}
} else {
} else
gpuVendor = GPU_VENDOR_UNKNOWN;
}
gstate_c.gpuVendor = gpuVendor;
NOTICE_LOG(HLE,"GPU Vendor : %s", cvendor);
}
FramebufferManager::~FramebufferManager() {

View File

@ -49,6 +49,8 @@ enum {
GPU_VENDOR_AMD = 2,
GPU_VENDOR_INTEL = 3,
GPU_VENDOR_ARM = 4,
GPU_VENDOR_POWERVR = 5,
GPU_VENDOR_ADRENO = 6,
GPU_VENDOR_UNKNOWN = 0
};

View File

@ -34,6 +34,7 @@
#include "GPU/GLES/ShaderManager.h"
#include "GPU/GLES/TransformPipeline.h"
#include "UI/OnScreenDisplay.h"
#include "Framebuffer.h"
Shader::Shader(const char *code, uint32_t shaderType, bool useHWTransform) : failed_(false), useHWTransform_(useHWTransform) {
source_ = code;
@ -195,13 +196,23 @@ static void SetColorUniform3Alpha(int uniform, u32 color, u8 alpha) {
// This passes colors unscaled (e.g. 0 - 255 not 0 - 1.)
static void SetColorUniform3Alpha255(int uniform, u32 color, u8 alpha) {
const float col[4] = {
(float)((color & 0xFF)) * (1.0f / 255.0f),
(float)((color & 0xFF00) >> 8) * (1.0f / 255.0f),
(float)((color & 0xFF0000) >> 16) * (1.0f / 255.0f),
(float)alpha * (1.0f / 255.0f)
};
glUniform4fv(uniform, 1, col);
if (gstate_c.gpuVendor == GPU_VENDOR_POWERVR) {
const float col[4] = {
(float)((color & 0xFF)) * (1.0f / 255.0f),
(float)((color & 0xFF00) >> 8) * (1.0f / 255.0f),
(float)((color & 0xFF0000) >> 16) * (1.0f / 255.0f),
(float)alpha * (1.0f / 255.0f)
};
glUniform4fv(uniform, 1, col);
} else {
const float col[4] = {
(float)((color & 0xFF)) ,
(float)((color & 0xFF00) >> 8) ,
(float)((color & 0xFF0000) >> 16) ,
(float)alpha
};
glUniform4fv(uniform, 1, col);
}
}
static void SetColorUniform3ExtraFloat(int uniform, u32 color, float extra) {

View File

@ -285,6 +285,7 @@ struct GPUStateCache
u32 curRTHeight;
u32 getRelativeAddress(u32 data) const;
int gpuVendor;
};
// TODO: Implement support for these.

View File

@ -53,7 +53,9 @@
#include "UI/MiscScreens.h"
EmuScreen::EmuScreen(const std::string &filename) : invalid_(true), pauseTrigger_(false) {
EmuScreen::EmuScreen(const std::string &filename)
: gamePath_(filename), invalid_(true), pauseTrigger_(false) {
bootGame(filename);
}
@ -224,34 +226,29 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) {
// Should get rid of that but not now.
#ifndef ANDROID
case VIRTKEY_PAUSE:
screenManager()->push(new PauseScreen());
if (g_Config.bNewUI)
screenManager()->push(new GamePauseScreen(gamePath_));
else
screenManager()->push(new PauseScreen());
break;
#endif
case VIRTKEY_AXIS_X_MIN:
__CtrlSetAnalogX(-1.0f, CTRL_STICK_LEFT);
break;
case VIRTKEY_AXIS_X_MAX:
__CtrlSetAnalogX(1.0f, CTRL_STICK_LEFT);
setVKeyAnalogX(CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX);
break;
case VIRTKEY_AXIS_Y_MIN:
__CtrlSetAnalogY(-1.0f, CTRL_STICK_LEFT);
break;
case VIRTKEY_AXIS_Y_MAX:
__CtrlSetAnalogY(1.0f, CTRL_STICK_LEFT);
setVKeyAnalogY(CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX);
break;
case VIRTKEY_AXIS_RIGHT_X_MIN:
__CtrlSetAnalogX(-1.0f, CTRL_STICK_RIGHT);
break;
case VIRTKEY_AXIS_RIGHT_X_MAX:
__CtrlSetAnalogX(1.0f, CTRL_STICK_RIGHT);
setVKeyAnalogX(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX);
break;
case VIRTKEY_AXIS_RIGHT_Y_MIN:
__CtrlSetAnalogY(-1.0f, CTRL_STICK_RIGHT);
break;
case VIRTKEY_AXIS_RIGHT_Y_MAX:
__CtrlSetAnalogY(1.0f, CTRL_STICK_RIGHT);
setVKeyAnalogY(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX);
break;
}
}
@ -261,29 +258,53 @@ void EmuScreen::onVKeyUp(int virtualKeyCode) {
case VIRTKEY_UNTHROTTLE:
PSP_CoreParameter().unthrottle = false;
break;
case VIRTKEY_AXIS_X_MIN:
case VIRTKEY_AXIS_X_MAX:
__CtrlSetAnalogX(0.0f, CTRL_STICK_LEFT);
setVKeyAnalogX(CTRL_STICK_LEFT, VIRTKEY_AXIS_X_MIN, VIRTKEY_AXIS_X_MAX);
break;
case VIRTKEY_AXIS_Y_MIN:
case VIRTKEY_AXIS_Y_MAX:
__CtrlSetAnalogY(0.0f, CTRL_STICK_LEFT);
setVKeyAnalogY(CTRL_STICK_LEFT, VIRTKEY_AXIS_Y_MIN, VIRTKEY_AXIS_Y_MAX);
break;
case VIRTKEY_AXIS_RIGHT_X_MIN:
case VIRTKEY_AXIS_RIGHT_X_MAX:
__CtrlSetAnalogX(0.0f, CTRL_STICK_RIGHT);
setVKeyAnalogX(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_X_MIN, VIRTKEY_AXIS_RIGHT_X_MAX);
break;
case VIRTKEY_AXIS_RIGHT_Y_MIN:
case VIRTKEY_AXIS_RIGHT_Y_MAX:
__CtrlSetAnalogY(0.0f, CTRL_STICK_RIGHT);
setVKeyAnalogY(CTRL_STICK_RIGHT, VIRTKEY_AXIS_RIGHT_Y_MIN, VIRTKEY_AXIS_RIGHT_Y_MAX);
break;
default:
break;
}
}
inline void EmuScreen::setVKeyAnalogX(int stick, int virtualKeyMin, int virtualKeyMax) {
float axis = 0.0f;
// The down events can repeat, so just trust the virtKeys array.
if (virtKeys[virtualKeyMin - VIRTKEY_FIRST])
axis -= 1.0f;
if (virtKeys[virtualKeyMax - VIRTKEY_FIRST])
axis += 1.0f;
__CtrlSetAnalogX(axis, stick);
}
inline void EmuScreen::setVKeyAnalogY(int stick, int virtualKeyMin, int virtualKeyMax) {
float axis = 0.0f;
if (virtKeys[virtualKeyMin - VIRTKEY_FIRST])
axis -= 1.0f;
if (virtKeys[virtualKeyMax - VIRTKEY_FIRST])
axis += 1.0f;
__CtrlSetAnalogY(axis, stick);
}
void EmuScreen::key(const KeyInput &key) {
if (key.keyCode == KEYCODE_BACK)
pauseTrigger_ = true;
int result = KeyMap::KeyToPspButton(key.deviceId, key.keyCode);
if (result == KEYMAP_ERROR_UNKNOWN_KEY)
return;
@ -420,7 +441,11 @@ void EmuScreen::update(InputState &input) {
// This is here to support the iOS on screen back button.
if (pauseTrigger_) {
pauseTrigger_ = false;
screenManager()->push(new PauseScreen());
if (g_Config.bNewUI) {
screenManager()->push(new GamePauseScreen(gamePath_));
} else {
screenManager()->push(new PauseScreen());
}
}
}

View File

@ -49,14 +49,16 @@ private:
void pspKey(int pspKeyCode, int flags);
void onVKeyDown(int virtualKeyCode);
void onVKeyUp(int virtualKeyCode);
void setVKeyAnalogX(int stick, int virtualKeyMin, int virtualKeyMax);
void setVKeyAnalogY(int stick, int virtualKeyMin, int virtualKeyMax);
bool pauseTrigger_;
std::string gamePath_;
// Something invalid was loaded, don't try to emulate
bool invalid_;
std::string errorMessage_;
bool pauseTrigger_;
// To track mappable virtual keys. We can have as many as we want.
bool virtKeys[VIRTKEY_COUNT];
};

View File

@ -150,6 +150,7 @@ void PopupSliderChoiceFloat::Draw(UIContext &dc) {
}
void GameSettingsScreen::CreateViews() {
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
@ -170,91 +171,105 @@ void GameSettingsScreen::CreateViews() {
root_ = new LinearLayout(ORIENT_HORIZONTAL);
ViewGroup *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f));
root_->Add(leftColumn);
leftColumn->Add(new Spacer(new LinearLayoutParams(1.0)));
leftColumn->Add(new Choice("Back"))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
leftColumn->Add(new Choice(g->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 200, new LinearLayoutParams(800, FILL_PARENT, actionMenuMargins));
root_->Add(tabHolder);
// TODO: These currently point to global settings, not game specific ones.
// Graphics
ViewGroup *graphicsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
ViewGroup *graphicsSettings = new LinearLayout(ORIENT_VERTICAL);
graphicsSettingsScroll->Add(graphicsSettings);
tabHolder->AddTab("Graphics", graphicsSettingsScroll);
graphicsSettings->Add(new ItemHeader(gs->T("Features")));
graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gs->T("Hardware Transform")));
graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache")));
graphicsSettings->Add(new CheckBox(&g_Config.bUseVBO, gs->T("Stream VBO")));
graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display")));
static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering", "Read FBO To Mem(GPU)", "Read FBO To Mem(CPU)"};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gs->T("Rendering Mode"), renderingMode, 0, 4, gs, screenManager()));
graphicsSettings->Add(new CheckBox(&g_Config.bDisplayFramebuffer, gs->T("Display Raw Framebuffer")));
graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping")));
graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache")));
graphicsSettings->Add(new CheckBox(&g_Config.bUseVBO, gs->T("Stream VBO")));
graphicsSettings->Add(new CheckBox(&g_Config.SSAntiAliasing, gs->T("Anti Aliasing")));
graphicsSettings->Add(new ItemHeader(gs->T("Frame rate")));
graphicsSettings->Add(new CheckBox(&cap60FPS_, gs->T("Read Framebuffer to memory")));
graphicsSettings->Add(new CheckBox(&g_Config.bTrueColor, gs->T("True Color")));
graphicsSettings->Add(new CheckBox(&g_Config.bDisplayFramebuffer, gs->T("Display Raw Framebuffer")));
#ifdef _WIN32
graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gs->T("VSync")));
graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")));
#endif
// TODO: Does frame rate belong among the graphics settings?
graphicsSettings->Add(new ItemHeader(gs->T("Frame Rate Control")));
static const char *fpsChoices[] = {"None", "Speed", "FPS", "Both"};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS Counter"), fpsChoices, 0, 4, gs, screenManager()));
graphicsSettings->Add(new CheckBox(&g_Config.bShowDebugStats, gs->T("Show Debug Statistics")));
graphicsSettings->Add(new PopupSliderChoice(&g_Config.iFrameSkip, 1, 9, gs->T("Frame Skipping"), screenManager()));
graphicsSettings->Add(new ItemHeader(gs->T("Texture filtering")));
graphicsSettings->Add(new ItemHeader(gs->T("Anisotropic Filtering")));
static const char *anisoLevels[] = { "Off", "2x", "4x", "8x", "16x" };
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAnisotropyLevel, gs->T("Aniso Filter"), anisoLevels, 0, 5, gs, screenManager()));
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAnisotropyLevel, gs->T("Anisotropic Filtering"), anisoLevels, 0, 5, gs, screenManager()));
graphicsSettings->Add(new ItemHeader(gs->T("Texture scaling")));
graphicsSettings->Add(new ItemHeader(gs->T("Texture Scaling")));
static const char *texScaleLevels[] = {
"Off (1x)", "2x", "3x",
#ifndef USING_GLES2
"4x", "5x",
#endif
};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingLevel, gs->T("Upscale"), texScaleLevels, 1, 5, gs, screenManager()));
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingLevel, gs->T("Upscale Level"), texScaleLevels, 1, 5, gs, screenManager()));
static const char *texScaleAlgos[] = { "xBRZ", "Hybrid", "Bicubic", "Hybrid + Bicubic", };
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingType, gs->T("Upscale type"), texScaleAlgos, 0, 4, gs, screenManager()));
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingType, gs->T("Upscale Type"), texScaleAlgos, 0, 4, gs, screenManager()));
graphicsSettings->Add(new ItemHeader(gs->T("Texture Filtering")));
static const char *texFilters[] = { "Default (auto)", "Nearest", "Linear", "Linear on FMV", };
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gs->T("Upscale type"), texFilters, 1, 4, gs, screenManager()));
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gs->T("Upscale Type"), texFilters, 1, 4, gs, screenManager()));
#ifdef USING_GLES2
g_Config.bFramebuffersCPUConvert = g_Config.bFramebuffersToMem;
#endif
#ifdef _WIN32
graphicsSettings->Add(new CheckBox(&g_Config.bAutoSaveSymbolMap, gs->T("VSync")));
#endif
// Audio
ViewGroup *audioSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
ViewGroup *audioSettings = new LinearLayout(ORIENT_VERTICAL);
audioSettingsScroll->Add(audioSettings);
tabHolder->AddTab("Audio", audioSettingsScroll);
audioSettings->Add(new PopupSliderChoice(&g_Config.iSEVolume, 0, 8, a->T("FX volume"), screenManager()));
audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, 8, a->T("BGM volume"), screenManager()));
audioSettings->Add(new Choice(a->T("Download Atrac3+ plugin")))->OnClick.Handle(this, &GameSettingsScreen::OnDownloadPlugin);
audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound")));
audioSettings->Add(new CheckBox(&g_Config.bEnableAtrac3plus, a->T("Enable Atrac3+")));
audioSettings->Add(new PopupSliderChoice(&g_Config.iSEVolume, 0, 8, a->T("FX volume"), screenManager()));
audioSettings->Add(new PopupSliderChoice(&g_Config.iBGMVolume, 0, 8, a->T("BGM volume"), screenManager()));
// Control
ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
ViewGroup *controlsSettings = new LinearLayout(ORIENT_VERTICAL);
controlsSettingsScroll->Add(controlsSettings);
tabHolder->AddTab("Controls", controlsSettingsScroll);
controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, c->T("OnScreen", "On-Screen Touch Controls")));
audioSettings->Add(new PopupSliderChoiceFloat(&g_Config.fButtonScale, 1.15, 2.0, a->T("Touch Controls Size"), screenManager()));
controlsSettings->Add(new CheckBox(&g_Config.bShowAnalogStick, c->T("Show Analog Stick")));
controlsSettings->Add(new CheckBox(&g_Config.bShowAnalogStick, c->T("Show Left Analog Stick")));
controlsSettings->Add(new PopupSliderChoice(&g_Config.iTouchButtonOpacity, 15, 65, c->T("Button Opacity"), screenManager()));
controlsSettings->Add(new CheckBox(&g_Config.bAccelerometerToAnalogHoriz, c->T("Tilt", "Tilt to Analog (horizontal)")));
// System
ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
ViewGroup *systemSettings = new LinearLayout(ORIENT_VERTICAL);
systemSettingsScroll->Add(systemSettings);
tabHolder->AddTab("System", systemSettingsScroll);
systemSettings->Add(new CheckBox(&g_Config.bJit, s->T("Dynarec", "Dynarec (JIT)")));
systemSettings->Add(new CheckBox(&g_Config.bFastMemory, s->T("Fast Memory", "Fast Memory (unstable)")));
systemSettings->Add(new CheckBox(&g_Config.bFastMemory, s->T("Fast Memory", "Fast Memory (Unstable)")));
}
void DrawBackground(float alpha);
void GameSettingsScreen::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
void GameSettingsScreen::update(InputState &input) {
UIScreen::update(input);
g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0;
}
@ -269,15 +284,9 @@ void GlobalSettingsScreen::CreateViews() {
LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
list->Add(new ItemHeader("General"));
list->Add(new CheckBox(&g_Config.bNewUI, gs->T("New UI")));
list->Add(new CheckBox(&enableReports_, gs->T("Enable error reporting")));
static const char *fpsChoices[] = {
"None", "Speed", "FPS", "Both"
};
list->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS"), fpsChoices, 0, 4, gs, screenManager()));
list->Add(new Choice(gs->T("Language")))->OnClick.Handle(this, &GlobalSettingsScreen::OnLanguage);
list->Add(new CheckBox(&g_Config.bNewUI, gs->T("Enable New UI")));
list->Add(new CheckBox(&enableReports_, gs->T("Enable Error Reporting")));
list->Add(new Choice(gs->T("System Language")))->OnClick.Handle(this, &GlobalSettingsScreen::OnLanguage);
list->Add(new Choice(gs->T("Developer Tools")))->OnClick.Handle(this, &GlobalSettingsScreen::OnDeveloperTools);
list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &GlobalSettingsScreen::OnBack);
}
@ -304,14 +313,6 @@ UI::EventReturn GlobalSettingsScreen::OnBack(UI::EventParams &e) {
return UI::EVENT_DONE;
}
void GlobalSettingsScreen::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
}
void DeveloperToolsScreen::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
}
void DeveloperToolsScreen::CreateViews() {
using namespace UI;
root_ = new ScrollView(ORIENT_VERTICAL);
@ -322,7 +323,6 @@ void DeveloperToolsScreen::CreateViews() {
LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
list->Add(new ItemHeader(g->T("General")));
list->Add(new Choice(a->T("Download Atrac3+ plugin")))->OnClick.Handle(this, &DeveloperToolsScreen::OnDownloadPlugin);
list->Add(new Choice(d->T("Run CPU Tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests);
list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &DeveloperToolsScreen::OnBack);
@ -338,7 +338,7 @@ UI::EventReturn DeveloperToolsScreen::OnRunCPUTests(UI::EventParams &e) {
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnDownloadPlugin(UI::EventParams &e) {
UI::EventReturn GameSettingsScreen::OnDownloadPlugin(UI::EventParams &e) {
screenManager()->push(new PluginScreen());
return UI::EVENT_DONE;
}

View File

@ -18,17 +18,18 @@
#pragma once
#include "ui/ui_screen.h"
#include "UI/MiscScreens.h"
// Per-game settings screen - enables you to configure graphic options, control options, etc
// per game.
class GameSettingsScreen : public UIScreen {
class GameSettingsScreen : public UIScreenWithBackground {
public:
GameSettingsScreen(std::string gamePath, std::string gameID) : gamePath_(gamePath), gameID_(gameID) {}
GameSettingsScreen(std::string gamePath, std::string gameID = "") : gamePath_(gamePath), gameID_(gameID) {}
virtual void update(InputState &input);
protected:
virtual void CreateViews();
virtual void DrawBackground(UIContext &dc);
private:
std::string gamePath_, gameID_;
@ -37,18 +38,20 @@ private:
UI::TextView *tvTitle_;
UI::TextView *tvGameSize_;
// Event handlers
UI::EventReturn OnDownloadPlugin(UI::EventParams &e);
// Temporaries to convert bools to int settings
bool cap60FPS_;
};
// TODO: Move to its own file.
class GlobalSettingsScreen : public UIScreen {
class GlobalSettingsScreen : public UIScreenWithBackground {
public:
GlobalSettingsScreen() {}
protected:
virtual void CreateViews();
virtual void DrawBackground(UIContext &dc);
private:
// Event handlers
@ -61,16 +64,14 @@ private:
bool enableReports_;
};
class DeveloperToolsScreen : public UIScreen {
class DeveloperToolsScreen : public UIScreenWithBackground {
public:
DeveloperToolsScreen() {}
protected:
virtual void CreateViews();
virtual void DrawBackground(UIContext &dc);
private:
UI::EventReturn OnBack(UI::EventParams &e);
UI::EventReturn OnRunCPUTests(UI::EventParams &e);
UI::EventReturn OnDownloadPlugin(UI::EventParams &e);
};

View File

@ -206,7 +206,7 @@ void PSPStick::Draw(UIContext &dc) {
__CtrlPeekAnalog(stick_, &dx, &dy);
dc.Draw()->DrawImage(bgImg_, stickX, stickY, 1.0f * scale_, colorBg, ALIGN_CENTER);
dc.Draw()->DrawImage(stickImageIndex_, stickX + dx * stick_size_ * scale_, stickY + dy * stick_size_ * scale_, 1.0f * scale_, colorBg, ALIGN_CENTER);
dc.Draw()->DrawImage(stickImageIndex_, stickX + dx * stick_size_ * scale_, stickY - dy * stick_size_ * scale_, 1.0f * scale_, colorBg, ALIGN_CENTER);
}
void PSPStick::Touch(const TouchInput &input) {
@ -249,7 +249,7 @@ void PSPStick::ProcessTouch(float x, float y, bool down) {
dy = std::min(1.0f, std::max(-1.0f, dy));
__CtrlSetAnalogX(dx, stick_);
__CtrlSetAnalogY(dy, stick_);
__CtrlSetAnalogY(-dy, stick_);
} else {
__CtrlSetAnalogX(0.0f, stick_);
__CtrlSetAnalogY(0.0f, stick_);

View File

@ -34,7 +34,7 @@ public:
virtual void Touch(const TouchInput &input);
virtual void Draw(UIContext &dc);
virtual void GetContentDimensions(const UIContext &dc, float &w, float &h) const;
virtual bool IsDown() { return pointerDownMask_ != NULL; }
virtual bool IsDown() { return pointerDownMask_ != 0; }
// chainable
MultiTouchButton *FlipImageH(bool flip) { flipImageH_ = flip; return this; }
MultiTouchButton *SetAngle(float angle) { angle_ = angle; return this; }
@ -88,12 +88,12 @@ public:
private:
void ProcessTouch(float x, float y, bool down);
float radius_;
float scale_;
int arrowIndex_;
int overlayIndex_;
float scale_;
float radius_;
int dragPointerId_;
int down_;
};

View File

@ -15,15 +15,17 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Common/FileUtil.h"
#include "Core/System.h"
#include "base/colorutil.h"
#include "base/timeutil.h"
#include "math/curves.h"
#include "ui/ui_context.h"
#include "ui/view.h"
#include "ui/viewgroup.h"
#include "Common/FileUtil.h"
#include "Core/System.h"
#include "Core/SaveState.h"
#include "UI/EmuScreen.h"
#include "UI/MainScreen.h"
#include "UI/GameScreen.h"
@ -352,12 +354,9 @@ void MainScreen::sendMessage(const char *message, const char *value) {
}
}
void DrawBackground(float alpha);
void MainScreen::DrawBackground(UIContext &dc) {
void MainScreen::update(InputState &input) {
UIScreen::update(input);
globalUIState = UISTATE_MENU;
::DrawBackground(1.0f);
dc.Flush();
}
UI::EventReturn MainScreen::OnLoadFile(UI::EventParams &e) {
@ -397,3 +396,98 @@ UI::EventReturn MainScreen::OnExit(UI::EventParams &e) {
exit(0);
return UI::EVENT_DONE;
}
void GamePauseScreen::update(InputState &input) {
globalUIState = UISTATE_PAUSEMENU;
UIScreen::update(input);
}
void GamePauseScreen::DrawBackground(UIContext &dc) {
GameInfo *ginfo = g_gameInfoCache.GetInfo(gamePath_, true);
dc.Flush();
if (ginfo && ginfo->pic1Texture) {
ginfo->pic1Texture->Bind(0);
uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 3)) & 0xFFc0c0c0;
dc.Draw()->DrawTexRect(0,0,dp_xres, dp_yres, 0,0,1,1,color);
dc.Flush();
dc.RebindTexture();
}
}
GamePauseScreen::~GamePauseScreen() {
g_Config.iCurrentStateSlot = saveSlots_->GetSelection();
g_Config.Save();
}
void GamePauseScreen::CreateViews() {
using namespace UI;
Margins actionMenuMargins(0, 100, 15, 0);
root_ = new LinearLayout(ORIENT_HORIZONTAL);
ViewGroup *leftColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
root_->Add(leftColumn);
root_->Add(new Spacer(new LinearLayoutParams(1.0)));
ViewGroup *leftColumnItems = new LinearLayout(ORIENT_VERTICAL);
leftColumn->Add(leftColumnItems);
saveSlots_ = leftColumnItems->Add(new ChoiceStrip(ORIENT_HORIZONTAL, new LinearLayoutParams(300, WRAP_CONTENT)));
saveSlots_->AddChoice("1");
saveSlots_->AddChoice("2");
saveSlots_->AddChoice("3");
saveSlots_->AddChoice("4");
saveSlots_->SetSelection(g_Config.iCurrentStateSlot);
leftColumnItems->Add(new Choice("Save State"))->OnClick.Handle(this, &GamePauseScreen::OnSaveState);
leftColumnItems->Add(new Choice("Load State"))->OnClick.Handle(this, &GamePauseScreen::OnLoadState);
ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
root_->Add(rightColumn);
ViewGroup *rightColumnItems = new LinearLayout(ORIENT_VERTICAL);
rightColumn->Add(rightColumnItems);
#ifdef _WIN32
rightColumnItems->Add(new Choice("Continue"))->OnClick.Handle(this, &GamePauseScreen::OnContinue);
#endif
rightColumnItems->Add(new Choice("Game Settings"))->OnClick.Handle(this, &GamePauseScreen::OnGameSettings);
rightColumnItems->Add(new Choice("Main Settings"))->OnClick.Handle(this, &GamePauseScreen::OnMainSettings);
rightColumnItems->Add(new Choice("Exit to menu"))->OnClick.Handle(this, &GamePauseScreen::OnExitToMenu);
}
UI::EventReturn GamePauseScreen::OnMainSettings(UI::EventParams &e) {
screenManager()->push(new GlobalSettingsScreen());
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnGameSettings(UI::EventParams &e) {
screenManager()->push(new GameSettingsScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnContinue(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_CANCEL);
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnExitToMenu(UI::EventParams &e) {
screenManager()->switchScreen(new MainScreen());
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnLoadState(UI::EventParams &e) {
SaveState::LoadSlot(saveSlots_->GetSelection(), 0, 0);
screenManager()->finishDialog(this, DR_CANCEL);
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnSaveState(UI::EventParams &e) {
SaveState::SaveSlot(saveSlots_->GetSelection(), 0, 0);
screenManager()->finishDialog(this, DR_CANCEL);
return UI::EVENT_DONE;
}

View File

@ -19,18 +19,20 @@
#include "base/functional.h"
#include "ui/ui_screen.h"
#include "ui/viewgroup.h"
#include "UI/MiscScreens.h"
// Game screen: Allows you to start a game, delete saves, delete the game,
// set game specific settings, etc.
// Uses GameInfoCache heavily to implement the functionality.
class MainScreen : public UIScreen {
class MainScreen : public UIScreenWithBackground {
public:
MainScreen() {}
protected:
virtual void CreateViews();
virtual void DrawBackground(UIContext &dc);
virtual void update(InputState &input);
virtual void sendMessage(const char *message, const char *value);
private:
@ -42,3 +44,26 @@ private:
UI::EventReturn OnSupport(UI::EventParams &e);
UI::EventReturn OnExit(UI::EventParams &e);
};
class GamePauseScreen : public UIScreen {
public:
GamePauseScreen(const std::string &filename) : UIScreen(), gamePath_(filename) {}
~GamePauseScreen();
protected:
virtual void DrawBackground(UIContext &dc);
virtual void CreateViews();
virtual void update(InputState &input);
private:
UI::EventReturn OnMainSettings(UI::EventParams &e);
UI::EventReturn OnGameSettings(UI::EventParams &e);
UI::EventReturn OnContinue(UI::EventParams &e);
UI::EventReturn OnExitToMenu(UI::EventParams &e);
UI::EventReturn OnSaveState(UI::EventParams &e);
UI::EventReturn OnLoadState(UI::EventParams &e);
std::string gamePath_;
UI::ChoiceStrip *saveSlots_;
};

View File

@ -1,4 +1,4 @@
// Copyright (c) 2013- PPSSPP Project.
// Copyright (c) 2013- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -29,8 +29,9 @@
void DrawBackground(float alpha);
void PromptScreen::DrawBackground(UIContext &dc) {
void UIScreenWithBackground::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
dc.Flush();
}
void PromptScreen::CreateViews() {
@ -83,7 +84,7 @@ NewLanguageScreen::NewLanguageScreen() : ListPopupScreen("Language") {
langValuesMapping["zh_TW"] = std::make_pair("繁體中文", PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL);
langValuesMapping["zh_CN"] = std::make_pair("简体中文", PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED);
//langValuesMapping["ar_AE"] = std::make_pair("العربية", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
//langValuesMapping["ar_AE"] = std::make_pair("العربية", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH)
langValuesMapping["az_AZ"] = std::make_pair("Azeri", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
langValuesMapping["ca_ES"] = std::make_pair("Català", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
langValuesMapping["gr_EL"] = std::make_pair("ελληνικά", PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
@ -155,4 +156,4 @@ void NewLanguageScreen::OnCompleted() {
} else {
g_Config.languageIni = oldLang;
}
}
}

View File

@ -27,7 +27,15 @@
inline void NoOpVoidBool(bool) {}
class PromptScreen : public UIScreen {
class UIScreenWithBackground : public UIScreen {
public:
UIScreenWithBackground() : UIScreen() {}
protected:
virtual void DrawBackground(UIContext &dc);
};
class PromptScreen : public UIScreenWithBackground {
public:
PromptScreen(std::string message, std::string yesButtonText, std::string noButtonText)
: message_(message), yesButtonText_(yesButtonText), noButtonText_(noButtonText) {
@ -37,8 +45,6 @@ public:
: message_(message), yesButtonText_(yesButtonText), noButtonText_(noButtonText), callback_(callback) {}
virtual void CreateViews();
protected:
virtual void DrawBackground(UIContext &dc);
private:
UI::EventReturn OnYes(UI::EventParams &e);

View File

@ -32,13 +32,6 @@
#endif
#endif
void DrawBackground(float alpha);
void PluginScreen::DrawBackground(UIContext &dc)
{
::DrawBackground(1.0f);
}
PluginScreen::PluginScreen() {
// Let's start by downloading the json. We'll find out in Update when it's finished.
json_ = downloader_.StartDownload("http://www.ppsspp.org/update/at3plusdecoder.json", "");

View File

@ -28,12 +28,9 @@
#include "file/file_util.h"
#include "net/http_client.h"
// Uses the new UI framework through UIScreen for simplicity.
// Looks disappointingly like the old UI, right? Don't worry, it's just the theme.
// A redesign is coming. And note that you can control this new UI with your
// keyboard or Xbox controller.
#include "UI/MiscScreens.h"
class PluginScreen : public UIScreen {
class PluginScreen : public UIScreenWithBackground {
public:
PluginScreen();
@ -41,7 +38,6 @@ public:
protected:
virtual void CreateViews();
virtual void DrawBackground(UIContext &dc);
private:
// Event handlers

View File

@ -330,11 +330,11 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
backgroundColor = scaleColor(backgroundColor,1.05f);
}
if (address == curAddress && searching == false)
if (address >= selectRangeStart && address < selectRangeEnd && searching == false)
{
if (hasFocus)
{
backgroundColor = 0xFF9933;
backgroundColor = address == curAddress ? 0xFF8822 : 0xFF9933;
textColor = 0xFFFFFF;
} else {
backgroundColor = 0xC0C0C0;
@ -511,28 +511,28 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
switch (wParam & 0xFFFF)
{
case VK_DOWN:
curAddress += instructionSize;
setCurAddress(curAddress + instructionSize, GetAsyncKeyState(VK_SHIFT) != 0);
scrollAddressIntoView();
break;
case VK_UP:
curAddress-=instructionSize;
setCurAddress(curAddress - instructionSize, GetAsyncKeyState(VK_SHIFT) != 0);
scrollAddressIntoView();
break;
case VK_NEXT:
if (curAddress != windowEnd-instructionSize && curAddressIsVisible()) {
curAddress = windowEnd-instructionSize;
if (curAddress != windowEnd - instructionSize && curAddressIsVisible()) {
setCurAddress(windowEnd - instructionSize, GetAsyncKeyState(VK_SHIFT) != 0);
scrollAddressIntoView();
} else {
curAddress += visibleRows*instructionSize;
setCurAddress(curAddress + visibleRows * instructionSize, GetAsyncKeyState(VK_SHIFT) != 0);
scrollAddressIntoView();
}
break;
case VK_PRIOR:
if (curAddress != windowStart && curAddressIsVisible()) {
curAddress = windowStart;
setCurAddress(windowStart, GetAsyncKeyState(VK_SHIFT) != 0);
scrollAddressIntoView();
} else {
curAddress -= visibleRows*instructionSize;
setCurAddress(curAddress - visibleRows * instructionSize, GetAsyncKeyState(VK_SHIFT) != 0);
scrollAddressIntoView();
}
break;
@ -640,10 +640,11 @@ void CtrlDisAsmView::toggleBreakpoint()
void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
{
int x = LOWORD(lParam);
int x = LOWORD(lParam);
int y = HIWORD(lParam);
int newAddress = yToAddress(y);
u32 newAddress = yToAddress(y);
bool extend = GetAsyncKeyState(VK_SHIFT) != 0;
if (button == 1)
{
if (newAddress == curAddress && hasFocus)
@ -651,15 +652,28 @@ void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
toggleBreakpoint();
}
}
else if (button == 2)
{
// Maintain the current selection if right clicking into it.
if (newAddress >= selectRangeStart && newAddress < selectRangeEnd)
extend = true;
}
setCurAddress(newAddress, extend);
curAddress = newAddress;
SetFocus(wnd);
redraw();
}
void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
{
if (button==2)
if (button == 1)
{
int x = LOWORD(lParam);
int y = HIWORD(lParam);
setCurAddress(yToAddress(y), GetAsyncKeyState(VK_SHIFT) != 0);
redraw();
}
else if (button == 2)
{
//popup menu?
POINT pt;
@ -679,12 +693,20 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
break;
case ID_DISASM_COPYINSTRUCTIONDISASM:
{
char temp[256],opcode[64],arguments[256];
const char *dizz = debugger->disasm(curAddress, instructionSize);
parseDisasm(dizz,opcode,arguments);
sprintf(temp,"%s\t%s",opcode,arguments);
int space = 256 * (selectRangeEnd - selectRangeStart) / instructionSize;
char opcode[64], arguments[256];
char *temp = new char[space];
char *p = temp, *end = temp + space;
for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize)
{
const char *dizz = debugger->disasm(pos, instructionSize);
parseDisasm(dizz, opcode, arguments);
p += snprintf(p, end - p, "%s\t%s\r\n", opcode, arguments);
}
W32Util::CopyTextToClipboard(wnd, temp);
delete [] temp;
}
break;
case ID_DISASM_COPYADDRESS:
@ -703,9 +725,15 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
break;
case ID_DISASM_COPYINSTRUCTIONHEX:
{
char temp[24];
sprintf(temp,"%08X",debugger->readMemory(curAddress));
W32Util::CopyTextToClipboard(wnd,temp);
int space = 24 * (selectRangeEnd - selectRangeStart) / instructionSize;
char *temp = new char[space];
char *p = temp, *end = temp + space;
for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize)
p += snprintf(p, end - p, "%08X\r\n", debugger->readMemory(pos));
W32Util::CopyTextToClipboard(wnd, temp);
delete [] temp;
}
break;
case ID_DISASM_RUNTOHERE:
@ -748,11 +776,18 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
void CtrlDisAsmView::onMouseMove(WPARAM wParam, LPARAM lParam, int button)
{
if ((button & 1) != 0)
{
int x = LOWORD(lParam);
int y = HIWORD(lParam);
setCurAddress(yToAddress(y), GetAsyncKeyState(VK_SHIFT) != 0);
// TODO: Perhaps don't do this every time, but on a timer?
redraw();
}
}
int CtrlDisAsmView::yToAddress(int y)
u32 CtrlDisAsmView::yToAddress(int y)
{
int line = y/rowHeight;
return windowStart + line*instructionSize;

View File

@ -22,6 +22,13 @@
#include <windows.h>
#include <vector>
#include <algorithm>
#undef min
#undef max
using std::min;
using std::max;
class CtrlDisAsmView
{
@ -31,6 +38,8 @@ class CtrlDisAsmView
RECT rect;
u32 curAddress;
u32 selectRangeStart;
u32 selectRangeEnd;
int rowHeight;
int charWidth;
@ -88,7 +97,7 @@ public:
void redraw();
void getOpcodeText(u32 address, char* dest);
int yToAddress(int y);
u32 yToAddress(int y);
void setDontRedraw(bool b) { dontRedraw = b; };
void setDebugger(DebugInterface *deb)
@ -111,7 +120,7 @@ public:
windowStart = newAddress-visibleRows/2*instructionSize;
}
curAddress = newAddress;
setCurAddress(newAddress);
redraw();
}
void gotoPC()
@ -135,4 +144,12 @@ public:
windowStart += lines*instructionSize;
redraw();
}
void setCurAddress(u32 newAddress, bool extend = false)
{
u32 after = newAddress + instructionSize;
curAddress = newAddress;
selectRangeStart = extend ? std::min(selectRangeStart, newAddress) : newAddress;
selectRangeEnd = extend ? std::max(selectRangeEnd, after) : after;
}
};

View File

@ -88,6 +88,8 @@ namespace MainWindow
LRESULT CALLBACK DisplayProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
const UINT WM_USER_SAVESTATE_FINISH = WM_USER + 100;
HWND GetHWND() {
return hwndMain;
}
@ -687,7 +689,7 @@ namespace MainWindow
break;
case ID_OPTIONS_VSYNC:
g_Config.iVSyncInterval = !g_Config.iVSyncInterval;
g_Config.bVSync = !g_Config.bVSync;
break;
case ID_TEXTURESCALING_OFF:
@ -1000,6 +1002,9 @@ namespace MainWindow
SetForegroundWindow(hwndMain);
break;
case WM_USER_SAVESTATE_FINISH:
SetCursor(LoadCursor(0, IDC_ARROW));
break;
case WM_MENUSELECT:
// Unfortunately, accelerate keys (hotkeys) shares the same enabled/disabled states
@ -1051,7 +1056,7 @@ namespace MainWindow
CHECKITEM(ID_OPTIONS_SHOWFPS, g_Config.iShowFPSCounter);
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_VSYNC, g_Config.bVSync);
CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost);
CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound);
CHECKITEM(ID_TEXTURESCALING_DEPOSTERIZE, g_Config.bTexDeposterize);
@ -1247,7 +1252,7 @@ namespace MainWindow
void SaveStateActionFinished(bool result, void *userdata)
{
SetCursor(LoadCursor(0, IDC_ARROW));
PostMessage(hwndMain, WM_USER_SAVESTATE_FINISH, 0, 0);
}
HINSTANCE GetHInstance()