Merge branch 'master' of https://github.com/hrydgard/ppsspp into GEDebugger

Conflicts:
	Windows/GEDebugger/GEDebugger.cpp
	Windows/GEDebugger/GEDebugger.h
	Windows/ppsspp.rc
	Windows/resource.h
This commit is contained in:
Kingcom committed 2013-09-28 10:39:28 +02:00
commit b6d49f09bc
48 files changed
+988 -630

No files matched your search

+6
View File
@@ -178,6 +178,11 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename)
graphics->Get("DisableStencilTest", &bDisableStencilTest, false);
graphics->Get("AlwaysDepthWrite", &bAlwaysDepthWrite, false);
graphics->Get("LowQualitySplineBezier", &bLowQualitySplineBezier, false);
#ifdef USING_GLES2
bFXAA = false;
#else
graphics->Get("FXAA", &bFXAA, false);
#endif
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Get("Enable", &bEnableSound, true);
@@ -338,6 +343,7 @@ void Config::Save() {
graphics->Set("DisableStencilTest", bDisableStencilTest);
graphics->Set("AlwaysDepthWrite", bAlwaysDepthWrite);
graphics->Set("LowQualitySplineBezier", bLowQualitySplineBezier);
graphics->Set("FXAA", bFXAA);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Set("Enable", bEnableSound);
+1
View File
@@ -95,6 +95,7 @@ public:
bool bDisableStencilTest;
bool bAlwaysDepthWrite;
bool bLowQualitySplineBezier;
bool bFXAA;
// Sound
bool bEnableSound;
+14
View File
@@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <set>
#include "base/NativeApp.h"
#include "base/display.h"
#include "base/mutex.h"
@@ -42,6 +43,7 @@ static recursive_mutex m_hStepMutex;
static event m_hInactiveEvent;
static recursive_mutex m_hInactiveMutex;
static bool singleStepPending = false;
static std::set<Core_ShutdownFunc> shutdownFuncs;
#ifdef _WIN32
InputState input_state;
@@ -49,6 +51,17 @@ InputState input_state;
extern InputState input_state;
#endif
void Core_ListenShutdown(Core_ShutdownFunc func)
{
shutdownFuncs.insert(func);
}
void Core_NotifyShutdown()
{
for (auto it = shutdownFuncs.begin(); it != shutdownFuncs.end(); ++it)
(*it)();
}
void Core_ErrorPause()
{
Core_UpdateState(CORE_ERROR);
@@ -63,6 +76,7 @@ void Core_Halt(const char *msg)
void Core_Stop()
{
Core_NotifyShutdown();
Core_UpdateState(CORE_POWERDOWN);
m_hStepEvent.notify_one();
}
+3
View File
@@ -30,6 +30,9 @@ void Core_EnableStepping(bool step);
void Core_DoSingleStep();
void Core_UpdateSingleStep();
typedef void (* Core_ShutdownFunc)();
void Core_ListenShutdown(Core_ShutdownFunc func);
void Core_NotifyShutdown();
void Core_Halt(const char *msg);
bool Core_IsStepping();
+2 -3
View File
@@ -15,7 +15,6 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
#include <string>
@@ -32,8 +31,8 @@ enum GPUCore {
GPU_DIRECTX9,
};
struct CoreParameter
{
// PSP_CoreParameter()
struct CoreParameter {
CoreParameter() : collectEmuLog(0), unthrottle(false), fpsLimit(0), updateRecent(true) {}
CPUCore cpuCore;
GPUCore gpuCore;
+119 -2
View File
@@ -19,6 +19,23 @@
#include "ChunkFile.h"
#include "../Core/MemMap.h"
std::string saveBasePath = "ms0:/PSP/SAVEDATA/";
namespace
{
std::vector<std::string> GetPSPFileList (std::string dirpath) {
std::vector<std::string> FileList;
auto Fileinfos = pspFileSystem.GetDirListing(dirpath);
std::string info;
for (auto it = Fileinfos.begin(); it != Fileinfos.end(); ++it) {
std::string info = (*it).name;
FileList.push_back(info);
}
return FileList;
}
}
PSPGamedataInstallDialog::PSPGamedataInstallDialog() {
}
@@ -26,6 +43,18 @@ PSPGamedataInstallDialog::~PSPGamedataInstallDialog() {
}
int PSPGamedataInstallDialog::Init(u32 paramAddr) {
///////////////////////////////////////////////////////
this->paramAddr = paramAddr;
inFileNames = GetPSPFileList ("disc0:/PSP_GAME/INSDIR");
numFiles = inFileNames.size();
readFiles = 0;
progressValue = 0;
allFilesSize = 0;
allReadSize = 0;
for (auto it = inFileNames.begin(); it != inFileNames.end(); ++it) {
allFilesSize += pspFileSystem.GetFileInfo("disc0:/PSP_GAME/INSDIR/" + (*it)).size;
}
//////////////////////////////////////////////////////
// Already running
if (status != SCE_UTILITY_STATUS_NONE && status != SCE_UTILITY_STATUS_SHUTDOWN)
return SCE_ERROR_UTILITY_INVALID_STATUS;
@@ -39,6 +68,61 @@ int PSPGamedataInstallDialog::Init(u32 paramAddr) {
return 0;
}
int PSPGamedataInstallDialog::Update() {
if (status == SCE_UTILITY_STATUS_INITIALIZE){
status = SCE_UTILITY_STATUS_RUNNING;
} else if (status == SCE_UTILITY_STATUS_RUNNING) {
std::string fullinFileName;
std::string outFileName;
u64 totalLength;
u64 restLength;
u32 bytesToRead = 4096;
u8 *temp = new u8[4096];
u32 inhandle;
u32 outhandle;
size_t readSize;
if (readFiles < numFiles) {
fullinFileName = "disc0:/PSP_GAME/INSDIR/" + inFileNames[readFiles];
outFileName = GetGameDataInstallFileName(&request, inFileNames[readFiles]);
totalLength = pspFileSystem.GetFileInfo(fullinFileName).size;
restLength = totalLength;
inhandle = pspFileSystem.OpenFile(fullinFileName, FILEACCESS_READ);
if (inhandle != 0) {
outhandle = pspFileSystem.OpenFile(outFileName, (FileAccess)(FILEACCESS_WRITE | FILEACCESS_CREATE));
if (outhandle != 0) {
while (restLength > 0) {
if (restLength < bytesToRead)
bytesToRead = (u32)restLength;
readSize = pspFileSystem.ReadFile(inhandle, temp, bytesToRead);
if(readSize > 0) {
pspFileSystem.WriteFile(outhandle, temp, readSize);
restLength -= readSize;
allReadSize += readSize;
} else
break;
}
pspFileSystem.CloseFile(outhandle);
}
++readFiles;
pspFileSystem.CloseFile(inhandle);
}
updateProgress();
delete temp;
} else {
//What is this?
request.unknownResult1 = readFiles;
request.unknownResult2 = readFiles;
Memory::WriteStruct(paramAddr,&request);
status = SCE_UTILITY_STATUS_FINISHED;
}
} else if (status == SCE_UTILITY_STATUS_FINISHED) {
status = SCE_UTILITY_STATUS_SHUTDOWN;
}
return 0;
}
int PSPGamedataInstallDialog::Abort() {
return PSPDialog::Shutdown();
}
@@ -50,11 +134,44 @@ int PSPGamedataInstallDialog::Shutdown(bool force) {
return PSPDialog::Shutdown();
}
std::string PSPGamedataInstallDialog::GetGameDataInstallFileName(SceUtilityGamedataInstallParam *param, std::string filename){
if (!param)
return "";
std::string GameDataInstallPath = saveBasePath + param->gameName + param->dataName + "/";
if (!pspFileSystem.GetFileInfo(GameDataInstallPath).exists)
pspFileSystem.MkDir(GameDataInstallPath);
return GameDataInstallPath + filename;
}
void PSPGamedataInstallDialog::updateProgress() {
// Update progress bar(if there is).
// progress value is progress[3] << 24 | progress[2] << 16 | progress[1] << 8 | progress[0].
// We only should update progress[0] here as the max progress value is 100.
progressValue = (int)(allReadSize / allFilesSize) * 100;
request.progress[0] = progressValue;
Memory::WriteStruct(paramAddr,&request);
}
void PSPGamedataInstallDialog::DoState(PointerWrap &p) {
auto s = p.Section("PSPGamedataInstallDialog", 0, 1);
auto s = p.Section("PSPGamedataInstallDialog", 0, 2);
if (!s)
return;
// This was included in version 1 and higher.
PSPDialog::DoState(p);
p.Do(request);
}
// This was included in version 2 and higher.
if (s > 2) {
p.Do(paramAddr);
p.Do(inFileNames);
p.Do(numFiles);
p.Do(readFiles);
p.Do(allFilesSize);
p.Do(allReadSize);
p.Do(progressValue);
} else {
paramAddr = 0;
}
}
+15 -3
View File
@@ -18,6 +18,7 @@
#pragma once
#include "Core/Dialog/PSPDialog.h"
#include "Core/System.h"
struct SceUtilityGamedataInstallParam {
pspUtilityDialogCommon common;
@@ -29,10 +30,11 @@ struct SceUtilityGamedataInstallParam {
char gamedataParamsDataTitle[128];
char gamedataParamsData[1024];
u8 unknown2;
char ignore2[7];
char ignore2[3];
char progress[4]; // This is progress value,should be updated.
u32 unknownResult1;
u32 unknownResult2;
char ignore[48];
char ignore3[48];
};
class PSPGamedataInstallDialog: public PSPDialog {
@@ -41,12 +43,22 @@ public:
virtual ~PSPGamedataInstallDialog();
virtual int Init(u32 paramAddr);
//virtual int Update();
virtual int Update();
virtual int Shutdown(bool force = false);
virtual void DoState(PointerWrap &p);
int Abort();
std::string GetGameDataInstallFileName(SceUtilityGamedataInstallParam *param, std::string filename);
private:
SceUtilityGamedataInstallParam request;
u32 paramAddr;
std::vector<std::string> inFileNames;
int numFiles;
int readFiles;
u64 allFilesSize; // use this to calculate progress value.
u64 allReadSize; // use this to calculate progress value.
int progressValue;
void updateProgress();
};
+112 -22
View File
@@ -36,8 +36,12 @@
#include <math.h>
#endif
const int numKeyCols[OSK_KEYBOARD_COUNT] = {12, 12, 13, 13, 12, 12, 12};
const int numKeyRows[OSK_KEYBOARD_COUNT] = {4, 4, 5, 5, 5, 4, 4};
extern std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping();
static std::map<std::string, std::pair<std::string, int>> languageMapping;
const int numKeyCols[OSK_KEYBOARD_COUNT] = {12, 12, 13, 13, 12, 12, 12, 12, 12};
const int numKeyRows[OSK_KEYBOARD_COUNT] = {4, 4, 5, 5, 5, 4, 4, 4, 4};
// Japanese(Kana) diacritics
static const wchar_t diacritics[2][103] =
@@ -49,7 +53,7 @@ static const wchar_t diacritics[2][103] =
// Korean(Hangul) consonant
static const wchar_t kor_cons[] = L"ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ";
// Korean(Hangul) vowels, Some bowels are not used, them will be spacing
// Korean(Hangul) vowels, Some vowels are not used, them will be spacing
static const wchar_t kor_vowel[] = L"ㅏㅐㅑㅒㅓㅔㅕㅖㅗ ㅛㅜ ㅠㅡ ㅣ";
// Korean(Hangul) vowel Combination key
@@ -118,6 +122,20 @@ static const wchar_t oskKeys[OSK_KEYBOARD_COUNT][5][14] =
{L"ФЫВАПРОЛДЖЭЁ"},
{L"ЯЧСМИТЬБЮ/?|"},
},
{
// Latin Full-width Lowercase
{ L"1234567890-+" },
{ L"qwertyuiop[]" },
{ L"asdfghjkl;@~" },
{ L"zxcvbnm,./?¥¥" },
},
{
// Latin Full-width Uppercase
{ L"!@#$%^&*()_+" },
{ L"QWERTYUIOP{}" },
{ L"ASDFGHJKL:¥”‘" },
{ L"ZXCVBNM<>/?|" },
},
};
@@ -242,6 +260,7 @@ int PSPOskDialog::Init(u32 oskPtr)
status = SCE_UTILITY_STATUS_INITIALIZE;
selectedChar = 0;
currentKeyboard = OSK_KEYBOARD_LATIN_LOWERCASE;
currentKeyboardLanguage = OSK_LANGUAGE_ENGLISH;
ConvertUCS2ToUTF8(oskDesc, oskParams->fields[0].desc);
ConvertUCS2ToUTF8(oskIntext, oskParams->fields[0].intext);
@@ -258,6 +277,8 @@ int PSPOskDialog::Init(u32 oskPtr)
inputChars += c;
}
languageMapping = GetLangValuesMapping();
// Eat any keys pressed before the dialog inited.
__CtrlReadLatch();
@@ -588,7 +609,7 @@ std::wstring PSPOskDialog::CombinationString(bool isInput)
string += inputChars[i];
}
if (string.size() < FieldMaxLength())
if (string.size() <= FieldMaxLength())
{
string += oskKeys[currentKeyboard][selectedRow][selectedCol];
}
@@ -671,7 +692,7 @@ int PSPOskDialog::GetIndex(const wchar_t* src, wchar_t ch)
u32 PSPOskDialog::FieldMaxLength()
{
if (oskParams->fields[0].outtextlimit > oskParams->fields[0].outtextlength - 1 || oskParams->fields[0].outtextlimit == 0)
if ((oskParams->fields[0].outtextlimit > oskParams->fields[0].outtextlength - 1) || oskParams->fields[0].outtextlimit == 0)
return oskParams->fields[0].outtextlength - 1;
return oskParams->fields[0].outtextlimit;
}
@@ -838,8 +859,6 @@ int PSPOskDialog::Update()
return NativeKeyboard();
#endif
u32 limit = FieldMaxLength();
if (status == SCE_UTILITY_STATUS_INITIALIZE)
{
status = SCE_UTILITY_STATUS_RUNNING;
@@ -853,25 +872,53 @@ int PSPOskDialog::Update()
RenderKeyboard();
if (g_Config.iButtonPreference != PSP_SYSTEMPARAM_BUTTON_CIRCLE)
{
PPGeDrawImage(I_CROSS, 30, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
PPGeDrawImage(I_CIRCLE, 150, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
PPGeDrawImage(I_CROSS, 85, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
PPGeDrawImage(I_CIRCLE, 85, 245, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
}
else
{
PPGeDrawImage(I_CIRCLE, 30, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
PPGeDrawImage(I_CROSS, 150, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
PPGeDrawImage(I_CIRCLE, 85, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
PPGeDrawImage(I_CROSS, 85, 245, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
}
//PPGeDrawImage(I_BUTTON, 230, 220, 50, 20, 0, CalcFadedColor(0xFFFFFFFF));
//PPGeDrawImage(I_BUTTON, 350, 220, 55, 20, 0, CalcFadedColor(0xFFFFFFFF));
I18NCategory *d = GetI18NCategory("Dialog");
PPGeDrawText(d->T("Select"), 60, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(d->T("Delete"), 180, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText("Start", 245, 220, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(d->T("Finish"), 290, 222, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText("Select", 365, 220, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
// TODO: Show title of next keyboard?
PPGeDrawText(d->T("Shift"), 415, 222, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(d->T("Select"), 115, 222, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(d->T("Delete"), 115, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText("Start", 195, 220, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(d->T("Finish"), 235, 222, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
int index = (currentKeyboardLanguage - 1) % OSK_LANGUAGE_COUNT;
const char *countryCode;
if (index >= 0)
countryCode = OskKeyboardNames[(currentKeyboardLanguage - 1) % OSK_LANGUAGE_COUNT].c_str();
else
countryCode = OskKeyboardNames[OSK_LANGUAGE_COUNT - 1].c_str();
const char *language = languageMapping[countryCode].first.c_str();
if (!strcmp(countryCode, "English Full-width"))
language = "English Full-width";
if (strcmp(countryCode, "ko_KR"))
{
PPGeDrawText("Select", 195, 245, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(d->T("Shift"), 240, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
}
PPGeDrawText("L", 300, 220, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(language, 315, 222, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
countryCode = OskKeyboardNames[(currentKeyboardLanguage + 1) % OSK_LANGUAGE_COUNT].c_str();
language = languageMapping[countryCode].first.c_str();
if (!strcmp(countryCode, "English Full-width"))
language = "English Full-width";
PPGeDrawText("R", 300, 245, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(language, 315, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
if (IsButtonPressed(CTRL_UP))
{
@@ -902,8 +949,11 @@ int PSPOskDialog::Update()
}
else if (IsButtonPressed(CTRL_SELECT))
{
// TODO: Limit by allowed keyboards...
currentKeyboard = (OskKeyboardDisplay)((currentKeyboard + 1) % OSK_KEYBOARD_COUNT);
// Select now swaps case.
if (currentKeyboard == OskKeyboardCases[currentKeyboardLanguage][UPPERCASE])
currentKeyboard = OskKeyboardCases[currentKeyboardLanguage][LOWERCASE];
else
currentKeyboard = OskKeyboardCases[currentKeyboardLanguage][UPPERCASE];
if(selectedRow >= numKeyRows[currentKeyboard])
{
@@ -917,6 +967,46 @@ int PSPOskDialog::Update()
selectedChar = selectedRow * numKeyCols[currentKeyboard] + selectedExtra;
}
else if (IsButtonPressed(CTRL_RTRIGGER))
{
// RTRIGGER now cycles languages forward.
currentKeyboardLanguage = (OskKeyboardLanguage)((currentKeyboardLanguage + 1) % OSK_LANGUAGE_COUNT);
currentKeyboard = OskKeyboardCases[currentKeyboardLanguage][LOWERCASE];
if (selectedRow >= numKeyRows[currentKeyboard])
{
selectedRow = numKeyRows[currentKeyboard] - 1;
}
if (selectedExtra >= numKeyCols[currentKeyboard])
{
selectedExtra = numKeyCols[currentKeyboard] - 1;
}
selectedChar = selectedRow * numKeyCols[currentKeyboard] + selectedExtra;
}
else if (IsButtonPressed(CTRL_LTRIGGER))
{
// LTRIGGER now cycles languages backward.
if (currentKeyboardLanguage - 1 >= 0)
currentKeyboardLanguage = (OskKeyboardLanguage)((currentKeyboardLanguage - 1) % OSK_LANGUAGE_COUNT);
else
currentKeyboardLanguage = (OskKeyboardLanguage)(OSK_LANGUAGE_COUNT - 1);
currentKeyboard = OskKeyboardCases[currentKeyboardLanguage][LOWERCASE];
if (selectedRow >= numKeyRows[currentKeyboard])
{
selectedRow = numKeyRows[currentKeyboard] - 1;
}
if (selectedExtra >= numKeyCols[currentKeyboard])
{
selectedExtra = numKeyCols[currentKeyboard] - 1;
}
selectedChar = selectedRow * numKeyCols[currentKeyboard] + selectedExtra;
}
else if (IsButtonPressed(g_Config.iButtonPreference != PSP_SYSTEMPARAM_BUTTON_CIRCLE ? CTRL_CIRCLE : CTRL_CROSS))
{
if (inputChars.size() > 0)
+38
View File
@@ -158,10 +158,47 @@ enum OskKeyboardDisplay
OSK_KEYBOARD_KOREAN,
OSK_KEYBOARD_RUSSIAN_LOWERCASE,
OSK_KEYBOARD_RUSSIAN_UPPERCASE,
OSK_KEYBOARD_LATIN_FW_LOWERCASE,
OSK_KEYBOARD_LATIN_FW_UPPERCASE,
// TODO: Something to do native?
OSK_KEYBOARD_COUNT
};
// Internal enum, not from PSP.
enum OskKeyboardLanguage
{
OSK_LANGUAGE_ENGLISH, //English half-width
OSK_LANGUAGE_JAPANESE,
OSK_LANGUAGE_KOREAN,
OSK_LANGUAGE_RUSSIAN,
OSK_LANGUAGE_ENGLISH_FW, //English full-width(mostly used in Japanese games)
OSK_LANGUAGE_COUNT
};
// Internal enum, not from PSP.
enum
{
LOWERCASE,
UPPERCASE
};
const OskKeyboardDisplay OskKeyboardCases[OSK_LANGUAGE_COUNT][2] =
{
{ OSK_KEYBOARD_LATIN_LOWERCASE, OSK_KEYBOARD_LATIN_UPPERCASE },
{ OSK_KEYBOARD_HIRAGANA, OSK_KEYBOARD_KATAKANA },
{ OSK_KEYBOARD_KOREAN, OSK_KEYBOARD_KOREAN }, // Korean only has one case, so just repeat it.
{ OSK_KEYBOARD_RUSSIAN_LOWERCASE, OSK_KEYBOARD_RUSSIAN_UPPERCASE },
{ OSK_KEYBOARD_LATIN_FW_LOWERCASE, OSK_KEYBOARD_LATIN_FW_UPPERCASE }
};
static const std::string OskKeyboardNames[] =
{
"en_US",
"ja_JP",
"ko_KR",
"ru_RU",
"English Full-width",
};
class PSPOskDialog: public PSPDialog {
public:
@@ -197,6 +234,7 @@ private:
int selectedChar;
std::wstring inputChars;
OskKeyboardDisplay currentKeyboard;
OskKeyboardLanguage currentKeyboardLanguage;
bool isCombinated;
int i_level; // for Korean Keyboard support
+7 -1
View File
@@ -40,9 +40,15 @@ u32 sceDmacMemcpy(u32 dst, u32 src, u32 size) {
return 0;
}
u32 sceDmacTryMemcpy(u32 x, u32 y , u32 z)
{
ERROR_LOG_REPORT(HLE,"UNIMPL sceDmacTryMemcpy(%08x, %08x, %i)", x ,y ,z);
return 0;
}
const HLEFunction sceDmac[] = {
{0x617f3fe6, &WrapU_UUU<sceDmacMemcpy>, "sceDmacMemcpy"},
{0xd97f94d8, 0, "sceDmacTryMemcpy"},
{0xd97f94d8, &WrapU_UUU<sceDmacTryMemcpy>, "sceDmacTryMemcpy"},
};
void Register_sceDmac() {
+5
View File
@@ -428,6 +428,10 @@ void __IoManagerThread() {
}
}
void __IoWakeManager() {
ioManager.FinishEventLoop();
}
void __IoInit() {
INFO_LOG(SCEIO, "Starting up I/O...");
@@ -458,6 +462,7 @@ void __IoInit() {
ioManagerThreadEnabled = g_Config.bSeparateIOThread;
ioManager.SetThreadEnabled(ioManagerThreadEnabled);
if (ioManagerThreadEnabled) {
Core_ListenShutdown(&__IoWakeManager);
ioManagerThread = new std::thread(&__IoManagerThread);
}
+42 -6
View File
@@ -48,7 +48,7 @@ static const int MP3_BITRATES[] = {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160,
struct Mp3Context {
void DoState(PointerWrap &p) {
auto s = p.Section("Mp3Context", 1);
auto s = p.Section("Mp3Context", 1, 2);
if (!s)
return;
@@ -59,6 +59,10 @@ struct Mp3Context {
p.Do(mp3PcmBuf);
p.Do(mp3PcmBufSize);
p.Do(mp3DecodedBytes);
if (s >= 2)
p.Do(mp3SumDecodedSamples);
else
mp3SumDecodedSamples = 0;
p.Do(mp3LoopNum);
p.Do(mp3MaxSamples);
p.Do(mp3Bitrate);
@@ -84,6 +88,7 @@ struct Mp3Context {
int mp3DecodedBytes;
int mp3LoopNum;
int mp3MaxSamples;
int mp3SumDecodedSamples;
MediaEngine *mediaengine;
int mp3Channels;
@@ -206,6 +211,8 @@ int sceMp3Decode(u32 mp3, u32 outPcmPtr) {
fclose(file);
}
#endif
// 2 bytes per channel and we always two channels per mp3 so it is 2 * 2
ctx->mp3SumDecodedSamples += bytesdecoded / 2 * 2;
return bytesdecoded;
}
@@ -430,7 +437,14 @@ int sceMp3GetMaxOutputSample(u32 mp3)
int sceMp3GetSumDecodedSample(u32 mp3) {
ERROR_LOG_REPORT(ME, "UNIMPL sceMp3GetSumDecodedSample(%08X)", mp3);
return 0;
Mp3Context *ctx = getMp3Ctx(mp3);
if (!ctx) {
ERROR_LOG(ME, "%s: bad mp3 handle %08x", __FUNCTION__, mp3);
return -1;
}
return ctx->mp3SumDecodedSamples;
}
int sceMp3SetLoopNum(u32 mp3, int loop) {
@@ -578,6 +592,28 @@ u32 sceMp3GetVersion(u32 mp3) {
return ctx->mp3Version;
}
u32 sceMp3ResetPlayPosition2(u32 mp3, int position) {
DEBUG_LOG(ME, "sceMp3ResetPlayPosition2(%08x, %i)", mp3, position);
Mp3Context *ctx = getMp3Ctx(mp3);
if (!ctx) {
ERROR_LOG(ME, "%s: bad mp3 handle %08x", __FUNCTION__, mp3);
return -1;
}
ctx->readPosition = position;
return 0;
}
u32 sceMp3_1B839B83() {
ERROR_LOG_REPORT(ME, "UNIMPL sceMp3_1B839B83(...)");
return 0;
}
u32 sceMp3_E3EE2C81() {
ERROR_LOG_REPORT(ME, "UNIMPL sceMp3_E3EE2C81(...)");
return 0;
}
const HLEFunction sceMp3[] = {
{0x07EC321A,WrapU_U<sceMp3ReserveMp3Handle>,"sceMp3ReserveMp3Handle"},
{0x0DB149F4,WrapI_UI<sceMp3NotifyAddStreamData>,"sceMp3NotifyAddStreamData"},
@@ -598,11 +634,11 @@ const HLEFunction sceMp3[] = {
{0xD0A56296,WrapI_U<sceMp3CheckStreamDataNeeded>,"sceMp3CheckStreamDataNeeded"},
{0xD8F54A51,WrapI_U<sceMp3GetLoopNum>,"sceMp3GetLoopNum"},
{0xF5478233,WrapI_U<sceMp3ReleaseMp3Handle>,"sceMp3ReleaseMp3Handle"},
{0xAE6D2027,WrapU_U<sceMp3GetVersion>,"sceMp3GetVersion"}, // Name is wrong.
{0xAE6D2027,WrapU_U<sceMp3GetVersion>,"sceMp3GetVersion"}, // Incorrect function name
{0x3548AEC8,WrapU_U<sceMp3GetFrameNum>,"sceMp3GetFrameNum"},
{0x0840e808,0,"sceMp3_0840E808"},
{0x1b839b83,0,"sceMp3_1B839B83"},
{0xe3ee2c81,0,"sceMp3_E3EE2C81"},
{0x0840e808,WrapU_UI<sceMp3ResetPlayPosition2>,"sceMp3ResetPlayPosition2"}, // Incorrect function name
{0x1b839b83,WrapU_V<sceMp3_1B839B83>,"sceMp3_1B839B83"},
{0xe3ee2c81,WrapU_V<sceMp3_E3EE2C81>,"sceMp3_E3EE2C81"}
};
void Register_sceMp3() {
+53 -7
View File
@@ -33,6 +33,8 @@
#include "../Dialog/PSPOskDialog.h"
#include "../Dialog/PSPGamedataInstallDialog.h"
#include "../native/file/ini_file.h"
const int SCE_ERROR_MODULE_BAD_ID = 0x80111101;
const int SCE_ERROR_MODULE_ALREADY_LOADED = 0x80111102;
const int SCE_ERROR_MODULE_NOT_LOADED = 0x80111103;
@@ -452,9 +454,10 @@ int sceUtilityGamedataInstallInitStart(u32 paramsAddr)
WARN_LOG(SCEUTILITY, "sceUtilityGamedataInstallInitStart(%08x): wrong dialog type", paramsAddr);
return SCE_ERROR_UTILITY_WRONG_TYPE;
}
DEBUG_LOG(SCEUTILITY, "sceUtilityGamedataInstallInitStart(%08x)", paramsAddr);
currentDialogType = UTILITY_DIALOG_GAMEDATAINSTALL;
currentDialogActive = true;
currentDialogActive = true;
DEBUG_LOG(SCEUTILITY, "sceUtilityGamedataInstallInitStart(%08x)", paramsAddr);
return gamedataInstallDialog.Init(paramsAddr);
}
@@ -470,11 +473,15 @@ int sceUtilityGamedataInstallShutdownStart() {
return gamedataInstallDialog.Shutdown();
}
int sceUtilityGamedataInstallUpdate(int speed) {
ERROR_LOG(SCEUTILITY, "UNIMPL sceUtilityGamedataInstallUpdate(%08x)", speed);
currentDialogActive = false;
gamedataInstallDialog.Abort();
return 0;
int sceUtilityGamedataInstallUpdate(int Speed) {
if (currentDialogType != UTILITY_DIALOG_GAMEDATAINSTALL)
{
WARN_LOG(SCEUTILITY, "sceUtilityGamedataInstallUpdate(): wrong dialog type");
return SCE_ERROR_UTILITY_WRONG_TYPE;
}
DEBUG_LOG(SCEUTILITY, "sceUtilityGamedataInstallUpdate(%i)", Speed);
return gamedataInstallDialog.Update();
}
int sceUtilityGamedataInstallGetStatus()
@@ -812,3 +819,42 @@ void Register_sceUtility()
{
RegisterModule("sceUtility", ARRAY_SIZE(sceUtility), sceUtility);
}
std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping() {
std::map<std::string, std::pair<std::string, int>> langValuesMapping;
IniFile mapping;
mapping.LoadFromVFS("langregion.ini");
std::vector<std::string> keys;
mapping.GetKeys("LangRegionNames", keys);
std::map<std::string, int> langCodeMapping;
langCodeMapping["JAPANESE"] = PSP_SYSTEMPARAM_LANGUAGE_JAPANESE;
langCodeMapping["ENGLISH"] = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
langCodeMapping["FRENCH"] = PSP_SYSTEMPARAM_LANGUAGE_FRENCH;
langCodeMapping["SPANISH"] = PSP_SYSTEMPARAM_LANGUAGE_SPANISH;
langCodeMapping["GERMAN"] = PSP_SYSTEMPARAM_LANGUAGE_GERMAN;
langCodeMapping["ITALIAN"] = PSP_SYSTEMPARAM_LANGUAGE_ITALIAN;
langCodeMapping["DUTCH"] = PSP_SYSTEMPARAM_LANGUAGE_DUTCH;
langCodeMapping["PORTUGUESE"] = PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE;
langCodeMapping["RUSSIAN"] = PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN;
langCodeMapping["KOREAN"] = PSP_SYSTEMPARAM_LANGUAGE_KOREAN;
langCodeMapping["CHINESE_TRADITIONAL"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL;
langCodeMapping["CHINESE_SIMPLIFIED"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED;
IniFile::Section *langRegionNames = mapping.GetOrCreateSection("LangRegionNames");
IniFile::Section *systemLanguage = mapping.GetOrCreateSection("SystemLanguage");
for (size_t i = 0; i < keys.size(); i++) {
std::string langName;
langRegionNames->Get(keys[i].c_str(), &langName, "ERROR");
std::string langCode;
systemLanguage->Get(keys[i].c_str(), &langCode, "ENGLISH");
int iLangCode = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
if (langCodeMapping.find(langCode) != langCodeMapping.end())
iLangCode = langCodeMapping[langCode];
langValuesMapping[keys[i]] = std::make_pair(langName, iLangCode);
}
return langValuesMapping;
}
+1
View File
@@ -81,3 +81,4 @@ void __UtilityDoState(PointerWrap &p);
void __UtilityShutdown();
void Register_sceUtility();
std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping();
+9 -1
View File
@@ -124,7 +124,7 @@ bool CPU_HasPendingAction() {
void CPU_WaitStatus(bool (*pred)()) {
cpuThreadLock.lock();
while (!pred())
cpuThreadCond.wait_for(cpuThreadLock, 16);
cpuThreadCond.wait(cpuThreadLock);
cpuThreadLock.unlock();
}
@@ -255,6 +255,12 @@ void Core_UpdateState(CoreState newState) {
Core_UpdateSingleStep();
}
void System_Wake() {
if (gpu) {
gpu->FinishEventLoop();
}
}
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
INFO_LOG(BOOT, "PPSSPP %s", PPSSPP_GIT_VERSION);
@@ -262,6 +268,7 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) {
coreParameter.errorString = "";
if (g_Config.bSeparateCPUThread) {
Core_ListenShutdown(System_Wake);
CPU_SetState(CPU_THREAD_PENDING);
cpuThread = new std::thread(&CPU_RunLoop);
CPU_WaitStatus(&CPU_IsReady);
@@ -288,6 +295,7 @@ bool PSP_IsInited() {
void PSP_Shutdown() {
if (coreState == CORE_RUNNING)
Core_UpdateState(CORE_ERROR);
Core_NotifyShutdown();
if (cpuThread != NULL) {
CPU_SetState(CPU_THREAD_SHUTDOWN);
CPU_WaitStatus(&CPU_IsShutdown);
+1 -1
View File
@@ -81,7 +81,7 @@ struct ThreadEventQueue : public B {
}
// coreState changes won't wake us, so recheck periodically.
eventsWait_.wait_for(eventsWaitLock_, 1);
eventsWait_.wait(eventsWaitLock_);
} while (CoreTiming::GetTicks() < globalticks);
}
+6 -1
View File
@@ -153,8 +153,13 @@ public:
return false;
}
// Similar to GetCurrentFramebuffer().
virtual bool GetCurrentTexture(GPUDebugBuffer &buffer) {
return false;
}
// TODO:
// cached framebuffers / textures / vertices?
// get content of framebuffer / texture
// get content of specific framebuffer / texture?
// vertex / texture decoding?
};
+103 -1
View File
@@ -17,4 +17,106 @@
#include "GPU/Common/TextureDecoder.h"
// TODO: Move some common things into here.
// TODO: Move some common things into here.
static inline u32 makecol(int r, int g, int b, int a) {
return (a << 24) | (r << 16) | (g << 8) | b;
}
// This could probably be done faster by decoding two or four blocks at a time with SSE/NEON.
void DecodeDXT1Block(u32 *dst, const DXT1Block *src, int pitch, bool ignore1bitAlpha) {
// S3TC Decoder
// Needs more speed and debugging.
u16 c1 = (src->color1);
u16 c2 = (src->color2);
int red1 = Convert5To8(c1 & 0x1F);
int red2 = Convert5To8(c2 & 0x1F);
int green1 = Convert6To8((c1 >> 5) & 0x3F);
int green2 = Convert6To8((c2 >> 5) & 0x3F);
int blue1 = Convert5To8((c1 >> 11) & 0x1F);
int blue2 = Convert5To8((c2 >> 11) & 0x1F);
u32 colors[4];
colors[0] = makecol(red1, green1, blue1, 255);
colors[1] = makecol(red2, green2, blue2, 255);
if (c1 > c2 || ignore1bitAlpha) {
int blue3 = ((blue2 - blue1) >> 1) - ((blue2 - blue1) >> 3);
int green3 = ((green2 - green1) >> 1) - ((green2 - green1) >> 3);
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
colors[2] = makecol(red1 + red3, green1 + green3, blue1 + blue3, 255);
colors[3] = makecol(red2 - red3, green2 - green3, blue2 - blue3, 255);
} else {
colors[2] = makecol((red1 + red2 + 1) / 2, // Average
(green1 + green2 + 1) / 2,
(blue1 + blue2 + 1) / 2, 255);
colors[3] = makecol(red2, green2, blue2, 0); // Color2 but transparent
}
for (int y = 0; y < 4; y++) {
int val = src->lines[y];
for (int x = 0; x < 4; x++) {
dst[x] = colors[val & 3];
val >>= 2;
}
dst += pitch;
}
}
void DecodeDXT3Block(u32 *dst, const DXT3Block *src, int pitch)
{
DecodeDXT1Block(dst, &src->color, pitch, true);
for (int y = 0; y < 4; y++) {
u32 line = src->alphaLines[y];
for (int x = 0; x < 4; x++) {
const u8 a4 = line & 0xF;
dst[x] = (dst[x] & 0xFFFFFF) | (a4 << 24) | (a4 << 28);
line >>= 4;
}
dst += pitch;
}
}
static inline u8 lerp8(const DXT5Block *src, int n) {
float d = n / 7.0f;
return (u8)(src->alpha1 + (src->alpha2 - src->alpha1) * d);
}
static inline u8 lerp6(const DXT5Block *src, int n) {
float d = n / 5.0f;
return (u8)(src->alpha1 + (src->alpha2 - src->alpha1) * d);
}
// The alpha channel is not 100% correct
void DecodeDXT5Block(u32 *dst, const DXT5Block *src, int pitch) {
DecodeDXT1Block(dst, &src->color, pitch, true);
u8 alpha[8];
alpha[0] = src->alpha1;
alpha[1] = src->alpha2;
if (alpha[0] > alpha[1]) {
alpha[2] = lerp8(src, 1);
alpha[3] = lerp8(src, 2);
alpha[4] = lerp8(src, 3);
alpha[5] = lerp8(src, 4);
alpha[6] = lerp8(src, 5);
alpha[7] = lerp8(src, 6);
} else {
alpha[2] = lerp6(src, 1);
alpha[3] = lerp6(src, 2);
alpha[4] = lerp6(src, 3);
alpha[5] = lerp6(src, 4);
alpha[6] = 0;
alpha[7] = 255;
}
u64 data = ((u64)(u16)src->alphadata1 << 32) | (u32)src->alphadata2;
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
dst[x] = (dst[x] & 0xFFFFFF) | (alpha[data & 7] << 24);
data >>= 3;
}
dst += pitch;
}
}
+107
View File
@@ -17,10 +17,36 @@
#pragma once
#include "Common/Common.h"
#include "Core/MemMap.h"
#include "GPU/ge_constants.h"
#include "GPU/GPUState.h"
// All these DXT structs are in the reverse order, as compared to PC.
// On PC, alpha comes before color, and interpolants are before the tile data.
struct DXT1Block {
u8 lines[4];
u16_le color1;
u16_le color2;
};
struct DXT3Block {
DXT1Block color;
u16_le alphaLines[4];
};
struct DXT5Block {
DXT1Block color;
u32_le alphadata2;
u16_le alphadata1;
u8 alpha1; u8 alpha2;
};
void DecodeDXT1Block(u32 *dst, const DXT1Block *src, int pitch, bool ignore1bitAlpha = false);
void DecodeDXT3Block(u32 *dst, const DXT3Block *src, int pitch);
void DecodeDXT5Block(u32 *dst, const DXT5Block *src, int pitch);
static const u8 textureBitsPerPixel[16] = {
16, //GE_TFMT_5650,
16, //GE_TFMT_5551,
@@ -72,3 +98,84 @@ static inline u32 GetTextureBufw(int level, u32 texaddr, GETextureFormat format)
}
return bufw;
}
template <typename IndexT, typename ClutT>
inline void DeIndexTexture(ClutT *dest, const IndexT *indexed, int length, const ClutT *clut) {
// Usually, there is no special offset, mask, or shift.
const bool nakedIndex = gstate.isClutIndexSimple();
if (nakedIndex) {
if (sizeof(IndexT) == 1) {
for (int i = 0; i < length; ++i) {
*dest++ = clut[*indexed++];
}
} else {
for (int i = 0; i < length; ++i) {
*dest++ = clut[(*indexed++) & 0xFF];
}
}
} else {
for (int i = 0; i < length; ++i) {
*dest++ = clut[gstate.transformClutIndex(*indexed++)];
}
}
}
template <typename IndexT, typename ClutT>
inline void DeIndexTexture(ClutT *dest, const u32 texaddr, int length, const ClutT *clut) {
const IndexT *indexed = (const IndexT *) Memory::GetPointer(texaddr);
DeIndexTexture(dest, indexed, length, clut);
}
template <typename ClutT>
inline void DeIndexTexture4(ClutT *dest, const u8 *indexed, int length, const ClutT *clut) {
// Usually, there is no special offset, mask, or shift.
const bool nakedIndex = gstate.isClutIndexSimple();
if (nakedIndex) {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = clut[(index >> 0) & 0xf];
dest[i + 1] = clut[(index >> 4) & 0xf];
}
} else {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = clut[gstate.transformClutIndex((index >> 0) & 0xf)];
dest[i + 1] = clut[gstate.transformClutIndex((index >> 4) & 0xf)];
}
}
}
template <typename ClutT>
inline void DeIndexTexture4Optimal(ClutT *dest, const u8 *indexed, int length, ClutT color) {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = color | ((index >> 0) & 0xf);
dest[i + 1] = color | ((index >> 4) & 0xf);
}
}
template <>
inline void DeIndexTexture4Optimal<u16>(u16 *dest, const u8 *indexed, int length, u16 color) {
const u16_le *indexed16 = (const u16_le *)indexed;
const u32 color32 = (color << 16) | color;
u32 *dest32 = (u32 *)dest;
for (int i = 0; i < length / 2; i += 2) {
u16 index = *indexed16++;
dest32[i + 0] = color32 | ((index & 0x00f0) << 12) | ((index & 0x000f) >> 0);
dest32[i + 1] = color32 | ((index & 0xf000) << 4) | ((index & 0x0f00) >> 8);
}
}
template <typename ClutT>
inline void DeIndexTexture4(ClutT *dest, const u32 texaddr, int length, const ClutT *clut) {
const u8 *indexed = (const u8 *) Memory::GetPointer(texaddr);
DeIndexTexture4(dest, indexed, length, clut);
}
template <typename ClutT>
inline void DeIndexTexture4Optimal(ClutT *dest, const u32 texaddr, int length, ClutT color) {
const u8 *indexed = (const u8 *) Memory::GetPointer(texaddr);
DeIndexTexture4Optimal(dest, indexed, length, color);
}
+3 -209
View File
@@ -324,87 +324,6 @@ void *TextureCacheDX9::UnswizzleFromMem(u32 texaddr, u32 bufw, u32 bytesPerPixel
return tmpTexBuf32.data();
}
template <typename IndexT, typename ClutT>
inline void DeIndexTexture(ClutT *dest, const IndexT *indexed, int length, const ClutT *clut) {
// Usually, there is no special offset, mask, or shift.
const bool nakedIndex = gstate.isClutIndexSimple();
if (nakedIndex) {
if (sizeof(IndexT) == 1) {
for (int i = 0; i < length; ++i) {
*dest++ = clut[*indexed++];
}
} else {
for (int i = 0; i < length; ++i) {
*dest++ = clut[(*indexed++) & 0xFF];
}
}
} else {
for (int i = 0; i < length; ++i) {
*dest++ = clut[gstate.transformClutIndex(*indexed++)];
}
}
}
template <typename IndexT, typename ClutT>
inline void DeIndexTexture(ClutT *dest, const u32 texaddr, int length, const ClutT *clut) {
const IndexT *indexed = (const IndexT *) Memory::GetPointer(texaddr);
DeIndexTexture(dest, indexed, length, clut);
}
template <typename ClutT>
inline void DeIndexTexture4(ClutT *dest, const u8 *indexed, int length, const ClutT *clut) {
// Usually, there is no special offset, mask, or shift.
const bool nakedIndex = gstate.isClutIndexSimple();
if (nakedIndex) {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = clut[(index >> 0) & 0xf];
dest[i + 1] = clut[(index >> 4) & 0xf];
}
} else {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = clut[gstate.transformClutIndex((index >> 0) & 0xf)];
dest[i + 1] = clut[gstate.transformClutIndex((index >> 4) & 0xf)];
}
}
}
template <typename ClutT>
inline void DeIndexTexture4Optimal(ClutT *dest, const u8 *indexed, int length, ClutT color) {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = color | ((index >> 0) & 0xf);
dest[i + 1] = color | ((index >> 4) & 0xf);
}
}
template <>
inline void DeIndexTexture4Optimal<u16>(u16 *dest, const u8 *indexed, int length, u16 color) {
const u16_le *indexed16 = (const u16_le *)indexed;
const u32 color32 = (color << 16) | color;
u32 *dest32 = (u32 *)dest;
for (int i = 0; i < length / 2; i += 2) {
u16 index = *indexed16++;
dest32[i + 0] = color32 | ((index & 0x00f0) << 12) | ((index & 0x000f) >> 0);
dest32[i + 1] = color32 | ((index & 0xf000) << 4) | ((index & 0x0f00) >> 8);
}
}
template <typename ClutT>
inline void DeIndexTexture4(ClutT *dest, const u32 texaddr, int length, const ClutT *clut) {
const u8 *indexed = (const u8 *) Memory::GetPointer(texaddr);
DeIndexTexture4(dest, indexed, length, clut);
}
template <typename ClutT>
inline void DeIndexTexture4Optimal(ClutT *dest, const u32 texaddr, int length, ClutT color) {
const u8 *indexed = (const u8 *) Memory::GetPointer(texaddr);
DeIndexTexture4Optimal(dest, indexed, length, color);
}
void *TextureCacheDX9::ReadIndexedTex(int level, u32 texaddr, int bytesPerIndex, u32 dstFmt, int bufw) {
int w = gstate.getTextureWidth(level);
int h = gstate.getTextureHeight(level);
@@ -613,131 +532,6 @@ void TextureCacheDX9::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
#endif
}
// All these DXT structs are in the reverse order, as compared to PC.
// On PC, alpha comes before color, and interpolants are before the tile data.
struct DXT1Block {
u8 lines[4];
u16_le color1;
u16_le color2;
};
struct DXT3Block {
DXT1Block color;
u16_le alphaLines[4];
};
struct DXT5Block {
DXT1Block color;
u32_le alphadata2;
u16_le alphadata1;
u8 alpha1; u8 alpha2;
};
static inline u32 makecol(int r, int g, int b, int a) {
return (a << 24) | (b << 16) | (g << 8) | r;
}
// This could probably be done faster by decoding two or four blocks at a time with SSE/NEON.
static void decodeDXT1Block(u32 *dst, const DXT1Block *src, int pitch, bool ignore1bitAlpha = false) {
// S3TC Decoder
// Needs more speed and debugging.
u16 c1 = (src->color1);
u16 c2 = (src->color2);
int red1 = Convert5To8(c1 & 0x1F);
int red2 = Convert5To8(c2 & 0x1F);
int green1 = Convert6To8((c1 >> 5) & 0x3F);
int green2 = Convert6To8((c2 >> 5) & 0x3F);
int blue1 = Convert5To8((c1 >> 11) & 0x1F);
int blue2 = Convert5To8((c2 >> 11) & 0x1F);
u32 colors[4];
colors[0] = makecol(red1, green1, blue1, 255);
colors[1] = makecol(red2, green2, blue2, 255);
if (c1 > c2 || ignore1bitAlpha) {
int blue3 = ((blue2 - blue1) >> 1) - ((blue2 - blue1) >> 3);
int green3 = ((green2 - green1) >> 1) - ((green2 - green1) >> 3);
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
colors[2] = makecol(red1 + red3, green1 + green3, blue1 + blue3, 255);
colors[3] = makecol(red2 - red3, green2 - green3, blue2 - blue3, 255);
} else {
colors[2] = makecol((red1 + red2 + 1) / 2, // Average
(green1 + green2 + 1) / 2,
(blue1 + blue2 + 1) / 2, 255);
colors[3] = makecol(red2, green2, blue2, 0); // Color2 but transparent
}
for (int y = 0; y < 4; y++) {
int val = src->lines[y];
for (int x = 0; x < 4; x++) {
dst[x] = colors[val & 3];
val >>= 2;
}
dst += pitch;
}
}
static void decodeDXT3Block(u32 *dst, const DXT3Block *src, int pitch)
{
decodeDXT1Block(dst, &src->color, pitch, true);
for (int y = 0; y < 4; y++) {
u32 line = src->alphaLines[y];
for (int x = 0; x < 4; x++) {
const u8 a4 = line & 0xF;
dst[x] = (dst[x] & 0xFFFFFF) | (a4 << 24) | (a4 << 28);
line >>= 4;
}
dst += pitch;
}
}
static inline u8 lerp8(const DXT5Block *src, int n) {
float d = n / 7.0f;
return (u8)(src->alpha1 + (src->alpha2 - src->alpha1) * d);
}
static inline u8 lerp6(const DXT5Block *src, int n) {
float d = n / 5.0f;
return (u8)(src->alpha1 + (src->alpha2 - src->alpha1) * d);
}
// The alpha channel is not 100% correct
static void decodeDXT5Block(u32 *dst, const DXT5Block *src, int pitch) {
decodeDXT1Block(dst, &src->color, pitch, true);
u8 alpha[8];
alpha[0] = src->alpha1;
alpha[1] = src->alpha2;
if (alpha[0] > alpha[1]) {
alpha[2] = lerp8(src, 1);
alpha[3] = lerp8(src, 2);
alpha[4] = lerp8(src, 3);
alpha[5] = lerp8(src, 4);
alpha[6] = lerp8(src, 5);
alpha[7] = lerp8(src, 6);
} else {
alpha[2] = lerp6(src, 1);
alpha[3] = lerp6(src, 2);
alpha[4] = lerp6(src, 3);
alpha[5] = lerp6(src, 4);
alpha[6] = 0;
alpha[7] = 255;
}
u32 a1 = src->alphadata1;
u32 a2 = src->alphadata2;
u64 data = ((u64)a1 << 32) | a2;
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
dst[x] = (dst[x] & 0xFFFFFF) | (alpha[data & 7] << 24);
data >>= 3;
}
dst += pitch;
}
}
static inline u32 ABGR2RGBA(u32 src) {
#ifndef _XBOX
return ((src & 0xFF000000)) |
@@ -1432,7 +1226,7 @@ void *TextureCacheDX9::DecodeTextureLevel(GETextureFormat format, GEPaletteForma
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < minw; x += 4) {
decodeDXT1Block(dst + bufw * y + x, src + blockIndex, bufw);
DecodeDXT1Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
@@ -1453,7 +1247,7 @@ void *TextureCacheDX9::DecodeTextureLevel(GETextureFormat format, GEPaletteForma
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < minw; x += 4) {
decodeDXT3Block(dst + bufw * y + x, src + blockIndex, bufw);
DecodeDXT3Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
@@ -1474,7 +1268,7 @@ void *TextureCacheDX9::DecodeTextureLevel(GETextureFormat format, GEPaletteForma
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < minw; x += 4) {
decodeDXT5Block(dst + bufw * y + x, src + blockIndex, bufw);
DecodeDXT5Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
+2 -2
View File
@@ -251,7 +251,7 @@ void GenerateFragmentShader(char *buffer) {
if (enableAlphaTest) {
if (gstate_c.gpuVendor == GPU_VENDOR_POWERVR)
WRITE(p, "float roundTo255th(in mediump float x) { mediump float y = x + (0.5/255.0); return y - fract(y * 255.0) * (1.0 / 255.0); }\n");
WRITE(p, "float roundTo255thf(in mediump float x) { mediump 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");
}
@@ -329,7 +329,7 @@ void GenerateFragmentShader(char *buffer) {
if (gstate_c.gpuVendor == GPU_VENDOR_POWERVR) {
// Work around bad PVR driver problem where equality check + discard just doesn't work.
if (alphaTestFunc != 3)
WRITE(p, " if (roundTo255th(v.a) %s u_alphacolorref.a) discard;\n", alphaTestFuncs[alphaTestFunc]);
WRITE(p, " if (roundTo255thf(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]);
}
+29 -11
View File
@@ -155,15 +155,33 @@ void DisableState() {
}
void FramebufferManager::CompileDraw2DProgram() {
if (!draw2dprogram) {
draw2dprogram = glsl_create_source(basic_vs, tex_fs);
if (!draw2dprogram_) {
if (g_Config.bFXAA) {
draw2dprogram_ = glsl_create("assets/shaders/fxaa.vsh", "assets/shaders/fxaa.fsh");
} else {
draw2dprogram_ = glsl_create_source(basic_vs, tex_fs);
}
glsl_bind(draw2dprogram_);
glUniform1i(draw2dprogram_->sampler0, 0);
float u_delta = 1.0f / PSP_CoreParameter().renderWidth;
float v_delta = 1.0f / PSP_CoreParameter().renderHeight;
if (g_Config.bFXAA) {
glUniform2f(glsl_uniform_loc(draw2dprogram_, "u_texcoordDelta"), u_delta, v_delta);
}
glsl_bind(draw2dprogram);
glUniform1i(draw2dprogram->sampler0, 0);
glsl_unbind();
}
}
void FramebufferManager::DestroyDraw2DProgram() {
if (draw2dprogram_) {
glsl_destroy(draw2dprogram_);
draw2dprogram_ = 0;
}
}
FramebufferManager::FramebufferManager() :
displayFramebufPtr_(0),
displayStride_(0),
@@ -176,7 +194,7 @@ FramebufferManager::FramebufferManager() :
drawPixelsTex_(0),
drawPixelsTexFormat_(GE_FORMAT_INVALID),
convBuf(0),
draw2dprogram(0)
draw2dprogram_(0)
#ifndef USING_GLES2
,
pixelBufObj_(0),
@@ -225,8 +243,8 @@ FramebufferManager::FramebufferManager() :
FramebufferManager::~FramebufferManager() {
if (drawPixelsTex_)
glDeleteTextures(1, &drawPixelsTex_);
if (draw2dprogram) {
glsl_destroy(draw2dprogram);
if (draw2dprogram_) {
glsl_destroy(draw2dprogram_);
}
#ifndef USING_GLES2
@@ -348,7 +366,7 @@ void FramebufferManager::DrawActiveTexture(float x, float y, float w, float h, b
if(!program) {
CompileDraw2DProgram();
program = draw2dprogram;
program = draw2dprogram_;
}
glsl_bind(program);
@@ -731,6 +749,7 @@ void FramebufferManager::CopyDisplayToOutput() {
if (resized_) {
ClearBuffer();
DestroyDraw2DProgram();
}
if (vfb->fbo) {
@@ -889,7 +908,7 @@ void FramebufferManager::BlitFramebuffer_(VirtualFramebuffer *src, VirtualFrameb
CompileDraw2DProgram();
DrawActiveTexture(x, y, w, h, flip, upscale, vscale, draw2dprogram);
DrawActiveTexture(x, y, w, h, flip, upscale, vscale, draw2dprogram_);
glBindTexture(GL_TEXTURE_2D, 0);
fbo_unbind();
@@ -1187,8 +1206,7 @@ void FramebufferManager::EndFrame() {
void FramebufferManager::DeviceLost() {
DestroyAllFBOs();
glsl_destroy(draw2dprogram);
draw2dprogram = 0;
DestroyDraw2DProgram();
resized_ = false;
}
+2 -2
View File
@@ -174,6 +174,7 @@ public:
private:
void CompileDraw2DProgram();
void DestroyDraw2DProgram();
u32 displayFramebufPtr_;
u32 displayStride_;
@@ -209,8 +210,7 @@ private:
GEBufferFormat drawPixelsTexFormat_;
u8 *convBuf;
GLSLProgram *draw2dprogram;
GLSLProgram *draw2dprogram_;
TextureCache *textureCache_;
ShaderManager *shaderManager_;
+23 -2
View File
@@ -1515,7 +1515,28 @@ void GLES_GPU::DoState(PointerWrap &p) {
framebufferManager_.DestroyAllFBOs();
}
bool GLES_GPU::GetCurrentFramebuffer(GPUDebugBuffer &buffer)
{
bool GLES_GPU::GetCurrentFramebuffer(GPUDebugBuffer &buffer) {
return framebufferManager_.GetCurrentFramebuffer(buffer);
}
bool GLES_GPU::GetCurrentTexture(GPUDebugBuffer &buffer) {
if (!gstate.isTextureMapEnabled()) {
return false;
}
#ifndef USING_GLES2
textureCache_.SetTexture(true);
int w = gstate.getTextureWidth(0);
int h = gstate.getTextureHeight(0);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
buffer.Allocate(w, h, GE_FORMAT_8888, false);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer.GetData());
return true;
#else
return false;
#endif
}
+1
View File
@@ -67,6 +67,7 @@ public:
std::vector<FramebufferInfo> GetFramebufferList();
bool GetCurrentFramebuffer(GPUDebugBuffer &buffer);
bool GetCurrentTexture(GPUDebugBuffer &buffer);
protected:
virtual void FastRunLoop(DisplayList &list);
+7 -7
View File
@@ -41,11 +41,11 @@ u32 TransformDrawEngine::NormalizeVertices(u8 *outPtr, u8 *bufPtr, const u8 *inP
SimpleVertex *sverts = (SimpleVertex *)outPtr;
u8 defaultColor[4] = {
gstate.getMaterialAmbientR(),
gstate.getMaterialAmbientG(),
gstate.getMaterialAmbientB(),
gstate.getMaterialAmbientA(),
const u8 defaultColor[4] = {
(u8)gstate.getMaterialAmbientR(),
(u8)gstate.getMaterialAmbientG(),
(u8)gstate.getMaterialAmbientB(),
(u8)gstate.getMaterialAmbientA(),
};
// Let's have two separate loops, one for non skinning and one for skinning.
@@ -706,7 +706,7 @@ void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int
int vertexSize = vdecoder->VertexSize();
if (vertexSize != sizeof(SimpleVertex)) {
ERROR_LOG(G3D, "Something went really wrong, vertex size: %i vs %i", vertexSize, sizeof(SimpleVertex));
ERROR_LOG(G3D, "Something went really wrong, vertex size: %i vs %i", vertexSize, (int)sizeof(SimpleVertex));
}
const DecVtxFormat& vtxfmt = vdecoder->GetDecVtxFmt();
@@ -770,7 +770,7 @@ void TransformDrawEngine::SubmitBezier(void* control_points, void* indices, int
int vertexSize = vdecoder->VertexSize();
if (vertexSize != sizeof(SimpleVertex)) {
ERROR_LOG(G3D, "Something went really wrong, vertex size: %i vs %i", vertexSize, sizeof(SimpleVertex));
ERROR_LOG(G3D, "Something went really wrong, vertex size: %i vs %i", vertexSize, (int)sizeof(SimpleVertex));
}
const DecVtxFormat& vtxfmt = vdecoder->GetDecVtxFmt();
+8 -208
View File
@@ -329,87 +329,6 @@ void *TextureCache::UnswizzleFromMem(u32 texaddr, u32 bufw, u32 bytesPerPixel, u
return tmpTexBuf32.data();
}
template <typename IndexT, typename ClutT>
inline void DeIndexTexture(ClutT *dest, const IndexT *indexed, int length, const ClutT *clut) {
// Usually, there is no special offset, mask, or shift.
const bool nakedIndex = gstate.isClutIndexSimple();
if (nakedIndex) {
if (sizeof(IndexT) == 1) {
for (int i = 0; i < length; ++i) {
*dest++ = clut[*indexed++];
}
} else {
for (int i = 0; i < length; ++i) {
*dest++ = clut[(*indexed++) & 0xFF];
}
}
} else {
for (int i = 0; i < length; ++i) {
*dest++ = clut[gstate.transformClutIndex(*indexed++)];
}
}
}
template <typename IndexT, typename ClutT>
inline void DeIndexTexture(ClutT *dest, const u32 texaddr, int length, const ClutT *clut) {
const IndexT *indexed = (const IndexT *) Memory::GetPointer(texaddr);
DeIndexTexture(dest, indexed, length, clut);
}
template <typename ClutT>
inline void DeIndexTexture4(ClutT *dest, const u8 *indexed, int length, const ClutT *clut) {
// Usually, there is no special offset, mask, or shift.
const bool nakedIndex = gstate.isClutIndexSimple();
if (nakedIndex) {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = clut[(index >> 0) & 0xf];
dest[i + 1] = clut[(index >> 4) & 0xf];
}
} else {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = clut[gstate.transformClutIndex((index >> 0) & 0xf)];
dest[i + 1] = clut[gstate.transformClutIndex((index >> 4) & 0xf)];
}
}
}
template <typename ClutT>
inline void DeIndexTexture4Optimal(ClutT *dest, const u8 *indexed, int length, ClutT color) {
for (int i = 0; i < length; i += 2) {
u8 index = *indexed++;
dest[i + 0] = color | ((index >> 0) & 0xf);
dest[i + 1] = color | ((index >> 4) & 0xf);
}
}
template <>
inline void DeIndexTexture4Optimal<u16>(u16 *dest, const u8 *indexed, int length, u16 color) {
const u16 *indexed16 = (const u16 *)indexed;
const u32 color32 = (color << 16) | color;
u32 *dest32 = (u32 *)dest;
for (int i = 0; i < length / 2; i += 2) {
u16 index = *indexed16++;
dest32[i + 0] = color32 | ((index & 0x00f0) << 12) | ((index & 0x000f) >> 0);
dest32[i + 1] = color32 | ((index & 0xf000) << 4) | ((index & 0x0f00) >> 8);
}
}
template <typename ClutT>
inline void DeIndexTexture4(ClutT *dest, const u32 texaddr, int length, const ClutT *clut) {
const u8 *indexed = (const u8 *) Memory::GetPointer(texaddr);
DeIndexTexture4(dest, indexed, length, clut);
}
template <typename ClutT>
inline void DeIndexTexture4Optimal(ClutT *dest, const u32 texaddr, int length, ClutT color) {
const u8 *indexed = (const u8 *) Memory::GetPointer(texaddr);
DeIndexTexture4Optimal(dest, indexed, length, color);
}
void *TextureCache::ReadIndexedTex(int level, u32 texaddr, int bytesPerIndex, GLuint dstFmt, int bufw) {
int w = gstate.getTextureWidth(level);
int h = gstate.getTextureHeight(level);
@@ -601,129 +520,6 @@ void TextureCache::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
}
}
// All these DXT structs are in the reverse order, as compared to PC.
// On PC, alpha comes before color, and interpolants are before the tile data.
struct DXT1Block {
u8 lines[4];
u16 color1;
u16 color2;
};
struct DXT3Block {
DXT1Block color;
u16 alphaLines[4];
};
struct DXT5Block {
DXT1Block color;
u32 alphadata2;
u16 alphadata1;
u8 alpha1; u8 alpha2;
};
static inline u32 makecol(int r, int g, int b, int a) {
return (a << 24) | (r << 16) | (g << 8) | b;
}
// This could probably be done faster by decoding two or four blocks at a time with SSE/NEON.
static void decodeDXT1Block(u32 *dst, const DXT1Block *src, int pitch, bool ignore1bitAlpha = false) {
// S3TC Decoder
// Needs more speed and debugging.
u16 c1 = (src->color1);
u16 c2 = (src->color2);
int red1 = Convert5To8(c1 & 0x1F);
int red2 = Convert5To8(c2 & 0x1F);
int green1 = Convert6To8((c1 >> 5) & 0x3F);
int green2 = Convert6To8((c2 >> 5) & 0x3F);
int blue1 = Convert5To8((c1 >> 11) & 0x1F);
int blue2 = Convert5To8((c2 >> 11) & 0x1F);
u32 colors[4];
colors[0] = makecol(red1, green1, blue1, 255);
colors[1] = makecol(red2, green2, blue2, 255);
if (c1 > c2 || ignore1bitAlpha) {
int blue3 = ((blue2 - blue1) >> 1) - ((blue2 - blue1) >> 3);
int green3 = ((green2 - green1) >> 1) - ((green2 - green1) >> 3);
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
colors[2] = makecol(red1 + red3, green1 + green3, blue1 + blue3, 255);
colors[3] = makecol(red2 - red3, green2 - green3, blue2 - blue3, 255);
} else {
colors[2] = makecol((red1 + red2 + 1) / 2, // Average
(green1 + green2 + 1) / 2,
(blue1 + blue2 + 1) / 2, 255);
colors[3] = makecol(red2, green2, blue2, 0); // Color2 but transparent
}
for (int y = 0; y < 4; y++) {
int val = src->lines[y];
for (int x = 0; x < 4; x++) {
dst[x] = colors[val & 3];
val >>= 2;
}
dst += pitch;
}
}
static void decodeDXT3Block(u32 *dst, const DXT3Block *src, int pitch)
{
decodeDXT1Block(dst, &src->color, pitch, true);
for (int y = 0; y < 4; y++) {
u32 line = src->alphaLines[y];
for (int x = 0; x < 4; x++) {
const u8 a4 = line & 0xF;
dst[x] = (dst[x] & 0xFFFFFF) | (a4 << 24) | (a4 << 28);
line >>= 4;
}
dst += pitch;
}
}
static inline u8 lerp8(const DXT5Block *src, int n) {
float d = n / 7.0f;
return (u8)(src->alpha1 + (src->alpha2 - src->alpha1) * d);
}
static inline u8 lerp6(const DXT5Block *src, int n) {
float d = n / 5.0f;
return (u8)(src->alpha1 + (src->alpha2 - src->alpha1) * d);
}
// The alpha channel is not 100% correct
static void decodeDXT5Block(u32 *dst, const DXT5Block *src, int pitch) {
decodeDXT1Block(dst, &src->color, pitch, true);
u8 alpha[8];
alpha[0] = src->alpha1;
alpha[1] = src->alpha2;
if (alpha[0] > alpha[1]) {
alpha[2] = lerp8(src, 1);
alpha[3] = lerp8(src, 2);
alpha[4] = lerp8(src, 3);
alpha[5] = lerp8(src, 4);
alpha[6] = lerp8(src, 5);
alpha[7] = lerp8(src, 6);
} else {
alpha[2] = lerp6(src, 1);
alpha[3] = lerp6(src, 2);
alpha[4] = lerp6(src, 3);
alpha[5] = lerp6(src, 4);
alpha[6] = 0;
alpha[7] = 255;
}
u64 data = ((u64)src->alphadata1 << 32) | src->alphadata2;
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 4; x++) {
dst[x] = (dst[x] & 0xFFFFFF) | (alpha[data & 7] << 24);
data >>= 3;
}
dst += pitch;
}
}
static void ConvertColors(void *dstBuf, const void *srcBuf, GLuint dstFmt, int numPixels) {
const u32 *src = (const u32 *)srcBuf;
u32 *dst = (u32 *)dstBuf;
@@ -984,7 +780,7 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry)
}
}
void TextureCache::SetTexture() {
void TextureCache::SetTexture(bool force) {
#ifdef DEBUG_TEXTURES
if (SetDebugTexture()) {
// A different texture was bound, let's rebind next time.
@@ -993,6 +789,10 @@ void TextureCache::SetTexture() {
}
#endif
if (force) {
lastBoundTexture = -1;
}
u32 texaddr = gstate.getTextureAddress(0);
if (!Memory::IsValidAddress(texaddr)) {
// Bind a null texture and return.
@@ -1418,7 +1218,7 @@ void *TextureCache::DecodeTextureLevel(GETextureFormat format, GEPaletteFormat c
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < minw; x += 4) {
decodeDXT1Block(dst + bufw * y + x, src + blockIndex, bufw);
DecodeDXT1Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
@@ -1439,7 +1239,7 @@ void *TextureCache::DecodeTextureLevel(GETextureFormat format, GEPaletteFormat c
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < minw; x += 4) {
decodeDXT3Block(dst + bufw * y + x, src + blockIndex, bufw);
DecodeDXT3Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
@@ -1460,7 +1260,7 @@ void *TextureCache::DecodeTextureLevel(GETextureFormat format, GEPaletteFormat c
for (int y = 0; y < h; y += 4) {
u32 blockIndex = (y / 4) * (bufw / 4);
for (int x = 0; x < minw; x += 4) {
decodeDXT5Block(dst + bufw * y + x, src + blockIndex, bufw);
DecodeDXT5Block(dst + bufw * y + x, src + blockIndex, bufw);
blockIndex++;
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ public:
TextureCache();
~TextureCache();
void SetTexture();
void SetTexture(bool force = false);
void Clear(bool delete_them);
void StartFrame();
+1 -1
View File
@@ -365,7 +365,7 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer) {
case GE_CMD_FRAMEBUFWIDTH:
{
sprintf(buffer, "FramebufWidth: %i", data);
sprintf(buffer, "FramebufWidth: %x, address high %02x", data & 0xFFFF, data >> 16);
}
break;
+4
View File
@@ -74,6 +74,10 @@ public:
}
virtual bool GetCurrentFramebuffer(GPUDebugBuffer &buffer);
bool GetCurrentTexture(GPUDebugBuffer &buffer) {
// TODO
return false;
}
protected:
virtual void FastRunLoop(DisplayList &list);
+1
View File
@@ -9,3 +9,4 @@ Icon=/usr/share/icons/hicolor/114x114/apps/icon-114.png
X-Window-Icon=
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
TEMPLATE = vcapp
+1 -1
View File
@@ -6,7 +6,7 @@ MOBILITY += multimedia
win32: QT += multimedia
greaterThan(QT_MAJOR_VERSION,4): QT += widgets
VERSION = 0.9.1
TEMPLATE = vcapp
include(Settings.pri)
mobile_platform: MOBILITY += sensors
symbian: MOBILITY += systeminfo
+1
View File
@@ -2,3 +2,4 @@ TEMPLATE = subdirs
SUBDIRS = Native.pro Core.pro Common.pro PPSSPP.pro
CONFIG += ordered
PPSSPP.depends = Native.pro Core.pro Common.pro
TEMPLATE = vcapp
+3
View File
@@ -119,6 +119,9 @@ void GameSettingsScreen::CreateViews() {
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.bLowQualitySplineBezier, gs->T("Low quality spline/bezier curves (speed)")));
#ifndef USING_GLES
graphicsSettings->Add(new CheckBox(&g_Config.bFXAA, gs->T("FXAA antialiasing")));
#endif
static const char *internalResolutions[] = {"Auto (1:1)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" };
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iInternalResolution, gs->T("Rendering Resolution"), internalResolutions, 0, ARRAY_SIZE(internalResolutions), gs, screenManager()))->OnClick.Handle(this, &GameSettingsScreen::OnResolutionChange);
-39
View File
@@ -42,7 +42,6 @@
#pragma execution_character_set("utf-8")
#endif
#include "base/timeutil.h"
#include "base/colorutil.h"
#include "gfx_es2/draw_buffer.h"
@@ -95,44 +94,6 @@ void DrawBackground(float alpha) {
}
}
std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping() {
std::map<std::string, std::pair<std::string, int>> langValuesMapping;
IniFile mapping;
mapping.LoadFromVFS("langregion.ini");
std::vector<std::string> keys;
mapping.GetKeys("LangRegionNames", keys);
std::map<std::string, int> langCodeMapping;
langCodeMapping["JAPANESE"] = PSP_SYSTEMPARAM_LANGUAGE_JAPANESE;
langCodeMapping["ENGLISH"] = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
langCodeMapping["FRENCH"] = PSP_SYSTEMPARAM_LANGUAGE_FRENCH;
langCodeMapping["SPANISH"] = PSP_SYSTEMPARAM_LANGUAGE_SPANISH;
langCodeMapping["GERMAN"] = PSP_SYSTEMPARAM_LANGUAGE_GERMAN;
langCodeMapping["ITALIAN"] = PSP_SYSTEMPARAM_LANGUAGE_ITALIAN;
langCodeMapping["DUTCH"] = PSP_SYSTEMPARAM_LANGUAGE_DUTCH;
langCodeMapping["PORTUGUESE"] = PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE;
langCodeMapping["RUSSIAN"] = PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN;
langCodeMapping["KOREAN"] = PSP_SYSTEMPARAM_LANGUAGE_KOREAN;
langCodeMapping["CHINESE_TRADITIONAL"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL;
langCodeMapping["CHINESE_SIMPLIFIED"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED;
IniFile::Section *langRegionNames = mapping.GetOrCreateSection("LangRegionNames");
IniFile::Section *systemLanguage = mapping.GetOrCreateSection("SystemLanguage");
for (size_t i = 0; i < keys.size(); i++) {
std::string langName;
langRegionNames->Get(keys[i].c_str(), &langName, "ERROR");
std::string langCode;
systemLanguage->Get(keys[i].c_str(), &langCode, "ENGLISH");
int iLangCode = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
if (langCodeMapping.find(langCode) != langCodeMapping.end())
iLangCode = langCodeMapping[langCode];
langValuesMapping[keys[i]] = std::make_pair(langName, iLangCode);
}
return langValuesMapping;
}
void UIScreenWithBackground::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
dc.Flush();
+87 -38
View File
@@ -38,7 +38,7 @@ const UINT WM_GEDBG_BREAK_DRAW = WM_USER + 201;
enum PauseAction {
PAUSE_CONTINUE,
PAUSE_GETFRAMEBUF,
// textures, etc.
PAUSE_GETTEX,
};
static bool attached = false;
@@ -56,12 +56,13 @@ static bool breakNextOp = false;
static bool breakNextDraw = false;
static bool bufferResult;
static GPUDebugBuffer buffer;
static GPUDebugBuffer bufferFrame;
static GPUDebugBuffer bufferTex;
// TODO: Simplify and move out of windows stuff, just block in a common way for everyone.
void CGEDebugger::init() {
SimpleGLWindow::registerClass();
void CGEDebugger::Init() {
SimpleGLWindow::RegisterClass();
CtrlDisplayListView::registerClass();
}
@@ -86,7 +87,11 @@ static void RunPauseAction() {
return;
case PAUSE_GETFRAMEBUF:
bufferResult = gpuDebug->GetCurrentFramebuffer(buffer);
bufferResult = gpuDebug->GetCurrentFramebuffer(bufferFrame);
break;
case PAUSE_GETTEX:
bufferResult = gpuDebug->GetCurrentTexture(bufferTex);
break;
}
@@ -94,9 +99,17 @@ static void RunPauseAction() {
pauseAction = PAUSE_CONTINUE;
}
static void ForceUnpause() {
lock_guard guard(pauseLock);
lock_guard actionGuard(actionLock);
pauseAction = PAUSE_CONTINUE;
pauseWait.notify_one();
}
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent), frameWindow(NULL) {
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent), frameWindow(NULL), texWindow(NULL) {
breakCmds.resize(256, false);
Core_ListenShutdown(ForceUnpause);
// it's ugly, but .rc coordinates don't match actual pixels and it screws
// up both the size and the aspect ratio
@@ -108,24 +121,62 @@ CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
MapWindowPoints(HWND_DESKTOP,m_hDlg,(LPPOINT)&frameRect,2);
MoveWindow(frameWnd,frameRect.left,frameRect.top,512,272,TRUE);
HWND wnd = addTabWindow(L"CtrlDisplayListView",L"Display List");
HWND wnd = AddTabWindow(L"CtrlDisplayListView",L"Display List");
displayList = CtrlDisplayListView::getFrom(wnd);
}
CGEDebugger::~CGEDebugger() {
delete frameWindow;
delete texWindow;
}
void CGEDebugger::SetupFrameWindow() {
void CGEDebugger::SetupPreviews() {
if (frameWindow == NULL) {
frameWindow = SimpleGLWindow::getFrom(GetDlgItem(m_hDlg,IDC_GEDBG_FRAME));
frameWindow->Initialize();
frameWindow = SimpleGLWindow::GetFrom(GetDlgItem(m_hDlg, IDC_GEDBG_FRAME));
frameWindow->Initialize(SimpleGLWindow::ALPHA_IGNORE | SimpleGLWindow::RESIZE_SHRINK_CENTER);
// TODO: Why doesn't this work?
frameWindow->Clear();
}
if (texWindow == NULL) {
texWindow = SimpleGLWindow::GetFrom(GetDlgItem(m_hDlg, IDC_GEDBG_TEX));
texWindow->Initialize(SimpleGLWindow::ALPHA_BLEND | SimpleGLWindow::RESIZE_SHRINK_CENTER);
// TODO: Why doesn't this work?
texWindow->Clear();
}
}
HWND CGEDebugger::addTabWindow(wchar_t* className, wchar_t* title, DWORD style)
void CGEDebugger::UpdatePreviews() {
// TODO: Do something different if not paused?
bufferResult = false;
SetPauseAction(PAUSE_GETFRAMEBUF);
if (bufferResult) {
auto fmt = SimpleGLWindow::Format(bufferFrame.GetFormat());
frameWindow->Draw(bufferFrame.GetData(), bufferFrame.GetStride(), bufferFrame.GetHeight(), bufferFrame.GetFlipped(), fmt);
} else {
ERROR_LOG(COMMON, "Unable to get framebuffer.");
frameWindow->Clear();
}
bufferResult = false;
SetPauseAction(PAUSE_GETTEX);
if (bufferResult) {
auto fmt = SimpleGLWindow::Format(bufferTex.GetFormat());
texWindow->Draw(bufferTex.GetData(), bufferTex.GetStride(), bufferTex.GetHeight(), bufferTex.GetFlipped(), fmt);
} else {
ERROR_LOG(COMMON, "Unable to get texture.");
texWindow->Clear();
}
DisplayList list;
if (gpuDebug->GetCurrentDisplayList(list)) {
displayList->setDisplayList(list);
}
}
HWND CGEDebugger::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style)
{
HWND tabControl = GetDlgItem(m_hDlg,IDC_GEDBG_MAINTAB);
style |= WS_CHILD;
@@ -151,11 +202,11 @@ HWND CGEDebugger::addTabWindow(wchar_t* className, wchar_t* title, DWORD style)
m_hDlg,0,MainWindow::GetHInstance(),0);
tabs.push_back(hwnd);
showTab(index);
ShowTab(index);
return hwnd;
}
void CGEDebugger::showTab(int index, bool setControlIndex)
void CGEDebugger::ShowTab(int index, bool setControlIndex)
{
HWND tabControl = GetDlgItem(m_hDlg,IDC_GEDBG_MAINTAB);
@@ -170,7 +221,7 @@ void CGEDebugger::showTab(int index, bool setControlIndex)
}
}
void CGEDebugger::showTab(HWND pageHandle)
void CGEDebugger::ShowTab(HWND pageHandle)
{
HWND tabControl = GetDlgItem(m_hDlg,IDC_GEDBG_MAINTAB);
@@ -198,7 +249,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
return TRUE;
case WM_SHOWWINDOW:
SetupFrameWindow();
SetupPreviews();
break;
case WM_NOTIFY:
@@ -212,7 +263,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
if (pNotifyMessage->hwndFrom == tabControl)
{
int iPage = TabCtrl_GetCurSel(tabControl);
showTab(iPage,false);
ShowTab(iPage,false);
}
}
break;
@@ -221,27 +272,29 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_GEDBG_BREAK:
case IDC_GEDBG_STEPDRAW:
attached = true;
SetupFrameWindow();
SetupPreviews();
DisplayList list;
// todo: for some reason this sometimes fails when hitting break
// when the core is running. then only works when stepping through
// in the debugger or when the core is already paused
if (gpuDebug->GetCurrentDisplayList(list)) {
displayList->setDisplayList(list);
}
//breakNextOp = true;
pauseWait.notify_one();
breakNextOp = false;
breakNextDraw = true;
// TODO
break;
case IDC_GEDBG_STEP:
attached = true;
SetupPreviews();
pauseWait.notify_one();
breakNextOp = true;
breakNextDraw = false;
break;
case IDC_GEDBG_RESUME:
frameWindow->Clear();
texWindow->Clear();
// TODO: detach? Should probably have separate UI, or just on activate?
//breakNextOp = false;
breakNextOp = false;
breakNextDraw = false;
pauseWait.notify_one();
break;
@@ -253,22 +306,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
u32 pc = (u32)wParam;
auto info = gpuDebug->DissassembleOp(pc);
NOTICE_LOG(COMMON, "Waiting at %08x, %s", pc, info.desc.c_str());
UpdatePreviews();
}
break;
case WM_GEDBG_BREAK_DRAW:
{
NOTICE_LOG(COMMON, "Waiting at a draw");
bufferResult = false;
SetPauseAction(PAUSE_GETFRAMEBUF);
if (bufferResult) {
auto fmt = SimpleGLWindow::Format(buffer.GetFormat());
frameWindow->Draw(buffer.GetData(), buffer.GetStride(), buffer.GetHeight(), buffer.GetFlipped(), fmt, SimpleGLWindow::RESIZE_SHRINK_CENTER);
} else {
ERROR_LOG(COMMON, "Unable to get buffer.");
}
UpdatePreviews();
}
break;
}
@@ -284,6 +329,10 @@ bool WindowsHost::GPUDebuggingActive() {
static void PauseWithMessage(UINT msg, WPARAM wParam = NULL, LPARAM lParam = NULL) {
lock_guard guard(pauseLock);
if (Core_IsInactive()) {
return;
}
PostMessage(geDebuggerWindow->GetDlgHandle(), msg, wParam, lParam);
do {
+7 -5
View File
@@ -30,17 +30,19 @@ public:
CGEDebugger(HINSTANCE _hInstance, HWND _hParent);
~CGEDebugger();
static void init();
static void Init();
protected:
BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private:
void SetupFrameWindow();
HWND addTabWindow(wchar_t* className, wchar_t* title, DWORD style = 0);
void showTab(int index, bool setControlIndex = true);
void showTab(HWND pageHandle);
void SetupPreviews();
void UpdatePreviews();
HWND AddTabWindow(wchar_t* className, wchar_t* title, DWORD style = 0);
void ShowTab(int index, bool setControlIndex = true);
void ShowTab(HWND pageHandle);
CtrlDisplayListView* displayList;
SimpleGLWindow *frameWindow;
SimpleGLWindow *texWindow;
std::vector<HWND> tabs;
};
+20 -13
View File
@@ -21,13 +21,13 @@
const PTCHAR SimpleGLWindow::windowClass = _T("SimpleGLWindow");
void SimpleGLWindow::registerClass() {
void SimpleGLWindow::RegisterClass() {
WNDCLASSEX wndClass;
wndClass.cbSize = sizeof(wndClass);
wndClass.lpszClassName = windowClass;
wndClass.hInstance = GetModuleHandle(0);
wndClass.lpfnWndProc = wndProc;
wndClass.lpfnWndProc = WndProc;
wndClass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndClass.hIcon = 0;
wndClass.lpszMenuName = 0;
@@ -47,8 +47,8 @@ static const char tex_fs[] =
"uniform sampler2D sampler0;\n"
"varying vec2 v_texcoord0;\n"
"void main() {\n"
" gl_FragColor.rgb = texture2D(sampler0, v_texcoord0).rgb;\n"
" gl_FragColor.a = 1.0;\n"
" gl_FragColor = texture2D(sampler0, v_texcoord0);\n"
" gl_FragColor.a = clamp(gl_FragColor.a, 0.2, 1.0);\n"
"}\n";
static const char basic_vs[] =
@@ -65,7 +65,7 @@ static const char basic_vs[] =
"}\n";
SimpleGLWindow::SimpleGLWindow(HWND wnd)
: hWnd_(wnd), valid_(false), drawProgram_(NULL), tex_(0) {
: hWnd_(wnd), valid_(false), drawProgram_(NULL), tex_(0), flags_(0) {
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG) this);
}
@@ -79,10 +79,11 @@ SimpleGLWindow::~SimpleGLWindow() {
}
};
void SimpleGLWindow::Initialize() {
void SimpleGLWindow::Initialize(u32 flags) {
RECT rect;
GetWindowRect(hWnd_, &rect);
SetFlags(flags);
SetupGL();
ResizeGL(rect.right-rect.left,rect.bottom-rect.top);
CreateProgram();
@@ -200,10 +201,16 @@ void SimpleGLWindow::DrawChecker() {
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices);
}
void SimpleGLWindow::Draw(u8 *data, int w, int h, bool flipped, Format fmt, ResizeType resize) {
void SimpleGLWindow::Draw(u8 *data, int w, int h, bool flipped, Format fmt) {
DrawChecker();
glDisable(GL_BLEND);
if (flags_ & ALPHA_BLEND) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
} else {
glDisable(GL_BLEND);
}
glViewport(0, 0, w_, h_);
glScissor(0, 0, w_, h_);
@@ -235,7 +242,7 @@ void SimpleGLWindow::Draw(u8 *data, int w, int h, bool flipped, Format fmt, Resi
float fw = (float)w, fh = (float)h;
float x = 0.0f, y = 0.0f;
if (resize == RESIZE_SHRINK_FIT || resize == RESIZE_SHRINK_CENTER) {
if (flags_ & (RESIZE_SHRINK_FIT | RESIZE_SHRINK_CENTER)) {
float wscale = fw / w_, hscale = fh / h_;
// Too wide, and width is the biggest problem, so scale based on that.
@@ -247,7 +254,7 @@ void SimpleGLWindow::Draw(u8 *data, int w, int h, bool flipped, Format fmt, Resi
fh = (float)h_;
}
if (resize == RESIZE_SHRINK_CENTER) {
if (flags_ & RESIZE_SHRINK_CENTER) {
x = ((float)w_ - fw) / 2;
y = ((float)h_ - fh) / 2;
}
@@ -273,12 +280,12 @@ void SimpleGLWindow::Clear() {
Swap();
}
SimpleGLWindow *SimpleGLWindow::getFrom(HWND hwnd) {
SimpleGLWindow *SimpleGLWindow::GetFrom(HWND hwnd) {
return (SimpleGLWindow*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
LRESULT CALLBACK SimpleGLWindow::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
SimpleGLWindow *win = SimpleGLWindow::getFrom(hwnd);
LRESULT CALLBACK SimpleGLWindow::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
SimpleGLWindow *win = SimpleGLWindow::GetFrom(hwnd);
switch(msg)
{
+16 -9
View File
@@ -31,26 +31,32 @@ struct SimpleGLWindow {
FORMAT_8888 = 3,
};
enum ResizeType {
RESIZE_NONE,
RESIZE_SHRINK_FIT,
RESIZE_SHRINK_CENTER,
enum Flags {
RESIZE_NONE = 0x00,
RESIZE_SHRINK_FIT = 0x01,
RESIZE_SHRINK_CENTER = 0x02,
ALPHA_IGNORE = 0x00,
ALPHA_BLEND = 0x04,
};
SimpleGLWindow(HWND wnd);
~SimpleGLWindow();
void Clear();
void Draw(u8 *data, int w, int h, bool flipped = false, Format = FORMAT_8888, ResizeType resize = RESIZE_NONE);
void Initialize();
static SimpleGLWindow* getFrom(HWND hwnd);
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void Draw(u8 *data, int w, int h, bool flipped = false, Format = FORMAT_8888);
void Initialize(u32 flags);
static SimpleGLWindow *GetFrom(HWND hwnd);
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void SetFlags(u32 flags) {
flags_ = flags;
}
void Swap() {
SwapBuffers(hDC_);
}
static void registerClass();
static void RegisterClass();
protected:
void SetupGL();
void ResizeGL(int w, int h);
@@ -68,4 +74,5 @@ protected:
GLSLProgram *drawProgram_;
GLuint checker_;
GLuint tex_;
u32 flags_;
};
+34 -25
View File
@@ -91,8 +91,6 @@ extern InputState input_state;
#define HID_USAGE_GENERIC_MOUSE ((USHORT) 0x02)
#endif
extern std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping();
namespace MainWindow
{
HWND hwndMain;
@@ -189,7 +187,7 @@ namespace MainWindow
rcOuter.top = g_Config.iWindowY;
}
void ResizeDisplay(bool noWindowMovement = false) {
void ResizeDisplay(bool displayOSM = true, bool noWindowMovement = false) {
RECT rc;
GetClientRect(hwndMain, &rc);
if (!noWindowMovement) {
@@ -211,14 +209,15 @@ namespace MainWindow
PSP_CoreParameter().renderHeight = 272 * zoom;
PSP_CoreParameter().outputWidth = 480 * zoom;
PSP_CoreParameter().outputHeight = 272 * zoom;
I18NCategory *g = GetI18NCategory("Graphics");
char message[256];
sprintf(message, "%s: %ix%i %s: %ix%i",
g->T("Internal Resolution"), PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight,
g->T("Window Size"), PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
osm.Show(g->T(message), 2.0f);
if (displayOSM) {
I18NCategory *g = GetI18NCategory("Graphics");
char message[256];
sprintf(message, "%s: %ix%i %s: %ix%i",
g->T("Internal Resolution"), PSP_CoreParameter().renderWidth, PSP_CoreParameter().renderHeight,
g->T("Window Size"), PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
osm.Show(g->T(message), 2.0f);
}
if (gpu)
gpu->Resized();
@@ -228,7 +227,7 @@ namespace MainWindow
RECT rc, rcOuter;
GetWindowRectAtResolution(480 * (int)zoom, 272 * (int)zoom, rc, rcOuter);
MoveWindow(hwndMain, rcOuter.left, rcOuter.top, rcOuter.right - rcOuter.left, rcOuter.bottom - rcOuter.top, TRUE);
ResizeDisplay();
ResizeDisplay(true, true);
}
void SetInternalResolution(int res = -1) {
@@ -239,7 +238,7 @@ namespace MainWindow
g_Config.iInternalResolution = 0;
}
ResizeDisplay(true);
ResizeDisplay(true, true);
}
void CorrectCursor() {
@@ -277,7 +276,9 @@ namespace MainWindow
// Reset full screen indicator.
g_Config.bFullScreen = false;
CorrectCursor();
ResizeDisplay();
bool showOSM = (g_Config.iInternalResolution == RESOLUTION_AUTO);
ResizeDisplay(showOSM, true);
ShowOwnedPopups(hwndMain, TRUE);
W32Util::MakeTopMost(hwndMain, g_Config.bTopMost);
}
@@ -305,7 +306,10 @@ namespace MainWindow
// Set full screen indicator.
g_Config.bFullScreen = true;
CorrectCursor();
ResizeDisplay();
bool showOSM = (g_Config.iInternalResolution == RESOLUTION_AUTO);
ResizeDisplay(showOSM, true);
ShowOwnedPopups(hwndMain, FALSE);
UpdateScreenScale();
}
@@ -830,7 +834,7 @@ namespace MainWindow
LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
// Only apply a factor > 1 in windowed mode.
int factor = !g_Config.bFullScreen && g_Config.iWindowWidth < (480 + 80) ? 2 : 1;
int factor = !IsZoomed(GetHWND()) && !g_Config.bFullScreen && g_Config.iWindowWidth < (480 + 80) ? 2 : 1;
switch (message) {
case WM_ACTIVATE:
@@ -996,12 +1000,12 @@ namespace MainWindow
case WM_MOVE:
SavePosition();
ResizeDisplay();
ResizeDisplay(false);
break;
case WM_SIZE:
SavePosition();
ResizeDisplay();
ResizeDisplay(false);
break;
case WM_TIMER:
@@ -1095,12 +1099,8 @@ namespace MainWindow
break;
case ID_EMULATION_STOP:
if (Core_IsStepping()) {
// If the current PC is on a breakpoint, disabling stepping doesn't work without
// explicitly skipping it
CBreakPoints::SetSkipFirst(currentMIPS->pc);
Core_EnableStepping(false);
}
Core_Stop();
NativeMessageReceived("stop", "");
Update();
break;
@@ -1113,8 +1113,13 @@ namespace MainWindow
Core_EnableStepping(false);
}
Core_EnableStepping(true);
Core_WaitInactive();
Core_EnableStepping(false);
NativeMessageReceived("reset", "");
break;
case ID_EMULATION_CHEATS:
g_Config.bEnableCheats = !g_Config.bEnableCheats;
osm.ShowOnOff(g->T("Cheats"), g_Config.bEnableCheats);
@@ -1126,6 +1131,10 @@ namespace MainWindow
Core_EnableStepping(false);
}
Core_EnableStepping(true);
Core_WaitInactive();
Core_EnableStepping(false);
NativeMessageReceived("reset", "");
break;
@@ -1534,7 +1543,7 @@ namespace MainWindow
break;
case WM_USER_UPDATE_SCREEN:
ResizeDisplay(true);
ResizeDisplay(true, true);
break;
case WM_USER_WINDOW_TITLE_CHANGED:
+1 -1
View File
@@ -190,7 +190,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
CtrlDisAsmView::init();
CtrlMemView::init();
CtrlRegisterList::init();
CGEDebugger::init();
CGEDebugger::Init();
DialogManager::AddDlg(memoryWindow[0] = new CMemoryDlg(_hInstance, hwndMain, currentDebugMIPS));
DialogManager::AddDlg(vfpudlg = new CVFPUDlg(_hInstance, hwndMain, currentDebugMIPS));
+6 -4
View File
@@ -169,10 +169,12 @@ EXSTYLE WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW
CAPTION "GE"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
PUSHBUTTON "Break",IDC_GEDBG_BREAK,0,0,48,14
PUSHBUTTON "Resume",IDC_GEDBG_RESUME,52,0,48,14
CONTROL "",IDC_GEDBG_MAINTAB,"SysTabControl32",TCS_TABS ,10,16,480,180
CONTROL "",IDC_GEDBG_FRAME,"SimpleGLWindow",WS_CHILD | WS_VISIBLE,140,210,256,136
PUSHBUTTON "Step Draw",IDC_GEDBG_STEPDRAW,0,0,48,14
PUSHBUTTON "Step Into",IDC_GEDBG_STEP,52,0,48,14
PUSHBUTTON "Resume",IDC_GEDBG_RESUME,104,0,48,14
CONTROL "",IDC_GEDBG_TEX,"SimpleGLWindow",WS_CHILD | WS_VISIBLE,10,20,128,128
CONTROL "",IDC_GEDBG_FRAME,"SimpleGLWindow",WS_CHILD | WS_VISIBLE,148,20,256,136
CONTROL "",IDC_GEDBG_MAINTAB,"SysTabControl32",TCS_TABS ,10,216,480,180
END
#include "aboutbox.rc"
+4 -2
View File
@@ -259,10 +259,12 @@
#define ID_OPTIONS_SCREEN9X 40114
#define ID_OPTIONS_SCREEN10X 40115
#define ID_DEBUG_GEDEBUGGER 40116
#define IDC_GEDBG_BREAK 40117
#define IDC_GEDBG_STEPDRAW 40117
#define IDC_GEDBG_RESUME 40118
#define IDC_GEDBG_FRAME 40119
#define IDC_GEDBG_MAINTAB 40120
#define IDC_GEDBG_TEX 40121
#define IDC_GEDBG_STEP 40122
// Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
@@ -275,7 +277,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 251
#define _APS_NEXT_COMMAND_VALUE 40121
#define _APS_NEXT_COMMAND_VALUE 40123
#define _APS_NEXT_CONTROL_VALUE 1181
#define _APS_NEXT_SYMED_VALUE 101
#endif
+68
View File
@@ -0,0 +1,68 @@
// PPSSPP: Grabbed from Processing and slightly modified.
// FXAA shader, GLSL code adapted from:
// http://horde3d.org/wiki/index.php5?title=Shading_Technique_-_FXAA
// Whitepaper describing the technique:
// http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
// The inverse of the texture dimensions along X and Y
uniform vec2 u_texcoordDelta;
varying vec2 v_texcoord0;
void main() {
// The parameters are hardcoded for now, but could be
// made into uniforms to control fromt he program.
float FXAA_SPAN_MAX = 8.0;
float FXAA_REDUCE_MUL = 1.0/8.0;
float FXAA_REDUCE_MIN = (1.0/128.0);
vec3 rgbNW = texture2D(sampler0, v_texcoord0.xy + (vec2(-1.0, -1.0) * u_texcoordDelta)).xyz;
vec3 rgbNE = texture2D(sampler0, v_texcoord0.xy + (vec2(+1.0, -1.0) * u_texcoordDelta)).xyz;
vec3 rgbSW = texture2D(sampler0, v_texcoord0.xy + (vec2(-1.0, +1.0) * u_texcoordDelta)).xyz;
vec3 rgbSE = texture2D(sampler0, v_texcoord0.xy + (vec2(+1.0, +1.0) * u_texcoordDelta)).xyz;
vec3 rgbM = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 luma = vec3(0.299, 0.587, 0.114);
float lumaNW = dot(rgbNW, luma);
float lumaNE = dot(rgbNE, luma);
float lumaSW = dot(rgbSW, luma);
float lumaSE = dot(rgbSE, luma);
float lumaM = dot( rgbM, luma);
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
vec2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * u_texcoordDelta;
vec3 rgbA = (1.0/2.0) * (
texture2D(sampler0, v_texcoord0.xy + dir * (1.0/3.0 - 0.5)).xyz +
texture2D(sampler0, v_texcoord0.xy + dir * (2.0/3.0 - 0.5)).xyz);
vec3 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (
texture2D(sampler0, v_texcoord0.xy + dir * (0.0/3.0 - 0.5)).xyz +
texture2D(sampler0, v_texcoord0.xy + dir * (3.0/3.0 - 0.5)).xyz);
float lumaB = dot(rgbB, luma);
if((lumaB < lumaMin) || (lumaB > lumaMax)){
gl_FragColor.xyz=rgbA;
} else {
gl_FragColor.xyz=rgbB;
}
gl_FragColor.a = 1.0;
}
+9
View File
@@ -0,0 +1,9 @@
#version 120
attribute vec4 a_position;
attribute vec2 a_texcoord0;
uniform mat4 u_viewproj;
varying vec2 v_texcoord0;
void main() {
v_texcoord0 = a_texcoord0;
gl_Position = u_viewproj * a_position;
}
+3
View File
@@ -1,4 +1,7 @@
한국어
ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ
ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅛㅜㅠㅡㅣ
ㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ
[MainMenu]
Load = 불러오기...
+1 -1
Submodule lang updated: dc0ada4053...2c000fdc92.
+1 -1
Submodule native updated: 7510676b8c...9e31751386.