55#if defined(__WIIU__)
66#include < romfs-wiiu.h>
77#include < unistd.h>
8+
9+
10+ #include < unistd.h>
11+ #include < sys/iosupport.h>
812#endif
913
1014#include " libs/get/src/Get.hpp"
1519
1620#include " console/Menu.hpp"
1721
22+
1823#include " main.hpp"
1924
2025static bool running = true ;
@@ -30,6 +35,9 @@ int main(int argc, char* argv[])
3035 // stdout = stderr; // for yuzu
3136
3237#if defined(__WIIU__)
38+ // WHBLogUdpInit();
39+ // WHBLogCafeInit();
40+
3341#define HBAS_PATH ROOT_PATH " wiiu/apps/appstore"
3442#define ELF_PATH HBAS_PATH " /hbas.elf"
3543#define RPX_PATH HBAS_PATH " /appstore.rpx"
@@ -39,7 +47,22 @@ int main(int argc, char* argv[])
3947 // "migrate" old elf users over to rpx (should've been done last version)
4048 struct stat sbuff;
4149 if (stat (ELF_PATH, &sbuff) == 0 )
42- std::rename (ELF_PATH, RPX_PATH);
50+ {
51+ // hbas.elf exists... what should we do about it?
52+ if (stat (RPX_PATH, &sbuff) == 0 )
53+ {
54+ // rpx is here, we can just delete hbas.elf
55+ // if we really have to, we can have wiiu-hbas.elf later for nostalgic people for the old version
56+ int re = std::remove (ELF_PATH);
57+ printf (" Status removing folder... %d, %d: %s\n " , re, errno, strerror (errno));
58+ }
59+ else
60+ {
61+ // no rpx, let's move our elf there
62+ int re = std::rename (ELF_PATH, RPX_PATH);
63+ printf (" Status renaming folder... %d, %d: %s\n " , re, errno, strerror (errno));
64+ }
65+ }
4366#endif
4467
4568 init_networking ();
@@ -62,7 +85,7 @@ int main(int argc, char* argv[])
6285 while (events->update ()) {
6386 cliMode |= (events->held (L_BUTTON) || events->held (R_BUTTON));
6487 }
65- SDL_Delay (32 );
88+ SDL_Delay (16 );
6689 }
6790
6891 if (cliMode)
@@ -72,6 +95,9 @@ int main(int argc, char* argv[])
7295 console_main (display, events);
7396 running = false ;
7497 }
98+ else
99+ // start music (only if MUSIC defined)
100+ display->initAndStartMusic ();
75101
76102 DownloadQueue::init ();
77103
@@ -132,5 +158,9 @@ int main(int argc, char* argv[])
132158 socketExit ();
133159#endif
134160
161+ #if defined(__WIIU__)
162+ // WHBLogUdpDeinit();
163+ #endif
164+
135165 return 0 ;
136166}
0 commit comments