mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-04 16:53:48 -04:00
ams: replace most remaining operator & with std::addressof
This commit is contained in:
parent
ce8aacef21
commit
1ab0bd1765
109 changed files with 587 additions and 586 deletions
|
@ -43,7 +43,7 @@ namespace ams::fatal::srv {
|
|||
/* Event creator. */
|
||||
os::NativeHandle GetFatalDirtyEventReadableHandle() {
|
||||
Event evt;
|
||||
R_ABORT_UNLESS(setsysAcquireFatalDirtyFlagEventHandle(&evt));
|
||||
R_ABORT_UNLESS(setsysAcquireFatalDirtyFlagEventHandle(std::addressof(evt)));
|
||||
return evt.revent;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace ams::fatal::srv {
|
|||
os::ClearSystemEvent(std::addressof(g_fatal_dirty_event));
|
||||
|
||||
u64 flags_0, flags_1;
|
||||
if (R_SUCCEEDED(setsysGetFatalDirtyFlags(&flags_0, &flags_1)) && (flags_0 & 1)) {
|
||||
if (R_SUCCEEDED(setsysGetFatalDirtyFlags(std::addressof(flags_0), std::addressof(flags_1))) && (flags_0 & 1)) {
|
||||
GetFatalConfigImpl().UpdateLanguageCode();
|
||||
}
|
||||
}
|
||||
|
@ -77,20 +77,20 @@ namespace ams::fatal::srv {
|
|||
/* Get information from set. */
|
||||
settings::system::GetSerialNumber(std::addressof(this->serial_number));
|
||||
settings::system::GetFirmwareVersion(std::addressof(this->firmware_version));
|
||||
setsysGetQuestFlag(&this->quest_flag);
|
||||
setsysGetQuestFlag(std::addressof(this->quest_flag));
|
||||
this->UpdateLanguageCode();
|
||||
|
||||
/* Read information from settings. */
|
||||
settings::fwdbg::GetSettingsItemValue(&this->transition_to_fatal, sizeof(this->transition_to_fatal), "fatal", "transition_to_fatal");
|
||||
settings::fwdbg::GetSettingsItemValue(&this->show_extra_info, sizeof(this->show_extra_info), "fatal", "show_extra_info");
|
||||
settings::fwdbg::GetSettingsItemValue(std::addressof(this->transition_to_fatal), sizeof(this->transition_to_fatal), "fatal", "transition_to_fatal");
|
||||
settings::fwdbg::GetSettingsItemValue(std::addressof(this->show_extra_info), sizeof(this->show_extra_info), "fatal", "show_extra_info");
|
||||
|
||||
u64 quest_interval_second;
|
||||
settings::fwdbg::GetSettingsItemValue(&quest_interval_second, sizeof(quest_interval_second), "fatal", "quest_reboot_interval_second");
|
||||
settings::fwdbg::GetSettingsItemValue(std::addressof(quest_interval_second), sizeof(quest_interval_second), "fatal", "quest_reboot_interval_second");
|
||||
this->quest_reboot_interval = TimeSpan::FromSeconds(quest_interval_second);
|
||||
|
||||
/* Atmosphere extension for automatic reboot. */
|
||||
u64 auto_reboot_ms;
|
||||
if (settings::fwdbg::GetSettingsItemValue(&auto_reboot_ms, sizeof(auto_reboot_ms), "atmosphere", "fatal_auto_reboot_interval") == sizeof(auto_reboot_ms)) {
|
||||
if (settings::fwdbg::GetSettingsItemValue(std::addressof(auto_reboot_ms), sizeof(auto_reboot_ms), "atmosphere", "fatal_auto_reboot_interval") == sizeof(auto_reboot_ms)) {
|
||||
this->fatal_auto_reboot_interval = TimeSpan::FromMilliSeconds(auto_reboot_ms);
|
||||
this->fatal_auto_reboot_enabled = auto_reboot_ms != 0;
|
||||
}
|
||||
|
|
|
@ -160,13 +160,13 @@ namespace ams::fatal::srv {
|
|||
bool TryGuessBaseAddress(u64 *out_base_address, os::NativeHandle debug_handle, u64 guess) {
|
||||
svc::MemoryInfo mi;
|
||||
svc::PageInfo pi;
|
||||
if (R_FAILED(svc::QueryDebugProcessMemory(&mi, &pi, debug_handle, guess)) || mi.permission != svc::MemoryPermission_ReadExecute) {
|
||||
if (R_FAILED(svc::QueryDebugProcessMemory(std::addressof(mi), std::addressof(pi), debug_handle, guess)) || mi.permission != svc::MemoryPermission_ReadExecute) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Iterate backwards until we find the memory before the code region. */
|
||||
while (mi.base_address > 0) {
|
||||
if (R_FAILED(svc::QueryDebugProcessMemory(&mi, &pi, debug_handle, guess))) {
|
||||
if (R_FAILED(svc::QueryDebugProcessMemory(std::addressof(mi), std::addressof(pi), debug_handle, guess))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -185,16 +185,16 @@ namespace ams::fatal::srv {
|
|||
u64 GetBaseAddress(const ThrowContext *throw_ctx, const svc::ThreadContext *thread_ctx, os::NativeHandle debug_handle) {
|
||||
u64 base_address = 0;
|
||||
|
||||
if (TryGuessBaseAddress(&base_address, debug_handle, thread_ctx->pc)) {
|
||||
if (TryGuessBaseAddress(std::addressof(base_address), debug_handle, thread_ctx->pc)) {
|
||||
return base_address;
|
||||
}
|
||||
|
||||
if (TryGuessBaseAddress(&base_address, debug_handle, thread_ctx->lr)) {
|
||||
if (TryGuessBaseAddress(std::addressof(base_address), debug_handle, thread_ctx->lr)) {
|
||||
return base_address;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < throw_ctx->cpu_ctx.aarch64_ctx.stack_trace_size; i++) {
|
||||
if (TryGuessBaseAddress(&base_address, debug_handle, throw_ctx->cpu_ctx.aarch64_ctx.stack_trace[i])) {
|
||||
if (TryGuessBaseAddress(std::addressof(base_address), debug_handle, throw_ctx->cpu_ctx.aarch64_ctx.stack_trace[i])) {
|
||||
return base_address;
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ namespace ams::fatal::srv {
|
|||
/* We start by trying to get a list of threads. */
|
||||
s32 thread_count;
|
||||
u64 thread_ids[0x60];
|
||||
if (R_FAILED(svc::GetThreadList(&thread_count, thread_ids, 0x60, debug_handle))) {
|
||||
if (R_FAILED(svc::GetThreadList(std::addressof(thread_count), thread_ids, 0x60, debug_handle))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ namespace ams::fatal::srv {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (IsThreadFatalCaller(ctx->result, debug_handle, cur_thread_id, cur_thread_tls, &thread_ctx)) {
|
||||
if (IsThreadFatalCaller(ctx->result, debug_handle, cur_thread_id, cur_thread_tls, std::addressof(thread_ctx))) {
|
||||
thread_id = cur_thread_id;
|
||||
thread_tls = cur_thread_tls;
|
||||
found_fatal_caller = true;
|
||||
|
@ -276,7 +276,7 @@ namespace ams::fatal::srv {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (R_FAILED(svc::GetDebugThreadContext(&thread_ctx, debug_handle, thread_id, svc::ThreadContextFlag_All))) {
|
||||
if (R_FAILED(svc::GetDebugThreadContext(std::addressof(thread_ctx), debug_handle, thread_id, svc::ThreadContextFlag_All))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ namespace ams::fatal::srv {
|
|||
}
|
||||
|
||||
/* Parse the base address. */
|
||||
ctx->cpu_ctx.aarch64_ctx.SetBaseAddress(GetBaseAddress(ctx, &thread_ctx, debug_handle));
|
||||
ctx->cpu_ctx.aarch64_ctx.SetBaseAddress(GetBaseAddress(ctx, std::addressof(thread_ctx), debug_handle));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace ams::fatal::srv::font {
|
|||
|
||||
void DrawCodePoint(u32 codepoint, u32 x, u32 y) {
|
||||
int width = 0, height = 0;
|
||||
u8* imageptr = stbtt_GetCodepointBitmap(&g_stb_font, g_font_size, g_font_size, codepoint, &width, &height, 0, 0);
|
||||
u8* imageptr = stbtt_GetCodepointBitmap(std::addressof(g_stb_font), g_font_size, g_font_size, codepoint, std::addressof(width), std::addressof(height), 0, 0);
|
||||
ON_SCOPE_EXIT { DeallocateForFont(imageptr); };
|
||||
|
||||
for (int tmpy = 0; tmpy < height; tmpy++) {
|
||||
|
@ -114,11 +114,11 @@ namespace ams::fatal::srv::font {
|
|||
u32 prev_char = 0;
|
||||
for (u32 i = 0; i < len; ) {
|
||||
u32 cur_char;
|
||||
ssize_t unit_count = decode_utf8(&cur_char, reinterpret_cast<const u8 *>(str + i));
|
||||
ssize_t unit_count = decode_utf8(std::addressof(cur_char), reinterpret_cast<const u8 *>(str + i));
|
||||
if (unit_count <= 0) break;
|
||||
|
||||
if (!g_mono_adv && i > 0) {
|
||||
cur_x += g_font_size * stbtt_GetCodepointKernAdvance(&g_stb_font, prev_char, cur_char);
|
||||
cur_x += g_font_size * stbtt_GetCodepointKernAdvance(std::addressof(g_stb_font), prev_char, cur_char);
|
||||
}
|
||||
|
||||
i += unit_count;
|
||||
|
@ -130,11 +130,11 @@ namespace ams::fatal::srv::font {
|
|||
}
|
||||
|
||||
int adv_width, left_side_bearing;
|
||||
stbtt_GetCodepointHMetrics(&g_stb_font, cur_char, &adv_width, &left_side_bearing);
|
||||
stbtt_GetCodepointHMetrics(std::addressof(g_stb_font), cur_char, std::addressof(adv_width), std::addressof(left_side_bearing));
|
||||
const u32 cur_width = static_cast<u32>(adv_width) * g_font_size;
|
||||
|
||||
int x0, y0, x1, y1;
|
||||
stbtt_GetCodepointBitmapBoxSubpixel(&g_stb_font, cur_char, g_font_size, g_font_size, 0, 0, &x0, &y0, &x1, &y1);
|
||||
stbtt_GetCodepointBitmapBoxSubpixel(std::addressof(g_stb_font), cur_char, g_font_size, g_font_size, 0, 0, std::addressof(x0), std::addressof(y0), std::addressof(x1), std::addressof(y1));
|
||||
|
||||
DrawCodePoint(cur_char, cur_x + x0 + ((mono && g_mono_adv > cur_width) ? ((g_mono_adv - cur_width) / 2) : 0), cur_y + y0);
|
||||
|
||||
|
@ -225,14 +225,14 @@ namespace ams::fatal::srv::font {
|
|||
}
|
||||
|
||||
void SetFontSize(float fsz) {
|
||||
g_font_size = stbtt_ScaleForPixelHeight(&g_stb_font, fsz * 1.375);
|
||||
g_font_size = stbtt_ScaleForPixelHeight(std::addressof(g_stb_font), fsz * 1.375);
|
||||
|
||||
int ascent;
|
||||
stbtt_GetFontVMetrics(&g_stb_font, &ascent,0,0);
|
||||
stbtt_GetFontVMetrics(std::addressof(g_stb_font), std::addressof(ascent),0,0);
|
||||
g_font_line_pixels = ascent * g_font_size * 1.125;
|
||||
|
||||
int adv_width, left_side_bearing;
|
||||
stbtt_GetCodepointHMetrics(&g_stb_font, 'A', &adv_width, &left_side_bearing);
|
||||
stbtt_GetCodepointHMetrics(std::addressof(g_stb_font), 'A', std::addressof(adv_width), std::addressof(left_side_bearing));
|
||||
|
||||
g_mono_adv = adv_width * g_font_size;
|
||||
}
|
||||
|
@ -248,10 +248,10 @@ namespace ams::fatal::srv::font {
|
|||
}
|
||||
|
||||
Result InitializeSharedFont() {
|
||||
R_TRY(plGetSharedFontByType(&g_font, PlSharedFontType_Standard));
|
||||
R_TRY(plGetSharedFontByType(std::addressof(g_font), PlSharedFontType_Standard));
|
||||
|
||||
u8 *font_buffer = reinterpret_cast<u8 *>(g_font.address);
|
||||
stbtt_InitFont(&g_stb_font, font_buffer, stbtt_GetFontOffsetForIndex(font_buffer, 0));
|
||||
stbtt_InitFont(std::addressof(g_stb_font), font_buffer, stbtt_GetFontOffsetForIndex(font_buffer, 0));
|
||||
|
||||
SetFontSize(16.0f);
|
||||
return ResultSuccess();
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace ams::fatal::srv {
|
|||
}
|
||||
|
||||
bool in_repair;
|
||||
return R_SUCCEEDED(setsysGetInRepairProcessEnableFlag(&in_repair)) && in_repair;
|
||||
return R_SUCCEEDED(setsysGetInRepairProcessEnableFlag(std::addressof(in_repair))) && in_repair;
|
||||
}
|
||||
|
||||
bool IsInRepairWithoutVolHeld() {
|
||||
|
@ -66,7 +66,7 @@ namespace ams::fatal::srv {
|
|||
}
|
||||
|
||||
bool requires_time_reviser;
|
||||
return R_SUCCEEDED(setsysGetRequiresRunRepairTimeReviser(&requires_time_reviser)) && requires_time_reviser;
|
||||
return R_SUCCEEDED(setsysGetRequiresRunRepairTimeReviser(std::addressof(requires_time_reviser))) && requires_time_reviser;
|
||||
}
|
||||
|
||||
bool IsTimeReviserCartridgeInserted() {
|
||||
|
@ -74,21 +74,21 @@ namespace ams::fatal::srv {
|
|||
u8 gc_attr;
|
||||
{
|
||||
FsDeviceOperator devop;
|
||||
if (R_FAILED(fsOpenDeviceOperator(&devop))) {
|
||||
if (R_FAILED(fsOpenDeviceOperator(std::addressof(devop)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Ensure we close even on early return. */
|
||||
ON_SCOPE_EXIT { fsDeviceOperatorClose(&devop); };
|
||||
ON_SCOPE_EXIT { fsDeviceOperatorClose(std::addressof(devop)); };
|
||||
|
||||
/* Check that a gamecard is inserted. */
|
||||
bool inserted;
|
||||
if (R_FAILED(fsDeviceOperatorIsGameCardInserted(&devop, &inserted)) || !inserted) {
|
||||
if (R_FAILED(fsDeviceOperatorIsGameCardInserted(std::addressof(devop), std::addressof(inserted))) || !inserted) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check that we can retrieve the gamecard's attributes. */
|
||||
if (R_FAILED(fsDeviceOperatorGetGameCardHandle(&devop, &gc_hnd)) || R_FAILED(fsDeviceOperatorGetGameCardAttribute(&devop, &gc_hnd, &gc_attr))) {
|
||||
if (R_FAILED(fsDeviceOperatorGetGameCardHandle(std::addressof(devop), std::addressof(gc_hnd))) || R_FAILED(fsDeviceOperatorGetGameCardAttribute(std::addressof(devop), std::addressof(gc_hnd), std::addressof(gc_attr)))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,13 +85,13 @@ namespace ams::fatal::srv {
|
|||
}
|
||||
|
||||
/* Get program id. */
|
||||
pm::info::GetProgramId(&this->context.program_id, process_id);
|
||||
pm::info::GetProgramId(std::addressof(this->context.program_id), process_id);
|
||||
this->context.is_creport = (this->context.program_id == ncm::SystemProgramId::Creport);
|
||||
|
||||
if (!this->context.is_creport) {
|
||||
/* On firmware version 2.0.0, use debugging SVCs to collect information. */
|
||||
if (hos::GetVersion() >= hos::Version_2_0_0) {
|
||||
fatal::srv::TryCollectDebugInformation(&this->context, process_id);
|
||||
fatal::srv::TryCollectDebugInformation(std::addressof(this->context), process_id);
|
||||
}
|
||||
} else {
|
||||
/* We received info from creport. Parse program id from afsr0. */
|
||||
|
@ -117,7 +117,7 @@ namespace ams::fatal::srv {
|
|||
this->event_manager.SignalEvents();
|
||||
|
||||
if (GetFatalConfig().ShouldTransitionToFatal()) {
|
||||
RunTasks(&this->context);
|
||||
RunTasks(std::addressof(this->context));
|
||||
}
|
||||
break;
|
||||
/* N aborts here. Should we just return an error code? */
|
||||
|
|
|
@ -41,13 +41,13 @@ namespace ams::fatal::srv {
|
|||
if (hos::GetVersion() >= hos::Version_8_0_0) {
|
||||
/* On 8.0.0+, convert to module id + use clkrst API. */
|
||||
PcvModuleId module_id;
|
||||
R_TRY(pcvGetModuleId(&module_id, module));
|
||||
R_TRY(pcvGetModuleId(std::addressof(module_id), module));
|
||||
|
||||
ClkrstSession session;
|
||||
R_TRY(clkrstOpenSession(&session, module_id, 3));
|
||||
ON_SCOPE_EXIT { clkrstCloseSession(&session); };
|
||||
R_TRY(clkrstOpenSession(std::addressof(session), module_id, 3));
|
||||
ON_SCOPE_EXIT { clkrstCloseSession(std::addressof(session)); };
|
||||
|
||||
R_TRY(clkrstSetClockRate(&session, hz));
|
||||
R_TRY(clkrstSetClockRate(std::addressof(session), hz));
|
||||
} else {
|
||||
/* On 1.0.0-7.0.1, use pcv API. */
|
||||
R_TRY(pcvSetClockRate(module, hz));
|
||||
|
@ -77,7 +77,7 @@ namespace ams::fatal::srv {
|
|||
|
||||
ITask *GetAdjustClockTask(const ThrowContext *ctx) {
|
||||
g_adjust_clock_task.Initialize(ctx);
|
||||
return &g_adjust_clock_task;
|
||||
return std::addressof(g_adjust_clock_task);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace ams::fatal::srv {
|
|||
/* Check if we have time service. */
|
||||
{
|
||||
bool has_time_service = false;
|
||||
if (R_FAILED(sm::HasService(&has_time_service, sm::ServiceName::Encode("time:s"))) || !has_time_service) {
|
||||
if (R_FAILED(sm::HasService(std::addressof(has_time_service), sm::ServiceName::Encode("time:s"))) || !has_time_service) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace ams::fatal::srv {
|
|||
|
||||
/* Get a timestamp. */
|
||||
u64 timestamp;
|
||||
if (!TryGetCurrentTimestamp(×tamp)) {
|
||||
if (!TryGetCurrentTimestamp(std::addressof(timestamp))) {
|
||||
timestamp = os::GetSystemTick().GetInt64Value();
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ namespace ams::fatal::srv {
|
|||
|
||||
ITask *GetErrorReportTask(const ThrowContext *ctx) {
|
||||
g_error_report_task.Initialize(ctx);
|
||||
return &g_error_report_task;
|
||||
return std::addressof(g_error_report_task);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace ams::fatal::srv {
|
|||
break;
|
||||
}
|
||||
|
||||
if (R_FAILED(psmGetBatteryVoltageState(&bv_state)) || bv_state == PsmBatteryVoltageState_NeedsShutdown) {
|
||||
if (R_FAILED(psmGetBatteryVoltageState(std::addressof(bv_state))) || bv_state == PsmBatteryVoltageState_NeedsShutdown) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ namespace ams::fatal::srv {
|
|||
PsmBatteryVoltageState bv_state = PsmBatteryVoltageState_Normal;
|
||||
|
||||
/* Check the battery state, and shutdown on low voltage. */
|
||||
if (R_FAILED(psmGetBatteryVoltageState(&bv_state)) || bv_state == PsmBatteryVoltageState_NeedsShutdown) {
|
||||
if (R_FAILED(psmGetBatteryVoltageState(std::addressof(bv_state))) || bv_state == PsmBatteryVoltageState_NeedsShutdown) {
|
||||
/* Wait a second for the error report task to finish. */
|
||||
this->context->erpt_event->TimedWait(TimeSpan::FromSeconds(1));
|
||||
this->TryShutdown();
|
||||
|
@ -124,7 +124,7 @@ namespace ams::fatal::srv {
|
|||
|
||||
/* Loop querying voltage state every 5 seconds. */
|
||||
while (true) {
|
||||
if (R_FAILED(psmGetBatteryVoltageState(&bv_state))) {
|
||||
if (R_FAILED(psmGetBatteryVoltageState(std::addressof(bv_state)))) {
|
||||
bv_state = PsmBatteryVoltageState_NeedsShutdown;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ namespace ams::fatal::srv {
|
|||
if (fatal_reboot_helper.IsRebootTiming() || (quest_reboot_helper.IsRebootTiming()) ||
|
||||
(check_vol_up && gpio::GetValue(std::addressof(vol_up_btn)) == gpio::GpioValue_Low) ||
|
||||
(check_vol_down && gpio::GetValue(std::addressof(vol_down_btn)) == gpio::GpioValue_Low) ||
|
||||
(R_SUCCEEDED(bpcGetSleepButtonState(&state)) && state == BpcSleepButtonState_Held))
|
||||
(R_SUCCEEDED(bpcGetSleepButtonState(std::addressof(state))) && state == BpcSleepButtonState_Held))
|
||||
{
|
||||
/* If any of the above conditions succeeded, we should reboot. */
|
||||
bpcRebootSystem();
|
||||
|
@ -214,17 +214,17 @@ namespace ams::fatal::srv {
|
|||
|
||||
ITask *GetPowerControlTask(const ThrowContext *ctx) {
|
||||
g_power_control_task.Initialize(ctx);
|
||||
return &g_power_control_task;
|
||||
return std::addressof(g_power_control_task);
|
||||
}
|
||||
|
||||
ITask *GetPowerButtonObserveTask(const ThrowContext *ctx) {
|
||||
g_power_button_observe_task.Initialize(ctx);
|
||||
return &g_power_button_observe_task;
|
||||
return std::addressof(g_power_button_observe_task);
|
||||
}
|
||||
|
||||
ITask *GetStateTransitionStopTask(const ThrowContext *ctx) {
|
||||
g_state_transition_stop_task.Initialize(ctx);
|
||||
return &g_state_transition_stop_task;
|
||||
return std::addressof(g_state_transition_stop_task);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,23 +107,23 @@ namespace ams::fatal::srv {
|
|||
Result ShowFatalTask::SetupDisplayInternal() {
|
||||
ViDisplay temp_display;
|
||||
/* Try to open the display. */
|
||||
R_TRY_CATCH(viOpenDisplay("Internal", &temp_display)) {
|
||||
R_TRY_CATCH(viOpenDisplay("Internal", std::addressof(temp_display))) {
|
||||
R_CONVERT(vi::ResultNotFound, ResultSuccess());
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
/* Guarantee we close the display. */
|
||||
ON_SCOPE_EXIT { viCloseDisplay(&temp_display); };
|
||||
ON_SCOPE_EXIT { viCloseDisplay(std::addressof(temp_display)); };
|
||||
|
||||
/* Turn on the screen. */
|
||||
if (hos::GetVersion() >= hos::Version_3_0_0) {
|
||||
R_TRY(viSetDisplayPowerState(&temp_display, ViPowerState_On));
|
||||
R_TRY(viSetDisplayPowerState(std::addressof(temp_display), ViPowerState_On));
|
||||
} else {
|
||||
/* Prior to 3.0.0, the ViPowerState enum was different (0 = Off, 1 = On). */
|
||||
R_TRY(viSetDisplayPowerState(&temp_display, ViPowerState_On_Deprecated));
|
||||
R_TRY(viSetDisplayPowerState(std::addressof(temp_display), ViPowerState_On_Deprecated));
|
||||
}
|
||||
|
||||
/* Set alpha to 1.0f. */
|
||||
R_TRY(viSetDisplayAlpha(&temp_display, 1.0f));
|
||||
R_TRY(viSetDisplayAlpha(std::addressof(temp_display), 1.0f));
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
@ -131,15 +131,15 @@ namespace ams::fatal::srv {
|
|||
Result ShowFatalTask::SetupDisplayExternal() {
|
||||
ViDisplay temp_display;
|
||||
/* Try to open the display. */
|
||||
R_TRY_CATCH(viOpenDisplay("External", &temp_display)) {
|
||||
R_TRY_CATCH(viOpenDisplay("External", std::addressof(temp_display))) {
|
||||
R_CONVERT(vi::ResultNotFound, ResultSuccess());
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
/* Guarantee we close the display. */
|
||||
ON_SCOPE_EXIT { viCloseDisplay(&temp_display); };
|
||||
ON_SCOPE_EXIT { viCloseDisplay(std::addressof(temp_display)); };
|
||||
|
||||
/* Set alpha to 1.0f. */
|
||||
R_TRY(viSetDisplayAlpha(&temp_display, 1.0f));
|
||||
R_TRY(viSetDisplayAlpha(std::addressof(temp_display), 1.0f));
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
@ -156,19 +156,19 @@ namespace ams::fatal::srv {
|
|||
R_TRY(SetupDisplayExternal());
|
||||
|
||||
/* Open the default display. */
|
||||
R_TRY(viOpenDefaultDisplay(&this->display));
|
||||
R_TRY(viOpenDefaultDisplay(std::addressof(this->display)));
|
||||
|
||||
/* Reset the display magnification to its default value. */
|
||||
s32 display_width, display_height;
|
||||
R_TRY(viGetDisplayLogicalResolution(&this->display, &display_width, &display_height));
|
||||
R_TRY(viGetDisplayLogicalResolution(std::addressof(this->display), std::addressof(display_width), std::addressof(display_height)));
|
||||
|
||||
/* viSetDisplayMagnification was added in 3.0.0. */
|
||||
if (hos::GetVersion() >= hos::Version_3_0_0) {
|
||||
R_TRY(viSetDisplayMagnification(&this->display, 0, 0, display_width, display_height));
|
||||
R_TRY(viSetDisplayMagnification(std::addressof(this->display), 0, 0, display_width, display_height));
|
||||
}
|
||||
|
||||
/* Create layer to draw to. */
|
||||
R_TRY(viCreateLayer(&this->display, &this->layer));
|
||||
R_TRY(viCreateLayer(std::addressof(this->display), std::addressof(this->layer)));
|
||||
|
||||
/* Setup the layer. */
|
||||
{
|
||||
|
@ -183,16 +183,16 @@ namespace ams::fatal::srv {
|
|||
const float layer_x = static_cast<float>((display_width - LayerWidth) / 2);
|
||||
const float layer_y = static_cast<float>((display_height - LayerHeight) / 2);
|
||||
|
||||
R_TRY(viSetLayerSize(&this->layer, LayerWidth, LayerHeight));
|
||||
R_TRY(viSetLayerSize(std::addressof(this->layer), LayerWidth, LayerHeight));
|
||||
|
||||
/* Set the layer's Z at display maximum, to be above everything else .*/
|
||||
R_TRY(viSetLayerZ(&this->layer, FatalLayerZ));
|
||||
R_TRY(viSetLayerZ(std::addressof(this->layer), FatalLayerZ));
|
||||
|
||||
/* Center the layer in the screen. */
|
||||
R_TRY(viSetLayerPosition(&this->layer, layer_x, layer_y));
|
||||
R_TRY(viSetLayerPosition(std::addressof(this->layer), layer_x, layer_y));
|
||||
|
||||
/* Create framebuffer. */
|
||||
R_TRY(nwindowCreateFromLayer(&this->win, &this->layer));
|
||||
R_TRY(nwindowCreateFromLayer(std::addressof(this->win), std::addressof(this->layer)));
|
||||
R_TRY(this->InitializeNativeWindow());
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ namespace ams::fatal::srv {
|
|||
R_TRY(nvFenceInit());
|
||||
|
||||
/* Create nvmap. */
|
||||
R_TRY(nvMapCreate(&this->map, g_framebuffer_memory, sizeof(g_framebuffer_memory), 0x20000, NvKind_Pitch, true));
|
||||
R_TRY(nvMapCreate(std::addressof(this->map), g_framebuffer_memory, sizeof(g_framebuffer_memory), 0x20000, NvKind_Pitch, true));
|
||||
|
||||
/* Setup graphics buffer. */
|
||||
{
|
||||
|
@ -458,14 +458,14 @@ namespace ams::fatal::srv {
|
|||
grbuf.planes[0].layout = NvLayout_BlockLinear;
|
||||
grbuf.planes[0].kind = NvKind_Generic_16BX2;
|
||||
grbuf.planes[0].block_height_log2 = 4;
|
||||
grbuf.nvmap_id = nvMapGetId(&this->map);
|
||||
grbuf.nvmap_id = nvMapGetId(std::addressof(this->map));
|
||||
grbuf.stride = FatalScreenWidthAligned;
|
||||
grbuf.total_size = sizeof(g_framebuffer_memory);
|
||||
grbuf.planes[0].pitch = FatalScreenWidthAlignedBytes;
|
||||
grbuf.planes[0].size = sizeof(g_framebuffer_memory);
|
||||
grbuf.planes[0].offset = 0;
|
||||
|
||||
R_TRY(nwindowConfigureBuffer(&this->win, 0, &grbuf));
|
||||
R_TRY(nwindowConfigureBuffer(std::addressof(this->win), 0, std::addressof(grbuf)));
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
|
@ -473,9 +473,9 @@ namespace ams::fatal::srv {
|
|||
|
||||
void ShowFatalTask::DisplayPreRenderedFrame() {
|
||||
s32 slot;
|
||||
R_ABORT_UNLESS(nwindowDequeueBuffer(&this->win, &slot, nullptr));
|
||||
R_ABORT_UNLESS(nwindowDequeueBuffer(std::addressof(this->win), std::addressof(slot), nullptr));
|
||||
dd::FlushDataCache(g_framebuffer_memory, sizeof(g_framebuffer_memory));
|
||||
R_ABORT_UNLESS(nwindowQueueBuffer(&this->win, this->win.cur_slot, NULL));
|
||||
R_ABORT_UNLESS(nwindowQueueBuffer(std::addressof(this->win), this->win.cur_slot, NULL));
|
||||
}
|
||||
|
||||
Result ShowFatalTask::ShowFatal() {
|
||||
|
@ -511,12 +511,12 @@ namespace ams::fatal::srv {
|
|||
|
||||
ITask *GetShowFatalTask(const ThrowContext *ctx) {
|
||||
g_show_fatal_task.Initialize(ctx);
|
||||
return &g_show_fatal_task;
|
||||
return std::addressof(g_show_fatal_task);
|
||||
}
|
||||
|
||||
ITask *GetBacklightControlTask(const ThrowContext *ctx) {
|
||||
g_backlight_control_task.Initialize(ctx);
|
||||
return &g_backlight_control_task;
|
||||
return std::addressof(g_backlight_control_task);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ namespace ams::fatal::srv {
|
|||
/* Talk to the ALC5639 over I2C, and disable audio output. */
|
||||
{
|
||||
I2cSession audio;
|
||||
if (R_SUCCEEDED(i2cOpenSession(&audio, I2cDevice_Alc5639))) {
|
||||
ON_SCOPE_EXIT { i2csessionClose(&audio); };
|
||||
if (R_SUCCEEDED(i2cOpenSession(std::addressof(audio), I2cDevice_Alc5639))) {
|
||||
ON_SCOPE_EXIT { i2csessionClose(std::addressof(audio)); };
|
||||
|
||||
struct {
|
||||
u8 reg;
|
||||
|
@ -50,16 +50,16 @@ namespace ams::fatal::srv {
|
|||
|
||||
cmd.reg = 0x01;
|
||||
cmd.val = 0xC8C8;
|
||||
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
i2csessionSendAuto(std::addressof(audio), std::addressof(cmd), sizeof(cmd), I2cTransactionOption_All);
|
||||
|
||||
cmd.reg = 0x02;
|
||||
cmd.val = 0xC8C8;
|
||||
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
i2csessionSendAuto(std::addressof(audio), std::addressof(cmd), sizeof(cmd), I2cTransactionOption_All);
|
||||
|
||||
for (u8 reg = 97; reg <= 102; reg++) {
|
||||
cmd.reg = reg;
|
||||
cmd.val = 0;
|
||||
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||
i2csessionSendAuto(std::addressof(audio), std::addressof(cmd), sizeof(cmd), I2cTransactionOption_All);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ namespace ams::fatal::srv {
|
|||
|
||||
ITask *GetStopSoundTask(const ThrowContext *ctx) {
|
||||
g_stop_sound_task.Initialize(ctx);
|
||||
return &g_stop_sound_task;
|
||||
return std::addressof(g_stop_sound_task);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue