1
// Copyright (c) 2012- PPSSPP Project.
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
18
#include "Core/HLE/HLE.h"
19
#include "Core/HLE/FunctionWrappers.h"
20
#include "Core/HLE/sceImpose.h"
21
#include "Core/HLE/sceUtility.h"
22
#include "Core/MIPS/MIPS.h"
23
#include "Core/Config.h"
24
#include "Core/MemMap.h"
25
#include "Common/ChunkFile.h"
27
const int PSP_UMD_POPUP_DISABLE = 0;
28
const int PSP_UMD_POPUP_ENABLE = 1;
30
#define PSP_IMPOSE_BATTICON_NONE 0x80000000
31
#define PSP_IMPOSE_BATTICON_VISIBLE 0x00000000
32
#define PSP_IMPOSE_BATTICON_BLINK 0x00000001
34
static u32 language = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
35
static u32 buttonValue = PSP_SYSTEMPARAM_BUTTON_CIRCLE;
36
static u32 umdPopup = PSP_UMD_POPUP_DISABLE;
37
static u32 backlightOffTime;
41
language = g_Config.iLanguage;
42
buttonValue = g_Config.iButtonPreference;
43
umdPopup = PSP_UMD_POPUP_DISABLE;
47
void __ImposeDoState(PointerWrap &p)
49
auto s = p.Section("sceImpose", 1);
56
p.Do(backlightOffTime);
59
static u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr)
61
DEBUG_LOG(SCEUTILITY, "sceImposeGetBatteryIconStatus(%08x, %08x)", chargingPtr, iconStatusPtr);
62
if (Memory::IsValidAddress(chargingPtr))
63
Memory::Write_U32(PSP_IMPOSE_BATTICON_NONE, chargingPtr);
64
if (Memory::IsValidAddress(iconStatusPtr))
65
Memory::Write_U32(3, iconStatusPtr);
69
static u32 sceImposeSetLanguageMode(u32 languageVal, u32 buttonVal)
71
DEBUG_LOG(SCEUTILITY, "sceImposeSetLanguageMode(%08x, %08x)", languageVal, buttonVal);
72
language = languageVal;
73
buttonValue = buttonVal;
77
static u32 sceImposeGetLanguageMode(u32 languagePtr, u32 btnPtr)
79
DEBUG_LOG(SCEUTILITY, "sceImposeGetLanguageMode(%08x, %08x)", languagePtr, btnPtr);
80
if (Memory::IsValidAddress(languagePtr))
81
Memory::Write_U32(language, languagePtr);
82
if (Memory::IsValidAddress(btnPtr))
83
Memory::Write_U32(buttonValue, btnPtr);
87
static u32 sceImposeSetUMDPopup(int mode) {
88
DEBUG_LOG(SCEUTILITY, "sceImposeSetUMDPopup(%i)", mode);
93
static u32 sceImposeGetUMDPopup() {
94
DEBUG_LOG(SCEUTILITY, "sceImposeGetUMDPopup()");
98
static u32 sceImposeSetBacklightOffTime(int time) {
99
DEBUG_LOG(SCEUTILITY, "sceImposeSetBacklightOffTime(%i)", time);
100
backlightOffTime = time;
104
static u32 sceImposeGetBacklightOffTime() {
105
DEBUG_LOG(SCEUTILITY, "sceImposeGetBacklightOffTime()");
106
return backlightOffTime;
109
//OSD stuff? home button?
110
const HLEFunction sceImpose[] =
112
{0X36AA6E91, &WrapU_UU<sceImposeSetLanguageMode>, "sceImposeSetLanguageMode", 'x', "xx"}, // Seen
113
{0X381BD9E7, nullptr, "sceImposeHomeButton", '?', "" },
114
{0X0F341BE4, nullptr, "sceImposeGetHomePopup", '?', "" },
115
{0X5595A71A, nullptr, "sceImposeSetHomePopup", '?', "" },
116
{0X24FD7BCF, &WrapU_UU<sceImposeGetLanguageMode>, "sceImposeGetLanguageMode", 'x', "xx"},
117
{0X8C943191, &WrapU_UU<sceImposeGetBatteryIconStatus>, "sceImposeGetBatteryIconStatus", 'x', "xx"},
118
{0X72189C48, &WrapU_I<sceImposeSetUMDPopup>, "sceImposeSetUMDPopup", 'x', "i" },
119
{0XE0887BC8, &WrapU_V<sceImposeGetUMDPopup>, "sceImposeGetUMDPopup", 'x', "" },
120
{0X8F6E3518, &WrapU_V<sceImposeGetBacklightOffTime>, "sceImposeGetBacklightOffTime", 'x', "" },
121
{0X967F6D4A, &WrapU_I<sceImposeSetBacklightOffTime>, "sceImposeSetBacklightOffTime", 'x', "i" },
122
{0XFCD44963, nullptr, "sceImpose_FCD44963", '?', "" },
123
{0XA9884B00, nullptr, "sceImpose_A9884B00", '?', "" },
124
{0XBB3F5DEC, nullptr, "sceImpose_BB3F5DEC", '?', "" },
125
{0X9BA61B49, nullptr, "sceImpose_9BA61B49", '?', "" },
126
{0XFF1A2F07, nullptr, "sceImpose_FF1A2F07", '?', "" },
129
void Register_sceImpose()
131
RegisterModule("sceImpose", ARRAY_SIZE(sceImpose), sceImpose);