Some cleanup

* Prefer default initializer over std::memset 0 when possible and more readable.
* Use std::format in trophy files name obtaining.
* Use vm::ptr<>::operator bool() instead of comparing vm::ptr to vm::null or using addr().
* Add a few std::memset calls in hle where it matters (or in some places just to document an actual firmware memcpy call).
This commit is contained in:
Eladash 2019-12-20 05:51:16 +02:00 committed by Ivan
parent 5de83e0425
commit 9690854e58
20 changed files with 52 additions and 88 deletions

View file

@ -113,7 +113,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
std::memset(osk->osk_text, 0, sizeof(osk->osk_text));
std::memset(osk->osk_text_old, 0, sizeof(osk->osk_text_old));
if (inputFieldInfo->init_text.addr() != 0)
if (inputFieldInfo->init_text)
{
for (u32 i = 0; (i < maxLength) && (inputFieldInfo->init_text[i] != 0); i++)
{
@ -124,10 +124,9 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
// Get message to display above the input field
// Guarantees 0 terminated (+1). In praxis only 128 but for now lets display all of it
char16_t message[CELL_OSKDIALOG_STRING_SIZE + 1];
std::memset(message, 0, sizeof(message));
char16_t message[CELL_OSKDIALOG_STRING_SIZE + 1]{};
if (inputFieldInfo->message.addr() != 0)
if (inputFieldInfo->message)
{
for (u32 i = 0; (i < CELL_OSKDIALOG_STRING_SIZE) && (inputFieldInfo->message[i] != 0); i++)
{