2020-08-22 22:30:12 -04:00
|
|
|
#include "libscf.h"
|
|
|
|
|
2022-07-03 17:27:23 -04:00
|
|
|
#include <ctime>
|
|
|
|
|
2023-02-26 09:46:57 -05:00
|
|
|
#ifdef _WIN32
|
|
|
|
// clang-format off
|
|
|
|
#include <Windows.h>
|
|
|
|
#include <WinNls.h>
|
|
|
|
// clang-format on
|
|
|
|
#endif
|
|
|
|
|
2020-08-22 22:30:12 -04:00
|
|
|
namespace ee {
|
|
|
|
int sceScfGetAspect() {
|
2021-07-11 16:35:25 -04:00
|
|
|
return SCE_ASPECT_43;
|
2020-08-22 22:30:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int sceScfGetLanguage() {
|
2023-02-26 09:46:57 -05:00
|
|
|
#ifdef _WIN32
|
|
|
|
// method 1: GetUserDefaultUILanguage
|
|
|
|
LANGID curLang = GetUserDefaultUILanguage();
|
|
|
|
auto curLangMain = curLang & 0x3ff; // "base" language
|
|
|
|
auto curLangSub = (curLang >> 10) & 0x3f; // "sub"-language
|
|
|
|
if (curLangMain == LANG_JAPANESE) {
|
|
|
|
return SCE_JAPANESE_LANGUAGE;
|
|
|
|
} else if (curLangMain == LANG_ENGLISH) {
|
|
|
|
return SCE_ENGLISH_LANGUAGE;
|
|
|
|
} else if (curLangMain == LANG_FRENCH) {
|
|
|
|
return SCE_FRENCH_LANGUAGE;
|
|
|
|
} else if (curLangMain == LANG_SPANISH) {
|
|
|
|
// would non-European Spanish speakers prefer this over English?
|
|
|
|
// I'll wait for someone to complain first
|
|
|
|
return SCE_SPANISH_LANGUAGE;
|
|
|
|
} else if (curLangMain == LANG_GERMAN) {
|
|
|
|
return SCE_GERMAN_LANGUAGE;
|
|
|
|
} else if (curLangMain == LANG_ITALIAN) {
|
|
|
|
return SCE_ITALIAN_LANGUAGE;
|
|
|
|
} else if (curLangMain == LANG_PORTUGUESE) {
|
|
|
|
if (curLangSub == SUBLANG_PORTUGUESE) {
|
|
|
|
return SCE_ENGLISH_LANGUAGE; // SCE_PORTUGUESE_LANGUAGE;
|
|
|
|
} else {
|
|
|
|
return SCE_ENGLISH_LANGUAGE;
|
|
|
|
}
|
|
|
|
} else if (curLangMain == LANG_DUTCH) {
|
|
|
|
return SCE_DUTCH_LANGUAGE;
|
|
|
|
}
|
|
|
|
#endif
|
2020-08-22 22:30:12 -04:00
|
|
|
return SCE_ENGLISH_LANGUAGE;
|
|
|
|
}
|
2021-10-01 23:12:34 -04:00
|
|
|
|
|
|
|
void sceCdReadClock(sceCdCLOCK* result) {
|
2022-07-03 17:27:23 -04:00
|
|
|
time_t t = time(0);
|
|
|
|
std::tm* date = localtime(&t);
|
|
|
|
|
|
|
|
// convert decimal value into hex value with identical digit representation
|
|
|
|
// e.g. 60 -> 0x60
|
|
|
|
auto convert = [](u8 val) -> u8 { return ((val % 10) * 0x01) + ((val / 10) * 0x10); };
|
|
|
|
|
2021-10-01 23:12:34 -04:00
|
|
|
result->stat = 0; // ??
|
2022-07-03 17:27:23 -04:00
|
|
|
result->second = convert(date->tm_sec);
|
|
|
|
result->minute = convert(date->tm_min);
|
|
|
|
result->hour = convert(date->tm_hour);
|
|
|
|
result->week = convert((date->tm_yday - date->tm_wday + 7) / 7);
|
|
|
|
result->day = convert(date->tm_mday);
|
|
|
|
result->month = convert(date->tm_mon + 1);
|
|
|
|
result->year = convert(date->tm_year - 100);
|
2021-10-01 23:12:34 -04:00
|
|
|
}
|
2023-02-26 09:46:57 -05:00
|
|
|
} // namespace ee
|