diff --git a/Makefile b/Makefile index 33681ad3..74906505 100644 --- a/Makefile +++ b/Makefile @@ -19,17 +19,20 @@ TARGET := boot BUILD := build SOURCES := source \ source/banner \ + source/channel \ source/cheats \ source/config \ source/data \ source/devicemounter \ + source/devicemounter/libwbfs \ + source/fileOps \ source/gc \ source/gecko \ source/gui \ + source/homebrew \ + source/libwbfs \ source/list \ source/loader \ - source/channel \ - source/homebrew \ source/memory \ source/menu \ source/music \ @@ -37,35 +40,14 @@ SOURCES := source \ source/plugin \ source/unzip \ source/xml \ - source/wstringEx \ - source/devicemounter/libwbfs + source/wstringEx DATA := data \ data/images \ data/sounds \ data/help -INCLUDES := source \ - source/banner \ - source/cheats \ - source/config \ - source/devicemounter \ - source/gc \ - source/gecko \ - source/gui \ - source/list \ - source/loader \ - source/channel \ - source/homebrew \ - source/memory \ - source/menu \ - source/music \ - source/network \ - source/plugin \ - source/unzip \ - source/wstringEx \ - source/xml - +INCLUDES := source #--------------------------------------------------------------------------------- # Default build shell script options #--------------------------------------------------------------------------------- diff --git a/source/banner/AnimatedBanner.cpp b/source/banner/AnimatedBanner.cpp index 4270bfe3..2a2d519d 100644 --- a/source/banner/AnimatedBanner.cpp +++ b/source/banner/AnimatedBanner.cpp @@ -22,12 +22,12 @@ misrepresented as being the original software. distribution. */ #include -#include "U8Archive.h" #include "LanguageCode.h" #include "AnimatedBanner.h" -#include "text.hpp" -#include "lz77.h" -#include "ash.h" +#include "gui/text.hpp" +#include "unzip/U8Archive.h" +#include "unzip/lz77.h" +#include "unzip/ash.h" AnimatedBanner::AnimatedBanner() { diff --git a/source/banner/AnimatedBanner.h b/source/banner/AnimatedBanner.h index 272ddb09..bacf2441 100644 --- a/source/banner/AnimatedBanner.h +++ b/source/banner/AnimatedBanner.h @@ -26,8 +26,8 @@ distribution. #define _ANIMATEDBANNER_H_ #include "Layout.h" -#include "disc.h" #include "channel/banner.h" +#include "loader/disc.h" class AnimatedBanner { diff --git a/source/banner/BannerTools.h b/source/banner/BannerTools.h index 60a15768..8721d1c4 100644 --- a/source/banner/BannerTools.h +++ b/source/banner/BannerTools.h @@ -25,7 +25,7 @@ distribution. #define BANNER_TOOLS_H_ #include -#include "gecko.h" +#include "gecko/gecko.h" #define MAKE_FOURCC(a, b, c, d) ((a) * (1 << 24) + (b) * (1 << 16) + (c) * (1 << 8) + (d) * (1 << 0)) diff --git a/source/banner/BannerWindow.cpp b/source/banner/BannerWindow.cpp index 06f56614..de7a85a8 100644 --- a/source/banner/BannerWindow.cpp +++ b/source/banner/BannerWindow.cpp @@ -16,10 +16,10 @@ ****************************************************************************/ #include #include "BannerWindow.hpp" -#include "menu.hpp" -#include "utils.h" #include "gx_addons.h" -#include "gecko.h" +#include "gecko/gecko.h" +#include "loader/utils.h" +#include "menu/menu.hpp" BannerWindow *m_banner; diff --git a/source/banner/BannerWindow.hpp b/source/banner/BannerWindow.hpp index 89015fb7..2eea5a92 100644 --- a/source/banner/BannerWindow.hpp +++ b/source/banner/BannerWindow.hpp @@ -19,11 +19,11 @@ #include -#include "disc.h" #include "AnimatedBanner.h" -#include "gui_sound.h" -#include "video.hpp" #include "channel/banner.h" +#include "gui/video.hpp" +#include "loader/disc.h" +#include "music/gui_sound.h" #define FAVORITE_STARS 5 diff --git a/source/banner/Layout.cpp b/source/banner/Layout.cpp index 629c26f8..e6ddba62 100644 --- a/source/banner/Layout.cpp +++ b/source/banner/Layout.cpp @@ -23,7 +23,7 @@ distribution. */ #include "Layout.h" #include "WiiFont.h" -#include "U8Archive.h" +#include "unzip/U8Archive.h" Layout::Layout(u8 *font1, u8 *font2) : header(0) diff --git a/source/channel/MD5.c b/source/channel/MD5.c index ab2d7930..1ba17155 100644 --- a/source/channel/MD5.c +++ b/source/channel/MD5.c @@ -84,7 +84,6 @@ #include #include "MD5.h" -#include "mem2.hpp" /* -------------------------------------------------------------------------- ** * Static Constants: diff --git a/source/channel/banner.cpp b/source/channel/banner.cpp index 2aab7d54..3cb966ca 100644 --- a/source/channel/banner.cpp +++ b/source/channel/banner.cpp @@ -32,12 +32,12 @@ #include #include -#include "memory/smartptr.hpp" #include "banner.h" #include "MD5.h" +#include "gecko/gecko.h" #include "loader/fs.h" -#include "gecko.h" -#include "U8Archive.h" +#include "memory/smartptr.hpp" +#include "unzip/U8Archive.h" #define IMET_OFFSET 0x40 #define IMET_SIGNATURE 0x494d4554 diff --git a/source/channel/channel_launcher.c b/source/channel/channel_launcher.c index e681b8f7..b0db7555 100644 --- a/source/channel/channel_launcher.c +++ b/source/channel/channel_launcher.c @@ -1,18 +1,18 @@ -#include "channel_launcher.h" #include #include #include #include -#include "disc.h" -#include "patchcode.h" -#include "videopatch.h" -#include "fst.h" -#include "lz77.h" -#include "utils.h" -#include "fs.h" -#include "gecko.h" +#include "channel_launcher.h" +#include "gecko/gecko.h" +#include "loader/disc.h" +#include "loader/fs.h" +#include "loader/fst.h" +#include "loader/patchcode.h" +#include "loader/utils.h" +#include "loader/videopatch.h" +#include "unzip/lz77.h" void __Disc_SetLowMem(void); void __Disc_SetTime(void); diff --git a/source/channel/channels.cpp b/source/channel/channels.cpp index c2f1cfa3..382ded71 100644 --- a/source/channel/channels.cpp +++ b/source/channel/channels.cpp @@ -25,22 +25,19 @@ * * for WiiXplorer 2010 ***************************************************************************/ - -#include "mem2.hpp" - #include #include #include +#include "channel_launcher.h" #include "channels.h" #include "banner.h" -#include "wstringEx.hpp" -#include "gecko.h" -#include "fs.h" -#include "config.hpp" -#include "text.hpp" - -#include "channel_launcher.h" +#include "config/config.hpp" +#include "gecko/gecko.h" +#include "gui/text.hpp" +#include "loader/fs.h" +#include "memory/mem2.hpp" +#include "wstringEx/wstringEx.hpp" #define DOWNLOADED_CHANNELS 0x00010001 #define SYSTEM_CHANNELS 0x00010002 diff --git a/source/channel/channels.h b/source/channel/channels.h index bf919281..398a757e 100644 --- a/source/channel/channels.h +++ b/source/channel/channels.h @@ -32,7 +32,7 @@ #include #include -#include "smartptr.hpp" +#include "memory/smartptr.hpp" #include "banner.h" #define IMET_MAX_NAME_LEN 0x2a diff --git a/source/channel/nand.cpp b/source/channel/nand.cpp index afd17aa4..28bc837c 100644 --- a/source/channel/nand.cpp +++ b/source/channel/nand.cpp @@ -36,9 +36,9 @@ #include #include "nand.hpp" -#include "wbfs.h" -#include "gecko.h" -#include "fileOps.h" +#include "fileOps/fileOps.h" +#include "gecko/gecko.h" +#include "loader/wbfs.h" u8 *confbuffer ATTRIBUTE_ALIGN(32); u8 CCode[0x1008]; diff --git a/source/config/config.cpp b/source/config/config.cpp index 84ee2c03..fddaa3f2 100644 --- a/source/config/config.cpp +++ b/source/config/config.cpp @@ -2,9 +2,8 @@ #include #include "config.hpp" -#include "text.hpp" -#include "DeviceHandler.hpp" -#include "gecko.h" +#include "gecko/gecko.h" +#include "gui/text.hpp" static const char *g_whitespaces = " \f\n\r\t\v"; static const int g_floatPrecision = 10; diff --git a/source/config/config.hpp b/source/config/config.hpp index a1a8668a..9abb8840 100644 --- a/source/config/config.hpp +++ b/source/config/config.hpp @@ -4,13 +4,10 @@ #include #include - -#include "video.hpp" -#include "smartptr.hpp" -#include "wstringEx.hpp" - -class CColor; -class Vector3D; +#include +#include "gui/vector.hpp" +#include "gui/video.hpp" +#include "wstringEx/wstringEx.hpp" class Config { diff --git a/source/devicemounter/DeviceHandler.cpp b/source/devicemounter/DeviceHandler.cpp index c6b3a9c9..b98a4950 100644 --- a/source/devicemounter/DeviceHandler.cpp +++ b/source/devicemounter/DeviceHandler.cpp @@ -29,11 +29,11 @@ #include #include #include -#include "cios.h" #include "DeviceHandler.hpp" -#include "wbfs.h" -#include "usbstorage.h" #include "sdhc.h" +#include "usbstorage.h" +#include "loader/cios.h" +#include "loader/wbfs.h" DeviceHandler * DeviceHandler::instance = NULL; diff --git a/source/devicemounter/PartitionHandle.cpp b/source/devicemounter/PartitionHandle.cpp index fac21f7e..d0f40f33 100644 --- a/source/devicemounter/PartitionHandle.cpp +++ b/source/devicemounter/PartitionHandle.cpp @@ -28,15 +28,15 @@ #include #include #include -#include "cios.h" #include "PartitionHandle.h" -#include "utils.h" #include "ntfs.h" #include "fat.h" #include "ext2.h" -#include "wbfs.h" -#include "usbstorage.h" #include "sdhc.h" +#include "usbstorage.h" +#include "loader/cios.h" +#include "loader/utils.h" +#include "loader/wbfs.h" #define PARTITION_TYPE_DOS33_EXTENDED 0x05 /* DOS 3.3+ extended partition */ #define PARTITION_TYPE_WIN95_EXTENDED 0x0F /* Windows 95 extended partition */ diff --git a/source/devicemounter/usbstorage.c b/source/devicemounter/usbstorage.c index 9eb9846e..8b16d7ff 100644 --- a/source/devicemounter/usbstorage.c +++ b/source/devicemounter/usbstorage.c @@ -27,15 +27,13 @@ distribution. -------------------------------------------------------------*/ - #include #include #include #include -#include "usbstorage.h" -#include "memory/mem2.hpp" -#include "gecko.h" +#include "usbstorage.h" +#include "gecko/gecko.h" /* IOCTL commands */ #define UMS_BASE (('U'<<24)|('M'<<16)|('S'<<8)) diff --git a/source/gc/fileOps.c b/source/fileOps/fileOps.c similarity index 93% rename from source/gc/fileOps.c rename to source/fileOps/fileOps.c index e770591a..134219cd 100644 --- a/source/gc/fileOps.c +++ b/source/fileOps/fileOps.c @@ -17,9 +17,9 @@ en exposed s_fsop fsop structure can be used by callback to update operation sta #include #include -#include "fileOps.h" -#include "utils.h" -#include "gecko.h" +#include "fileOps/fileOps.h" +#include "gecko/gecko.h" +#include "loader/utils.h" #define SET(a, b) a = b; DCFlushRange(&a, sizeof(a)); #define STACKSIZE 8192 diff --git a/source/gc/fileOps.h b/source/fileOps/fileOps.h similarity index 100% rename from source/gc/fileOps.h rename to source/fileOps/fileOps.h diff --git a/source/gc/gc.c b/source/gc/gc.cpp similarity index 86% rename from source/gc/gc.c rename to source/gc/gc.cpp index 8b00536f..7126b765 100644 --- a/source/gc/gc.c +++ b/source/gc/gc.cpp @@ -1,3 +1,19 @@ +/**************************************************************************** + * Copyright (C) 2012 FIX94 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + ****************************************************************************/ #include #include #include @@ -11,10 +27,10 @@ #include #include -#include "gc.h" -#include "gecko.h" -#include "fileOps.h" -#include "utils.h" +#include "gc/gc.hpp" +#include "gecko/gecko.h" +#include "fileOps/fileOps.h" +#include "loader/utils.h" #include "loader/disc.h" // DIOS-MIOS @@ -142,7 +158,7 @@ void DML_New_WriteOptions() // Devolution u8 *loader_bin = NULL; -extern void __exception_closeall(); +extern "C" { extern void __exception_closeall(); } static gconfig *DEVO_CONFIG = (gconfig*)0x80000020; #define DEVO_Entry() ((void(*)(void))loader_bin)() @@ -182,8 +198,9 @@ void DEVO_SetOptions(const char *isopath, const char *partition, const char *loa fseek(f, 0, SEEK_END); u32 size = ftell(f); rewind(f); - loader_bin = malloc(size); + loader_bin = (u8*)memalign(32, size); fread(loader_bin, 1, size, f); + DCFlushRange(loader_bin, ALIGN32(size)); fclose(f); } else @@ -301,9 +318,11 @@ void DEVO_Boot() #define SRAM_ITALIAN 4 #define SRAM_DUTCH 5 +extern "C" { syssram* __SYS_LockSram(); u32 __SYS_UnlockSram(u32 write); u32 __SYS_SyncSram(void); +} void GC_SetVideoMode(u8 videomode, u8 videoSetting) { diff --git a/source/gc/gc.h b/source/gc/gc.hpp similarity index 67% rename from source/gc/gc.h rename to source/gc/gc.hpp index b1181138..e81783fc 100644 --- a/source/gc/gc.h +++ b/source/gc/gc.hpp @@ -1,10 +1,23 @@ -#ifdef __cplusplus -extern "C" -{ -#endif +/**************************************************************************** + * Copyright (C) 2012 FIX94 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + ****************************************************************************/ +#ifndef _GC_HPP_ +#define _GC_HPP_ -#ifndef GC_H_ -#define GC_H_ +#include // DIOS-MIOS typedef struct DML_CFG @@ -76,8 +89,4 @@ void GC_SetVideoMode(u8 videomode, u8 videoSetting); void GC_SetLanguage(u8 lang); int GC_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir); -#endif //GC_H_ - -#ifdef __cplusplus -} -#endif \ No newline at end of file +#endif //_GC_HPP_ diff --git a/source/gc/gcdisc.cpp b/source/gc/gcdisc.cpp index a9034cd1..7e2d95e3 100644 --- a/source/gc/gcdisc.cpp +++ b/source/gc/gcdisc.cpp @@ -19,11 +19,11 @@ #include #include +#include "gc.hpp" #include "gcdisc.hpp" #include "loader/gc_disc_dump.hpp" -#include "mem2.hpp" -#include "gecko.h" -#include "gc.h" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" using namespace std; diff --git a/source/gecko/gecko.c b/source/gecko/gecko.c index cc82c595..e8e10d5e 100644 --- a/source/gecko/gecko.c +++ b/source/gecko/gecko.c @@ -10,8 +10,9 @@ #include #include -#include "mem2.hpp" +#include "gecko.h" #include "wifi_gecko.h" +#include "memory/mem2.hpp" /* init-globals */ bool geckoinit = false; @@ -175,11 +176,11 @@ bool InitGecko() u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1); if(geckoattached) { + geckoinit = true; usb_flush(EXI_CHANNEL_1); - return true; + puts("USB Gecko inited."); } - else - return false; + return geckoinit; } void AllocSDGeckoBuffer() diff --git a/source/gecko/gecko.h b/source/gecko/gecko.h index 564229cc..1d01fa64 100644 --- a/source/gecko/gecko.h +++ b/source/gecko/gecko.h @@ -6,7 +6,8 @@ extern "C" { #endif -extern bool geckoinit; +#include + extern bool bufferMessages; extern bool WriteToSD; diff --git a/source/gecko/wifi_gecko.c b/source/gecko/wifi_gecko.c index d30055d6..8b547668 100644 --- a/source/gecko/wifi_gecko.c +++ b/source/gecko/wifi_gecko.c @@ -31,6 +31,7 @@ #include #include #include "wifi_gecko.h" +#include "loader/utils.h" // set to use TCP socket instead of UDP #define WIFI_GECKO_USE_TCP (0) diff --git a/source/gecko/wifi_gecko.h b/source/gecko/wifi_gecko.h index 130e53c5..970d6e23 100644 --- a/source/gecko/wifi_gecko.h +++ b/source/gecko/wifi_gecko.h @@ -26,8 +26,6 @@ #ifndef WIFI_GECKO_H_ #define WIFI_GECKO_H_ -#include "utils.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/source/gui/FreeTypeGX.cpp b/source/gui/FreeTypeGX.cpp index 8e25daad..84ac1c29 100644 --- a/source/gui/FreeTypeGX.cpp +++ b/source/gui/FreeTypeGX.cpp @@ -18,12 +18,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with FreeTypeGX. If not, see . */ - -#include "FreeTypeGX.h" - -#include "mem2.hpp" - #include +#include "FreeTypeGX.h" +#include "memory/mem2.hpp" /** * Default constructor for the FreeTypeGX class. diff --git a/source/gui/FreeTypeGX.h b/source/gui/FreeTypeGX.h index 5f732ebe..06e593df 100644 --- a/source/gui/FreeTypeGX.h +++ b/source/gui/FreeTypeGX.h @@ -155,7 +155,7 @@ #include #include FT_FREETYPE_H #include FT_BITMAP_H -#include "utils.h" +#include "loader/utils.h" #include #include diff --git a/source/gui/GameTDB.cpp b/source/gui/GameTDB.cpp index c65ff90b..7e441b67 100644 --- a/source/gui/GameTDB.cpp +++ b/source/gui/GameTDB.cpp @@ -26,11 +26,11 @@ #include #include #include "GameTDB.hpp" -#include "config.hpp" #include "video.hpp" -#include "gecko.h" #include "defines.h" #include "text.hpp" +#include "config/config.hpp" +#include "gecko/gecko.h" #define NAME_OFFSET_DB "gametdb_offsets.bin" #define MAXREADSIZE 1024*1024 //Cache size only for parsing the offsets: 1MB diff --git a/source/gui/WiiMovie.cpp b/source/gui/WiiMovie.cpp index f383e7f1..e61356ab 100644 --- a/source/gui/WiiMovie.cpp +++ b/source/gui/WiiMovie.cpp @@ -27,11 +27,10 @@ ***************************************************************************/ #include #include -#include "wiiuse/wpad.h" #include "WiiMovie.hpp" -#include "gecko.h" -#include "mem2.hpp" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" #define SND_BUFFERS 8 #define FRAME_BUFFERS 8 diff --git a/source/gui/WiiMovie.hpp b/source/gui/WiiMovie.hpp index ab62ecb3..89e00b92 100644 --- a/source/gui/WiiMovie.hpp +++ b/source/gui/WiiMovie.hpp @@ -4,7 +4,7 @@ #include "gcvid.h" #include "Timer.h" #include "texture.hpp" -#include "BufferCircle.hpp" +#include "music/BufferCircle.hpp" using namespace std; diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index 1baa2093..296ad914 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -11,11 +11,11 @@ #include "coverflow.hpp" #include "pngu.h" #include "boxmesh.hpp" -#include "wstringEx.hpp" #include "lockMutex.hpp" #include "fonts.h" -#include "gecko.h" #include "types.h" +#include "gecko/gecko.h" +#include "wstringEx/wstringEx.hpp" extern const u8 dvdskin_jpg[]; extern const u32 dvdskin_jpg_size; diff --git a/source/gui/coverflow.hpp b/source/gui/coverflow.hpp index 4580b99f..36d62b32 100644 --- a/source/gui/coverflow.hpp +++ b/source/gui/coverflow.hpp @@ -11,13 +11,13 @@ #include #include "video.hpp" -#include "smartptr.hpp" #include "FreeTypeGX.h" #include "text.hpp" -#include "config.hpp" -#include "gui_sound.h" -#include "disc.h" -#include "utils.h" +#include "config/config.hpp" +#include "loader/disc.h" +#include "loader/utils.h" +#include "memory/smartptr.hpp" +#include "music/gui_sound.h" using namespace std; diff --git a/source/gui/fanart.cpp b/source/gui/fanart.cpp index b32a9071..4f3b61f0 100644 --- a/source/gui/fanart.cpp +++ b/source/gui/fanart.cpp @@ -2,7 +2,7 @@ #include "pngu.h" #include "boxmesh.hpp" #include "text.hpp" -#include "gecko.h" +#include "gecko/gecko.h" using namespace std; diff --git a/source/gui/fanart.hpp b/source/gui/fanart.hpp index 105e5cbb..35397299 100644 --- a/source/gui/fanart.hpp +++ b/source/gui/fanart.hpp @@ -7,9 +7,9 @@ #include #include -#include "config.hpp" -#include "texture.hpp" #include "gui.hpp" +#include "texture.hpp" +#include "config/config.hpp" class CFanartElement { diff --git a/source/gui/gcvid.cpp b/source/gui/gcvid.cpp index f6f5e7ae..018602d2 100644 --- a/source/gui/gcvid.cpp +++ b/source/gui/gcvid.cpp @@ -32,8 +32,8 @@ #include #include "gcvid.h" -#include "utils.h" -#include "mem2.hpp" +#include "loader/utils.h" +#include "memory/mem2.hpp" using namespace std; @@ -784,18 +784,13 @@ void decodeRealJpeg(const u8* data, int size, VideoFrame& dest) jpeg_read_header(&cinfo, TRUE); -#if 1 - //set quality/speed parameters to speed: - cinfo.do_fancy_upsampling = FALSE; - cinfo.do_block_smoothing = FALSE; - - //this actually slows decoding down: - //cinfo.dct_method = JDCT_FASTEST; -#endif + cinfo.do_fancy_upsampling = TRUE; + cinfo.do_block_smoothing = TRUE; + cinfo.dct_method = JDCT_ISLOW; jpeg_start_decompress(&cinfo); - dest.resize(cinfo.output_width, cinfo.output_height); + dest.resize(ALIGN(4, cinfo.output_width), ALIGN(4, cinfo.output_height)); if(cinfo.num_components == 3) { diff --git a/source/gui/gui.hpp b/source/gui/gui.hpp index 765e32ba..304d1543 100644 --- a/source/gui/gui.hpp +++ b/source/gui/gui.hpp @@ -4,15 +4,15 @@ #ifndef __GUI_HPP #define __GUI_HPP -#include "wiiuse/wpad.h" #include +#include "wiiuse/wpad.h" #include "video.hpp" #include "FreeTypeGX.h" -#include "wstringEx.hpp" -#include "smartptr.hpp" #include "text.hpp" -#include "gui_sound.h" +#include "memory/smartptr.hpp" +#include "music/gui_sound.h" +#include "wstringEx/wstringEx.hpp" struct SButtonTextureSet { diff --git a/source/gui/pngu.c b/source/gui/pngu.c index d6cdbc16..0ff20638 100644 --- a/source/gui/pngu.c +++ b/source/gui/pngu.c @@ -13,15 +13,14 @@ More info : http://frontier-dev.net #include "pngu.h" #include "png.h" -#include "mem2.hpp" -#include "utils.h" #include "gecko/gecko.h" +#include "loader/utils.h" +#include "memory/mem2.hpp" // Constants #define PNGU_SOURCE_BUFFER 1 #define PNGU_SOURCE_DEVICE 2 - // Prototypes of helper functions int pngu_info (IMGCTX ctx); int pngu_decode (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, PNGU_u32 stripAlpha, int force32bits); @@ -30,7 +29,6 @@ void pngu_read_data_from_buffer (png_structp png_ptr, png_bytep data, png_size_t void pngu_write_data_to_buffer (png_structp png_ptr, png_bytep data, png_size_t length); int pngu_clamp (int value, int min, int max); - // PNGU Image context struct struct _IMGCTX { diff --git a/source/gui/text.hpp b/source/gui/text.hpp index afac5c8d..f6fd9b48 100644 --- a/source/gui/text.hpp +++ b/source/gui/text.hpp @@ -5,11 +5,10 @@ #include #include -#include "wstringEx.hpp" #include "FreeTypeGX.h" #include "video.hpp" - -#include "smartptr.hpp" +#include "memory/smartptr.hpp" +#include "wstringEx/wstringEx.hpp" using namespace std; diff --git a/source/gui/texture.hpp b/source/gui/texture.hpp index e1ce54d0..a7abccac 100644 --- a/source/gui/texture.hpp +++ b/source/gui/texture.hpp @@ -4,7 +4,7 @@ #include -#include "smartptr.hpp" +#include "memory/smartptr.hpp" struct STexture { diff --git a/source/gui/video.cpp b/source/gui/video.cpp index dd8cddef..57366993 100644 --- a/source/gui/video.cpp +++ b/source/gui/video.cpp @@ -1,9 +1,11 @@ -#include "pngu.h" -#include "video.hpp" + #include + +#include "video.hpp" +#include "pngu.h" #include "Gekko.h" -#include "gecko.h" -#include "utils.h" +#include "gecko/gecko.h" +#include "loader/utils.h" #define DEFAULT_FIFO_SIZE (256 * 1024) @@ -119,11 +121,9 @@ void CVideo::setAA(u8 aa, bool alpha, int width, int height) void CVideo::init(void) { VIDEO_Init(); - VIDEO_SetBlack(TRUE); m_wide = CONF_GetAspectRatio() == CONF_ASPECT_16_9; m_rmode = VIDEO_GetPreferredMode(NULL); u32 type = CONF_GetVideo(); - m_50hz = false; if(m_rmode == &TVPal528IntDf) { @@ -133,7 +133,7 @@ void CVideo::init(void) m_rmode->viWidth = m_wide ? 700 : 672; //CONF_VIDEO_NTSC and CONF_VIDEO_MPAL and m_rmode TVEurgb60Hz480IntDf are the same max height and width. - if (type == CONF_VIDEO_PAL && m_rmode != &TVEurgb60Hz480IntDf) + if(type == CONF_VIDEO_PAL && m_rmode != &TVEurgb60Hz480IntDf) { m_rmode->viHeight = VI_MAX_HEIGHT_PAL; m_rmode->viXOrigin = (VI_MAX_WIDTH_PAL - m_rmode->viWidth) / 2; @@ -147,15 +147,22 @@ void CVideo::init(void) } s8 hoffset = 0; //Use horizontal offset set in wii menu. - if (CONF_GetDisplayOffsetH(&hoffset) == 0) + if(CONF_GetDisplayOffsetH(&hoffset) == 0) m_rmode->viXOrigin += hoffset; + VIDEO_Configure(m_rmode); + VIDEO_SetBlack(FALSE); + VIDEO_Flush(); + VIDEO_WaitVSync(); + if(m_rmode->viTVMode & VI_NON_INTERLACE) + VIDEO_WaitVSync(); + else while(VIDEO_GetNextField()) + VIDEO_WaitVSync(); + m_frameBuf[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode)); m_frameBuf[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode)); - VIDEO_Configure(m_rmode); - VIDEO_Flush(); m_curFB = 0; - m_fifo = MEM1_memalign(32, DEFAULT_FIFO_SIZE); + m_fifo = memalign(32, DEFAULT_FIFO_SIZE); memset(m_fifo, 0, DEFAULT_FIFO_SIZE); GX_Init(m_fifo, DEFAULT_FIFO_SIZE); GX_SetCopyClear(CColor(0), 0x00FFFFFF); @@ -185,15 +192,9 @@ void CVideo::init(void) GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); for(u32 i = 0; i < 8; i++) GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0+i, GX_TEX_ST, GX_F32, 0); - _clearScreen(); - VIDEO_SetBlack(FALSE); - VIDEO_Flush(); - VIDEO_WaitVSync(); - if(m_rmode->viTVMode & VI_NON_INTERLACE) - VIDEO_WaitVSync(); - - m_stencil = MEM1_memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight); + m_stencil = memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight); memset(m_stencil, 0, CVideo::_stencilWidth * CVideo::_stencilHeight); + _clearScreen(); } void CVideo::_clearScreen() diff --git a/source/gui/video.hpp b/source/gui/video.hpp index d166afa4..19aeb4d9 100644 --- a/source/gui/video.hpp +++ b/source/gui/video.hpp @@ -5,7 +5,7 @@ #include #include -#include "smartptr.hpp" +#include "memory/smartptr.hpp" #include "vector.hpp" #include "texture.hpp" diff --git a/source/homebrew/homebrew.cpp b/source/homebrew/homebrew.cpp index ecf834db..ce0f9831 100644 --- a/source/homebrew/homebrew.cpp +++ b/source/homebrew/homebrew.cpp @@ -5,9 +5,9 @@ #include #include #include -#include "smartptr.hpp" -#include "gecko.h" -#include "mem2.hpp" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" +#include "memory/smartptr.hpp" #define EXECUTE_ADDR ((u8 *)0x92000000) #define BOOTER_ADDR ((u8 *)0x93000000) diff --git a/source/devicemounter/libwbfs/libwbfs.c b/source/libwbfs/libwbfs.c similarity index 100% rename from source/devicemounter/libwbfs/libwbfs.c rename to source/libwbfs/libwbfs.c diff --git a/source/devicemounter/libwbfs/libwbfs.h b/source/libwbfs/libwbfs.h similarity index 100% rename from source/devicemounter/libwbfs/libwbfs.h rename to source/libwbfs/libwbfs.h diff --git a/source/devicemounter/libwbfs/libwbfs_os.h b/source/libwbfs/libwbfs_os.h similarity index 94% rename from source/devicemounter/libwbfs/libwbfs_os.h rename to source/libwbfs/libwbfs_os.h index ff0bd8f0..f16bc562 100644 --- a/source/devicemounter/libwbfs/libwbfs_os.h +++ b/source/libwbfs/libwbfs_os.h @@ -9,10 +9,10 @@ #include #include -#include "utils.h" -#include "mem2.hpp" #include "gecko/gecko.h" #include "loader/disc.h" +#include "loader/utils.h" +#include "memory/mem2.hpp" #define wbfs_fatal(x) do { gprintf(x); wd_last_error = 1; } while(0) #define wbfs_error(x) do { gprintf(x); wd_last_error = 2; } while(0) diff --git a/source/devicemounter/libwbfs/rijndael.c b/source/libwbfs/rijndael.c similarity index 100% rename from source/devicemounter/libwbfs/rijndael.c rename to source/libwbfs/rijndael.c diff --git a/source/devicemounter/libwbfs/wiidisc.c b/source/libwbfs/wiidisc.c similarity index 100% rename from source/devicemounter/libwbfs/wiidisc.c rename to source/libwbfs/wiidisc.c diff --git a/source/devicemounter/libwbfs/wiidisc.h b/source/libwbfs/wiidisc.h similarity index 100% rename from source/devicemounter/libwbfs/wiidisc.h rename to source/libwbfs/wiidisc.h diff --git a/source/list/cache.hpp b/source/list/cache.hpp index 3a700419..635254dd 100644 --- a/source/list/cache.hpp +++ b/source/list/cache.hpp @@ -5,7 +5,7 @@ #include #include #include -#include "disc.h" +#include "loader/disc.h" //#include "gecko.h" using namespace std; diff --git a/source/list/cachedlist.cpp b/source/list/cachedlist.cpp index f1548cc7..246fc939 100644 --- a/source/list/cachedlist.cpp +++ b/source/list/cachedlist.cpp @@ -97,10 +97,8 @@ void CachedList::Load(string path, string containing, string m_lastLanguage, m_update = false; if(!music && pathlist.size() > 0) - { Save(); - pathlist.clear(); - } + pathlist.clear(); } else { diff --git a/source/list/cachedlist.hpp b/source/list/cachedlist.hpp index 117ad8ea..10ace70c 100644 --- a/source/list/cachedlist.hpp +++ b/source/list/cachedlist.hpp @@ -3,8 +3,8 @@ #include "list.hpp" #include "cache.hpp" -#include "gecko.h" #include "config/config.hpp" +#include "gecko/gecko.h" using namespace std; diff --git a/source/list/list.cpp b/source/list/list.cpp index 7b5930a0..7ff5e6a3 100644 --- a/source/list/list.cpp +++ b/source/list/list.cpp @@ -1,11 +1,11 @@ #include "list.hpp" -#include "gecko.h" -#include "GameTDB.hpp" -#include "config.hpp" #include "types.h" -#include "channels.h" -#include "gc.h" -#include "fileOps.h" +#include "channel/channels.h" +#include "config/config.hpp" +#include "fileOps/fileOps.h" +#include "gecko/gecko.h" +#include "gc/gc.hpp" +#include "gui/GameTDB.hpp" template void CList::GetPaths(vector &pathlist, string containing, string directory, bool wbfs_fs, bool dml, bool depth_limit) diff --git a/source/list/list.hpp b/source/list/list.hpp index 2e0b0384..d2e90a44 100644 --- a/source/list/list.hpp +++ b/source/list/list.hpp @@ -8,13 +8,13 @@ #include #include -#include "DeviceHandler.hpp" -#include "wbfs_ext.h" -#include "libwbfs/libwbfs.h" -#include "disc.h" -#include "text.hpp" #include "cache.hpp" #include "config/config.hpp" +#include "devicemounter/DeviceHandler.hpp" +#include "gui/text.hpp" +#include "loader/disc.h" +#include "loader/wbfs_ext.h" +#include "libwbfs/libwbfs.h" template class CList diff --git a/source/loader/alt_ios.cpp b/source/loader/alt_ios.cpp index 5cffc265..c4c2d685 100644 --- a/source/loader/alt_ios.cpp +++ b/source/loader/alt_ios.cpp @@ -1,16 +1,16 @@ #include -#include "DeviceHandler.hpp" -#include "wdvd.h" -#include "disc.h" -#include "usbstorage.h" -#include "mem2.hpp" #include "alt_ios.h" +#include "cios.h" +#include "disc.h" #include "sys.h" #include "wbfs.h" -#include "gecko.h" -#include "cios.h" +#include "wdvd.h" +#include "devicemounter/DeviceHandler.hpp" +#include "devicemounter/usbstorage.h" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" #include "types.h" // mload from uloader by Hermes diff --git a/source/loader/apploader.c b/source/loader/apploader.c index e05d6cdc..9b1b20c0 100644 --- a/source/loader/apploader.c +++ b/source/loader/apploader.c @@ -1,6 +1,8 @@ + #include #include -#include +#include + #include "mload_modules.h" #include "apploader.h" #include "wdvd.h" @@ -10,10 +12,10 @@ #include "wip.h" #include "wbfs.h" #include "sys.h" -#include "gecko.h" #include "fst.h" #include "cios.h" #include "types.h" +#include "gecko/gecko.h" /* Apploader function pointers */ typedef int (*app_main)(void **dst, int *size, int *offset); diff --git a/source/loader/cios.c b/source/loader/cios.c index a02cfcda..317994a7 100644 --- a/source/loader/cios.c +++ b/source/loader/cios.c @@ -23,7 +23,6 @@ * 3. This notice may not be removed or altered from any source * distribution. ***************************************************************************/ - #include #include #include @@ -31,9 +30,10 @@ #include "cios.h" #include "utils.h" -#include "gecko.h" #include "fs.h" #include "mload.h" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" static bool checked = false; static bool neek = false; @@ -83,10 +83,9 @@ signed_blob *GetTMD(u8 ios, u32 *TMD_Length) if(ES_GetStoredTMDSize(TITLE_ID(1, ios), TMD_Length) < 0) return NULL; - signed_blob *TMD = (signed_blob*)memalign(32, ALIGN32(*TMD_Length)); + signed_blob *TMD = (signed_blob*)MEM2_alloc(*TMD_Length); if(TMD == NULL) return NULL; - if(ES_GetStoredTMD(TITLE_ID(1, ios), TMD, *TMD_Length) < 0) { free(TMD); @@ -149,13 +148,13 @@ int get_ios_type(u8 slot) free(TMD_Buffer); return IOS_TYPE_NO_CIOS; } + u32 title_rev = iosTMD->title_version; + free(TMD_Buffer); + iosTMD = NULL; iosinfo_t *info = GetInfo(slot); if(info == NULL) - { - free(TMD_Buffer); return IOS_TYPE_NO_CIOS; - } free(info); u8 base = 0; @@ -165,7 +164,7 @@ int get_ios_type(u8 slot) case 223: case 224: case 225: - if(iosTMD->title_version == 1) + if(title_rev == 1) return IOS_TYPE_KWIIRK; else return IOS_TYPE_HERMES; @@ -186,7 +185,6 @@ int get_ios_type(u8 slot) else return IOS_TYPE_NO_CIOS; } - free(TMD_Buffer); } int is_ios_type(int type, u8 slot) diff --git a/source/loader/disc.c b/source/loader/disc.c index 18e51f36..faae5453 100644 --- a/source/loader/disc.c +++ b/source/loader/disc.c @@ -5,7 +5,6 @@ #include #include #include -#include "wiiuse/wpad.h" #include #include "apploader.h" @@ -18,13 +17,15 @@ #include "wbfs.h" #include "patchcode.h" #include "frag.h" -#include "usbstorage.h" #include "wip.h" -#include "memory.h" -#include "gecko.h" + #include "utils.h" #include "cios.h" +#include "devicemounter/usbstorage.h" +#include "gecko/gecko.h" +#include "memory/memory.h" + /* Constants */ #define PTABLE_OFFSET 0x40000 diff --git a/source/loader/frag.c b/source/loader/frag.c index e7e9e534..9b1dd326 100644 --- a/source/loader/frag.c +++ b/source/loader/frag.c @@ -7,17 +7,17 @@ #include "ntfs.h" #include "ntfsfile_frag.h" -#include "libwbfs/libwbfs.h" #include "wbfs.h" #include "wbfs_ext.h" -#include "usbstorage.h" #include "frag.h" #include "utils.h" #include "sys.h" #include "wdvd.h" -#include "gecko.h" #include "ext2_frag.h" #include "fatfile_frag.h" +#include "devicemounter/usbstorage.h" +#include "gecko/gecko.h" +#include "libwbfs/libwbfs.h" FragList *frag_list = NULL; diff --git a/source/loader/fst.c b/source/loader/fst.c index 885bb22b..0ff8c78a 100644 --- a/source/loader/fst.c +++ b/source/loader/fst.c @@ -18,26 +18,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - #include #include #include #include #include #include -#include "fst.h" -#include "gecko.h" +#include "fst.h" #include "sys.h" -#include "mem2.hpp" #include "patchcode.h" - #include "codehandler.h" #include "codehandleronly.h" #include "multidol.h" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" + #define FSTDIRTYPE 1 #define FSTFILETYPE 0 #define ENTRYSIZE 0xC diff --git a/source/loader/gc_disc_dump.cpp b/source/loader/gc_disc_dump.cpp index 551d04a7..2ae174bc 100644 --- a/source/loader/gc_disc_dump.cpp +++ b/source/loader/gc_disc_dump.cpp @@ -29,17 +29,17 @@ #include #include -#include "mem2.hpp" #include "gc_disc_dump.hpp" -#include "DeviceHandler.hpp" #include "disc.h" #include "utils.h" #include "wdvd.h" -#include "text.hpp" -#include "gecko.h" -#include "fileOps.h" +#include "devicemounter/DeviceHandler.hpp" +#include "fileOps/fileOps.h" +#include "gecko/gecko.h" +#include "gui/Gekko.h" +#include "gui/text.hpp" +#include "memory/mem2.hpp" #include "defines.h" -#include "Gekko.h" using namespace std; diff --git a/source/loader/mload.c b/source/loader/mload.c index 70358a16..0e5e0d79 100644 --- a/source/loader/mload.c +++ b/source/loader/mload.c @@ -16,7 +16,7 @@ */ #include "mload.h" -#include "gecko.h" +#include "gecko/gecko.h" static const char mload_fs[] ATTRIBUTE_ALIGN(32) = "/dev/mload"; diff --git a/source/loader/nk.c b/source/loader/nk.c index 0278f2d7..758cdb4d 100644 --- a/source/loader/nk.c +++ b/source/loader/nk.c @@ -28,10 +28,10 @@ #include #include -#include "mem2.hpp" #include "nk.h" #include "cios.h" #include "armboot.h" +#include "memory/mem2.hpp" s32 Launch_nk(u64 TitleID, const char *nandpath) { diff --git a/source/loader/patchcode.c b/source/loader/patchcode.c index 6f403a57..1f895611 100644 --- a/source/loader/patchcode.c +++ b/source/loader/patchcode.c @@ -26,7 +26,7 @@ #include "apploader.h" #include "patchcode.h" -#include "gecko.h" +#include "gecko/gecko.h" extern void patchhook(u32 address, u32 len); extern void patchhook2(u32 address, u32 len); diff --git a/source/loader/playlog.c b/source/loader/playlog.c index c1563f99..abaab3ed 100644 --- a/source/loader/playlog.c +++ b/source/loader/playlog.c @@ -12,7 +12,7 @@ #include #include #include -#include "gecko.h" +#include "gecko/gecko.h" #define PLAYRECPATH "/title/00000001/00000002/data/play_rec.dat" #define SECONDS_TO_2000 946684800LL diff --git a/source/loader/splits.c b/source/loader/splits.c index 4593f57c..e93ff8fd 100644 --- a/source/loader/splits.c +++ b/source/loader/splits.c @@ -12,7 +12,7 @@ #include #include "splits.h" -#include "gecko.h" +#include "gecko/gecko.h" #define off64_t off_t #define FMT_llu "%llu" diff --git a/source/loader/splits.h b/source/loader/splits.h index 6af17456..461461a8 100644 --- a/source/loader/splits.h +++ b/source/loader/splits.h @@ -3,7 +3,7 @@ extern "C" { #endif -#include "devicemounter/libwbfs/libwbfs.h" +#include "libwbfs/libwbfs.h" #define MAX_SPLIT 10 diff --git a/source/loader/sys.c b/source/loader/sys.c index b0c1b7f4..22a9500f 100644 --- a/source/loader/sys.c +++ b/source/loader/sys.c @@ -7,16 +7,15 @@ #include #include -#include "wiiuse/wpad.h" -#include "memory/mem2.hpp" -#include "memory/memory.h" -#include "sys.h" -#include "gecko.h" -#include "channel_launcher.h" #include "sha1.h" #include "fs.h" -#include "mem2.hpp" #include "mload.h" +#include "sys.h" +#include "channel/channel_launcher.h" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" +#include "memory/memory.h" +#include "wiiuse/wpad.h" /* Variables */ static bool reset = false; diff --git a/source/loader/utils.c b/source/loader/utils.c index d5d30dfe..f1d113ab 100644 --- a/source/loader/utils.c +++ b/source/loader/utils.c @@ -2,8 +2,6 @@ #include #include -#include "gecko.h" - #define MAX_BLOCKSIZE 0x10000 u64 le64(u64 x) diff --git a/source/loader/utils.h b/source/loader/utils.h index b29b5f07..e3a63376 100644 --- a/source/loader/utils.h +++ b/source/loader/utils.h @@ -34,9 +34,6 @@ u64 le64(u64); u32 le32(u32); u16 le16(u16); -typedef volatile unsigned short vu16; -typedef volatile unsigned int vu32; - bool str_replace(char *str, const char *olds, const char *news, int size); bool str_replace_all(char *str, const char *olds, const char *news, int size); diff --git a/source/loader/wbfs.c b/source/loader/wbfs.c index bbd1c266..0fb6ab64 100644 --- a/source/loader/wbfs.c +++ b/source/loader/wbfs.c @@ -9,9 +9,6 @@ #include #include -#include "libwbfs/libwbfs.h" -#include "sdhc.h" -#include "usbstorage.h" #include "utils.h" #include "wbfs.h" #include "wdvd.h" @@ -20,8 +17,12 @@ #include "wbfs_ext.h" #include "sys.h" #include "disc.h" -#include "gecko.h" -#include "mem2.hpp" + +#include "devicemounter/sdhc.h" +#include "devicemounter/usbstorage.h" +#include "libwbfs/libwbfs.h" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" /* Constants */ #define MAX_NB_SECTORS 32 diff --git a/source/loader/wbfs.h b/source/loader/wbfs.h index 6480df85..a3f26c09 100644 --- a/source/loader/wbfs.h +++ b/source/loader/wbfs.h @@ -12,7 +12,6 @@ extern "C" { #define WBFS_MIN_DEVICE 1 #define WBFS_MAX_DEVICE 2 -//also menu.hpp #define PART_FS_WBFS 0 #define PART_FS_FAT 1 #define PART_FS_NTFS 2 diff --git a/source/loader/wbfs_ext.c b/source/loader/wbfs_ext.c index 9009e031..8e7cb3ee 100644 --- a/source/loader/wbfs_ext.c +++ b/source/loader/wbfs_ext.c @@ -11,17 +11,18 @@ #include #include -#include "libwbfs/libwbfs.h" -#include "sdhc.h" -#include "usbstorage.h" #include "wbfs.h" #include "wdvd.h" #include "splits.h" #include "wbfs_ext.h" #include "utils.h" #include "disc.h" -#include "gecko.h" -#include "gc/fileOps.h" + +#include "devicemounter/sdhc.h" +#include "devicemounter/usbstorage.h" +#include "fileOps/fileOps.h" +#include "gecko/gecko.h" +#include "libwbfs/libwbfs.h" #define MAX_FAT_PATH 1024 #define TITLE_LEN 64 diff --git a/source/loader/wdvd.c b/source/loader/wdvd.c index 3cecd317..e53fd8f5 100644 --- a/source/loader/wdvd.c +++ b/source/loader/wdvd.c @@ -2,7 +2,7 @@ #include #include #include -#include "gecko.h" +#include "gecko/gecko.h" /* Constants */ #define IOCTL_DI_READID 0x70 diff --git a/source/loader/wip.c b/source/loader/wip.c index 2237236b..bcb6a157 100644 --- a/source/loader/wip.c +++ b/source/loader/wip.c @@ -3,9 +3,10 @@ #include #include #include -#include "mem2.hpp" -#include "gecko.h" + #include "wip.h" +#include "gecko/gecko.h" +#include "memory/mem2.hpp" static WIP_Code * CodeList = NULL; static u32 CodesCount = 0; diff --git a/source/main.cpp b/source/main.cpp index 647a9c77..149eec25 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,21 +1,23 @@ -#include "video.hpp" -#include "menu/menu.hpp" -#include "loader/disc.h" +#include +#include + +#include "defines.h" +#include "svnrev.h" + +#include "channel/nand.hpp" +#include "devicemounter/DeviceHandler.hpp" +#include "gecko/gecko.h" +#include "gecko/wifi_gecko.h" +#include "gui/video.hpp" +#include "gui/text.hpp" +#include "homebrew/homebrew.h" +#include "loader/disc.h" #include "loader/alt_ios.h" #include "loader/sys.h" #include "loader/wbfs.h" -#include "text.hpp" -#include -#include -#include "DeviceHandler.hpp" -#include "homebrew.h" -#include "gecko.h" -#include "wifi_gecko.h" -#include "cios.h" -#include "nand.hpp" -#include "defines.h" -#include "svnrev.h" +#include "loader/cios.h" +#include "menu/menu.hpp" CMenu *mainMenu; @@ -30,7 +32,7 @@ extern "C" int main(int argc, char **argv) { __exception_setreload(5); - geckoinit = InitGecko(); + InitGecko(); // Init video CVideo vid; @@ -98,14 +100,13 @@ int main(int argc, char **argv) if(deviceAvailable) break; usleep(50000); - } + } DeviceHandler::Instance()->MountAllUSB(); if(DeviceHandler::Instance()->IsInserted(SD)) deviceAvailable = true; #else bool deviceAvailable = true; DeviceHandler::Instance()->MountAll(); - sleep(1); #endif bool dipOK = Disc_Init() >= 0; diff --git a/source/memory/mem2.cpp b/source/memory/mem2.cpp index ec063d9e..0d57bc41 100644 --- a/source/memory/mem2.cpp +++ b/source/memory/mem2.cpp @@ -5,8 +5,8 @@ #include "mem2.hpp" #include "mem2alloc.hpp" -#include "gecko.h" -#include "utils.h" +#include "gecko/gecko.h" +#include "loader/utils.h" // Forbid the use of MEM2 through malloc u32 MALLOC_MEM2 = 0; @@ -74,6 +74,12 @@ void *MEM2_alloc(unsigned int s) return g_mem2gp.allocate(s); } +/* Placeholder, will be needed with new memory manager */ +void *MEM2_memalign(unsigned int /* alignment */, unsigned int s) +{ + return MEM2_alloc(s); +} + void *MEM2_realloc(void *p, unsigned int s) { return g_mem2gp.reallocate(p, s); diff --git a/source/memory/mem2.hpp b/source/memory/mem2.hpp index 7ef53040..af8c1cf0 100644 --- a/source/memory/mem2.hpp +++ b/source/memory/mem2.hpp @@ -22,6 +22,7 @@ void MEM2_cleanup(void); void MEM2_clear(void); void MEM2_free(void *p); void *MEM2_alloc(unsigned int s); +void *MEM2_memalign(unsigned int /* alignment */, unsigned int s); void *MEM2_realloc(void *p, unsigned int s); unsigned int MEM2_usableSize(void *p); unsigned int MEM2_freesize(); diff --git a/source/memory/smartptr.hpp b/source/memory/smartptr.hpp index c03af1d8..aba26c9b 100644 --- a/source/memory/smartptr.hpp +++ b/source/memory/smartptr.hpp @@ -7,9 +7,9 @@ #include #include -#include "utils.h" #include "mem2.hpp" -#include "gui_sound.h" +#include "loader/utils.h" +#include "music/gui_sound.h" template class SmartPtr { diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index e05a4b4c..59816b7d 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -1,9 +1,3 @@ -#include "menu.hpp" -#include "loader/sys.h" -#include "loader/wbfs.h" -#include "loader/alt_ios.h" - -#include "network/gcard.h" #include #include @@ -13,20 +7,24 @@ #include #include -#include "gecko.h" +#include "menu.hpp" #include "types.h" #include "fonts.h" -#include "music/SoundHandler.hpp" -#include "fs.h" -#include "U8Archive.h" -#include "nand.hpp" -#include "cios.h" +#include "banner/BannerWindow.hpp" +#include "channel/nand.hpp" +#include "fileOps/fileOps.h" +#include "gc/gc.hpp" +#include "gui/Gekko.h" +#include "gui/GameTDB.hpp" +#include "loader/alt_ios.h" +#include "loader/cios.h" +#include "loader/fs.h" #include "loader/playlog.h" -#include "gc/fileOps.h" -#include "gc/gc.h" -#include "Gekko.h" -#include "GameTDB.hpp" -#include "BannerWindow.hpp" +#include "loader/sys.h" +#include "loader/wbfs.h" +#include "music/SoundHandler.hpp" +#include "network/gcard.h" +#include "unzip/U8Archive.h" // Sounds extern const u8 click_wav[]; diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 3ae97a82..dfcf19e7 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -2,33 +2,29 @@ #define __MENU_HPP //#define SHOWMEM 1 //#define SHOWMEMGECKO -#include "wiiuse/wpad.h" + #include #include - -#include "cachedlist.hpp" -#include "plugin/plugin.hpp" - #include -#include "gui_sound.h" -#include "cursor.hpp" -#include "gui.hpp" -#include "coverflow.hpp" -#include "fanart.hpp" -#include "loader/disc.h" -#include "btnmap.h" -#include "banner.h" -#include "channels.h" -#include "gct.h" -#include "DeviceHandler.hpp" -#include "musicplayer.h" -#include "loader/gc_disc_dump.hpp" -//Also in wbfs.h -#define PART_FS_WBFS 0 -#define PART_FS_FAT 1 -#define PART_FS_NTFS 2 -#define PART_FS_EXT 3 +#include "btnmap.h" +#include "channel/banner.h" +#include "channel/channels.h" +#include "cheats/gct.h" +#include "devicemounter/DeviceHandler.hpp" +#include "gecko/gecko.h" +#include "gui/coverflow.hpp" +#include "gui/cursor.hpp" +#include "gui/fanart.hpp" +#include "gui/gui.hpp" +#include "list/cachedlist.hpp" +#include "loader/disc.h" +#include "loader/gc_disc_dump.hpp" +#include "loader/wbfs.h" +#include "music/gui_sound.h" +#include "music/musicplayer.h" +#include "plugin/plugin.hpp" +#include "wiiuse/wpad.h" using namespace std; diff --git a/source/menu/menu_about.cpp b/source/menu/menu_about.cpp index a0c4975c..efa09094 100644 --- a/source/menu/menu_about.cpp +++ b/source/menu/menu_about.cpp @@ -1,12 +1,11 @@ #include "menu.hpp" -#include "nand.hpp" -#include "svnrev.h" - -#include "sys.h" -#include "alt_ios.h" #include "defines.h" -#include "cios.h" +#include "svnrev.h" +#include "channel/nand.hpp" +#include "loader/alt_ios.h" +#include "loader/cios.h" +#include "loader/sys.h" const int pixels_to_skip = 10; diff --git a/source/menu/menu_cheat.cpp b/source/menu/menu_cheat.cpp index 8d2c2364..75c350d1 100644 --- a/source/menu/menu_cheat.cpp +++ b/source/menu/menu_cheat.cpp @@ -1,12 +1,11 @@ #include #include -#include "text.hpp" -#include "lockMutex.hpp" - #include "menu.hpp" -#include "http.h" -#include "sys.h" +#include "lockMutex.hpp" +#include "gui/text.hpp" +#include "loader/sys.h" +#include "network/http.h" #define GECKOURL "http://geckocodes.org/codes/%c/%s.txt" #define CHEATSPERPAGE 4 diff --git a/source/menu/menu_config.cpp b/source/menu/menu_config.cpp index faadbe4d..0815502f 100644 --- a/source/menu/menu_config.cpp +++ b/source/menu/menu_config.cpp @@ -1,10 +1,9 @@ #include "menu.hpp" -#include "nand.hpp" -#include "sys.h" -#include "loader/cios.h" +#include "channel/nand.hpp" #include "loader/alt_ios.h" -#include "gecko/gecko.h" +#include "loader/cios.h" +#include "loader/sys.h" const int CMenu::_nbCfgPages = 6; static const int g_curPage = 1; diff --git a/source/menu/menu_config3.cpp b/source/menu/menu_config3.cpp index a0b9bc1e..c096de5e 100644 --- a/source/menu/menu_config3.cpp +++ b/source/menu/menu_config3.cpp @@ -1,9 +1,6 @@ #include "menu.hpp" - -#define ARRAY_SIZE(a) (sizeof a / sizeof a[0]) - static const int g_curPage = 3; template static inline T loopNum(T i, T s) diff --git a/source/menu/menu_config4.cpp b/source/menu/menu_config4.cpp index f57f0917..2c012858 100644 --- a/source/menu/menu_config4.cpp +++ b/source/menu/menu_config4.cpp @@ -1,11 +1,11 @@ #include "menu.hpp" -#include "loader/sys.h" -#include "channels.h" -#include "gecko.h" #include "defines.h" -#include "nand.hpp" -#include "cios.h" +#include "channel/channels.h" +#include "channel/nand.hpp" +#include "gecko/gecko.h" +#include "loader/cios.h" +#include "loader/sys.h" static const int g_curPage = 4; diff --git a/source/menu/menu_config_adv.cpp b/source/menu/menu_config_adv.cpp index 813e9a2b..2b4efaf6 100644 --- a/source/menu/menu_config_adv.cpp +++ b/source/menu/menu_config_adv.cpp @@ -1,12 +1,11 @@ +#include +#include +#include +#include +#include #include "menu.hpp" -#include "wbfs.h" - -#include -#include -#include -#include -#include +#include "loader/wbfs.h" using namespace std; diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index cb0c4275..4a1c46ee 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -1,10 +1,10 @@ -#include "loader/wbfs.h" -#include "libwbfs/wiidisc.h" + #include "menu.hpp" #include "types.h" - +#include "gecko/gecko.h" +#include "loader/wbfs.h" #include "loader/sys.h" -#include "gecko.h" +#include "libwbfs/wiidisc.h" #define ARRAY_SIZE(a) (sizeof a / sizeof a[0]) diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp index cd5a650e..e55b8890 100644 --- a/source/menu/menu_download.cpp +++ b/source/menu/menu_download.cpp @@ -1,27 +1,24 @@ -#include "menu.hpp" -#include "svnrev.h" -#include "loader/sys.h" -#include "loader/wbfs.h" -#include "http.h" -#include "pngu.h" -#include "types.h" - -#include "loader/fs.h" -#include "loader/wdvd.h" -#include "usbstorage.h" -#include "unzip/ZipFile.h" - #include - -#include "gecko.h" -#include "wifi_gecko.h" -#include -#include "lockMutex.hpp" -#include "nand.hpp" -#include "GameTDB.hpp" - #include #include +#include + +#include "menu.hpp" +#include "svnrev.h" +#include "types.h" +#include "lockMutex.hpp" +#include "channel/nand.hpp" +#include "devicemounter/usbstorage.h" +#include "gecko/gecko.h" +#include "gecko/wifi_gecko.h" +#include "gui/GameTDB.hpp" +#include "gui/pngu.h" +#include "loader/fs.h" +#include "loader/sys.h" +#include "loader/wbfs.h" +#include "loader/wdvd.h" +#include "network/http.h" +#include "unzip/ZipFile.h" #define TAG_GAME_ID "{gameid}" #define TAG_LOC "{loc}" @@ -31,13 +28,6 @@ #define GAMETDB_URL "http://www.gametdb.com/wiitdb.zip?LANG=%s&FALLBACK=TRUE&WIIWARE=TRUE&GAMECUBE=TRUE" #define UPDATE_URL_VERSION "http://dl.dropbox.com/u/25620767/WiiflowMod/versions.txt" -#define STACK_ALIGN(type, name, cnt, alignment) \ - u8 _al__##name[((sizeof(type)*(cnt)) + (alignment) + \ - (((sizeof(type)*(cnt))%(alignment)) > 0 ? ((alignment) - \ - ((sizeof(type)*(cnt))%(alignment))) : 0))]; \ - type *name = (type*)(((u32)(_al__##name)) + ((alignment) - (( \ - (u32)(_al__##name))&((alignment)-1)))) - static const char FMT_BPIC_URL[] = "http://art.gametdb.com/{console}/coverfullHQ/{loc}/{gameid}.png"\ "|http://art.gametdb.com/{console}/coverfull/{loc}/{gameid}.png"; static const char FMT_PIC_URL[] = "http://art.gametdb.com/{console}/cover/{loc}/{gameid}.png"; diff --git a/source/menu/menu_error.cpp b/source/menu/menu_error.cpp index 2bbe00c8..5828376b 100644 --- a/source/menu/menu_error.cpp +++ b/source/menu/menu_error.cpp @@ -1,6 +1,6 @@ #include "menu.hpp" -#include "gecko.h" +#include "gecko/gecko.h" extern const u8 error_png[]; u16 m_errorLblMessage; diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 9b98fa2f..0ce3b63c 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -1,47 +1,41 @@ -#include "menu.hpp" -#include "loader/patchcode.h" - -#include "loader/sys.h" -#include "loader/wdvd.h" -#include "loader/alt_ios.h" -#include "loader/playlog.h" #include #include #include #include -#include "network/http.h" -#include "network/gcard.h" -#include "DeviceHandler.hpp" -#include "loader/wbfs.h" -#include "wip.h" -#include "channel_launcher.h" -#include "BannerWindow.hpp" - #include #include -#include "loader/frag.h" -#include "loader/fst.h" -#include "cios.h" - +#include "menu.hpp" +#include "types.h" +#include "banner/BannerWindow.hpp" +#include "channel/channel_launcher.h" +#include "channel/channels.h" +#include "channel/nand.hpp" +#include "devicemounter/DeviceHandler.hpp" +#include "devicemounter/usbstorage.h" +#include "fileOps/fileOps.h" +#include "gc/gc.hpp" +#include "gc/gcdisc.hpp" +#include "gecko/gecko.h" #include "gui/WiiMovie.hpp" #include "gui/GameTDB.hpp" -#include "channels.h" -#include "nand.hpp" -#include "alt_ios.h" -#include "gecko.h" -#include "homebrew.h" -#include "types.h" -#include "nk.h" -#include "gc/gc.h" -#include "gc/fileOps.h" -#include "gc/gcdisc.hpp" -#include "Gekko.h" - -#ifndef DOLPHIN -#include "devicemounter/usbstorage.h" -#endif +#include "gui/Gekko.h" +#include "homebrew/homebrew.h" +#include "loader/alt_ios.h" +#include "loader/patchcode.h" +#include "loader/sys.h" +#include "loader/wdvd.h" +#include "loader/alt_ios.h" +#include "loader/playlog.h" +#include "loader/wbfs.h" +#include "loader/wip.h" +#include "loader/frag.h" +#include "loader/fst.h" +#include "loader/cios.h" +#include "loader/nk.h" +#include "network/http.h" +#include "network/gcard.h" extern const u8 btngamecfg_png[]; extern const u8 btngamecfgs_png[]; diff --git a/source/menu/menu_gameinfo.cpp b/source/menu/menu_gameinfo.cpp index 6237f3fb..4720d54c 100644 --- a/source/menu/menu_gameinfo.cpp +++ b/source/menu/menu_gameinfo.cpp @@ -1,11 +1,9 @@ + #include "menu.hpp" -#include "wiiuse/wpad.h" - -#include "GameTDB.hpp" -#include "alt_ios.h" -#include "gecko.h" -#include "sys.h" +#include "gui/GameTDB.hpp" +#include "loader/alt_ios.h" +#include "loader/sys.h" extern const u8 wifi1_png[]; extern const u8 wifi2_png[]; diff --git a/source/menu/menu_home.cpp b/source/menu/menu_home.cpp index 8d3bab10..0ee1263d 100644 --- a/source/menu/menu_home.cpp +++ b/source/menu/menu_home.cpp @@ -1,8 +1,8 @@ #include "menu.hpp" #include "svnrev.h" -#include "cios.h" -#include "nk.h" +#include "loader/cios.h" +#include "loader/nk.h" u32 m_homeLblTitle; u32 m_exittoLblTitle; diff --git a/source/menu/menu_input.cpp b/source/menu/menu_input.cpp index ae7ed69d..cb5d53c2 100644 --- a/source/menu/menu_input.cpp +++ b/source/menu/menu_input.cpp @@ -1,7 +1,8 @@ -#include "menu.hpp" -#include "gecko.h" + #include +#include "menu.hpp" + static const u32 g_repeatDelay = 25; void CMenu::SetupInput(bool reset_pos) diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index f39948e9..1ae86d4f 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -1,20 +1,19 @@ -#include "menu.hpp" -#include "nand.hpp" -#include "loader/wdvd.h" -#include "network/gcard.h" -#include "DeviceHandler.hpp" #include #include #include -#include "wbfs.h" -#include "gecko.h" -#include "sys.h" -#include "disc.h" -#include "loader/cios.h" +#include "menu.hpp" +#include "channel/nand.hpp" +#include "devicemounter/DeviceHandler.hpp" +#include "gui/GameTDB.hpp" #include "loader/alt_ios.h" -#include "GameTDB.hpp" +#include "loader/cios.h" +#include "loader/disc.h" +#include "loader/sys.h" +#include "loader/wbfs.h" +#include "loader/wdvd.h" +#include "network/gcard.h" extern const u8 btnconfig_png[]; extern const u8 btnconfigs_png[]; diff --git a/source/menu/menu_nandemu.cpp b/source/menu/menu_nandemu.cpp index 8228de17..73dcd397 100644 --- a/source/menu/menu_nandemu.cpp +++ b/source/menu/menu_nandemu.cpp @@ -1,13 +1,12 @@ #include "menu.hpp" -#include "nand.hpp" -#include "sys.h" -#include "loader/cios.h" -#include "loader/alt_ios.h" -#include "lockMutex.hpp" -#include "gecko/gecko.h" #include "defines.h" -#include "fileOps.h" +#include "lockMutex.hpp" +#include "channel/nand.hpp" +#include "fileOps/fileOps.h" +#include "loader/alt_ios.h" +#include "loader/cios.h" +#include "loader/sys.h" // NandEmulation menu u16 m_nandemuLblTitle; diff --git a/source/menu/menu_system.cpp b/source/menu/menu_system.cpp index cb51e500..824a0a3a 100644 --- a/source/menu/menu_system.cpp +++ b/source/menu/menu_system.cpp @@ -1,13 +1,10 @@ -#include "svnrev.h" -#include "menu.hpp" +#include "menu.hpp" +#include "svnrev.h" +#include "defines.h" +#include "lockMutex.hpp" #include "loader/sys.h" #include "loader/wbfs.h" -#include "gecko.h" -#include "lockMutex.hpp" -#include "defines.h" - -#define newIOS 249 extern int mainIOS; diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index d9f0870e..367d65d9 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -1,14 +1,14 @@ #include "menu.hpp" -#include "loader/wbfs.h" -#include "lockMutex.hpp" -#include "loader/gc_disc_dump.hpp" -#include "gc.h" -#include "fileOps.h" -#include "music/SoundHandler.hpp" -#include "channel/nand.hpp" #include "types.h" -#include "wdvd.h" +#include "lockMutex.hpp" +#include "channel/nand.hpp" +#include "gc/gc.hpp" +#include "fileOps/fileOps.h" +#include "loader/wbfs.h" +#include "loader/wdvd.h" +#include "loader/gc_disc_dump.hpp" +#include "music/SoundHandler.hpp" void CMenu::_hideWBFS(bool instant) { diff --git a/source/music/BufferCircle.cpp b/source/music/BufferCircle.cpp index 472b0a97..530d795f 100644 --- a/source/music/BufferCircle.cpp +++ b/source/music/BufferCircle.cpp @@ -23,10 +23,9 @@ * * for WiiXplorer 2010 ***************************************************************************/ -#include - #include "BufferCircle.hpp" -#include "utils.h" +#include "loader/utils.h" +#include "memory/mem2.hpp" BufferCircle::BufferCircle() { @@ -52,9 +51,9 @@ void BufferCircle::SetBufferBlockSize(int size) for(int i = 0; i < Size(); i++) { if(SoundBuffer[i] != NULL) - free(SoundBuffer[i]); + MEM2_free(SoundBuffer[i]); - SoundBuffer[i] = (u8 *)malloc(BufferBlockSize); + SoundBuffer[i] = (u8 *)MEM2_memalign(32, BufferBlockSize); memset(SoundBuffer[i], 0, BufferBlockSize); BufferSize[i] = 0; BufferReady[i] = false; @@ -76,7 +75,7 @@ void BufferCircle::Resize(int size) { if(BufferBlockSize > 0) { - SoundBuffer[i] = (u8 *)malloc(BufferBlockSize); + SoundBuffer[i] = (u8 *)MEM2_memalign(32, BufferBlockSize); memset(SoundBuffer[i], 0, BufferBlockSize); } else @@ -92,7 +91,7 @@ void BufferCircle::RemoveBuffer(int pos) return; if(SoundBuffer[pos] != NULL) - free(SoundBuffer[pos]); + MEM2_free(SoundBuffer[pos]); SoundBuffer.erase(SoundBuffer.begin()+pos); BufferSize.erase(BufferSize.begin()+pos); @@ -114,7 +113,7 @@ void BufferCircle::FreeBuffer() for(int i = 0; i < Size(); i++) { if(SoundBuffer[i] != NULL) - free(SoundBuffer[i]); + MEM2_free(SoundBuffer[i]); BufferSize[i] = 0; BufferReady[i] = false; } diff --git a/source/music/Mp3Decoder.cpp b/source/music/Mp3Decoder.cpp index 6b60c336..0255ce1e 100644 --- a/source/music/Mp3Decoder.cpp +++ b/source/music/Mp3Decoder.cpp @@ -28,9 +28,9 @@ #include #include #include -#include #include "Mp3Decoder.hpp" +#include "memory/mem2.hpp" Mp3Decoder::Mp3Decoder(const char * filepath) : SoundDecoder(filepath) @@ -74,13 +74,13 @@ Mp3Decoder::~Mp3Decoder() mad_frame_finish(&Frame); mad_stream_finish(&Stream); - free(ReadBuffer); + MEM2_free(ReadBuffer); } void Mp3Decoder::OpenFile() { GuardPtr = NULL; - ReadBuffer = (u8 *)malloc(SoundBlockSize * SoundBlocks); + ReadBuffer = (u8 *)MEM2_memalign(32, SoundBlockSize * SoundBlocks); if(!ReadBuffer) { if(file_fd) diff --git a/source/music/SoundDecoder.hpp b/source/music/SoundDecoder.hpp index 8b06fb4a..216da32a 100644 --- a/source/music/SoundDecoder.hpp +++ b/source/music/SoundDecoder.hpp @@ -32,7 +32,7 @@ //#include "Tools/timer.h" #include "File.hpp" #include "BufferCircle.hpp" -#include "utils.h" +#include "loader/utils.h" enum { diff --git a/source/music/SoundHandler.cpp b/source/music/SoundHandler.cpp index 04579038..6d2a7c41 100644 --- a/source/music/SoundHandler.cpp +++ b/source/music/SoundHandler.cpp @@ -24,7 +24,6 @@ * for WiiXplorer 2010 ***************************************************************************/ #include -#include #include "SoundHandler.hpp" #include "Mp3Decoder.hpp" @@ -33,6 +32,7 @@ #include "AifDecoder.hpp" #include "BNSDecoder.hpp" #include "gecko/gecko.h" +#include "memory/mem2.hpp" SoundHandler * SoundHandler::instance = NULL; @@ -43,7 +43,7 @@ SoundHandler::SoundHandler() for(u32 i = 0; i < MAX_DECODERS; ++i) DecoderList[i] = NULL; - ThreadStack = (u8 *)memalign(32, 32768); + ThreadStack = (u8 *)MEM2_memalign(32, 32768); if(!ThreadStack) return; @@ -61,7 +61,7 @@ SoundHandler::~SoundHandler() SoundThread = LWP_THREAD_NULL; if(ThreadStack != NULL) { - free(ThreadStack); + MEM2_free(ThreadStack); ThreadStack = NULL; } diff --git a/source/music/gui_sound.cpp b/source/music/gui_sound.cpp index a700aea5..d38b5396 100644 --- a/source/music/gui_sound.cpp +++ b/source/music/gui_sound.cpp @@ -25,12 +25,14 @@ ***************************************************************************/ #include #include -#include "SoundHandler.hpp" + #include "gui_sound.h" +#include "SoundHandler.hpp" #include "musicplayer.h" #include "WavDecoder.hpp" #include "loader/sys.h" #include "banner/AnimatedBanner.h" +#include "memory/mem2.hpp" #define MAX_SND_VOICES 16 @@ -105,7 +107,7 @@ GuiSound::GuiSound(GuiSound *g) if(g->sound != NULL) { - u8 *snd = (u8 *)malloc(g->length); + u8 *snd = (u8 *)MEM2_memalign(32, g->length); memcpy(snd, g->sound, g->length); Load(snd, g->length, true); } @@ -228,12 +230,12 @@ bool GuiSound::LoadSoundEffect(const u8 * snd, u32 len) decoder.Rewind(); u32 done = 0; - sound = (u8 *)malloc(4096); + sound = (u8 *)MEM2_memalign(32, 4096); memset(sound, 0, 4096); while(1) { - u8 * tmpsnd = (u8 *)realloc(sound, done+4096); + u8 * tmpsnd = (u8 *)MEM2_realloc(sound, done+4096); if(!tmpsnd) { free(sound); @@ -249,7 +251,7 @@ bool GuiSound::LoadSoundEffect(const u8 * snd, u32 len) done += read; } - sound = (u8 *)realloc(sound, done); + sound = (u8 *)MEM2_realloc(sound, done); SoundEffectLength = done; allocated = true; diff --git a/source/music/musicplayer.h b/source/music/musicplayer.h index 3bae338a..63398910 100644 --- a/source/music/musicplayer.h +++ b/source/music/musicplayer.h @@ -2,10 +2,9 @@ #define _MUSICPLAYER_H #include -#include "config/config.hpp" - -#include "cachedlist.hpp" #include "gui_sound.h" +#include "config/config.hpp" +#include "list/cachedlist.hpp" enum MusicDirectory { diff --git a/source/network/gcard.c b/source/network/gcard.c index c4bb78a4..f228e29c 100644 --- a/source/network/gcard.c +++ b/source/network/gcard.c @@ -3,7 +3,7 @@ #include "gcard.h" #include "http.h" -#include "utils.h" +#include "loader/utils.h" #include "gecko/gecko.h" #define MAX_URL_SIZE 178 // 128 + 48 + 6 diff --git a/source/network/http.c b/source/network/http.c index a9c765a4..78139b98 100644 --- a/source/network/http.c +++ b/source/network/http.c @@ -1,9 +1,12 @@ -#include "http.h" -#include "gecko.h" + #include #include #include #include + +#include "http.h" +#include "gecko/gecko.h" + /** * Emptyblock is a statically defined variable for functions to return if they are unable * to complete a request diff --git a/source/unzip/ZipFile.cpp b/source/unzip/ZipFile.cpp index 26df43ce..f6072aab 100644 --- a/source/unzip/ZipFile.cpp +++ b/source/unzip/ZipFile.cpp @@ -35,7 +35,7 @@ #include #include "ZipFile.h" -#include "gc/fileOps.h" +#include "fileOps/fileOps.h" ZipFile::ZipFile(const char *filepath) { diff --git a/source/banner/ash.cpp b/source/unzip/ash.cpp similarity index 99% rename from source/banner/ash.cpp rename to source/unzip/ash.cpp index 53f099b6..bb74a60b 100644 --- a/source/banner/ash.cpp +++ b/source/unzip/ash.cpp @@ -14,16 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . ****************************************************************************/ -#include "ash.h" -#include "gecko.h" - #include #include //#include #include #include - +#include "ash.h" +#include "gecko/gecko.h" bool IsAshCompressed( const u8 *stuff, u32 len ) { diff --git a/source/banner/ash.h b/source/unzip/ash.h similarity index 100% rename from source/banner/ash.h rename to source/unzip/ash.h diff --git a/source/channel/lz77.c b/source/unzip/lz77.c similarity index 95% rename from source/channel/lz77.c rename to source/unzip/lz77.c index f44230c3..c0129bba 100644 --- a/source/channel/lz77.c +++ b/source/unzip/lz77.c @@ -19,7 +19,7 @@ #include #include "lz77.h" -#include "utils.h" +#include "loader/utils.h" u32 packBytes(int a, int b, int c, int d) { diff --git a/source/channel/lz77.h b/source/unzip/lz77.h similarity index 100% rename from source/channel/lz77.h rename to source/unzip/lz77.h diff --git a/source/unzip/unzip.c b/source/unzip/unzip.c index 4e13e6fc..7b28030f 100644 --- a/source/unzip/unzip.c +++ b/source/unzip/unzip.c @@ -40,7 +40,7 @@ woven in by Terry Thorsen 1/2003. #include #include "zlib.h" #include "unzip.h" -#include "mem2.hpp" +#include "memory/mem2.hpp" #ifdef STDC # include diff --git a/source/unzip/unzip.h b/source/unzip/unzip.h index a331fdfc..f613a419 100644 --- a/source/unzip/unzip.h +++ b/source/unzip/unzip.h @@ -49,7 +49,7 @@ extern "C" { #endif -#include "utils.h" +#include "loader/utils.h" #ifndef _ZLIB_H #include "zlib.h" diff --git a/wiiflow.pnproj b/wiiflow.pnproj index ef273d6c..1dd027da 100644 --- a/wiiflow.pnproj +++ b/wiiflow.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/wiiflow.pnps b/wiiflow.pnps index 5503ffca..eba498cf 100644 --- a/wiiflow.pnps +++ b/wiiflow.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file