Merge pull request #462 from raven02/master

Set time format in config , make 24HR as default
This commit is contained in:
Henrik Rydgård 2013-01-21 06:10:33 -08:00
commit 57ec89f507
5 changed files with 32 additions and 24 deletions

View File

@ -84,6 +84,7 @@ void CConfig::Load(const char *iniFileName)
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Get("Language", &ilanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
pspConfig->Get("TimeFormat", &itimeformat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR);
// Ephemeral settings
bDrawWireframe = false;
@ -130,6 +131,7 @@ void CConfig::Save()
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Set("Language", ilanguage);
pspConfig->Set("TimeFormat", itimeformat);
if (!iniFile.Save(iniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't write ini %s", iniFilename_.c_str());

View File

@ -71,6 +71,7 @@ public:
// SystemParam
int ilanguage;
int itimeformat;
std::string currentDirectory;
std::string memCardDirectory;

View File

@ -19,6 +19,7 @@
#include "../Util/PPGeDraw.h"
#include "../HLE/sceCtrl.h"
#include "../Core/MemMap.h"
#include "../Config.h"
PSPSaveDialog::PSPSaveDialog()
: PSPDialog()
@ -252,20 +253,24 @@ void PSPSaveDialog::DisplaySaveDataInfo1()
char saveDetail[512];
char am_pm[] = "AM";
char hour_time[10] ;
int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour ;
if( hour > 12 ) {
strcpy(am_pm, "PM");
hour -= 12;
}
int min = param.GetFileInfo(currentSelectedSave).modif_time.tm_min ;
if (g_Config.itimeformat) {
if( hour > 12 ) {
strcpy(am_pm, "PM");
hour -= 12;
}
snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm);
} else
snprintf(hour_time,10,"%02d:%02d", hour, min);
snprintf(title,512,"%s", param.GetFileInfo(currentSelectedSave).title);
snprintf(time,512,"%02d/%02d/%d %02d:%02d %s %lld KB"
snprintf(time,512,"%02d/%02d/%d %s %lld KB"
, param.GetFileInfo(currentSelectedSave).modif_time.tm_mday
, param.GetFileInfo(currentSelectedSave).modif_time.tm_mon + 1
, param.GetFileInfo(currentSelectedSave).modif_time.tm_year + 1900
, hour
, param.GetFileInfo(currentSelectedSave).modif_time.tm_min
, am_pm
, hour_time
, param.GetFileInfo(currentSelectedSave).size / 1024
);
snprintf(saveTitle,512,"%s", param.GetFileInfo(currentSelectedSave).saveTitle);
@ -293,20 +298,24 @@ void PSPSaveDialog::DisplaySaveDataInfo2()
{
char txt[1024];
char am_pm[] = "AM";
char hour_time[10] ;
int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour ;
if( hour > 12 ) {
strcpy(am_pm, "PM");
hour -= 12;
}
int min = param.GetFileInfo(currentSelectedSave).modif_time.tm_min ;
if (g_Config.itimeformat) {
if( hour > 12 ) {
strcpy(am_pm, "PM");
hour -= 12;
}
snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm);
} else
snprintf(hour_time,10,"%02d:%02d", hour, min);
snprintf(txt,1024,"%s\n%02d/%02d/%d %02d:%02d %s\n%lld KB"
snprintf(txt,1024,"%s\n%02d/%02d/%d %s\n%lld KB"
, param.GetFileInfo(currentSelectedSave).saveTitle
, param.GetFileInfo(currentSelectedSave).modif_time.tm_mday
, param.GetFileInfo(currentSelectedSave).modif_time.tm_mon + 1
, param.GetFileInfo(currentSelectedSave).modif_time.tm_year + 1900
, hour
, param.GetFileInfo(currentSelectedSave).modif_time.tm_min
, am_pm
, hour_time
, param.GetFileInfo(currentSelectedSave).size / 1024
);
std::string saveinfoTxt = txt;

View File

@ -255,12 +255,6 @@ int sceUtilityGamedataInstallGetStatus()
#define PSP_SYSTEMPARAM_DATE_FORMAT_MMDDYYYY 1
#define PSP_SYSTEMPARAM_DATE_FORMAT_DDMMYYYY 2
/**
* Valid values for PSP_SYSTEMPARAM_ID_INT_TIME_FORMAT
*/
#define PSP_SYSTEMPARAM_TIME_FORMAT_24HR 0
#define PSP_SYSTEMPARAM_TIME_FORMAT_12HR 1
/**
* Valid values for PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS
*/
@ -313,7 +307,7 @@ u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr)
param = PSP_SYSTEMPARAM_DATE_FORMAT_DDMMYYYY;
break;
case PSP_SYSTEMPARAM_ID_INT_TIME_FORMAT:
param = PSP_SYSTEMPARAM_TIME_FORMAT_24HR;
param = g_Config.itimeformat;
break;
case PSP_SYSTEMPARAM_ID_INT_TIMEZONE:
param = 60;

View File

@ -33,8 +33,10 @@
#define PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN 8
#define PSP_SYSTEMPARAM_LANGUAGE_KOREAN 9
#define PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL 10
#define PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED 11
#define PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED 11
#define PSP_SYSTEMPARAM_TIME_FORMAT_24HR 0
#define PSP_SYSTEMPARAM_TIME_FORMAT_12HR 1
void __UtilityInit();
void __UtilityDoState(PointerWrap &p);