mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-24 02:41:55 +01:00
-plugin games now also can stay zipped for cover downloading,
crc will be read from the zip header, still 7z needs to be extracted
This commit is contained in:
parent
a953eddd1b
commit
0f2ca0c34a
@ -1,29 +1,30 @@
|
||||
|
||||
#ifndef _UTILS_H_
|
||||
#define _UTILS_H_
|
||||
|
||||
#include <gctypes.h>
|
||||
/* Constants */
|
||||
#define KB_SIZE 1024.0
|
||||
#define MB_SIZE 1048576.0
|
||||
#define GB_SIZE 1073741824.0
|
||||
|
||||
#define MAX_FAT_PATH 1024
|
||||
#define KB_SIZE 1024.0
|
||||
#define MB_SIZE 1048576.0
|
||||
#define GB_SIZE 1073741824.0
|
||||
|
||||
/* Macros */
|
||||
#define round_up(x,n) (-(-(x) & -(n)))
|
||||
#define MAX_FAT_PATH 1024
|
||||
|
||||
#define ALIGN(n, x) (((x) + (n - 1)) & ~(n - 1))
|
||||
#define ALIGN32(x) (((x) + 31) & ~31)
|
||||
#define ALIGNED(x) __attribute__((aligned(x)))
|
||||
#define round_up(x,n) (-(-(x) & -(n)))
|
||||
|
||||
#define ALIGN(n, x) (((x) + (n - 1)) & ~(n - 1))
|
||||
#define ALIGN32(x) (((x) + 31) & ~31)
|
||||
#define ALIGNED(x) __attribute__((aligned(x)))
|
||||
|
||||
#define TITLE_ID(x,y) (((u64)(x) << 32) | (y))
|
||||
#define TITLE_UPPER(x) ((u32)((x) >> 32))
|
||||
#define TITLE_LOWER(x) ((u32)(x) & 0xFFFFFFFF)
|
||||
|
||||
/* Macros */
|
||||
#define Write8(addr, val) *(u8 *)addr = val; DCFlushRange((void *)addr, sizeof(u8));
|
||||
#define Write16(addr, val) *(u16 *)addr = val; DCFlushRange((void *)addr, sizeof(u16));
|
||||
#define Write32(addr, val) *(u32 *)addr = val; DCFlushRange((void *)addr, sizeof(u32));
|
||||
#define SWAP32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) >> 24) & 0xff))
|
||||
|
||||
#define Write8(addr, val) *(u8 *)addr = val; DCFlushRange((void *)addr, sizeof(u8));
|
||||
#define Write16(addr, val) *(u16 *)addr = val; DCFlushRange((void *)addr, sizeof(u16));
|
||||
#define Write32(addr, val) *(u32 *)addr = val; DCFlushRange((void *)addr, sizeof(u32));
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -45,4 +46,3 @@ bool str_replace_all(char *str, const char *olds, const char *news, int size);
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -84,6 +84,7 @@ bool Plugin::AddPlugin(Config &plugin)
|
||||
NewPlugin.BannerSound = (u8*)FileReadBuffer;
|
||||
NewPlugin.BannerSoundSize = size;
|
||||
Plugins.push_back(NewPlugin);
|
||||
infile.close();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -292,7 +293,18 @@ string Plugin::GenerateCoverLink(dir_discHdr gameHeader, string url)
|
||||
url.replace(url.find(TAG_CONSOLE), strlen(TAG_CONSOLE), (Plugins[Plugin_Pos].consoleCoverID.size() ? Plugins[Plugin_Pos].consoleCoverID.c_str() : "nintendo"));
|
||||
|
||||
char crc_string[9];
|
||||
snprintf(crc_string, sizeof(crc_string), "%08x", crc32file(gameHeader.path));
|
||||
if(strstr(gameHeader.path, ".zip") == NULL)
|
||||
snprintf(crc_string, sizeof(crc_string), "%08x", crc32file(gameHeader.path));
|
||||
else
|
||||
{
|
||||
u32 crc_buffer;
|
||||
ifstream infile;
|
||||
infile.open(gameHeader.path, ios::binary);
|
||||
infile.seekg(0x0e, ios::beg);
|
||||
infile.read((char*)&crc_buffer, 8);
|
||||
infile.close();
|
||||
snprintf(crc_string, sizeof(crc_string), "%08x", SWAP32(crc_buffer));
|
||||
}
|
||||
url.replace(url.find(TAG_GAME_ID), strlen(TAG_GAME_ID), upperCase(crc_string).c_str());
|
||||
gprintf("URL: %s\n", url.c_str());
|
||||
return url;
|
||||
|
Loading…
Reference in New Issue
Block a user