~ppsspp/ppsspp/ppsspp_1.3.0

« back to all changes in this revision

Viewing changes to Core/HLE/sceImpose.cpp

  • Committer: Sérgio Benjamim
  • Date: 2017-01-02 00:12:05 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20170102001205-cxbta9za203nmjwm
1.3.0 source (from ppsspp_1.3.0-r160.p5.l1762.a165.t83~56~ubuntu16.04.1.tar.xz).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) 2012- PPSSPP Project.
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
12
// A copy of the GPL 2.0 should have been included with the program.
 
13
// If not, see http://www.gnu.org/licenses/
 
14
 
 
15
// Official git repository and contact information can be found at
 
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
 
17
 
 
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"
 
26
 
 
27
const int PSP_UMD_POPUP_DISABLE = 0;
 
28
const int PSP_UMD_POPUP_ENABLE = 1;
 
29
 
 
30
#define PSP_IMPOSE_BATTICON_NONE    0x80000000
 
31
#define PSP_IMPOSE_BATTICON_VISIBLE 0x00000000
 
32
#define PSP_IMPOSE_BATTICON_BLINK   0x00000001
 
33
 
 
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;
 
38
 
 
39
void __ImposeInit()
 
40
{
 
41
        language = g_Config.iLanguage;
 
42
        buttonValue = g_Config.iButtonPreference;
 
43
        umdPopup = PSP_UMD_POPUP_DISABLE;
 
44
        backlightOffTime = 0;
 
45
}
 
46
 
 
47
void __ImposeDoState(PointerWrap &p)
 
48
{
 
49
        auto s = p.Section("sceImpose", 1);
 
50
        if (!s)
 
51
                return;
 
52
 
 
53
        p.Do(language);
 
54
        p.Do(buttonValue);
 
55
        p.Do(umdPopup);
 
56
        p.Do(backlightOffTime);
 
57
}
 
58
 
 
59
static u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr)
 
60
{
 
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);
 
66
        return 0;
 
67
}
 
68
 
 
69
static u32 sceImposeSetLanguageMode(u32 languageVal, u32 buttonVal)
 
70
{
 
71
        DEBUG_LOG(SCEUTILITY, "sceImposeSetLanguageMode(%08x, %08x)", languageVal, buttonVal);
 
72
        language = languageVal;
 
73
        buttonValue = buttonVal;
 
74
        return 0;
 
75
}
 
76
 
 
77
static u32 sceImposeGetLanguageMode(u32 languagePtr, u32 btnPtr)
 
78
{
 
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);
 
84
        return 0;
 
85
}
 
86
 
 
87
static u32 sceImposeSetUMDPopup(int mode) {
 
88
        DEBUG_LOG(SCEUTILITY, "sceImposeSetUMDPopup(%i)", mode);
 
89
        umdPopup = mode;
 
90
        return 0;
 
91
}
 
92
 
 
93
static u32 sceImposeGetUMDPopup() {
 
94
        DEBUG_LOG(SCEUTILITY, "sceImposeGetUMDPopup()");
 
95
        return umdPopup;
 
96
}
 
97
 
 
98
static u32 sceImposeSetBacklightOffTime(int time) {
 
99
        DEBUG_LOG(SCEUTILITY, "sceImposeSetBacklightOffTime(%i)", time);
 
100
        backlightOffTime = time;
 
101
        return 0;
 
102
}
 
103
 
 
104
static u32 sceImposeGetBacklightOffTime() {
 
105
        DEBUG_LOG(SCEUTILITY, "sceImposeGetBacklightOffTime()");
 
106
        return backlightOffTime;
 
107
}
 
108
 
 
109
//OSD stuff? home button?
 
110
const HLEFunction sceImpose[] =
 
111
{
 
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",            '?', ""  },
 
127
};
 
128
 
 
129
void Register_sceImpose()
 
130
{
 
131
        RegisterModule("sceImpose", ARRAY_SIZE(sceImpose), sceImpose);
 
132
}