Now using devkitpro r29, fixed bug with configs, improved logging and changed datatypes

- Finally switching to r29
- Modifed the travis and .pl script to download r29 of devkit pro
- Improved the logging (more information)
- Fixed the bug when you have too many config files on the sd card
(maximum now 24)
- Changed all int to s32
- Some more general code cleanup
This commit is contained in:
Maschell 2017-04-10 11:07:50 +02:00
parent 7d72d0e2ff
commit e48fc17615
113 changed files with 731 additions and 769 deletions

View File

@ -31,13 +31,13 @@ before_install:
- export DEVKITPPC=${DEVKITPRO}/devkitPPC
- mkdir -p $DEVKITPRO
- cd $DEVKITPRO
- wget -N https://raw.githubusercontent.com/Maschell/hid_to_vpad/master/other/devkitPPCupdatePPCr27.pl
- wget -N https://raw.githubusercontent.com/Maschell/hid_to_vpad/master/other/devkitPPCupdatePPCr29.pl
- wget -N https://raw.githubusercontent.com/Maschell/hid_to_vpad/master/other/libogc.7z
- wget -N https://raw.githubusercontent.com/Maschell/hid_to_vpad/master/other/portlibs.7z
install:
- cd $DEVKITPRO
- perl devkitPPCupdatePPCr27.pl
- perl devkitPPCupdatePPCr29.pl
- 7z x -y libogc.7z
- 7z x -y portlibs.7z
- cp -R portlibs/ppc/* devkitPPC/

View File

@ -66,7 +66,7 @@ INCLUDES := src
#---------------------------------------------------------------------------------
CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math -D_GNU_SOURCE \
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
ASFLAGS := -mregnames
LDFLAGS := -nostartfiles -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,--gc-sections

View File

@ -97,12 +97,12 @@
}
# Grab update file
if(-e "devkitProUpdatePPCr27.ini")
if(-e "devkitProUpdatePPCr29.ini")
{
unlink("devkitProUpdatePPCr27.ini") or die $!;
unlink("devkitProUpdatePPCr29.ini") or die $!;
}
printf("Downloading update file...");
system($downloader . " https://raw.githubusercontent.com/MaschellTest/hid_to_vpad/master/other/devkitProUpdatePPCr27.ini") and die "Failed to download!";
system($downloader . " https://raw.githubusercontent.com/Maschell/hid_to_vpad/master/other/devkitProUpdatePPCr29.ini") and die "Failed to download!";
printf("OK!\n");
# Initialize versions & newVersions
@ -143,7 +143,7 @@
my %newFiles = ();
open(MYFILE, "<devkitProUpdatePPCr27.ini") or die $!;
open(MYFILE, "<devkitProUpdatePPCr29.ini") or die $!;
while(<MYFILE>)
{
chomp;
@ -161,7 +161,7 @@
}
}
close(MYFILE);
unlink("devkitProUpdatePPCr27.ini") or die $!;
unlink("devkitProUpdatePPCr29.ini") or die $!;
# see what to update
my %updates = ();

View File

@ -4,18 +4,18 @@ URL=http://downloads.sourceforge.net/devkitpro
Filename=devkitProUpdater-1.6.0.exe
[msys]
Version=1.0.17
File=msys-1.0.17.exe
Version=1.0.17-1
File=msys-1.0.17-1.exe
Size=118660
[devkitARM]
Version=45
File=devkitARM_r45-win32.exe
Version=46
File=devkitARM_r46-win32.exe
Size=70461
[devkitPPC]
Version=27
File=devkitPPC_r27-win32.exe
Version=29-1
File=devkitPPC_r29-1-win32.exe
Size=65356
[devkitPSP]
@ -29,48 +29,48 @@ File=pspsdk-doc-20051113.tar.bz2
Size=9344
[libgba]
Version=20090222
File=libgba-20090222.tar.bz2
Version=0.5.0
File=libgba-0.5.0.tar.bz2
Size=268
[libgbafat]
Version=1.0.14
File=libfat-gba-1.0.14.tar.bz2
Version=1.1.0
File=libfat-gba-1.1.0.tar.bz2
Size=241
[maxmodgba]
Version=1.0.9
File=maxmod-gba-1.0.9.tar.bz2
Version=1.0.10
File=maxmod-gba-1.0.10.tar.bz2
Size=
[libnds]
Version=1.5.12
File=libnds-1.5.12.tar.bz2
Version=1.6.2
File=libnds-1.6.2.tar.bz2
Size=470
[libndsfat]
Version=1.0.14
File=libfat-nds-1.0.14.tar.bz2
Version=1.1.0
File=libfat-nds-1.1.0.tar.bz2
Size=272
[maxmodds]
Version=1.0.9
File=maxmod-nds-1.0.9.tar.bz2
Version=1.0.10
File=maxmod-nds-1.0.10.tar.bz2
Size=
[dswifi]
Version=0.3.17
File=dswifi-0.3.17.tar.bz2
Version=0.4.0
File=dswifi-0.4.0.tar.bz2
Size=496
[libctru]
Version=1.0.0
File=libctru-1.0.0.tar.bz2
Version=1.2.1
File=libctru-1.2.1.tar.bz2
Size=371
[citro3d]
Version=1.0.0
File=citro3d-1.0.0.tar.bz2
Version=1.2.0
File=citro3d-1.2.0.tar.bz2
Size=371
[libmirko]
@ -79,13 +79,13 @@ File=libmirko-0.9.7.tar.bz2
Size=1056
[libogc]
Version=1.8.12
File=libogc-1.8.12.tar.bz2
Version=1.8.16
File=libogc-1.8.16.tar.bz2
Size=2748
[libogcfat]
Version=1.0.14
File=libfat-ogc-1.0.14.tar.bz2
Version=1.1.0
File=libfat-ogc-1.1.0.tar.bz2
Size=481
[pnotepad]
@ -99,23 +99,23 @@ File=insight-7.3.50.20110803-cvs.exe
Size=32932
[ndsexamples]
Version=20140401
File=nds-examples-20140401.tar.bz2
Version=20170124
File=nds-examples-20170124.tar.bz2
Size=1191
[defaultarm7]
Version=0.6.0
File=default_arm7-0.6.0.tar.bz2
Version=0.7.1
File=default_arm7-0.7.1.tar.bz2
Size=9
[filesystem]
Version=0.9.12
File=libfilesystem-0.9.12.tar.bz2
Version=0.9.13-1
File=libfilesystem-0.9.13-1.tar.bz2
Size=9
[gbaexamples]
Version=20090222
File=gba-examples-20090222.tar.bz2
Version=20170228
File=gba-examples-20170228.tar.bz2
Size=1019
[gp32examples]
@ -124,18 +124,18 @@ File=gp32-examples-20051021.tar.bz2
Size=732
[cubeexamples]
Version=20110620
File=gamecube-examples-20110620.tar.bz2
Version=20170228
File=gamecube-examples-20170228.tar.bz2
Size=198
[wiiexamples]
Version=20110620
File=wii-examples-20110620.tar.bz2
Version=20170228
File=wii-examples-20170228.tar.bz2
Size=93
[3dsexamples]
Version=20151219
File=3ds-examples-20151219.tar.bz2
Version=20170226
File=3ds-examples-20170226.tar.bz2
Size=93
[gcube]

Binary file not shown.

View File

@ -48,19 +48,19 @@ Application::Application()
}
Application::~Application(){
log_printf("Destroy music\n");
log_printf("Application::~Application: Destroy music\n");
delete bgMusic;
log_printf("Destroy controller\n");
log_printf("Application::~Application: Destroy controller\n");
for(int i = 0; i < 5; i++)
for(s32 i = 0; i < 5; i++)
delete controller[i];
//We may have to handle Asyncdelete in the Destructors.
log_printf("Destroy async deleter\n");
log_printf("Application::~Application: Destroy async deleter\n");
do{
log_printf("Triggering AsyncDeleter\n");
log_printf("Application::~Application: Triggering AsyncDeleter\n");
AsyncDeleter::triggerDeleteProcess();
while(!AsyncDeleter::realListEmpty()){
usleep(1000);
@ -68,14 +68,14 @@ Application::~Application(){
}while(!AsyncDeleter::deleteListEmpty());
AsyncDeleter::destroyInstance();
log_printf("Clear resources\n");
log_printf("Application::~Application: Clear resources\n");
Resources::Clear();
log_printf("Stop sound handler\n");
log_printf("Application::~Application: Stop sound handler\n");
SoundHandler::DestroyInstance();
}
int Application::exec(){
s32 Application::exec(){
//! start main GX2 thread
resumeThread();
//! now wait for thread to finish
@ -87,7 +87,7 @@ int Application::exec(){
void Application::fadeOut(){
GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color){ 0, 0, 0, 255 });
for(int i = 0; i < 255; i += 10)
for(s32 i = 0; i < 255; i += 10)
{
if(i > 255)
i = 255;
@ -132,17 +132,17 @@ void Application::fadeOut(){
}
void Application::executeThread(void){
log_printf("Initialize video\n");
log_printf("Application::executeThread: Initialize video\n");
video = new CVideo(GX2_TV_SCAN_MODE_720P, GX2_DRC_SINGLE);
log_printf("Video size %i x %i\n", video->getTvWidth(), video->getTvHeight());
log_printf("Application::executeThread: Video size %i x %i\n", video->getTvWidth(), video->getTvHeight());
//! setup default Font
log_printf("Initialize main font system\n");
log_printf("Application::executeThread: Initialize main font system\n");
FreeTypeGX *fontSystem = new FreeTypeGX(Resources::GetFile("font.ttf"), Resources::GetFileSize("font.ttf"), true);
GuiText::setPresetFont(fontSystem);
log_printf("Initialize main window\n");
log_printf("Application::executeThread: Initialize main window\n");
mainWindow = MainWindow::getInstance(video->getTvWidth(), video->getTvHeight());
@ -150,13 +150,13 @@ void Application::executeThread(void){
bgMusic->Play();
bgMusic->SetVolume(50);
log_printf("Entering main loop\n");
log_printf("Application::executeThread: Entering main loop\n");
//! main GX2 loop (60 Hz cycle with max priority on core 1)
while(!exitApplication)
{
//! Read out inputs
for(int i = 0; i < 5; i++)
for(s32 i = 0; i < 5; i++)
{
if(controller[i]->update(video->getTvWidth(), video->getTvHeight()) == false)
continue;

View File

@ -51,10 +51,10 @@ public:
return bgMusic;
}
int exec(void);
s32 exec(void);
void fadeOut(void);
void quit(int code) {
void quit(s32 code) {
exitCode = code;
exitApplication = true;
}
@ -71,7 +71,7 @@ private:
CVideo *video;
MainWindow *mainWindow;
GuiController *controller[5];
int exitCode;
s32 exitCode;
};
#endif //_APPLICATION_H

View File

@ -38,10 +38,10 @@ extern "C" {
#define MEM_BASE (0x00800000)
#endif
#define ELF_DATA_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x00))
#define ELF_DATA_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x04))
#define MAIN_ENTRY_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x00))
#define OS_FIRMWARE (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x04))
#define ELF_DATA_ADDR (*(volatile u32*)(MEM_BASE + 0x1300 + 0x00))
#define ELF_DATA_SIZE (*(volatile u32*)(MEM_BASE + 0x1300 + 0x04))
#define MAIN_ENTRY_ADDR (*(volatile u32*)(MEM_BASE + 0x1400 + 0x00))
#define OS_FIRMWARE (*(volatile u32*)(MEM_BASE + 0x1400 + 0x04))
#define OS_SPECIFICS ((OsSpecifics*)(MEM_BASE + 0x1500))

@ -1 +1 @@
Subproject commit 5a3aa0d0aab1d1729f46f01c5b53f72a4a2dbd92
Subproject commit 73bf9bfb74b74967fe017dedde2041e31397d75a

@ -1 +1 @@
Subproject commit 5e01fb7d3f458fafa4f7e321f963eecd05e89874
Subproject commit a136b12c5225d932a73c299cb0edb638930f2d67

View File

@ -5,7 +5,7 @@
#include "utils/utils.h"
#include "main.h"
int __entry_menu(int argc, char **argv)
int __entry_menu(s32 argc, char **argv)
{
//! *******************************************************************
//! * Jump to our application *

View File

@ -16,7 +16,7 @@ CFile::CFile(const std::string & filepath, eOpenTypes mode)
this->open(filepath, mode);
}
CFile::CFile(const u8 * mem, int size)
CFile::CFile(const u8 * mem, s32 size)
{
iFd = -1;
this->open(mem, size);
@ -27,7 +27,7 @@ CFile::~CFile()
this->close();
}
int CFile::open(const std::string & filepath, eOpenTypes mode)
s32 CFile::open(const std::string & filepath, eOpenTypes mode)
{
this->close();
@ -65,7 +65,7 @@ int CFile::open(const std::string & filepath, eOpenTypes mode)
return 0;
}
int CFile::open(const u8 * mem, int size)
s32 CFile::open(const u8 * mem, s32 size)
{
this->close();
@ -86,17 +86,17 @@ void CFile::close()
pos = 0;
}
int CFile::read(u8 * ptr, size_t size)
s32 CFile::read(u8 * ptr, size_t size)
{
if(iFd >= 0)
{
int ret = ::read(iFd, ptr,size);
s32 ret = ::read(iFd, ptr,size);
if(ret > 0)
pos += ret;
return ret;
}
int readsize = size;
s32 readsize = size;
if(readsize > (s64) (filesize-pos))
readsize = filesize-pos;
@ -114,14 +114,14 @@ int CFile::read(u8 * ptr, size_t size)
return -1;
}
int CFile::write(const u8 * ptr, size_t size)
s32 CFile::write(const u8 * ptr, size_t size)
{
if(iFd >= 0)
{
size_t done = 0;
while(done < size)
{
int ret = ::write(iFd, ptr, size - done);
s32 ret = ::write(iFd, ptr, size - done);
if(ret <= 0)
return ret;
@ -135,9 +135,9 @@ int CFile::write(const u8 * ptr, size_t size)
return -1;
}
int CFile::seek(long int offset, int origin)
s32 CFile::seek(long int offset, s32 origin)
{
int ret = 0;
s32 ret = 0;
s64 newPos = pos;
if(origin == SEEK_SET)
@ -175,9 +175,9 @@ int CFile::seek(long int offset, int origin)
return ret;
}
int CFile::fwrite(const char *format, ...)
s32 CFile::fwrite(const char *format, ...)
{
int result = -1;
s32 result = -1;
char * tmp = NULL;
va_list va;

View File

@ -21,11 +21,11 @@ class CFile
CFile();
CFile(const std::string & filepath, eOpenTypes mode);
CFile(const u8 * memory, int memsize);
CFile(const u8 * memory, s32 memsize);
virtual ~CFile();
int open(const std::string & filepath, eOpenTypes mode);
int open(const u8 * memory, int memsize);
s32 open(const std::string & filepath, eOpenTypes mode);
s32 open(const u8 * memory, s32 memsize);
bool isOpen() const {
if(iFd >= 0)
@ -39,16 +39,16 @@ class CFile
void close();
int read(u8 * ptr, size_t size);
int write(const u8 * ptr, size_t size);
int fwrite(const char *format, ...);
int seek(long int offset, int origin);
s32 read(u8 * ptr, size_t size);
s32 write(const u8 * ptr, size_t size);
s32 fwrite(const char *format, ...);
s32 seek(long int offset, s32 origin);
u64 tell() { return pos; };
u64 size() { return filesize; };
void rewind() { this->seek(0, SEEK_SET); };
protected:
int iFd;
s32 iFd;
const u8 * mem_file;
u64 filesize;
u64 pos;

View File

@ -96,7 +96,7 @@ bool DirList::InternalLoadPath(std::string &folderpath)
if(Flags & CheckSubfolders)
{
int length = folderpath.size();
s32 length = folderpath.size();
if(length > 2 && folderpath[length-1] != '/')
folderpath += '/';
folderpath += filename;
@ -136,7 +136,7 @@ void DirList::AddEntrie(const std::string &filepath, const char * filename, bool
if(!filename)
return;
int pos = FileInfo.size();
s32 pos = FileInfo.size();
FileInfo.resize(pos+1);
@ -165,7 +165,7 @@ void DirList::ClearList()
std::vector<DirEntry>().swap(FileInfo);
}
const char * DirList::GetFilename(int ind) const
const char * DirList::GetFilename(s32 ind) const
{
if (!valid(ind))
return "";
@ -199,7 +199,7 @@ void DirList::SortList(bool (*SortFunc)(const DirEntry &a, const DirEntry &b))
std::sort(FileInfo.begin(), FileInfo.end(), SortFunc);
}
u64 DirList::GetFilesize(int index) const
u64 DirList::GetFilesize(s32 index) const
{
struct stat st;
const char *path = GetFilepath(index);
@ -210,7 +210,7 @@ u64 DirList::GetFilesize(int index) const
return st.st_size;
}
int DirList::GetFileIndex(const char *filename) const
s32 DirList::GetFileIndex(const char *filename) const
{
if(!filename)
return -1;

View File

@ -52,24 +52,24 @@ public:
bool LoadPath(const std::string & path, const char *filter = NULL, u32 flags = Files | Dirs);
//! Get a filename of the list
//!\param list index
const char * GetFilename(int index) const;
const char * GetFilename(s32 index) const;
//! Get the a filepath of the list
//!\param list index
const char *GetFilepath(int index) const { if (!valid(index)) return ""; else return FileInfo[index].FilePath; }
const char *GetFilepath(s32 index) const { if (!valid(index)) return ""; else return FileInfo[index].FilePath; }
//! Get the a filesize of the list
//!\param list index
u64 GetFilesize(int index) const;
u64 GetFilesize(s32 index) const;
//! Is index a dir or a file
//!\param list index
bool IsDir(int index) const { if(!valid(index)) return false; return FileInfo[index].isDir; };
bool IsDir(s32 index) const { if(!valid(index)) return false; return FileInfo[index].isDir; };
//! Get the filecount of the whole list
int GetFilecount() const { return FileInfo.size(); };
s32 GetFilecount() const { return FileInfo.size(); };
//! Sort list by filepath
void SortList();
//! Custom sort command for custom sort functions definitions
void SortList(bool (*SortFunc)(const DirEntry &a, const DirEntry &b));
//! Get the index of the specified filename
int GetFileIndex(const char *filename) const;
s32 GetFileIndex(const char *filename) const;
//! Enum for search/filter flags
enum
{

View File

@ -6,9 +6,9 @@
#include "dynamic_libs/fs_defs.h"
#include "dynamic_libs/fs_functions.h"
int MountFS(void *pClient, void *pCmd, char **mount_path)
s32 MountFS(void *pClient, void *pCmd, char **mount_path)
{
int result = -1;
s32 result = -1;
void *mountSrc = malloc(FS_MOUNT_SOURCE_SIZE);
if(!mountSrc)
@ -44,22 +44,22 @@ int MountFS(void *pClient, void *pCmd, char **mount_path)
return result;
}
int UmountFS(void *pClient, void *pCmd, const char *mountPath)
s32 UmountFS(void *pClient, void *pCmd, const char *mountPath)
{
int result = -1;
s32 result = -1;
result = FSUnmount(pClient, pCmd, mountPath, -1);
return result;
}
int LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size)
s32 LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size)
{
//! always initialze input
*inbuffer = NULL;
if(size)
*size = 0;
int iFd = open(filepath, O_RDONLY);
s32 iFd = open(filepath, O_RDONLY);
if (iFd < 0)
return -1;
@ -75,7 +75,7 @@ int LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size)
u32 blocksize = 0x4000;
u32 done = 0;
int readBytes = 0;
s32 readBytes = 0;
while(done < filesize)
{
@ -100,13 +100,14 @@ int LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size)
*inbuffer = buffer;
//! sign is optional input
if(size)
if(size){
*size = filesize;
}
return filesize;
}
int CheckFile(const char * filepath)
s32 CheckFile(const char * filepath)
{
if(!filepath)
return 0;
@ -131,17 +132,17 @@ int CheckFile(const char * filepath)
return 0;
}
int CreateSubfolder(const char * fullpath)
s32 CreateSubfolder(const char * fullpath)
{
if(!fullpath)
return 0;
int result = 0;
s32 result = 0;
char dirnoslash[strlen(fullpath)+1];
strcpy(dirnoslash, fullpath);
int pos = strlen(dirnoslash)-1;
s32 pos = strlen(dirnoslash)-1;
while(dirnoslash[pos] == '/')
{
dirnoslash[pos] = '\0';

View File

@ -7,14 +7,14 @@ extern "C" {
#include <gctypes.h>
int MountFS(void *pClient, void *pCmd, char **mount_path);
int UmountFS(void *pClient, void *pCmd, const char *mountPath);
s32 MountFS(void *pClient, void *pCmd, char **mount_path);
s32 UmountFS(void *pClient, void *pCmd, const char *mountPath);
int LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size);
s32 LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size);
//! todo: C++ class
int CreateSubfolder(const char * fullpath);
int CheckFile(const char * filepath);
s32 CreateSubfolder(const char * fullpath);
s32 CheckFile(const char * filepath);
#ifdef __cplusplus
}

View File

@ -45,8 +45,8 @@ typedef struct _sd_fat_private_t {
typedef struct _sd_fat_file_state_t {
sd_fat_private_t *dev;
int fd; /* File descriptor */
int flags; /* Opening flags */
s32 fd; /* File descriptor */
s32 flags; /* Opening flags */
bool read; /* True if allowed to read from file */
bool write; /* True if allowed to write to file */
bool append; /* True if allowed to append to file */
@ -58,14 +58,14 @@ typedef struct _sd_fat_file_state_t {
typedef struct _sd_fat_dir_entry_t {
sd_fat_private_t *dev;
int dirHandle;
s32 dirHandle;
} sd_fat_dir_entry_t;
static sd_fat_private_t *sd_fat_get_device_data(const char *path)
{
const devoptab_t *devoptab = NULL;
char name[128] = {0};
int i;
s32 i;
// Get the device name from the path
strncpy(name, path, 127);
@ -98,7 +98,7 @@ static char *sd_fat_real_path (const char *path, sd_fat_private_t *dev)
path = strchr(path, ':') + 1;
}
int mount_len = strlen(dev->mount_path);
s32 mount_len = strlen(dev->mount_path);
char *new_name = (char*)malloc(mount_len + strlen(path) + 1);
if(new_name) {
@ -109,7 +109,7 @@ static char *sd_fat_real_path (const char *path, sd_fat_private_t *dev)
return new_name;
}
static int sd_fat_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode)
static s32 sd_fat_open_r (struct _reent *r, void *fileStruct, const char *path, s32 flags, s32 mode)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
@ -145,7 +145,7 @@ static int sd_fat_open_r (struct _reent *r, void *fileStruct, const char *path,
return -1;
}
int fd = -1;
s32 fd = -1;
OSLockMutex(dev->pMutex);
@ -156,7 +156,7 @@ static int sd_fat_open_r (struct _reent *r, void *fileStruct, const char *path,
return -1;
}
int result = FSOpenFile(dev->pClient, dev->pCmd, real_path, mode_str, &fd, -1);
s32 result = FSOpenFile(dev->pClient, dev->pCmd, real_path, mode_str, &fd, (s32)-1);
free(real_path);
@ -174,7 +174,7 @@ static int sd_fat_open_r (struct _reent *r, void *fileStruct, const char *path,
file->pos = 0;
file->len = stats.size;
OSUnlockMutex(dev->pMutex);
return (int)file;
return (s32)file;
}
r->_errno = result;
@ -183,7 +183,7 @@ static int sd_fat_open_r (struct _reent *r, void *fileStruct, const char *path,
}
static int sd_fat_close_r (struct _reent *r, int fd)
static s32 sd_fat_close_r (struct _reent *r, s32 fd)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
@ -193,7 +193,7 @@ static int sd_fat_close_r (struct _reent *r, int fd)
OSLockMutex(file->dev->pMutex);
int result = FSCloseFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
s32 result = FSCloseFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
OSUnlockMutex(file->dev->pMutex);
@ -205,7 +205,7 @@ static int sd_fat_close_r (struct _reent *r, int fd)
return 0;
}
static off_t sd_fat_seek_r (struct _reent *r, int fd, off_t pos, int dir)
static off_t sd_fat_seek_r (struct _reent *r, s32 fd, off_t pos, s32 dir)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
@ -231,7 +231,7 @@ static off_t sd_fat_seek_r (struct _reent *r, int fd, off_t pos, int dir)
return -1;
}
int result = FSSetPosFile(file->dev->pClient, file->dev->pCmd, file->fd, file->pos, -1);
s32 result = FSSetPosFile(file->dev->pClient, file->dev->pCmd, file->fd, file->pos, -1);
OSUnlockMutex(file->dev->pMutex);
@ -243,7 +243,7 @@ static off_t sd_fat_seek_r (struct _reent *r, int fd, off_t pos, int dir)
return result;
}
static ssize_t sd_fat_write_r (struct _reent *r, int fd, const char *ptr, size_t len)
static ssize_t sd_fat_write_r (struct _reent *r, s32 fd, const char *ptr, size_t len)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
@ -277,7 +277,7 @@ static ssize_t sd_fat_write_r (struct _reent *r, int fd, const char *ptr, size_t
size_t write_size = (len_aligned < (len - done)) ? len_aligned : (len - done);
memcpy(tmpBuf, ptr + done, write_size);
int result = FSWriteFile(file->dev->pClient, file->dev->pCmd, tmpBuf, 0x01, write_size, file->fd, 0, -1);
s32 result = FSWriteFile(file->dev->pClient, file->dev->pCmd, tmpBuf, 0x01, write_size, file->fd, 0, -1);
if(result < 0)
{
r->_errno = result;
@ -302,7 +302,7 @@ static ssize_t sd_fat_write_r (struct _reent *r, int fd, const char *ptr, size_t
return done;
}
static ssize_t sd_fat_read_r (struct _reent *r, int fd, char *ptr, size_t len)
static ssize_t sd_fat_read_r (struct _reent *r, s32 fd, char *ptr, size_t len)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
@ -335,7 +335,7 @@ static ssize_t sd_fat_read_r (struct _reent *r, int fd, char *ptr, size_t len)
{
size_t read_size = (len_aligned < (len - done)) ? len_aligned : (len - done);
int result = FSReadFile(file->dev->pClient, file->dev->pCmd, tmpBuf, 0x01, read_size, file->fd, 0, -1);
s32 result = FSReadFile(file->dev->pClient, file->dev->pCmd, tmpBuf, 0x01, read_size, file->fd, 0, -1);
if(result < 0)
{
r->_errno = result;
@ -362,7 +362,7 @@ static ssize_t sd_fat_read_r (struct _reent *r, int fd, char *ptr, size_t len)
}
static int sd_fat_fstat_r (struct _reent *r, int fd, struct stat *st)
static s32 sd_fat_fstat_r (struct _reent *r, s32 fd, struct stat *st)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
@ -376,7 +376,7 @@ static int sd_fat_fstat_r (struct _reent *r, int fd, struct stat *st)
memset(st, 0, sizeof(struct stat));
FSStat stats;
int result = FSGetStatFile(file->dev->pClient, file->dev->pCmd, file->fd, &stats, -1);
s32 result = FSGetStatFile(file->dev->pClient, file->dev->pCmd, file->fd, &stats, -1);
if(result != 0) {
r->_errno = result;
OSUnlockMutex(file->dev->pMutex);
@ -400,7 +400,7 @@ static int sd_fat_fstat_r (struct _reent *r, int fd, struct stat *st)
return 0;
}
static int sd_fat_ftruncate_r (struct _reent *r, int fd, off_t len)
static s32 sd_fat_ftruncate_r (struct _reent *r, s32 fd, off_t len)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
@ -410,7 +410,7 @@ static int sd_fat_ftruncate_r (struct _reent *r, int fd, off_t len)
OSLockMutex(file->dev->pMutex);
int result = FSTruncateFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
s32 result = FSTruncateFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
OSUnlockMutex(file->dev->pMutex);
@ -422,7 +422,7 @@ static int sd_fat_ftruncate_r (struct _reent *r, int fd, off_t len)
return 0;
}
static int sd_fat_fsync_r (struct _reent *r, int fd)
static s32 sd_fat_fsync_r (struct _reent *r, s32 fd)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
@ -432,7 +432,7 @@ static int sd_fat_fsync_r (struct _reent *r, int fd)
OSLockMutex(file->dev->pMutex);
int result = FSFlushFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
s32 result = FSFlushFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
OSUnlockMutex(file->dev->pMutex);
@ -444,7 +444,7 @@ static int sd_fat_fsync_r (struct _reent *r, int fd)
return 0;
}
static int sd_fat_stat_r (struct _reent *r, const char *path, struct stat *st)
static s32 sd_fat_stat_r (struct _reent *r, const char *path, struct stat *st)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
@ -466,7 +466,7 @@ static int sd_fat_stat_r (struct _reent *r, const char *path, struct stat *st)
FSStat stats;
int result = FSGetStat(dev->pClient, dev->pCmd, real_path, &stats, -1);
s32 result = FSGetStat(dev->pClient, dev->pCmd, real_path, &stats, -1);
free(real_path);
real_path = NULL;
@ -496,13 +496,13 @@ static int sd_fat_stat_r (struct _reent *r, const char *path, struct stat *st)
return 0;
}
static int sd_fat_link_r (struct _reent *r, const char *existing, const char *newLink)
static s32 sd_fat_link_r (struct _reent *r, const char *existing, const char *newLink)
{
r->_errno = ENOTSUP;
return -1;
}
static int sd_fat_unlink_r (struct _reent *r, const char *name)
static s32 sd_fat_unlink_r (struct _reent *r, const char *name)
{
sd_fat_private_t *dev = sd_fat_get_device_data(name);
if(!dev) {
@ -520,7 +520,7 @@ static int sd_fat_unlink_r (struct _reent *r, const char *name)
}
int result = FSRemove(dev->pClient, dev->pCmd, real_path, -1);
s32 result = FSRemove(dev->pClient, dev->pCmd, real_path, -1);
free(real_path);
real_path = NULL;
@ -535,7 +535,7 @@ static int sd_fat_unlink_r (struct _reent *r, const char *name)
return 0;
}
static int sd_fat_chdir_r (struct _reent *r, const char *name)
static s32 sd_fat_chdir_r (struct _reent *r, const char *name)
{
sd_fat_private_t *dev = sd_fat_get_device_data(name);
if(!dev) {
@ -552,7 +552,7 @@ static int sd_fat_chdir_r (struct _reent *r, const char *name)
return -1;
}
int result = FSChangeDir(dev->pClient, dev->pCmd, real_path, -1);
s32 result = FSChangeDir(dev->pClient, dev->pCmd, real_path, -1);
free(real_path);
real_path = NULL;
@ -567,7 +567,7 @@ static int sd_fat_chdir_r (struct _reent *r, const char *name)
return 0;
}
static int sd_fat_rename_r (struct _reent *r, const char *oldName, const char *newName)
static s32 sd_fat_rename_r (struct _reent *r, const char *oldName, const char *newName)
{
sd_fat_private_t *dev = sd_fat_get_device_data(oldName);
if(!dev) {
@ -591,7 +591,7 @@ static int sd_fat_rename_r (struct _reent *r, const char *oldName, const char *n
return -1;
}
int result = FSRename(dev->pClient, dev->pCmd, real_oldpath, real_newpath, -1);
s32 result = FSRename(dev->pClient, dev->pCmd, real_oldpath, real_newpath, -1);
free(real_oldpath);
free(real_newpath);
@ -607,7 +607,7 @@ static int sd_fat_rename_r (struct _reent *r, const char *oldName, const char *n
}
static int sd_fat_mkdir_r (struct _reent *r, const char *path, int mode)
static s32 sd_fat_mkdir_r (struct _reent *r, const char *path, s32 mode)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
@ -624,7 +624,7 @@ static int sd_fat_mkdir_r (struct _reent *r, const char *path, int mode)
return -1;
}
int result = FSMakeDir(dev->pClient, dev->pCmd, real_path, -1);
s32 result = FSMakeDir(dev->pClient, dev->pCmd, real_path, -1);
free(real_path);
@ -638,7 +638,7 @@ static int sd_fat_mkdir_r (struct _reent *r, const char *path, int mode)
return 0;
}
static int sd_fat_statvfs_r (struct _reent *r, const char *path, struct statvfs *buf)
static s32 sd_fat_statvfs_r (struct _reent *r, const char *path, struct statvfs *buf)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
@ -660,7 +660,7 @@ static int sd_fat_statvfs_r (struct _reent *r, const char *path, struct statvfs
u64 size;
int result = FSGetFreeSpaceSize(dev->pClient, dev->pCmd, real_path, &size, -1);
s32 result = FSGetFreeSpaceSize(dev->pClient, dev->pCmd, real_path, &size, -1);
free(real_path);
@ -682,7 +682,7 @@ static int sd_fat_statvfs_r (struct _reent *r, const char *path, struct statvfs
// Free blocks available for all and for non-privileged processes
buf->f_bfree = buf->f_bavail = size >> 9;
// Number of inodes at this point in time
// Number of inodes at this pos32 in time
buf->f_files = 0xffffffff;
// Free inodes available for all and for non-privileged processes
@ -721,9 +721,9 @@ static DIR_ITER *sd_fat_diropen_r (struct _reent *r, DIR_ITER *dirState, const c
return NULL;
}
int dirHandle;
s32 dirHandle;
int result = FSOpenDir(dev->pClient, dev->pCmd, real_path, &dirHandle, -1);
s32 result = FSOpenDir(dev->pClient, dev->pCmd, real_path, &dirHandle, (s32)-1);
free(real_path);
@ -741,7 +741,7 @@ static DIR_ITER *sd_fat_diropen_r (struct _reent *r, DIR_ITER *dirState, const c
return dirState;
}
static int sd_fat_dirclose_r (struct _reent *r, DIR_ITER *dirState)
static s32 sd_fat_dirclose_r (struct _reent *r, DIR_ITER *dirState)
{
sd_fat_dir_entry_t *dirIter = (sd_fat_dir_entry_t *)dirState->dirStruct;
if(!dirIter->dev) {
@ -751,7 +751,7 @@ static int sd_fat_dirclose_r (struct _reent *r, DIR_ITER *dirState)
OSLockMutex(dirIter->dev->pMutex);
int result = FSCloseDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, -1);
s32 result = FSCloseDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, -1);
OSUnlockMutex(dirIter->dev->pMutex);
@ -763,7 +763,7 @@ static int sd_fat_dirclose_r (struct _reent *r, DIR_ITER *dirState)
return 0;
}
static int sd_fat_dirreset_r (struct _reent *r, DIR_ITER *dirState)
static s32 sd_fat_dirreset_r (struct _reent *r, DIR_ITER *dirState)
{
sd_fat_dir_entry_t *dirIter = (sd_fat_dir_entry_t *)dirState->dirStruct;
if(!dirIter->dev) {
@ -773,7 +773,7 @@ static int sd_fat_dirreset_r (struct _reent *r, DIR_ITER *dirState)
OSLockMutex(dirIter->dev->pMutex);
int result = FSRewindDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, -1);
s32 result = FSRewindDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, -1);
OSUnlockMutex(dirIter->dev->pMutex);
@ -785,7 +785,7 @@ static int sd_fat_dirreset_r (struct _reent *r, DIR_ITER *dirState)
return 0;
}
static int sd_fat_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *st)
static s32 sd_fat_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *st)
{
sd_fat_dir_entry_t *dirIter = (sd_fat_dir_entry_t *)dirState->dirStruct;
if(!dirIter->dev) {
@ -797,7 +797,7 @@ static int sd_fat_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filenam
FSDirEntry * dir_entry = malloc(sizeof(FSDirEntry));
int result = FSReadDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, dir_entry, -1);
s32 result = FSReadDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, dir_entry, -1);
if(result < 0)
{
free(dir_entry);
@ -859,12 +859,12 @@ static const devoptab_t devops_sd_fat = {
NULL /* Device data */
};
static int sd_fat_add_device (const char *name, const char *mount_path, void *pClient, void *pCmd)
static s32 sd_fat_add_device (const char *name, const char *mount_path, void *pClient, void *pCmd)
{
devoptab_t *dev = NULL;
char *devname = NULL;
char *devpath = NULL;
int i;
s32 i;
// Sanity check
if (!name) {
@ -933,11 +933,11 @@ static int sd_fat_add_device (const char *name, const char *mount_path, void *pC
return -1;
}
static int sd_fat_remove_device (const char *path, void **pClient, void **pCmd, char **mountPath)
static s32 sd_fat_remove_device (const char *path, void **pClient, void **pCmd, char **mountPath)
{
const devoptab_t *devoptab = NULL;
char name[128] = {0};
int i;
s32 i;
// Get the device name from the path
strncpy(name, path, 127);
@ -975,9 +975,9 @@ static int sd_fat_remove_device (const char *path, void **pClient, void **pCmd,
return -1;
}
int mount_sd_fat(const char *path)
s32 mount_sd_fat(const char *path)
{
int result = -1;
s32 result = -1;
// get command and client
void* pClient = malloc(FS_CLIENT_SIZE);
@ -1006,13 +1006,13 @@ int mount_sd_fat(const char *path)
return result;
}
int unmount_sd_fat(const char *path)
s32 unmount_sd_fat(const char *path)
{
void *pClient = 0;
void *pCmd = 0;
char *mountPath = 0;
int result = sd_fat_remove_device(path, &pClient, &pCmd, &mountPath);
s32 result = sd_fat_remove_device(path, &pClient, &pCmd, &mountPath);
if(result == 0)
{
UmountFS(pClient, pCmd, mountPath);

View File

@ -28,8 +28,8 @@
extern "C" {
#endif
int mount_sd_fat(const char *path);
int unmount_sd_fat(const char *path);
s32 mount_sd_fat(const char *path);
s32 unmount_sd_fat(const char *path);
#ifdef __cplusplus
}

View File

@ -1,6 +1,6 @@
/*
* FreeTypeGX is a wrapper class for libFreeType which renders a compiled
* FreeType parsable font into a GX texture for Wii homebrew development.
* FreeType parsable font so a GX texture for Wii homebrew development.
* Copyright (C) 2008 Armin Tamzarian
* Modified by Dimok, 2015 for WiiU GX2
*
@ -34,7 +34,7 @@ using namespace std;
*/
FreeTypeGX::FreeTypeGX(const uint8_t* fontBuffer, FT_Long bufferSize, bool lastFace)
{
int faceIndex = 0;
int32_t faceIndex = 0;
ftPointSize = 0;
GX2InitSampler(&ftSampler, GX2_TEX_CLAMP_CLAMP_BORDER, GX2_TEX_XY_FILTER_BILINEAR);
@ -78,7 +78,7 @@ wchar_t* FreeTypeGX::charToWideChar(const char* strChar)
wchar_t *strWChar = new (std::nothrow) wchar_t[strlen(strChar) + 1];
if (!strWChar) return NULL;
int bt = mbstowcs(strWChar, strChar, strlen(strChar));
int32_t bt = mbstowcs(strWChar, strChar, strlen(strChar));
if (bt > 0)
{
strWChar[bt] = 0;
@ -389,7 +389,7 @@ uint16_t FreeTypeGX::drawText(CVideo *video, int16_t x, int16_t y, int16_t z, co
y_offset = getStyleOffsetHeight(textStyle, pixelSize);
}
int i = 0;
int32_t i = 0;
while (text[i])
{
ftgxCharData* glyphData = cacheGlyphData(text[i], pixelSize);
@ -429,8 +429,8 @@ uint16_t FreeTypeGX::getWidth(const wchar_t *text, int16_t pixelSize)
uint16_t strWidth = 0;
FT_Vector pairDelta;
int32_t i = 0;
int i = 0;
while (text[i])
{
ftgxCharData* glyphData = cacheGlyphData(text[i], pixelSize);
@ -505,7 +505,7 @@ void FreeTypeGX::getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widt
int16_t strMax = 0, strMin = 9999;
uint16_t currWidth = 0;
int i = 0;
int32_t i = 0;
while (text[i])
{

View File

@ -183,7 +183,7 @@ void GameIcon::draw(CVideo *pVideo, const glm::mat4 & projectionMtx, const glm::
f32 strokeScaleX = pVideo->getWidthScaleFactor() * strokeWidth * 0.25f + cfIconMirrorScale;
f32 strokeScaleY = pVideo->getHeightScaleFactor() * strokeWidth * 0.25f + cfIconMirrorScale;
for(int iDraw = 0; iDraw < 2; iDraw++)
for(s32 iDraw = 0; iDraw < 2; iDraw++)
{
glm::vec4 * alphaFadeOut;
glm::mat4 m_iconView;

View File

@ -72,7 +72,7 @@ private:
f32 *strokePosVtxs;
f32 *strokeTexCoords;
u8 *strokeColorVtxs;
int strokeFractalEnable;
s32 strokeFractalEnable;
f32 strokeBlurBorder;
glm::vec4 selectionBlurOuterColorIntensity;
f32 selectionBlurOuterSize;

View File

@ -755,6 +755,6 @@ const float cfGameIconStrokeVtxs[] =
-0.376756459475,1.046143651009,0.0f
};
const unsigned int cuGameIconStrokeVtxCount = sizeof(cfGameIconStrokeVtxs) / (sizeof(float) * 3);
const u32 cuGameIconStrokeVtxCount = sizeof(cfGameIconStrokeVtxs) / (sizeof(float) * 3);
#endif

View File

@ -20,7 +20,7 @@ GridBackground::GridBackground(GuiImageData *img)
if(m_posVtxs)
{
int i = 0;
s32 i = 0;
m_posVtxs[i++] = -1.0f; m_posVtxs[i++] = 0.0f; m_posVtxs[i++] = 1.0f;
m_posVtxs[i++] = 1.0f; m_posVtxs[i++] = 0.0f; m_posVtxs[i++] = 1.0f;
m_posVtxs[i++] = 1.0f; m_posVtxs[i++] = 0.0f; m_posVtxs[i++] = -1.0f;
@ -44,7 +44,7 @@ GridBackground::GridBackground(GuiImageData *img)
sinRot, cosRot
});
for(int i = 0; i < 4; i++) {
for(s32 i = 0; i < 4; i++) {
texCoordVec[i] = texRotateMtx * texCoordVec[i];
m_texCoords[i*2 + 0] = texCoordVec[i][0];
m_texCoords[i*2 + 1] = texCoordVec[i][1];

View File

@ -33,14 +33,14 @@ GuiButton::GuiButton(f32 w, f32 h)
icon = NULL;
iconOver = NULL;
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
{
label[i] = NULL;
labelOver[i] = NULL;
labelHold[i] = NULL;
labelClick[i] = NULL;
}
for(int i = 0; i < iMaxGuiTriggers; i++)
for(s32 i = 0; i < iMaxGuiTriggers; i++)
{
trigger[i] = NULL;
}
@ -93,22 +93,22 @@ void GuiButton::setIconOver(GuiImage* img)
if(img) img->setParent(this);
}
void GuiButton::setLabel(GuiText* txt, int n)
void GuiButton::setLabel(GuiText* txt, s32 n)
{
label[n] = txt;
if(txt) txt->setParent(this);
}
void GuiButton::setLabelOver(GuiText* txt, int n)
void GuiButton::setLabelOver(GuiText* txt, s32 n)
{
labelOver[n] = txt;
if(txt) txt->setParent(this);
}
void GuiButton::setLabelHold(GuiText* txt, int n)
void GuiButton::setLabelHold(GuiText* txt, s32 n)
{
labelHold[n] = txt;
if(txt) txt->setParent(this);
}
void GuiButton::setLabelClick(GuiText* txt, int n)
void GuiButton::setLabelClick(GuiText* txt, s32 n)
{
labelClick[n] = txt;
if(txt) txt->setParent(this);
@ -127,7 +127,7 @@ void GuiButton::setSoundClick(GuiSound * snd)
soundClick = snd;
}
void GuiButton::setTrigger(GuiTrigger * t, int idx)
void GuiButton::setTrigger(GuiTrigger * t, s32 idx)
{
if(idx >= 0 && idx < iMaxGuiTriggers)
{
@ -135,7 +135,7 @@ void GuiButton::setTrigger(GuiTrigger * t, int idx)
}
else
{
for(int i = 0; i < iMaxGuiTriggers; i++)
for(s32 i = 0; i < iMaxGuiTriggers; i++)
{
if(!trigger[i])
{
@ -175,7 +175,7 @@ void GuiButton::draw(CVideo *v)
icon->draw(v);
// draw text
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
{
if(isStateSet(STATE_OVER | STATE_SELECTED | STATE_CLICKED | STATE_HELD) && labelOver[i])
labelOver[i]->draw(v);
@ -231,7 +231,7 @@ void GuiButton::update(GuiController * c)
}
}
for(int i = 0; i < iMaxGuiTriggers; i++)
for(s32 i = 0; i < iMaxGuiTriggers; i++)
{
if(!trigger[i])
continue;
@ -240,7 +240,7 @@ void GuiButton::update(GuiController * c)
if(clickable)
{
int isClicked = trigger[i]->clicked(c);
s32 isClicked = trigger[i]->clicked(c);
if( !clickedTrigger && (isClicked != GuiTrigger::CLICKED_NONE)
&& (trigger[i]->isClickEverywhere() || (isStateSet(STATE_SELECTED | STATE_OVER, c->chan) && trigger[i]->isSelectionClickEverywhere()) || this->isInside(c->data.x, c->data.y)))

View File

@ -52,19 +52,19 @@ class GuiButton : public GuiElement
//!Sets the button's label
//!\param t Pointer to GuiText object
//!\param n Index of label to set (optional, default is 0)
void setLabel(GuiText* t, int n = 0);
void setLabel(GuiText* t, s32 n = 0);
//!Sets the button's label on over (eg: different colored text)
//!\param t Pointer to GuiText object
//!\param n Index of label to set (optional, default is 0)
void setLabelOver(GuiText* t, int n = 0);
void setLabelOver(GuiText* t, s32 n = 0);
//!Sets the button's label on hold
//!\param t Pointer to GuiText object
//!\param n Index of label to set (optional, default is 0)
void setLabelHold(GuiText* t, int n = 0);
void setLabelHold(GuiText* t, s32 n = 0);
//!Sets the button's label on click
//!\param t Pointer to GuiText object
//!\param n Index of label to set (optional, default is 0)
void setLabelClick(GuiText* t, int n = 0);
void setLabelClick(GuiText* t, s32 n = 0);
//!Sets the sound to play on over
//!\param s Pointer to GuiSound object
void setSoundOver(GuiSound * s);
@ -77,7 +77,7 @@ class GuiButton : public GuiElement
//!Set a new GuiTrigger for the element
//!\param i Index of trigger array to set
//!\param t Pointer to GuiTrigger
void setTrigger(GuiTrigger * t, int idx = -1);
void setTrigger(GuiTrigger * t, s32 idx = -1);
//!
void resetState(void);
//!Constantly called to draw the GuiButton
@ -85,7 +85,7 @@ class GuiButton : public GuiElement
//!Constantly called to allow the GuiButton to respond to updated input data
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
void update(GuiController * c);
sigslot::signal2<GuiButton *, const GuiController *> selected;
sigslot::signal2<GuiButton *, const GuiController *> deSelected;
sigslot::signal2<GuiButton *, const GuiController *> pointedOn;
@ -94,7 +94,7 @@ class GuiButton : public GuiElement
sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> held;
sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> released;
protected:
static const int iMaxGuiTriggers = 10;
static const s32 iMaxGuiTriggers = 10;
GuiImage * image; //!< Button image (default)
GuiImage * imageOver; //!< Button image for STATE_SELECTED

View File

@ -23,11 +23,11 @@
class GuiConfigurationScreen : public GuiFrame
{
public:
GuiConfigurationScreen(int w, int h) : GuiFrame(w, h) {}
GuiConfigurationScreen(s32 w, s32 h) : GuiFrame(w, h) {}
virtual ~GuiConfigurationScreen() {}
sigslot::signal2<GuiConfigurationScreen *, int> gameLaunchClicked;
sigslot::signal2<GuiConfigurationScreen *, int> gameSelectionChanged;
sigslot::signal2<GuiConfigurationScreen *, s32> gameLaunchClicked;
sigslot::signal2<GuiConfigurationScreen *, s32> gameSelectionChanged;
};
#endif /* GUICONFIGURATIONSCREEN_H_ */

View File

@ -24,7 +24,7 @@ class GuiController
{
public:
//!Constructor
GuiController(int channel)
GuiController(s32 channel)
: chan(channel)
{
memset(&lastData, 0, sizeof(lastData));
@ -54,22 +54,22 @@ public:
//!Destructor
virtual ~GuiController() {}
virtual bool update(int width, int height) = 0;
virtual bool update(s32 width, s32 height) = 0;
typedef struct
{
unsigned int buttons_h;
unsigned int buttons_d;
unsigned int buttons_r;
u32 buttons_h;
u32 buttons_d;
u32 buttons_r;
bool validPointer;
bool touched;
float pointerAngle;
int x;
int y;
s32 x;
s32 y;
} PadData;
int chan;
int chanIdx;
s32 chan;
s32 chanIdx;
PadData data;
PadData lastData;

View File

@ -19,8 +19,6 @@
#include "utils/StringTools.h"
#include "utils/logger.h"
GuiControllerInputDisplay::GuiControllerInputDisplay(UController_Type _controller_type): GuiFrame(441,324)
, controller_type(_controller_type)
, proImageData(Resources::GetImageData("buttons_pro_controller.png"))
@ -45,29 +43,21 @@ GuiControllerInputDisplay::GuiControllerInputDisplay(UController_Type _controlle
}
typedef std::map<std::string, u32>::iterator it_type;
for(it_type iterator = btn_list->begin(); iterator != btn_list->end(); iterator++) {
//log_printf("Adding button! \"%s\"\n",iterator->first.c_str());
//log_printf("Creating ButtonConfig* \n");
ButtonConfig * btn_cfg = new ButtonConfig;
if(btn_cfg == NULL){
log_printf("Error on alloc ButtonConfig\n");
continue;
}
memset(btn_cfg,0,sizeof(ButtonConfig));
//log_printf("Creating suffix \n");
std::string * suffix = new std::string(iterator->first);
//log_printf("Setting suffix \n");
btn_cfg->img.suffix = suffix;
//log_printf("creating new filename\n");
std::string filename = strfmt("%s%s.png",prefix.c_str(),btn_cfg->img.suffix->c_str());
//log_printf("loading file..%s \n",filename.c_str());
btn_cfg->img.imagedata = Resources::GetImageData(filename.c_str());
if(btn_cfg->img.imagedata == NULL){
log_printf("Error, was null!\n");
delete btn_cfg;
continue;
}
//log_printf("Done!\n");
//log_printf("loading image..\n");
btn_cfg->img.image = new GuiImage(btn_cfg->img.imagedata);
if(btn_cfg->img.image == NULL){
log_printf("Error, was null! Removing ImageData\n");
@ -75,11 +65,9 @@ GuiControllerInputDisplay::GuiControllerInputDisplay(UController_Type _controlle
delete btn_cfg;
continue;
}
//log_printf("setting value to %08X.\n",iterator->second);
btn_cfg->value = iterator->second;
controllerConfig.buttons.push_back(btn_cfg);
btn_cfg->img.image->setState(STATE_HIDDEN);
//log_printf("Appending\n");
append(btn_cfg->img.image);
}
}
@ -109,18 +97,17 @@ void GuiControllerInputDisplay::process(){
buttons_hold = gamepadData.btns_h;
}else{
int chan = 0;
s32 chan = 0;
if(controller_type == UController_Type_Pro1){ chan = 0;}
if(controller_type == UController_Type_Pro2){ chan = 1;}
if(controller_type == UController_Type_Pro3){ chan = 2;}
if(controller_type == UController_Type_Pro4){ chan = 3;}
int res = 0;
s32 res = 0;
if((res = ControllerPatcher::setProControllerDataFromHID((void *) &proData,chan,PRO_CONTROLLER_MODE_KPADDATA)) >= 0){
buttons_hold = proData.pro.btns_h;
}
}
for(std::vector<ButtonConfig *>::iterator it = controllerConfig.buttons.begin(); it != controllerConfig.buttons.end(); ++it) {
ButtonConfig * btn_cfg = *it;
if(btn_cfg != NULL){

View File

@ -26,7 +26,7 @@
GuiDragListener::GuiDragListener(f32 w,f32 h){
width = w;
height = h;
for(int i = 0; i < iMaxGuiTriggers; i++)
for(s32 i = 0; i < iMaxGuiTriggers; i++)
{
trigger[i] = NULL;
}
@ -38,18 +38,18 @@ GuiDragListener::GuiDragListener(f32 w,f32 h){
GuiDragListener::~GuiDragListener(){
}
void GuiDragListener::setState(int i, int c){
void GuiDragListener::setState(s32 i, s32 c){
GuiElement::setState(i,c);
}
void GuiDragListener::setTrigger(GuiTrigger * t, int idx){
void GuiDragListener::setTrigger(GuiTrigger * t, s32 idx){
if(idx >= 0 && idx < iMaxGuiTriggers)
{
trigger[idx] = t;
}
else
{
for(int i = 0; i < iMaxGuiTriggers; i++)
for(s32 i = 0; i < iMaxGuiTriggers; i++)
{
if(!trigger[i])
{
@ -66,7 +66,7 @@ void GuiDragListener::update(GuiController * c){
else if(parentElement && (parentElement->isStateSet(STATE_DISABLED|STATE_HIDDEN|STATE_DISABLE_INPUT, c->chan)))
return;
for(int i = 0; i < iMaxGuiTriggers; i++){
for(s32 i = 0; i < iMaxGuiTriggers; i++){
if(!trigger[i]){
continue;
}
@ -75,8 +75,8 @@ void GuiDragListener::update(GuiController * c){
if(isHeld && this->isInside(c->data.x, c->data.y)){
int dx = c->data.x - c->lastData.x;
int dy = c->data.y - c->lastData.y;
s32 dx = c->data.x - c->lastData.x;
s32 dy = c->data.y - c->lastData.y;
if(dx == 0 && dy == 0) continue;

View File

@ -32,20 +32,20 @@ class GuiDragListener : public GuiElement
//!Destructor
virtual ~GuiDragListener();
void setState(int i, int c);
void setState(s32 i, s32 c);
//!Set a new GuiTrigger for the element
//!\param i Index of trigger array to set
//!\param t Pointer to GuiTrigger
void setTrigger(GuiTrigger * t, int idx = -1);
void setTrigger(GuiTrigger * t, s32 idx = -1);
//!Constantly called to allow the GuiDragListener to respond to updated input data
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
void update(GuiController * c);
sigslot::signal5<GuiDragListener *, const GuiController *, GuiTrigger *,int,int> dragged;
sigslot::signal5<GuiDragListener *, const GuiController *, GuiTrigger *,s32,s32> dragged;
protected:
static const int iMaxGuiTriggers = 10;
static const s32 iMaxGuiTriggers = 10;
GuiTrigger * trigger[iMaxGuiTriggers]; //!< GuiTriggers (input actions) that this element responds to
};

View File

@ -17,8 +17,8 @@
#include "GuiElement.h"
//! TODO remove this!
static int screenwidth = 1280;
static int screenheight = 720;
static s32 screenwidth = 1280;
static s32 screenheight = 720;
/**
* Constructor for the Object class.
@ -34,7 +34,7 @@ GuiElement::GuiElement()
scaleX = 1.0f;
scaleY = 1.0f;
scaleZ = 1.0f;
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
state[i] = STATE_DEFAULT;
stateChan = -1;
parentElement = NULL;
@ -130,7 +130,7 @@ f32 GuiElement::getTop()
return y + yoffset;
}
void GuiElement::setEffect(int eff, int amount, int target)
void GuiElement::setEffect(s32 eff, s32 amount, s32 target)
{
if(eff & EFFECT_SLIDE_IN)
{
@ -138,28 +138,28 @@ void GuiElement::setEffect(int eff, int amount, int target)
if(eff & EFFECT_SLIDE_TOP)
{
if(eff & EFFECT_SLIDE_FROM)
yoffsetDyn = (int) -getHeight()*scaleY;
yoffsetDyn = (s32) -getHeight()*scaleY;
else
yoffsetDyn = -screenheight;
}
else if(eff & EFFECT_SLIDE_LEFT)
{
if(eff & EFFECT_SLIDE_FROM)
xoffsetDyn = (int) -getWidth()*scaleX;
xoffsetDyn = (s32) -getWidth()*scaleX;
else
xoffsetDyn = -screenwidth;
}
else if(eff & EFFECT_SLIDE_BOTTOM)
{
if(eff & EFFECT_SLIDE_FROM)
yoffsetDyn = (int) getHeight()*scaleY;
yoffsetDyn = (s32) getHeight()*scaleY;
else
yoffsetDyn = screenheight;
}
else if(eff & EFFECT_SLIDE_RIGHT)
{
if(eff & EFFECT_SLIDE_FROM)
xoffsetDyn = (int) getWidth()*scaleX;
xoffsetDyn = (s32) getWidth()*scaleX;
else
xoffsetDyn = screenwidth;
}
@ -181,7 +181,7 @@ void GuiElement::setEffect(int eff, int amount, int target)
//!\param e Effect to enable
//!\param a Amount of the effect (usage varies on effect)
//!\param t Target amount of the effect (usage varies on effect)
void GuiElement::setEffectOnOver(int e, int a, int t)
void GuiElement::setEffectOnOver(s32 e, s32 a, s32 t)
{
effectsOver |= e;
effectAmountOver = a;

View File

@ -239,7 +239,7 @@ class GuiElement : public AsyncDeleter::Element
//!Sets the element's state
//!\param s State (STATE_DEFAULT, STATE_SELECTED, STATE_CLICKED, STATE_DISABLED)
//!\param c Controller channel (0-3, -1 = none)
virtual void setState(int s, int c = -1)
virtual void setState(s32 s, s32 c = -1)
{
if(c >= 0 && c < 4)
{
@ -247,13 +247,13 @@ class GuiElement : public AsyncDeleter::Element
}
else
{
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
state[i] |= s;
}
stateChan = c;
stateChanged(this, s, c);
}
virtual void clearState(int s, int c = -1)
virtual void clearState(s32 s, s32 c = -1)
{
if(c >= 0 && c < 4)
{
@ -261,13 +261,13 @@ class GuiElement : public AsyncDeleter::Element
}
else
{
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
state[i] &= ~s;
}
stateChan = c;
stateChanged(this, s, c);
}
virtual bool isStateSet(int s, int c = -1) const
virtual bool isStateSet(s32 s, s32 c = -1) const
{
if(c >= 0 && c < 4)
{
@ -275,7 +275,7 @@ class GuiElement : public AsyncDeleter::Element
}
else
{
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
if((state[i] & s) != 0)
return true;
@ -284,14 +284,14 @@ class GuiElement : public AsyncDeleter::Element
}
//!Gets the element's current state
//!\return state
virtual int getState(int c = 0) { return state[c]; };
virtual s32 getState(s32 c = 0) { return state[c]; };
//!Gets the controller channel that last changed the element's state
//!\return Channel number (0-3, -1 = no channel)
virtual int getStateChan() { return stateChan; };
virtual s32 getStateChan() { return stateChan; };
//!Resets the element's state to STATE_DEFAULT
virtual void resetState()
{
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
state[i] = STATE_DEFAULT;
stateChan = -1;
}
@ -386,19 +386,19 @@ class GuiElement : public AsyncDeleter::Element
//!\param e Effect to enable
//!\param a Amount of the effect (usage varies on effect)
//!\param t Target amount of the effect (usage varies on effect)
virtual void setEffect(int e, int a, int t=0);
virtual void setEffect(s32 e, s32 a, s32 t=0);
//!Sets an effect to be enabled on wiimote cursor over
//!\param e Effect to enable
//!\param a Amount of the effect (usage varies on effect)
//!\param t Target amount of the effect (usage varies on effect)
virtual void setEffectOnOver(int e, int a, int t=0);
virtual void setEffectOnOver(s32 e, s32 a, s32 t=0);
//!Shortcut to SetEffectOnOver(EFFECT_SCALE, 4, 110)
virtual void setEffectGrow() { setEffectOnOver(EFFECT_SCALE, 4, 110); }
//!Reset all applied effects
virtual void resetEffects();
//!Gets the current element effects
//!\return element effects
virtual int getEffect() const { return effects; }
virtual s32 getEffect() const { return effects; }
//!\return true if element animation is on going
virtual bool isAnimated() const { return (parentElement != 0) && (getEffect() > 0); }
//!Checks whether the specified coordinates are within the element's boundaries
@ -432,13 +432,13 @@ class GuiElement : public AsyncDeleter::Element
}
//!Gets whether or not the element is in STATE_SELECTED
//!\return true if selected, false otherwise
virtual int getSelected() { return -1; }
virtual s32 getSelected() { return -1; }
//!Sets the element's alignment respective to its parent element
//!Bitwise ALIGN_LEFT | ALIGN_RIGHT | ALIGN_CENTRE, ALIGN_TOP, ALIGN_BOTTOM, ALIGN_MIDDLE)
//!\param align Alignment
virtual void setAlignment(int a) { alignment = a; }
virtual void setAlignment(s32 a) { alignment = a; }
//!Gets the element's alignment
virtual int getAlignment() const { return alignment; }
virtual s32 getAlignment() const { return alignment; }
//!Angle of the object
virtual void setAngle(f32 a) { angle = a; }
//!Angle of the object
@ -489,7 +489,7 @@ class GuiElement : public AsyncDeleter::Element
}
//! Signals
sigslot::signal2<GuiElement *, bool> visibleChanged;
sigslot::signal3<GuiElement *, int, int> stateChanged;
sigslot::signal3<GuiElement *, s32, s32> stateChanged;
sigslot::signal1<GuiElement *> effectFinished;
protected:
bool rumble; //!< Wiimote rumble (on/off) - set to on when this element requests a rumble event
@ -508,22 +508,22 @@ class GuiElement : public AsyncDeleter::Element
f32 scaleX; //!< Element scale (1 = 100%)
f32 scaleY; //!< Element scale (1 = 100%)
f32 scaleZ; //!< Element scale (1 = 100%)
int alignment; //!< Horizontal element alignment, respective to parent element
int state[4]; //!< Element state (DEFAULT, SELECTED, CLICKED, DISABLED)
int stateChan; //!< Which controller channel is responsible for the last change in state
s32 alignment; //!< Horizontal element alignment, respective to parent element
s32 state[4]; //!< Element state (DEFAULT, SELECTED, CLICKED, DISABLED)
s32 stateChan; //!< Which controller channel is responsible for the last change in state
GuiElement * parentElement; //!< Parent element
//! TODO: Move me to some Animator class
int xoffsetDyn; //!< Element X offset, dynamic (added to xoffset value for animation effects)
int yoffsetDyn; //!< Element Y offset, dynamic (added to yoffset value for animation effects)
s32 xoffsetDyn; //!< Element X offset, dynamic (added to xoffset value for animation effects)
s32 yoffsetDyn; //!< Element Y offset, dynamic (added to yoffset value for animation effects)
f32 alphaDyn; //!< Element alpha, dynamic (multiplied by alpha value for blending/fading effects)
f32 scaleDyn; //!< Element scale, dynamic (multiplied by alpha value for blending/fading effects)
int effects; //!< Currently enabled effect(s). 0 when no effects are enabled
int effectAmount; //!< Effect amount. Used by different effects for different purposes
int effectTarget; //!< Effect target amount. Used by different effects for different purposes
int effectsOver; //!< Effects to enable when wiimote cursor is over this element. Copied to effects variable on over event
int effectAmountOver; //!< EffectAmount to set when wiimote cursor is over this element
int effectTargetOver; //!< EffectTarget to set when wiimote cursor is over this element
s32 effects; //!< Currently enabled effect(s). 0 when no effects are enabled
s32 effectAmount; //!< Effect amount. Used by different effects for different purposes
s32 effectTarget; //!< Effect target amount. Used by different effects for different purposes
s32 effectsOver; //!< Effects to enable when wiimote cursor is over this element. Copied to effects variable on over event
s32 effectAmountOver; //!< EffectAmount to set when wiimote cursor is over this element
s32 effectTargetOver; //!< EffectTarget to set when wiimote cursor is over this element
};
#endif

View File

@ -118,7 +118,7 @@ void GuiFrame::resetState()
}
}
void GuiFrame::setState(int s, int c)
void GuiFrame::setState(s32 s, s32 c)
{
GuiElement::setState(s, c);
@ -128,7 +128,7 @@ void GuiFrame::setState(int s, int c)
}
}
void GuiFrame::clearState(int s, int c)
void GuiFrame::clearState(s32 s, s32 c)
{
GuiElement::clearState(s, c);
@ -148,10 +148,10 @@ void GuiFrame::setVisible(bool v)
}
}
int GuiFrame::getSelected()
s32 GuiFrame::getSelected()
{
// find selected element
int found = -1;
s32 found = -1;
for (u32 i = 0; i < elements.size(); ++i)
{
if(elements[i]->isStateSet(STATE_SELECTED | STATE_OVER))

View File

@ -61,11 +61,11 @@ class GuiFrame : public GuiElement
void resetState();
//!Sets the window's state
//!\param s State
void setState(int s, int c = -1);
void clearState(int s, int c = -1);
void setState(s32 s, s32 c = -1);
void clearState(s32 s, s32 c = -1);
//!Gets the index of the GuiElement inside the window that is currently selected
//!\return index of selected GuiElement
int getSelected();
s32 getSelected();
//!Dim the Window's background
void dimBackground(bool d);
//!Draws all the elements in this GuiFrame

View File

@ -33,7 +33,7 @@ GuiImage::GuiImage(GuiImageData * img)
imageData = img;
}
GuiImage::GuiImage(int w, int h, const GX2Color & c, int type)
GuiImage::GuiImage(s32 w, s32 h, const GX2Color & c, s32 type)
{
internalInit(w, h);
imgType = type;
@ -47,7 +47,7 @@ GuiImage::GuiImage(int w, int h, const GX2Color & c, int type)
}
}
GuiImage::GuiImage(int w, int h, const GX2Color *c, u32 color_count, int type)
GuiImage::GuiImage(s32 w, s32 h, const GX2Color *c, u32 color_count, s32 type)
{
internalInit(w, h);
imgType = type;
@ -61,7 +61,7 @@ GuiImage::GuiImage(int w, int h, const GX2Color *c, u32 color_count, int type)
for(u32 i = 0; i < colorCount; i++)
{
// take the last as reference if not enough colors defined
int idx = (i < color_count) ? i : (color_count - 1);
s32 idx = (i < color_count) ? i : (color_count - 1);
setImageColor(c[idx], i);
}
}
@ -78,7 +78,7 @@ GuiImage::~GuiImage()
}
}
void GuiImage::internalInit(int w, int h)
void GuiImage::internalInit(s32 w, s32 h)
{
imageData = NULL;
width = w;
@ -114,7 +114,7 @@ void GuiImage::setImageData(GuiImageData * img)
imgType = IMAGE_TEXTURE;
}
GX2Color GuiImage::getPixel(int x, int y)
GX2Color GuiImage::getPixel(s32 x, s32 y)
{
if(!imageData || this->getWidth() <= 0 || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight())
return (GX2Color){0, 0, 0, 0};
@ -131,7 +131,7 @@ GX2Color GuiImage::getPixel(int x, int y)
return color;
}
void GuiImage::setPixel(int x, int y, const GX2Color & color)
void GuiImage::setPixel(s32 x, s32 y, const GX2Color & color)
{
if(!imageData || this->getWidth() <= 0 || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight())
return;
@ -142,13 +142,13 @@ void GuiImage::setPixel(int x, int y, const GX2Color & color)
imagePtr[y * pitch + x] = (color.r << 24) | (color.g << 16) | (color.b << 8) | (color.a << 0);
}
void GuiImage::setImageColor(const GX2Color & c, int idx)
void GuiImage::setImageColor(const GX2Color & c, s32 idx)
{
if(!colorVtxs) {
return;
}
if(idx >= 0 && idx < (int)colorCount)
if(idx >= 0 && idx < (s32)colorCount)
{
colorVtxs[(idx << 2) + 0] = c.r;
colorVtxs[(idx << 2) + 1] = c.g;
@ -169,7 +169,7 @@ void GuiImage::setImageColor(const GX2Color & c, int idx)
}
}
void GuiImage::setSize(int w, int h)
void GuiImage::setSize(s32 w, s32 h)
{
width = w;
height = h;
@ -188,8 +188,8 @@ void GuiImage::setPrimitiveVertex(s32 prim, const f32 *posVtx, const f32 *texCoo
for(u32 i = 0; i < vtxCount; i++)
{
int newColorIdx = (i << 2);
int colorIdx = (i < colorCount) ? (newColorIdx) : ((colorCount - 1) << 2);
s32 newColorIdx = (i << 2);
s32 colorIdx = (i < colorCount) ? (newColorIdx) : ((colorCount - 1) << 2);
newColorVtxs[newColorIdx + 0] = colorVtxs[colorIdx + 0];
newColorVtxs[newColorIdx + 1] = colorVtxs[colorIdx + 1];
@ -228,8 +228,8 @@ void GuiImage::draw(CVideo *pVideo)
// if(image && tileHorizontal > 0 && tileVertical > 0)
// {
// for(int n=0; n<tileVertical; n++)
// for(int i=0; i<tileHorizontal; i++)
// for(s32 n=0; n<tileVertical; n++)
// for(s32 i=0; i<tileHorizontal; i++)
// {
// if(bUnCut)
// Menu_DrawImg(image, width, height, format, currLeft+width*i, currTop+width*n, currZ, imageangle, currScaleX, currScaleY, currAlpha);
@ -239,9 +239,9 @@ void GuiImage::draw(CVideo *pVideo)
// }
// else if(image && tileHorizontal > 0)
// {
// for(int i=0; i<tileHorizontal; i++)
// for(s32 i=0; i<tileHorizontal; i++)
// {
// int widthTile = (imageangle == 90 || imageangle == 270) ? height : width;
// s32 widthTile = (imageangle == 90 || imageangle == 270) ? height : width;
// if(bUnCut)
// Menu_DrawImg(image, width, height, format, currLeft+widthTile*i, currTop, currZ, imageangle, currScaleX, currScaleY, currAlpha);
// else
@ -250,7 +250,7 @@ void GuiImage::draw(CVideo *pVideo)
// }
// else if(image && tileVertical > 0)
// {
// for(int i=0; i<tileVertical; i++)
// for(s32 i=0; i<tileVertical; i++)
// {
// if(bUnCut)
// Menu_DrawImg(image, width, height, format, currLeft, currTop+height*i, currZ, imageangle, currScaleX, currScaleY, currAlpha);

View File

@ -39,16 +39,16 @@ public:
//!\param w Image width
//!\param h Image height
//!\param c Array with 4 x image color (BL, BR, TL, TR)
GuiImage(int w, int h, const GX2Color & c, int imgType = IMAGE_COLOR);
GuiImage(int w, int h, const GX2Color * c, u32 colorCount = 1, int imgType = IMAGE_COLOR);
GuiImage(s32 w, s32 h, const GX2Color & c, s32 imgType = IMAGE_COLOR);
GuiImage(s32 w, s32 h, const GX2Color * c, u32 colorCount = 1, s32 imgType = IMAGE_COLOR);
//!Destructor
virtual ~GuiImage();
//!Sets the number of times to draw the image horizontally
//!\param t Number of times to draw the image
void setTileHorizontal(int t) { tileHorizontal = t; }
void setTileHorizontal(s32 t) { tileHorizontal = t; }
//!Sets the number of times to draw the image vertically
//!\param t Number of times to draw the image
void setTileVertical(int t) { tileVertical = t; }
void setTileVertical(s32 t) { tileVertical = t; }
//!Constantly called to draw the image
void draw(CVideo *pVideo);
//!Gets the image data
@ -60,16 +60,16 @@ public:
//!Gets the pixel color at the specified coordinates of the image
//!\param x X coordinate
//!\param y Y coordinate
GX2Color getPixel(int x, int y);
GX2Color getPixel(s32 x, s32 y);
//!Sets the pixel color at the specified coordinates of the image
//!\param x X coordinate
//!\param y Y coordinate
//!\param color Pixel color
void setPixel(int x, int y, const GX2Color & color);
void setPixel(s32 x, s32 y, const GX2Color & color);
//!Change ImageColor
void setImageColor(const GX2Color & c, int idx = -1);
void setImageColor(const GX2Color & c, s32 idx = -1);
//!Change ImageColor
void setSize(int w, int h);
void setSize(s32 w, s32 h);
void setPrimitiveVertex(s32 prim, const f32 *pos, const f32 *tex, u32 count);
@ -84,12 +84,12 @@ public:
colorIntensity = col;
}
protected:
void internalInit(int w, int h);
void internalInit(s32 w, s32 h);
int imgType; //!< Type of image data (IMAGE_TEXTURE, IMAGE_COLOR, IMAGE_DATA)
s32 imgType; //!< Type of image data (IMAGE_TEXTURE, IMAGE_COLOR, IMAGE_DATA)
GuiImageData * imageData; //!< Poiner to image data. May be shared with GuiImageData data
int tileHorizontal; //!< Number of times to draw (tile) the image horizontally
int tileVertical; //!< Number of times to draw (tile) the image vertically
s32 tileHorizontal; //!< Number of times to draw (tile) the image horizontally
s32 tileVertical; //!< Number of times to draw (tile) the image vertically
//! Internally used variables for rendering
u8 *colorVtxs;

View File

@ -114,7 +114,7 @@ void GuiImageAsync::guiImageAsyncThread(CThread *thread, void *arg)
u8 *buffer = NULL;
u32 bufferSize = 0;
int iResult = LoadFileToMem(pInUse->filename.c_str(), &buffer, &bufferSize);
s32 iResult = LoadFileToMem(pInUse->filename.c_str(), &buffer, &bufferSize);
if(iResult > 0)
{
pInUse->imgData = new GuiImageData(buffer, bufferSize, GX2_TEX_CLAMP_MIRROR);
@ -159,8 +159,9 @@ void GuiImageAsync::threadInit()
void GuiImageAsync::threadExit()
{
if(threadRefCounter)
if(threadRefCounter){
--threadRefCounter;
}
if(/*(threadRefCounter == 0) &&*/ (pThread != NULL))
{

View File

@ -31,7 +31,7 @@ GuiImageData::GuiImageData()
/**
* Constructor for the GuiImageData class.
*/
GuiImageData::GuiImageData(const u8 * img, int imgSize, int textureClamp, int textureFormat)
GuiImageData::GuiImageData(const u8 * img, s32 imgSize, s32 textureClamp, s32 textureFormat)
{
texture = NULL;
sampler = NULL;
@ -74,7 +74,7 @@ void GuiImageData::releaseData(void)
}
}
void GuiImageData::loadImage(const u8 *img, int imgSize, int textureClamp, int textureFormat)
void GuiImageData::loadImage(const u8 *img, s32 imgSize, s32 textureClamp, s32 textureFormat)
{
if(!img || (imgSize < 8))
return;

View File

@ -29,22 +29,22 @@ public:
GuiImageData();
//!\param img Image data
//!\param imgSize The image size
GuiImageData(const u8 * img, int imgSize, int textureClamp = GX2_TEX_CLAMP_CLAMP, int textureFormat = GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM);
GuiImageData(const u8 * img, s32 imgSize, s32 textureClamp = GX2_TEX_CLAMP_CLAMP, s32 textureFormat = GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM);
//!Destructor
virtual ~GuiImageData();
//!Load image from buffer
//!\param img Image data
//!\param imgSize The image size
void loadImage(const u8 * img, int imgSize, int textureClamp = GX2_TEX_CLAMP_CLAMP, int textureFormat = GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM);
void loadImage(const u8 * img, s32 imgSize, s32 textureClamp = GX2_TEX_CLAMP_CLAMP, s32 textureFormat = GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM);
//! getter functions
const GX2Texture * getTexture() const { return texture; };
const GX2Sampler * getSampler() const { return sampler; };
//!Gets the image width
//!\return image width
int getWidth() const { if(texture) return texture->surface.width; else return 0; };
s32 getWidth() const { if(texture) return texture->surface.width; else return 0; };
//!Gets the image height
//!\return image height
int getHeight() const { if(texture) return texture->surface.height; else return 0; };
s32 getHeight() const { if(texture) return texture->surface.height; else return 0; };
//! release memory of the image data
void releaseData(void);
private:

View File

@ -30,7 +30,7 @@ static inline f32 getRandMinusOneToOneF32()
return getRandZeroToOneF32() * 2.0f - 1.0f;
}
GuiParticleImage::GuiParticleImage(int w, int h, u32 particleCount)
GuiParticleImage::GuiParticleImage(s32 w, s32 h, u32 particleCount)
: GuiImage(NULL)
{
width = w;

View File

@ -22,7 +22,7 @@
class GuiParticleImage : public GuiImage, public sigslot::has_slots<>
{
public:
GuiParticleImage(int w, int h, u32 particleCount);
GuiParticleImage(s32 w, s32 h, u32 particleCount);
virtual ~GuiParticleImage();
void draw(CVideo *pVideo);

View File

@ -151,7 +151,7 @@ void GuiSelectBox::OnDPADClick(GuiButton *button, const GuiController *controlle
}
}
void GuiSelectBox::Init(std::map<std::string,std::string> values, int valueID)
void GuiSelectBox::Init(std::map<std::string,std::string> values, s32 valueID)
{
if((u32)valueID >= values.size()){
valueID = 0;
@ -164,7 +164,7 @@ void GuiSelectBox::Init(std::map<std::string,std::string> values, int valueID)
valueButtons.resize(values.size());
int i = 0;
s32 i = 0;
f32 imgScale = 1.0f;
std::map<std::string, std::string>::iterator itr;
for(itr = values.begin(); itr != values.end(); itr++) {
@ -240,7 +240,7 @@ GuiSelectBox::~GuiSelectBox()
}
void GuiSelectBox::setState(int s, int c)
void GuiSelectBox::setState(s32 s, s32 c)
{
GuiElement::setState(s, c);
}

View File

@ -35,9 +35,9 @@ class GuiSelectBox : public GuiFrame, public sigslot::has_slots<>
sigslot::signal2<GuiSelectBox *, std::string> valueChanged;
sigslot::signal2<GuiSelectBox *, bool> showhide;
void OnTopValueClicked(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
void Init(std::map<std::string,std::string> values, int valueID);
void Init(std::map<std::string,std::string> values, s32 valueID);
void setState(int s, int c = -1);
void setState(s32 s, s32 c = -1);
virtual f32 getTopValueHeight();
virtual f32 getTopValueWidth();

View File

@ -48,7 +48,7 @@ bool GuiSound::Load(const char * filepath)
}
//! find next free decoder
for(int i = 0; i < MAX_DECODERS; i++)
for(s32 i = 0; i < MAX_DECODERS; i++)
{
SoundDecoder * decoder = SoundHandler::instance()->getDecoder(i);
if(decoder == NULL)
@ -64,8 +64,9 @@ bool GuiSound::Load(const char * filepath)
}
}
if(voice < 0)
if(voice < 0){
return false;
}
return true;
}
@ -82,7 +83,7 @@ bool GuiSound::Load(const u8 * snd, s32 len)
return false;
//! find next free decoder
for(int i = 0; i < MAX_DECODERS; i++)
for(s32 i = 0; i < MAX_DECODERS; i++)
{
SoundDecoder * decoder = SoundHandler::instance()->getDecoder(i);
if(decoder == NULL)
@ -98,8 +99,9 @@ bool GuiSound::Load(const u8 * snd, s32 len)
}
}
if(voice < 0)
if(voice < 0){
return false;
}
return true;
}
@ -161,11 +163,10 @@ void GuiSound::Resume()
bool GuiSound::IsPlaying()
{
Voice * v = SoundHandler::instance()->getVoice(voice);
if(v)
if(v){
return v->getState() == Voice::STATE_PLAYING;
}
return false;
}
void GuiSound::SetVolume(u32 vol)

View File

@ -28,7 +28,7 @@ class GuiSound : public AsyncDeleter::Element
//!\param sound Pointer to the sound data
//!\param filesize Length of sound data
GuiSound(const char * filepath);
GuiSound(const u8 * sound, int length);
GuiSound(const u8 * sound, s32 length);
//!Destructor
virtual ~GuiSound();
//!Load a file and replace the old one

View File

@ -19,10 +19,10 @@
#include "video/CVideo.h"
FreeTypeGX * GuiText::presentFont = NULL;
int GuiText::presetSize = 28;
int GuiText::presetInternalRenderingScale = 2.0f; //Lets render the font at the doubled size. This make it even smoother!
int GuiText::presetMaxWidth = 0xFFFF;
int GuiText::presetAlignment = ALIGN_CENTER | ALIGN_MIDDLE;
s32 GuiText::presetSize = 28;
float GuiText::presetInternalRenderingScale = 2.0f; //Lets render the font at the doubled size. This make it even smoother!
s32 GuiText::presetMaxWidth = 0xFFFF;
s32 GuiText::presetAlignment = ALIGN_CENTER | ALIGN_MIDDLE;
GX2ColorF32 GuiText::presetColor = (GX2ColorF32){ 1.0f, 1.0f, 1.0f, 1.0f };
#define TEXT_SCROLL_DELAY 6
@ -56,7 +56,7 @@ GuiText::GuiText()
internalRenderingScale = presetInternalRenderingScale;
}
GuiText::GuiText(const char * t, int s, const glm::vec4 & c)
GuiText::GuiText(const char * t, s32 s, const glm::vec4 & c)
{
text = NULL;
size = s;
@ -88,7 +88,7 @@ GuiText::GuiText(const char * t, int s, const glm::vec4 & c)
}
}
GuiText::GuiText(const wchar_t * t, int s, const glm::vec4 & c)
GuiText::GuiText(const wchar_t * t, s32 s, const glm::vec4 & c)
{
text = NULL;
size = s;
@ -199,7 +199,7 @@ void GuiText::setTextf(const char *format, ...)
return;
}
int max_len = strlen(format) + 8192;
s32 max_len = strlen(format) + 8192;
char *tmp = new char[max_len];
va_list va;
va_start(va, format);
@ -248,7 +248,7 @@ void GuiText::clearDynamicText()
textDynWidth.clear();
}
void GuiText::setPresets(int sz, const glm::vec4 & c, int w, int a)
void GuiText::setPresets(s32 sz, const glm::vec4 & c, s32 w, s32 a)
{
presetSize = sz;
presetColor = (GX2ColorF32) { (f32)c.r / 255.0f, (f32)c.g / 255.0f, (f32)c.b / 255.0f, (f32)c.a / 255.0f };
@ -261,12 +261,12 @@ void GuiText::setPresetFont(FreeTypeGX *f)
presentFont = f;
}
void GuiText::setFontSize(int s)
void GuiText::setFontSize(s32 s)
{
size = s;
}
void GuiText::setMaxWidth(int width, int w)
void GuiText::setMaxWidth(s32 width, s32 w)
{
maxWidth = width;
wrapMode = w;
@ -294,17 +294,17 @@ void GuiText::setBlurGlowColor(float blur, const glm::vec4 & c)
blurAlpha = c[3];
}
int GuiText::getTextWidth(int ind)
s32 GuiText::getTextWidth(s32 ind)
{
if(ind < 0 || ind >= (int) textDyn.size())
if(ind < 0 || ind >= (s32) textDyn.size())
return this->getTextWidth();
return font->getWidth(textDyn[ind], currentSize);
}
const wchar_t * GuiText::getDynText(int ind)
const wchar_t * GuiText::getDynText(s32 ind)
{
if(ind < 0 || ind >= (int) textDyn.size())
if(ind < 0 || ind >= (s32) textDyn.size())
return text;
return textDyn[ind];
@ -341,10 +341,10 @@ std::string GuiText::toUTF8(void) const
void GuiText::makeDottedText()
{
int pos = textDyn.size();
s32 pos = textDyn.size();
textDyn.resize(pos + 1);
int i = 0, currentWidth = 0;
s32 i = 0, currentWidth = 0;
textDyn[pos] = new (std::nothrow) wchar_t[maxWidth];
if(!textDyn[pos]) {
textDyn.resize(pos);
@ -374,8 +374,8 @@ void GuiText::scrollText(u32 frameCount)
{
if (textDyn.size() == 0)
{
int pos = textDyn.size();
int i = 0, currentWidth = 0;
s32 pos = textDyn.size();
s32 i = 0, currentWidth = 0;
textDyn.resize(pos + 1);
textDyn[pos] = new (std::nothrow) wchar_t[maxWidth];
@ -408,7 +408,7 @@ void GuiText::scrollText(u32 frameCount)
return;
}
int stringlen = wcslen(text);
s32 stringlen = wcslen(text);
++textScrollPos;
if (textScrollPos > stringlen)
@ -417,8 +417,8 @@ void GuiText::scrollText(u32 frameCount)
textScrollInitialDelay = TEXT_SCROLL_INITIAL_DELAY;
}
int ch = textScrollPos;
int pos = textDyn.size() - 1;
s32 ch = textScrollPos;
s32 pos = textDyn.size() - 1;
if (!textDyn[pos])
textDyn[pos] = new (std::nothrow) wchar_t[maxWidth];
@ -428,7 +428,7 @@ void GuiText::scrollText(u32 frameCount)
return;
}
int i = 0, currentWidth = 0;
s32 i = 0, currentWidth = 0;
while (currentWidth < maxWidth)
{
@ -458,16 +458,16 @@ void GuiText::wrapText()
{
if (textDyn.size() > 0) return;
int i = 0;
int ch = 0;
int linenum = 0;
int lastSpace = -1;
int lastSpaceIndex = -1;
int currentWidth = 0;
s32 i = 0;
s32 ch = 0;
s32 linenum = 0;
s32 lastSpace = -1;
s32 lastSpaceIndex = -1;
s32 currentWidth = 0;
while (text[ch] && linenum < linestodraw)
{
if (linenum >= (int) textDyn.size())
if (linenum >= (s32) textDyn.size())
{
textDyn.resize(linenum + 1);
textDyn[linenum] = new (std::nothrow) wchar_t[maxWidth];
@ -538,8 +538,8 @@ void GuiText::draw(CVideo *pVideo)
float finalRenderingScale = 2.0f * internalRenderingScale;
int newSize = size * getScale() * finalRenderingScale;
int normal_size = size * getScale();
s32 newSize = size * getScale() * finalRenderingScale;
s32 normal_size = size * getScale();
if(newSize != currentSize)
{
@ -582,9 +582,9 @@ void GuiText::draw(CVideo *pVideo)
}
else if(wrapMode == WRAP)
{
int lineheight = newSize + 6;
int yoffset = 0;
int voffset = 0;
s32 lineheight = newSize + 6;
s32 yoffset = 0;
s32 voffset = 0;
if(textDyn.size() == 0)
wrapText();

View File

@ -30,12 +30,12 @@ public:
//!\param t Text
//!\param s Font size
//!\param c Font color
GuiText(const char * t, int s, const glm::vec4 & c);
GuiText(const char * t, s32 s, const glm::vec4 & c);
//!\overload
//!\param t Text
//!\param s Font size
//!\param c Font color
GuiText(const wchar_t * t, int s, const glm::vec4 & c);
GuiText(const wchar_t * t, s32 s, const glm::vec4 & c);
//!\overload
//!\Assumes SetPresets() has been called to setup preferred text attributes
//!\param t Text
@ -54,16 +54,16 @@ public:
//!\param w Maximum width of texture image (for text wrapping)
//!\param wrap Wrapmode when w>0
//!\param a Text alignment
static void setPresets(int sz, const glm::vec4 & c, int w, int a);
static void setPresets(s32 sz, const glm::vec4 & c, s32 w, s32 a);
static void setPresetFont(FreeTypeGX *font);
//!Sets the font size
//!\param s Font size
void setFontSize(int s);
void setFontSize(s32 s);
//!Sets the maximum width of the drawn texture image
//!If the text exceeds this, it is wrapped to the next line
//!\param w Maximum width
//!\param m WrapMode
void setMaxWidth(int w = 0, int m = WRAP);
void setMaxWidth(s32 w = 0, s32 m = WRAP);
//!Sets the font color
//!\param c Font color
void setColor(const glm::vec4 & c);
@ -75,21 +75,21 @@ public:
virtual const wchar_t * getText() const { return text; }
virtual std::string toUTF8(void) const;
//!Get the Horizontal Size of Text
int getTextWidth() { return textWidth; }
int getTextWidth(int ind);
s32 getTextWidth() { return textWidth; }
s32 getTextWidth(s32 ind);
//!Get the max textwidth
int getTextMaxWidth() { return maxWidth; }
s32 getTextMaxWidth() { return maxWidth; }
//!Get fontsize
int getFontSize() { return size; };
s32 getFontSize() { return size; };
//!Set max lines to draw
void setLinesToDraw(int l) { linestodraw = l; }
void setLinesToDraw(s32 l) { linestodraw = l; }
//!Get current Textline (for position calculation)
const wchar_t * getDynText(int ind = 0);
virtual const wchar_t * getTextLine(int ind) { return getDynText(ind); };
const wchar_t * getDynText(s32 ind = 0);
virtual const wchar_t * getTextLine(s32 ind) { return getDynText(ind); };
//!Change the font
bool setFont(FreeTypeGX *font);
//! virtual function used in child classes
virtual int getStartWidth() { return 0; };
virtual s32 getStartWidth() { return 0; };
//!Constantly called to draw the text
void draw(CVideo *pVideo);
//! text enums
@ -102,10 +102,10 @@ public:
};
protected:
static FreeTypeGX * presentFont;
static int presetSize;
static int presetMaxWidth;
static int presetInternalRenderingScale;
static int presetAlignment;
static s32 presetSize;
static s32 presetMaxWidth;
static float presetInternalRenderingScale;
static s32 presetAlignment;
static GX2ColorF32 presetColor;
//!Clear the dynamic text
@ -120,16 +120,16 @@ protected:
wchar_t * text;
std::vector<wchar_t *> textDyn;
std::vector<uint16_t> textDynWidth;
int wrapMode; //!< Wrapping toggle
int textScrollPos; //!< Current starting index of text string for scrolling
int textScrollInitialDelay; //!< Delay to wait before starting to scroll
int textScrollDelay; //!< Scrolling speed
int size; //!< Font size
int maxWidth; //!< Maximum width of the generated text object (for text wrapping)
s32 wrapMode; //!< Wrapping toggle
s32 textScrollPos; //!< Current starting index of text string for scrolling
s32 textScrollInitialDelay; //!< Delay to wait before starting to scroll
s32 textScrollDelay; //!< Scrolling speed
s32 size; //!< Font size
s32 maxWidth; //!< Maximum width of the generated text object (for text wrapping)
FreeTypeGX *font;
int textWidth;
int currentSize;
int linestodraw;
s32 textWidth;
s32 currentSize;
s32 linestodraw;
glm::vec4 color;
float defaultBlur;
float blurGlowIntensity;

View File

@ -38,12 +38,9 @@ GuiToggle::~GuiToggle()
void GuiToggle::OnToggleClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger){
if(!isStateSet(STATE_DISABLED | STATE_HIDDEN | STATE_DISABLE_INPUT)){
log_print("Clicked on Toggle: ");
if(selected){
log_print("Uncheck\n");
setUnchecked();
}else{
log_print("Check\n");
setChecked();
}
}

View File

@ -107,13 +107,13 @@ bool GuiTrigger::down(const GuiController *controller) const
return false;
}
int GuiTrigger::clicked(const GuiController *controller) const
s32 GuiTrigger::clicked(const GuiController *controller) const
{
if((controller->chan & chan) == 0) {
return CLICKED_NONE;
}
int bResult = CLICKED_NONE;
s32 bResult = CLICKED_NONE;
if(controller->data.touched && controller->data.validPointer && (btns & VPAD_TOUCH) && !controller->lastData.touched)
{

View File

@ -91,7 +91,7 @@ public:
bool right(const GuiController *controller) const;
bool up(const GuiController *controller) const;
bool down(const GuiController *controller) const;
int clicked(const GuiController *controller) const;
s32 clicked(const GuiController *controller) const;
bool held(const GuiController *controller) const;
bool released(const GuiController *controller) const;
private:

View File

@ -24,7 +24,7 @@
#include "Scrollbar.h"
#include "resources/Resources.h"
Scrollbar::Scrollbar(int h)
Scrollbar::Scrollbar(s32 h)
: touchTrigger(GuiTrigger::CHANNEL_1, GuiTrigger::VPAD_TOUCH)
, wpadTouchTrigger(GuiTrigger::CHANNEL_2 | GuiTrigger::CHANNEL_3 | GuiTrigger::CHANNEL_4 | GuiTrigger::CHANNEL_5, GuiTrigger::BUTTON_A)
{
@ -164,19 +164,21 @@ void Scrollbar::OnDownButtonClick(GuiButton *button, const GuiController *contro
void Scrollbar::OnBoxButtonHold(GuiButton *button, const GuiController *controller, GuiTrigger *trigger)
{
if(EntrieCount == 0)
if(EntrieCount == 0){
return;
}
if(!controller->data.validPointer)
if(!controller->data.validPointer){
return;
}
int y = controller->data.y - this->getCenterY();
s32 y = controller->data.y - this->getCenterY();
int positionWiimote = LIMIT(y - MinHeight, 0, MaxHeight - MinHeight);
s32 positionWiimote = LIMIT(y - MinHeight, 0, MaxHeight - MinHeight);
int newSelected = (EntrieCount - 1) - (int) ((float) positionWiimote / (float) (MaxHeight-MinHeight) * (float) (EntrieCount-1));
s32 newSelected = (EntrieCount - 1) - (s32) ((float) positionWiimote / (float) (MaxHeight-MinHeight) * (float) (EntrieCount-1));
int diff = newSelected-SelInd-SelItem;
s32 diff = newSelected-SelInd-SelItem;
if(newSelected <= 0)
{
@ -190,7 +192,7 @@ void Scrollbar::OnBoxButtonHold(GuiButton *button, const GuiController *controll
}
else if(newSelected < PageSize && SelInd == 0 && diff < 0)
{
SelItem = std::max(SelItem+diff, 0);
SelItem = std::max(SelItem+diff, (s32)0);
}
else if(EntrieCount-newSelected < PageSize && SelInd == EntrieCount-PageSize && diff > 0)
{
@ -205,7 +207,7 @@ void Scrollbar::OnBoxButtonHold(GuiButton *button, const GuiController *controll
listChanged(SelItem, SelInd);
}
void Scrollbar::SetPageSize(int size)
void Scrollbar::SetPageSize(s32 size)
{
if(PageSize == size)
return;
@ -214,7 +216,7 @@ void Scrollbar::SetPageSize(int size)
listChanged(SelItem, SelInd);
}
void Scrollbar::SetSelectedItem(int pos)
void Scrollbar::SetSelectedItem(s32 pos)
{
if(SelItem == pos)
return;
@ -223,7 +225,7 @@ void Scrollbar::SetSelectedItem(int pos)
listChanged(SelItem, SelInd);
}
void Scrollbar::SetSelectedIndex(int pos)
void Scrollbar::SetSelectedIndex(s32 pos)
{
if(SelInd == pos)
return;
@ -232,7 +234,7 @@ void Scrollbar::SetSelectedIndex(int pos)
listChanged(SelItem, SelInd);
}
void Scrollbar::SetEntrieCount(int cnt)
void Scrollbar::SetEntrieCount(s32 cnt)
{
if(EntrieCount == cnt)
return;
@ -241,9 +243,9 @@ void Scrollbar::SetEntrieCount(int cnt)
listChanged(SelItem, SelInd);
}
void Scrollbar::setScrollboxPosition(int SelItem, int SelInd)
void Scrollbar::setScrollboxPosition(s32 SelItem, s32 SelInd)
{
int position = MaxHeight-(MaxHeight-MinHeight)*(SelInd+SelItem)/(EntrieCount-1);
s32 position = MaxHeight-(MaxHeight-MinHeight)*(SelInd+SelItem)/(EntrieCount-1);
if(position < MinHeight || (SelInd+SelItem >= EntrieCount-1))
position = MinHeight;

View File

@ -30,25 +30,25 @@
class Scrollbar : public GuiElement, public sigslot::has_slots<>
{
public:
Scrollbar(int height);
Scrollbar(s32 height);
virtual ~Scrollbar();
void ScrollOneUp();
void ScrollOneDown();
int GetSelectedItem() { return SelItem; }
int GetSelectedIndex() { return SelInd; }
s32 GetSelectedItem() { return SelItem; }
s32 GetSelectedIndex() { return SelInd; }
void draw(CVideo * video);
void update(GuiController * t);
//! Signals
sigslot::signal2<int, int> listChanged;
sigslot::signal2<s32, s32> listChanged;
//! Slots
void SetPageSize(int size);
void SetRowSize(int size);
void SetSelectedItem(int pos);
void SetSelectedIndex(int pos);
void SetEntrieCount(int cnt);
void SetPageSize(s32 size);
void SetRowSize(s32 size);
void SetSelectedItem(s32 pos);
void SetSelectedIndex(s32 pos);
void SetEntrieCount(s32 cnt);
protected:
void setScrollboxPosition(int SelItem, int SelInd);
void setScrollboxPosition(s32 SelItem, s32 SelInd);
void OnUpButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
void OnDownButtonClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
void OnBoxButtonHold(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
@ -56,13 +56,13 @@ class Scrollbar : public GuiElement, public sigslot::has_slots<>
u32 ScrollState;
u16 ScrollSpeed;
int MinHeight;
int MaxHeight;
int SelItem;
int SelInd;
int PageSize;
int EntrieCount;
int pressedChan;
s32 MinHeight;
s32 MaxHeight;
s32 SelItem;
s32 SelInd;
s32 PageSize;
s32 EntrieCount;
s32 pressedChan;
GuiButton * arrowUpBtn;
GuiButton * arrowDownBtn;

View File

@ -24,7 +24,7 @@ class VPadController : public GuiController
{
public:
//!Constructor
VPadController(int channel)
VPadController(s32 channel)
: GuiController(channel)
{
memset(&vpad, 0, sizeof(vpad));
@ -33,11 +33,11 @@ public:
//!Destructor
virtual ~VPadController() {}
bool update(int width, int height)
bool update(s32 width, s32 height)
{
lastData = data;
int vpadError = -1;
s32 vpadError = -1;
VPADRead(0, &vpad, 1, &vpadError);
if(vpadError == 0)
@ -48,9 +48,9 @@ public:
data.validPointer = !vpad.tpdata.invalid;
data.touched = vpad.tpdata.touched;
//! calculate the screen offsets
data.x = -(width >> 1) + ((int)(vpad.tpdata1.x * ((width)/1211.0f)*width) >> 12)-30;
data.y = -(height >> 1) + ((int)(vpad.tpdata1.y * ((height)/653.0f)*height) >> 12)-35;
data.x = -(width >> 1) + ((s32)(vpad.tpdata1.x * ((width)/1211.0f)*width) >> 12)-30;
data.y = -(height >> 1) + ((s32)(vpad.tpdata1.y * ((height)/653.0f)*height) >> 12)-35;
return true;
}
return false;

View File

@ -24,7 +24,7 @@ class WPadController : public GuiController
{
public:
//!Constructor
WPadController(int channel)
WPadController(s32 channel)
: GuiController(channel)
{
memset(&kpadData, 0, sizeof(kpadData));
@ -130,7 +130,7 @@ public:
return conv_buttons;
}
bool update(int width, int height)
bool update(s32 width, s32 height)
{
lastData = data;

View File

@ -7,22 +7,22 @@
extern void my_PrepareTitle_hook(void);
static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len)
static void KernelCopyData(u32 addr, u32 src, u32 len)
{
/*
* Setup a DBAT access with cache inhibited to write through and read directly from memory
*/
unsigned int dbatu0, dbatl0, dbatu1, dbatl1;
u32 dbatu0, dbatl0, dbatu1, dbatl1;
// save the original DBAT value
asm volatile("mfdbatu %0, 0" : "=r" (dbatu0));
asm volatile("mfdbatl %0, 0" : "=r" (dbatl0));
asm volatile("mfdbatu %0, 1" : "=r" (dbatu1));
asm volatile("mfdbatl %0, 1" : "=r" (dbatl1));
unsigned int target_dbatu0 = 0;
unsigned int target_dbatl0 = 0;
unsigned int target_dbatu1 = 0;
unsigned int target_dbatl1 = 0;
u32 target_dbatu0 = 0;
u32 target_dbatl0 = 0;
u32 target_dbatu1 = 0;
u32 target_dbatl1 = 0;
unsigned char *dst_p = (unsigned char*)addr;
unsigned char *src_p = (unsigned char*)src;
@ -50,11 +50,11 @@ static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len
asm volatile("eieio; isync");
unsigned int i;
u32 i;
for(i = 0; i < len; i++)
{
// if we are on the edge to next chunk
if((target_dbatu0 != 0) && (((unsigned int)dst_p & 0x00F00000) != (target_dbatu0 & 0x00F00000)))
if((target_dbatu0 != 0) && (((u32)dst_p & 0x00F00000) != (target_dbatu0 & 0x00F00000)))
{
target_dbatu0 = ((addr + i) & 0x00F00000) | 0xC0000000 | 0x1F;
target_dbatl0 = ((addr + i) & 0xFFF00000) | 0x32;
@ -65,7 +65,7 @@ static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len
asm volatile("mtdbatl 0, %0" : : "r" (target_dbatl0));
asm volatile("eieio; isync");
}
if((target_dbatu1 != 0) && (((unsigned int)src_p & 0x00F00000) != (target_dbatu1 & 0x00F00000)))
if((target_dbatu1 != 0) && (((u32)src_p & 0x00F00000) != (target_dbatu1 & 0x00F00000)))
{
target_dbatu1 = ((src + i) & 0x00F00000) | 0xB0000000 | 0x1F;
target_dbatl1 = ((src + i) & 0xFFF00000) | 0x32;
@ -219,21 +219,21 @@ void KernelSetupSyscalls(void)
ucSyscallsSetupRequired = 0;
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl1 + (0x36 * 4)), (unsigned int)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl2 + (0x36 * 4)), (unsigned int)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl3 + (0x36 * 4)), (unsigned int)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl4 + (0x36 * 4)), (unsigned int)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl5 + (0x36 * 4)), (unsigned int)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl1 + (0x36 * 4)), (u32)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl2 + (0x36 * 4)), (u32)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl3 + (0x36 * 4)), (u32)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl4 + (0x36 * 4)), (u32)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl5 + (0x36 * 4)), (u32)KernelReadDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl1 + (0x37 * 4)), (unsigned int)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl2 + (0x37 * 4)), (unsigned int)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl3 + (0x37 * 4)), (unsigned int)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl4 + (0x37 * 4)), (unsigned int)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl5 + (0x37 * 4)), (unsigned int)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl1 + (0x37 * 4)), (u32)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl2 + (0x37 * 4)), (u32)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl3 + (0x37 * 4)), (u32)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl4 + (0x37 * 4)), (u32)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl5 + (0x37 * 4)), (u32)KernelWriteDBATs);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl1 + (0x25 * 4)), (unsigned int)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl2 + (0x25 * 4)), (unsigned int)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl3 + (0x25 * 4)), (unsigned int)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl4 + (0x25 * 4)), (unsigned int)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl5 + (0x25 * 4)), (unsigned int)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl1 + (0x25 * 4)), (u32)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl2 + (0x25 * 4)), (u32)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl3 + (0x25 * 4)), (u32)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl4 + (0x25 * 4)), (u32)KernelCopyData);
kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl5 + (0x25 * 4)), (u32)KernelCopyData);
}

View File

@ -11,7 +11,7 @@ extern "C" {
void KernelSetupSyscalls(void);
void SC0x25_KernelCopyData(unsigned int addr, unsigned int src, unsigned int len);
void SC0x25_KernelCopyData(u32 addr, u32 src, u32 len);
void SC0x36_KernelReadDBATs(bat_table_t * table);
void SC0x37_KernelWriteDBATs(bat_table_t * table);

View File

@ -17,15 +17,9 @@
#include "common/common.h"
#include "controller_patcher/ControllerPatcher.hpp"
#include "controller_patcher/ConfigReader.hpp"
#include "controller_patcher/config/ConfigValues.hpp"
#include "controller_patcher/utils/CPRetainVars.hpp"
#include "controller_patcher/network/UDPServer.hpp"
#include "controller_patcher/network/TCPServer.hpp"
#include "utils/function_patcher.h"
#include "patcher/hid_controller_function_patcher.hpp"
#include "kernel/kernel_functions.h"
#include "kernel/syscalls.h"
#include "video/CursorDrawer.h"
#include "utils/logger.h"
#include "utils/StringTools.h"
@ -33,7 +27,7 @@
#include "system/memory.h"
/* Entry point */
extern "C" int Menu_Main(void){
extern "C" s32 Menu_Main(void){
//!*******************************************************************
//! Initialize function pointers *
//!*******************************************************************
@ -56,7 +50,7 @@ extern "C" int Menu_Main(void){
//!*******************************************************************
//! Initialize HID Config *
//!*******************************************************************
log_print("Initializing the controller data\n");
log_printf("Menu_Main (line %d): Initializing the controller data\n",__LINE__);
bool res = ControllerPatcher::Init();
if(!res){
SplashScreen(5, std::string("Error. The app starts in 5 seconds without patches.").c_str());
@ -67,23 +61,24 @@ extern "C" int Menu_Main(void){
ControllerPatcher::enableControllerMapping();
ControllerPatcher::startNetworkServer();
int result = 0;
s32 result = 0;
if(isInMiiMakerHBL()){
//!*******************************************************************
//! Initialize heap memory *
//!*******************************************************************
log_print("Initialize memory management\n");
log_printf("Menu_Main (line %d): Initialize memory management\n",__LINE__);
memoryInitialize();
log_printf("Mount SD partition\n");
log_printf("Menu_Main (line %d): Mount SD partition\n",__LINE__);
mount_sd_fat("sd");
log_printf("Start main application\n");
log_printf("Menu_Main (line %d): Start main application\n",__LINE__);
result = Application::instance()->exec();
log_printf("Main application stopped result: %d\n",result);
log_printf("Menu_Main (line %d): Main application stopped result: %d\n",__LINE__,result);
Application::destroyInstance();
log_printf("Unmount SD\n");
log_printf("Menu_Main (line %d): Unmount SD\n",__LINE__);
unmount_sd_fat("sd");
log_printf("Menu_Main (line %d): Release memory\n",__LINE__);
memoryRelease();
ControllerPatcher::destroyConfigHelper();
}
@ -92,7 +87,7 @@ extern "C" int Menu_Main(void){
//!*******************************************************************
//! Patching functions *
//!*******************************************************************
log_print("Patching functions\n");
log_printf("Menu_Main(line %d): Patching functions\n",__LINE__);
ApplyPatches();
if(!isInMiiMakerHBL()){
@ -101,11 +96,11 @@ extern "C" int Menu_Main(void){
}
if(result == APPLICATION_CLOSE_APPLY){
log_print("back to sysmenu\n");
log_printf("Menu_Main (line %d): Loading the system menu.\n",__LINE__);
SYSLaunchMenu();
return EXIT_RELAUNCH_ON_LOAD;
}
log_print("back to hbl\n");
log_printf("Menu_Main (line %d): Going back to the Homebrew Launcher\n",__LINE__);
ControllerPatcher::restoreWiiUEnergySetting();
deInit();
return EXIT_SUCCESS;
@ -125,7 +120,7 @@ void deInit(){
ControllerPatcher::stopNetworkServer();
log_deinit();
}
int isInMiiMakerHBL(){
s32 isInMiiMakerHBL(){
if (OSGetTitleID != 0 && (
OSGetTitleID() == 0x000500101004A200 || // mii maker eur
OSGetTitleID() == 0x000500101004A100 || // mii maker usa
@ -138,9 +133,9 @@ int isInMiiMakerHBL(){
}
void SplashScreen(int time,const char * message){
void SplashScreen(s32 time,const char * message){
// Prepare screen
int screen_buf0_size = 0;
s32 screen_buf0_size = 0;
// Init screen and screen buffers
OSScreenInit();
@ -165,10 +160,10 @@ void SplashScreen(int time,const char * message){
OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1);
int tickswait = time * 1000*1000;
int times = 1000;
int sleepingtime = tickswait / 1000;
int i=0;
s32 tickswait = time * 1000*1000;
s32 times = 1000;
s32 sleepingtime = tickswait / 1000;
s32 i=0;
while(i<times){
i++;
usleep(sleepingtime);

View File

@ -10,13 +10,13 @@ extern "C" {
#endif
//! C wrapper for our C++ functions
int Menu_Main(void);
s32 Menu_Main(void);
void deInit(void);
void ApplyPatches(void);
void RestorePatches(void);
int isInMiiMakerHBL();
void SplashScreen(int time,const char * message);
s32 isInMiiMakerHBL();
void SplashScreen(s32 time,const char * message);
#ifdef __cplusplus
}
#endif

View File

@ -1,21 +0,0 @@
/****************************************************************************
* Copyright (C) 2016,2017 Maschell
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef CONTROLLER_DEFS_H_
#define CONTROLLER_DEFS_H_
#endif //CONTROLLER_DEFS_H_

View File

@ -106,8 +106,8 @@ void InputGetterMenu::GetInputsAsync(InputGetterMenu * menu)
void InputGetterMenu::GetInputs(CThread *thread, void *arg){
InputGetterMenu * args = (InputGetterMenu * )arg;
int gotPress = 0;
int inputsize = gHIDMaxDevices;
s32 gotPress = 0;
s32 inputsize = gHIDMaxDevices;
InputData * hiddata = (InputData * ) malloc(sizeof(InputData)*inputsize);
memset(hiddata,0,sizeof(InputData)*inputsize);
@ -115,14 +115,14 @@ void InputGetterMenu::GetInputs(CThread *thread, void *arg){
memset(&pad_result,0,sizeof(ControllerMappingPADInfo));
while(!gotPress){
int foo = args->exitInputThread;
s32 foo = args->exitInputThread;
foo +=1;
if(args->exitInputThread)break;
int result = ControllerPatcher::gettingInputAllDevices(hiddata,inputsize);
s32 result = ControllerPatcher::gettingInputAllDevices(hiddata,inputsize);
if(result > 0){
//log_printf("got %d results\n",result);
for(int i =0;i<result;i++){
for(int j = 0;j<HID_MAX_PADS_COUNT;j++){
for(s32 i =0;i<result;i++){
for(s32 j = 0;j<HID_MAX_PADS_COUNT;j++){
//log_printf("check pad %d. %08X\n",j,hiddata[i].button_data[j].btn_h);
if(hiddata[i].button_data[j].btn_h != 0){
//log_printf("It pressed a buttons!\n",result);

View File

@ -56,8 +56,8 @@ private:
GuiTrigger buttonBTrigger;
GuiButton DPADButtons;
UController_Type controller_type;
volatile int total_result = 0;
volatile int exitInputThread = 0;
volatile s32 total_result = 0;
volatile s32 exitInputThread = 0;
static CThread *pThread;
};

View File

@ -26,11 +26,11 @@
MainWindow * MainWindow::instance = NULL;
MainWindow::MainWindow(int w, int h)
MainWindow::MainWindow(s32 w, s32 h)
: width(w)
, height(h)
{
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
{
std::string filename = strfmt("player%i_point.png", i+1);
pointerImgData[i] = Resources::GetImageData(filename.c_str());
@ -55,7 +55,7 @@ MainWindow::~MainWindow()
delete drcElements[0];
remove(drcElements[0]);
}
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
{
delete pointerImg[i];
Resources::RemoveImageData(pointerImgData[i]);
@ -159,7 +159,7 @@ void MainWindow::update(GuiController *controller)
if(controller->chanIdx >= 1 && controller->chanIdx <= 4 && controller->data.validPointer)
{
int wpadIdx = controller->chanIdx - 1;
s32 wpadIdx = controller->chanIdx - 1;
f32 posX = controller->data.x;
f32 posY = controller->data.y;
pointerImg[wpadIdx]->setPosition(posX, posY);
@ -175,7 +175,7 @@ void MainWindow::drawDrc(CVideo *video)
drcElements[i]->draw(video);
}
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
{
if(pointerValid[i])
{
@ -193,7 +193,7 @@ void MainWindow::drawTv(CVideo *video)
tvElements[i]->draw(video);
}
for(int i = 0; i < 4; i++)
for(s32 i = 0; i < 4; i++)
{
if(pointerValid[i])
{
@ -224,7 +224,7 @@ bool MainWindow::checkForRealProController(){
u32 type;
bool changed = false;
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
if(WPADProbe(i,&type) == 0){
UController_Type controller_type = UController_Type_Pro1;
@ -291,7 +291,7 @@ void MainWindow::removeFromAllElements(GuiElement * element){
}
void MainWindow::setState(int val, int c){
void MainWindow::setState(s32 val, s32 c){
u32 drcSize = drcElements.size();
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
{
@ -305,7 +305,7 @@ void MainWindow::setState(int val, int c){
}
}
void MainWindow::clearState(int val, int c){
void MainWindow::clearState(s32 val, s32 c){
u32 drcSize = drcElements.size();
for(u32 i = 0; (i < drcSize) && (i < drcElements.size()); ++i)
{

View File

@ -34,7 +34,7 @@ public:
static MainWindow *instance;
static MainWindow *getInstance(int w,int h) {
static MainWindow *getInstance(s32 w,s32 h) {
if(!instance){
instance = new MainWindow(w, h);
}
@ -142,8 +142,8 @@ public:
void appendToAllElements(GuiElement * element);
void removeFromAllElements(GuiElement * element);
void setState(int i, int c = -1 );
void clearState(int i, int c = -1);
void setState(s32 i, s32 c = -1 );
void clearState(s32 i, s32 c = -1);
void OpenInputGetterMenu(UController_Type controller_type);
void openPageForController(UController_Type controller_type);
@ -158,7 +158,7 @@ public:
}
private:
MainWindow(int w, int h);
MainWindow(s32 w, s32 h);
void SetupMainView(void);
void OnOpenEffectFinish(GuiElement *element);
@ -170,7 +170,7 @@ private:
void clickListEntryByController(UController_Type controller_type);
int width, height;
s32 width, height;
std::vector<GuiElement *> drcElements;
std::vector<GuiElement *> tvElements;

View File

@ -16,7 +16,7 @@
****************************************************************************/
#include "MainWindowContent.h"
MainWindowContent::MainWindowContent(int w, int h)
MainWindowContent::MainWindowContent(s32 w, s32 h)
: GuiFrame(w, h)
, width(w)
, height(h)

View File

@ -24,7 +24,7 @@
class MainWindowContent : public GuiFrame, public sigslot::has_slots<>{
public:
MainWindowContent(int w, int h);
MainWindowContent(s32 w, s32 h);
virtual ~MainWindowContent();
void SetScreen(ContentTemplate * new_content);
@ -32,7 +32,7 @@ public:
ContentTemplate * getContent();
private:
int width, height;
s32 width, height;
GuiImage bgImageColor;
GuiImageData * footer_imgdata;

View File

@ -21,7 +21,7 @@
extern u32 hostIpAddress;
MainWindowDRC::MainWindowDRC(int w, int h)
MainWindowDRC::MainWindowDRC(s32 w, s32 h)
: GuiConfigurationScreen(w, h)
, width(w)
, height(h)
@ -45,7 +45,7 @@ MainWindowDRC::MainWindowDRC(int w, int h)
versionText.setText(fmt("%s - %s",APP_VERION,__DATE__));
versionText.setAlignment(ALIGN_TOP_LEFT);
versionText.setPosition(windowSplitter_img.getOffsetX()+5,-25);
ipAddress.setText(wfmt("TCP Server running on: %u.%u.%u.%u",(hostIpAddress >> 24) & 0xFF, (hostIpAddress >> 16) & 0xFF, (hostIpAddress >> 8) & 0xFF, (hostIpAddress >> 0) & 0xFF));
ipAddress.setAlignment(ALIGN_TOP_RIGHT);
ipAddress.setPosition(-5,-25);
@ -63,7 +63,7 @@ void MainWindowDRC::clickListEntryByController(UController_Type controller_type)
}
}
void MainWindowDRC::setState(int i, int c){
void MainWindowDRC::setState(s32 i, s32 c){
GuiFrame::setState(i,c);
}

View File

@ -25,12 +25,12 @@
class MainWindowDRC : public GuiConfigurationScreen, public sigslot::has_slots<>{
public:
MainWindowDRC(int w, int h);
MainWindowDRC(s32 w, s32 h);
virtual ~MainWindowDRC();
void clickListEntryByController(UController_Type controller_type);
private:
int width, height;
s32 width, height;
GuiImageData * windowSplitter_imgdata;
GuiImage windowSplitter_img;
MainWindowContent content;
@ -38,7 +38,7 @@ private:
GuiText versionText;
GuiText ipAddress;
void setState(int i, int c);
void setState(s32 i, s32 c);
void process();
};

View File

@ -65,7 +65,7 @@ MenuElementController::MenuElementController(UController_Type controllertype)
notAttachedLabel.setColor(glm::vec4(0.2f,0.2f,0.2f,1.0f));
notAttachedLabel.setParent(&icon_img);
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
ledImages.ledon[i] = new GuiImage(ledon_imgdata);
ledImages.ledoff[i] = new GuiImage(ledoff_imgdata);
@ -127,7 +127,7 @@ MenuElementController::~MenuElementController()
Resources::RemoveImageData(ledon_imgdata);
Resources::RemoveImageData(ledoff_imgdata);
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
if(ledImages.ledon[i]) delete ledImages.ledon[i];
if(ledImages.ledoff[i]) delete ledImages.ledoff[i];
}
@ -155,7 +155,7 @@ void MenuElementController::draw(CVideo *v){
std::string name = "";
controllerConnected = 0;
int found = ControllerPatcher::getActiveMappingSlot(getControllerType());
s32 found = ControllerPatcher::getActiveMappingSlot(getControllerType());
if(found == -1){
name = "No device";
}else{
@ -187,13 +187,13 @@ void MenuElementController::draw(CVideo *v){
proController_img.draw(v);
controllerlabel.draw(v);
}
int pad_active = 0;
bool pad_active = false;
ControllerMappingPADInfo * info = ControllerPatcher::getControllerMappingInfo(getControllerType(),0);
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
if(info != NULL && (info->pad == i && info->active)){
ledImages.ledon[i]->draw(v);
pad_active = 1;
pad_active = true;
}else{
ledImages.ledoff[i]->draw(v);
}
@ -204,7 +204,7 @@ void MenuElementController::draw(CVideo *v){
alpha = 1.0f;
}
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
ledImages.ledon[i]->setAlpha(alpha);
ledImages.ledoff[i]->setAlpha(alpha);
}

View File

@ -21,7 +21,6 @@
#include "controller_patcher/patcher/ControllerPatcherDefs.h"
#include "controller_patcher/utils/CPRetainVars.hpp"
#include "utils/StringTools.h"
#include "menu/ControllerDefs.h"
class MenuElementController : public MenuElement{
public:

View File

@ -22,7 +22,7 @@
#include "content/ContentController.h"
#include "utils/logger.h"
MenuListDRC::MenuListDRC(int w, int h,MainWindowContent * _contentWindow)
MenuListDRC::MenuListDRC(s32 w, s32 h,MainWindowContent * _contentWindow)
: GuiFrame(w, h)
, contentWindow(_contentWindow)
, width(w)
@ -85,7 +85,7 @@ MenuListDRC::MenuListDRC(int w, int h,MainWindowContent * _contentWindow)
}
void MenuListDRC::setState(int i, int c){
void MenuListDRC::setState(s32 i, s32 c){
GuiFrame::setState(i,c);
}
@ -112,14 +112,14 @@ void MenuListDRC::listAppend(GuiElement * listElement){
append(listElement);
}
void MenuListDRC::OnDrag(GuiDragListener * listener, const GuiController * controller, GuiTrigger * trigger,int dx,int dy){
void MenuListDRC::OnDrag(GuiDragListener * listener, const GuiController * controller, GuiTrigger * trigger,s32 dx,s32 dy){
addToTotalOffset((float)dy);
scroll_needs_update = true;
}
void MenuListDRC::OnButtonClicked(GuiButton *button, const GuiController *controller, GuiTrigger *trigger){
MenuElement * element = NULL;
int i = 0;
s32 i = 0;
for (std::vector<MenuElement*>::iterator it = listElementsButtons.begin() ; it != listElementsButtons.end(); ++it){
element = (*it);
if(!element){continue; i++;}
@ -159,7 +159,7 @@ void MenuListDRC::update(GuiController * c){
if(dpad_selection_changed && (lastSelectedItem != selectedItem)){
lastSelectedItem = selectedItem;
if(selectedItem >= 0 && (u32) selectedItem < listElementsButtons.size()){
int i = 0;
s32 i = 0;
MenuElement * element = NULL;
for (std::vector<MenuElement*>::iterator it = listElementsButtons.begin() ; it != listElementsButtons.end(); ++it){
element = (*it);

View File

@ -27,14 +27,14 @@
class MenuListDRC : public GuiFrame, public sigslot::has_slots<>{
public:
MenuListDRC(int w, int h,MainWindowContent * contentWindow);
MenuListDRC(s32 w, s32 h,MainWindowContent * contentWindow);
virtual ~MenuListDRC();
MenuElement * getButtonElementByController(UController_Type controller_type);
void OnButtonClicked(GuiButton * button, const GuiController *controller, GuiTrigger *trigger);
private:
MainWindowContent * contentWindow;
int width, height;
s32 width, height;
GuiImage bgImageColor;
MenuSeperator homeSeperator;
MenuElementInfo elementHome;
@ -66,16 +66,16 @@ private:
std::vector<GuiElement*> listElementsAll;
std::vector<MenuElement*> listElementsButtons;
int sizeListElementsAll = 0;
int sizeListElementsButtons = 0;
s32 sizeListElementsAll = 0;
s32 sizeListElementsButtons = 0;
int selectedItem = 0;
int lastSelectedItem = -1;
s32 selectedItem = 0;
s32 lastSelectedItem = -1;
void setState(int i, int c);
void setState(s32 i, s32 c);
void update(GuiController * c);
void OnDrag(GuiDragListener * listener, const GuiController * controller, GuiTrigger * trigger,int dx,int dy);
void OnDrag(GuiDragListener * listener, const GuiController * controller, GuiTrigger * trigger,s32 dx,s32 dy);
void addToTotalOffset(f32 added_offset);
void calculateAndSetOffsets(std::vector<GuiElement*>& elements,f32 total_offset);
void listAppend(GuiElement * listElement);

View File

@ -32,7 +32,7 @@ ContentAbout::ContentAbout(): ContentTemplate(){
f32 positionX2 = 250.0f;
f32 positionX3 = 80.0f;
int fontSize = 28;
s32 fontSize = 28;
glm::vec4 textColor = glm::vec4(0.3f,0.3f,0.3f,1.0f);
text = new GuiText("Coding:", fontSize, textColor);

View File

@ -195,10 +195,10 @@ bool ContentController::isKeyboard(){
void ContentController::process(){
ContentTemplate::process();
int connected = ControllerPatcher::getActiveMappingSlot(getControllerType());
s32 connectedSlot = ControllerPatcher::getActiveMappingSlot(getControllerType());
//TODO: maybe just do it once and not every time?
if(connected != -1){
if(connectedSlot != -1){
notConnectedFrame.setState(STATE_DISABLE_INPUT);
notConnectedFrame.setVisible(false);
connectedFrame.clearState(STATE_DISABLE_INPUT);

View File

@ -32,8 +32,8 @@ ContentHelp::ContentHelp(): ContentTemplate(){
//f32 positionX2 = 250.0f;
//f32 positionX3 = 80.0f;
int fontSize = 35;
int fontSize2 = 24;
s32 fontSize = 35;
s32 fontSize2 = 24;
glm::vec4 textColor = glm::vec4(0.3f,0.3f,0.3f,1.0f);
text = new GuiText("My controller is not working!", fontSize, textColor);

View File

@ -32,8 +32,8 @@ ContentNetworkHelp::ContentNetworkHelp(): ContentTemplate(){
//f32 positionX2 = 250.0f;
//f32 positionX3 = 80.0f;
int fontSize = 35;
int fontSize2 = 24;
s32 fontSize = 35;
s32 fontSize2 = 24;
glm::vec4 textColor = glm::vec4(0.3f,0.3f,0.3f,1.0f);
text = new GuiText("What is the Network Client?", fontSize, textColor);

View File

@ -24,7 +24,7 @@
TVControllerBanner *MainWindowTV::bannerInstance = NULL;
MainWindowTV::MainWindowTV(int w, int h)
MainWindowTV::MainWindowTV(s32 w, s32 h)
: GuiConfigurationScreen(w, h)
, width(w)
, height(h)

View File

@ -29,13 +29,13 @@ class CVideo;
class MainWindowTV : public GuiConfigurationScreen{
public:
MainWindowTV(int w, int h);
MainWindowTV(s32 w, s32 h);
virtual ~MainWindowTV();
static TVControllerBanner * bannerInstance;
private:
int width, height;
s32 width, height;
GuiImageData *backgroundImageData;
GuiImage backgroundImage;

View File

@ -65,7 +65,7 @@ TVButtonController::TVButtonController(UController_Type controllertype)
notAttachedLabel.setColor(glm::vec4(0.2f,0.2f,0.2f,1.0f));
notAttachedLabel.setParent(this);
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
ledImages.ledon[i] = new GuiImage(ledon_imgdata);
ledImages.ledoff[i] = new GuiImage(ledoff_imgdata);
@ -130,7 +130,7 @@ TVButtonController::~TVButtonController()
Resources::RemoveImageData(ledon_imgdata);
Resources::RemoveImageData(ledoff_imgdata);
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
if(ledImages.ledon[i]) delete ledImages.ledon[i];
if(ledImages.ledoff[i]) delete ledImages.ledoff[i];
}
@ -166,14 +166,14 @@ void TVButtonController::draw(CVideo *v){
std::string name ="";
controllerConnected = 0;
int found = ControllerPatcher::getActiveMappingSlot(getControllerType());
s32 foundSlot = ControllerPatcher::getActiveMappingSlot(getControllerType());
if(found == -1){
if(foundSlot == -1){
name = "No device";
}else{
controllerConnected = 1;
ControllerMappingPADInfo * info = ControllerPatcher::getControllerMappingInfo(getControllerType(),found);
ControllerMappingPADInfo * info = ControllerPatcher::getControllerMappingInfo(getControllerType(),foundSlot);
if(info !=NULL){
if(info->type == CM_Type_Controller){
drawControllerName(v,info->vidpid.vid,info->vidpid.pid);
@ -187,14 +187,14 @@ void TVButtonController::draw(CVideo *v){
notAttachedLabel.setText(name.c_str());
notAttachedLabel.draw(v);
int pad_active = 0;
bool pad_active = false;
ControllerMappingPADInfo * info = ControllerPatcher::getControllerMappingInfo(getControllerType(),0);
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
if(info != NULL && (info->pad == i && info->active)){
ledImages.ledon[i]->draw(v);
pad_active = 1;
pad_active = true;
}else{
ledImages.ledoff[i]->draw(v);
}
@ -204,7 +204,7 @@ void TVButtonController::draw(CVideo *v){
if(pad_active){
alpha = 1.0f;
}
for(int i = 0;i<4;i++){
for(s32 i = 0;i<4;i++){
ledImages.ledon[i]->setAlpha(alpha);
ledImages.ledoff[i]->setAlpha(alpha);
}

View File

@ -27,7 +27,7 @@
#include "utils/StringTools.h"
TVControllerBanner::TVControllerBanner(int w, int h)
TVControllerBanner::TVControllerBanner(s32 w, s32 h)
: GuiFrame(w, h)
, background_imgdata(Resources::GetImageData("MainWindowTVBackgroundBanner.png"))
, background_img(background_imgdata)

View File

@ -25,7 +25,7 @@
class TVControllerBanner : public GuiFrame, public sigslot::has_slots<>
{
public:
TVControllerBanner(int w, int h);
TVControllerBanner(s32 w, s32 h);
virtual ~TVControllerBanner();
void draw(CVideo *pVideo);

View File

@ -50,8 +50,8 @@ DECL(void, __PPCExit, void){
real___PPCExit();
}
DECL(int, VPADRead, int chan, VPADData *buffer, u32 buffer_size, s32 *error) {
int result = real_VPADRead(chan, buffer, buffer_size, error);
DECL(s32, VPADRead, s32 chan, VPADData *buffer, u32 buffer_size, s32 *error) {
s32 result = real_VPADRead(chan, buffer, buffer_size, error);
if(gHIDAttached && buffer_size > 0){
@ -82,7 +82,7 @@ DECL(int, VPADRead, int chan, VPADData *buffer, u32 buffer_size, s32 *error) {
DECL(s32,KPADReadEx, s32 chan, KPADData * buffer, u32 buffer_count, s32 *error ){
//log_printf("KPADReadEx\n");
if(buffer_count > 0){
int res = ControllerPatcher::setProControllerDataFromHID((void*)&buffer[0],chan,PRO_CONTROLLER_MODE_KPADDATA); //Check if a controller is connected and fill the buffer with data.
s32 res = ControllerPatcher::setProControllerDataFromHID((void*)&buffer[0],chan,PRO_CONTROLLER_MODE_KPADDATA); //Check if a controller is connected and fill the buffer with data.
if(res >= 0){
if(buffer[0].pro.btns_h & WPAD_PRO_BUTTON_HOME){ //Pro controller doesn't work in home menu so it's okay to let this enabled.
@ -213,5 +213,5 @@ hooks_magic_t method_hooks_hid_controller[] __attribute__((section(".data"))) =
u32 method_hooks_size_hid_controller __attribute__((section(".data"))) = sizeof(method_hooks_hid_controller) / sizeof(hooks_magic_t);
//! buffer to store our instructions needed for our replacements
volatile unsigned int method_calls_hid_controller[sizeof(method_hooks_hid_controller) / sizeof(hooks_magic_t) * FUNCTION_PATCHER_METHOD_STORE_SIZE] __attribute__((section(".data")));
volatile u32 method_calls_hid_controller[sizeof(method_hooks_hid_controller) / sizeof(hooks_magic_t) * FUNCTION_PATCHER_METHOD_STORE_SIZE] __attribute__((section(".data")));

View File

@ -26,7 +26,7 @@ extern "C" {
extern hooks_magic_t method_hooks_hid_controller[];
extern u32 method_hooks_size_hid_controller;
extern volatile unsigned int method_calls_hid_controller[];
extern volatile u32 method_calls_hid_controller[];
#ifdef __cplusplus
}

View File

@ -12,7 +12,7 @@ Resources * Resources::instance = NULL;
void Resources::Clear()
{
for(int i = 0; RecourceList[i].filename != NULL; ++i)
for(s32 i = 0; RecourceList[i].filename != NULL; ++i)
{
if(RecourceList[i].CustomFile)
{
@ -38,7 +38,7 @@ bool Resources::LoadFiles(const char * path)
bool result = false;
Clear();
for(int i = 0; RecourceList[i].filename != NULL; ++i)
for(s32 i = 0; RecourceList[i].filename != NULL; ++i)
{
std::string fullpath(path);
fullpath += "/";
@ -59,7 +59,7 @@ bool Resources::LoadFiles(const char * path)
const u8 * Resources::GetFile(const char * filename)
{
for(int i = 0; RecourceList[i].filename != NULL; ++i)
for(s32 i = 0; RecourceList[i].filename != NULL; ++i)
{
if(strcasecmp(filename, RecourceList[i].filename) == 0)
{
@ -72,7 +72,7 @@ const u8 * Resources::GetFile(const char * filename)
u32 Resources::GetFileSize(const char * filename)
{
for(int i = 0; RecourceList[i].filename != NULL; ++i)
for(s32 i = 0; RecourceList[i].filename != NULL; ++i)
{
if(strcasecmp(filename, RecourceList[i].filename) == 0)
{
@ -87,14 +87,14 @@ GuiImageData * Resources::GetImageData(const char * filename)
if(!instance)
instance = new Resources;
std::map<std::string, std::pair<unsigned int, GuiImageData *> >::iterator itr = instance->imageDataMap.find(std::string(filename));
std::map<std::string, std::pair<u32, GuiImageData *> >::iterator itr = instance->imageDataMap.find(std::string(filename));
if(itr != instance->imageDataMap.end())
{
itr->second.first++;
return itr->second.second;
}
for(int i = 0; RecourceList[i].filename != NULL; ++i)
for(s32 i = 0; RecourceList[i].filename != NULL; ++i)
{
if(strcasecmp(filename, RecourceList[i].filename) == 0)
{
@ -117,7 +117,7 @@ GuiImageData * Resources::GetImageData(const char * filename)
void Resources::RemoveImageData(GuiImageData * image)
{
std::map<std::string, std::pair<unsigned int, GuiImageData *> >::iterator itr;
std::map<std::string, std::pair<u32, GuiImageData *> >::iterator itr;
for(itr = instance->imageDataMap.begin(); itr != instance->imageDataMap.end(); itr++)
{
@ -140,14 +140,14 @@ GuiSound * Resources::GetSound(const char * filename)
if(!instance)
instance = new Resources;
std::map<std::string, std::pair<unsigned int, GuiSound *> >::iterator itr = instance->soundDataMap.find(std::string(filename));
std::map<std::string, std::pair<u32, GuiSound *> >::iterator itr = instance->soundDataMap.find(std::string(filename));
if(itr != instance->soundDataMap.end())
{
itr->second.first++;
return itr->second.second;
}
for(int i = 0; RecourceList[i].filename != NULL; ++i)
for(s32 i = 0; RecourceList[i].filename != NULL; ++i)
{
if(strcasecmp(filename, RecourceList[i].filename) == 0)
{
@ -170,7 +170,7 @@ GuiSound * Resources::GetSound(const char * filename)
void Resources::RemoveSound(GuiSound * sound)
{
std::map<std::string, std::pair<unsigned int, GuiSound *> >::iterator itr;
std::map<std::string, std::pair<u32, GuiSound *> >::iterator itr;
for(itr = instance->soundDataMap.begin(); itr != instance->soundDataMap.end(); itr++)
{

View File

@ -27,8 +27,8 @@ private:
Resources() {}
~Resources() {}
std::map<std::string, std::pair<unsigned int, GuiImageData *> > imageDataMap;
std::map<std::string, std::pair<unsigned int, GuiSound *> > soundDataMap;
std::map<std::string, std::pair<u32, GuiImageData *> > imageDataMap;
std::map<std::string, std::pair<u32, GuiSound *> > soundDataMap;
};
#endif

View File

@ -41,14 +41,14 @@ BufferCircle::~BufferCircle()
BufferReady.clear();
}
void BufferCircle::SetBufferBlockSize(int size)
void BufferCircle::SetBufferBlockSize(s32 size)
{
if(size < 0)
return;
BufferBlockSize = size;
for(int i = 0; i < Size(); i++)
for(s32 i = 0; i < Size(); i++)
{
if(SoundBuffer[i] != NULL)
free(SoundBuffer[i]);
@ -59,18 +59,18 @@ void BufferCircle::SetBufferBlockSize(int size)
}
}
void BufferCircle::Resize(int size)
void BufferCircle::Resize(s32 size)
{
while(size < Size())
RemoveBuffer(Size()-1);
int oldSize = Size();
s32 oldSize = Size();
SoundBuffer.resize(size);
BufferSize.resize(size);
BufferReady.resize(size);
for(int i = oldSize; i < Size(); i++)
for(s32 i = oldSize; i < Size(); i++)
{
if(BufferBlockSize > 0)
SoundBuffer[i] = (u8 *) memalign(32, ALIGN32(BufferBlockSize));
@ -81,7 +81,7 @@ void BufferCircle::Resize(int size)
}
}
void BufferCircle::RemoveBuffer(int pos)
void BufferCircle::RemoveBuffer(s32 pos)
{
if(!Valid(pos))
return;
@ -96,7 +96,7 @@ void BufferCircle::RemoveBuffer(int pos)
void BufferCircle::ClearBuffer()
{
for(int i = 0; i < Size(); i++)
for(s32 i = 0; i < Size(); i++)
{
BufferSize[i] = 0;
BufferReady[i] = false;
@ -106,7 +106,7 @@ void BufferCircle::ClearBuffer()
void BufferCircle::FreeBuffer()
{
for(int i = 0; i < Size(); i++)
for(s32 i = 0; i < Size(); i++)
{
if(SoundBuffer[i] != NULL)
free(SoundBuffer[i]);
@ -125,7 +125,7 @@ void BufferCircle::LoadNext()
which = Next();
}
void BufferCircle::SetBufferReady(int pos, bool state)
void BufferCircle::SetBufferReady(s32 pos, bool state)
{
if(!Valid(pos))
return;
@ -133,7 +133,7 @@ void BufferCircle::SetBufferReady(int pos, bool state)
BufferReady[pos] = state;
}
void BufferCircle::SetBufferSize(int pos, int size)
void BufferCircle::SetBufferSize(s32 pos, s32 size)
{
if(!Valid(pos))
return;

View File

@ -37,13 +37,13 @@ class BufferCircle
//!> Destructor
~BufferCircle();
//!> Set circle size
void Resize(int size);
void Resize(s32 size);
//!> Get the circle size
int Size() { return SoundBuffer.size(); };
s32 Size() { return SoundBuffer.size(); };
//!> Set/resize the buffer size
void SetBufferBlockSize(int size);
void SetBufferBlockSize(s32 size);
//!> Remove a buffer
void RemoveBuffer(int pos);
void RemoveBuffer(s32 pos);
//!> Set all buffers clear
void ClearBuffer();
//!> Free all buffers
@ -53,28 +53,28 @@ class BufferCircle
//!> Get the current buffer
u8 * GetBuffer() { return GetBuffer(which); };
//!> Get a buffer at a position
u8 * GetBuffer(int pos) { if(!Valid(pos)) return NULL; else return SoundBuffer[pos]; };
u8 * GetBuffer(s32 pos) { if(!Valid(pos)) return NULL; else return SoundBuffer[pos]; };
//!> Get current buffer size
u32 GetBufferSize() { return GetBufferSize(which); };
//!> Get buffer size at position
u32 GetBufferSize(int pos) { if(!Valid(pos)) return 0; else return BufferSize[pos]; };
u32 GetBufferSize(s32 pos) { if(!Valid(pos)) return 0; else return BufferSize[pos]; };
//!> Is current buffer ready
bool IsBufferReady() { return IsBufferReady(which); };
//!> Is a buffer at a position ready
bool IsBufferReady(int pos) { if(!Valid(pos)) return false; else return BufferReady[pos]; };
bool IsBufferReady(s32 pos) { if(!Valid(pos)) return false; else return BufferReady[pos]; };
//!> Set a buffer at a position to a ready state
void SetBufferReady(int pos, bool st);
void SetBufferReady(s32 pos, bool st);
//!> Set the buffersize at a position
void SetBufferSize(int pos, int size);
void SetBufferSize(s32 pos, s32 size);
//!> Get the current position in the circle
u16 Which() { return which; };
//!> Get the next location
inline u16 Next() { return (which+1 >= Size()) ? 0 : which+1; }
inline u16 Prev() { if(Size() == 0) return 0; else return ((int)which-1 < 0) ? Size()-1 : which-1; }
inline u16 Prev() { if(Size() == 0) return 0; else return ((s32)which-1 < 0) ? Size()-1 : which-1; }
protected:
//!> Check if the position is a valid position in the vector
bool Valid(int pos) { return !(pos < 0 || pos >= Size()); };
bool Valid(s32 pos) { return !(pos < 0 || pos >= Size()); };
u16 which;
u32 BufferBlockSize;

View File

@ -48,7 +48,7 @@ Mp3Decoder::Mp3Decoder(const char * filepath)
OpenFile();
}
Mp3Decoder::Mp3Decoder(const u8 * snd, int len)
Mp3Decoder::Mp3Decoder(const u8 * snd, s32 len)
: SoundDecoder(snd, len)
{
SoundType = SOUND_MP3;
@ -92,7 +92,7 @@ void Mp3Decoder::OpenFile()
}
u8 dummybuff[4096];
int ret = Read(dummybuff, 4096, 0);
s32 ret = Read(dummybuff, 4096, 0);
if(ret <= 0)
{
if(file_fd)
@ -106,7 +106,7 @@ void Mp3Decoder::OpenFile()
Rewind();
}
int Mp3Decoder::Rewind()
s32 Mp3Decoder::Rewind()
{
mad_synth_finish(&Synth);
mad_frame_finish(&Frame);
@ -136,7 +136,7 @@ static inline s16 FixedToShort(mad_fixed_t Fixed)
return((s16)Fixed);
}
int Mp3Decoder::Read(u8 * buffer, int buffer_size, int pos)
s32 Mp3Decoder::Read(u8 * buffer, s32 buffer_size, s32 pos)
{
if(!file_fd)
return -1;
@ -170,8 +170,8 @@ int Mp3Decoder::Read(u8 * buffer, int buffer_size, int pos)
if(Stream.buffer == NULL || Stream.error == MAD_ERROR_BUFLEN)
{
u8 * ReadStart = ReadBuffer;
int ReadSize = SoundBlockSize*SoundBlocks;
int Remaining = 0;
s32 ReadSize = SoundBlockSize*SoundBlocks;
s32 Remaining = 0;
if(Stream.next_frame != NULL)
{

View File

@ -31,10 +31,10 @@ class Mp3Decoder : public SoundDecoder
{
public:
Mp3Decoder(const char * filepath);
Mp3Decoder(const u8 * sound, int len);
Mp3Decoder(const u8 * sound, s32 len);
virtual ~Mp3Decoder();
int Rewind();
int Read(u8 * buffer, int buffer_size, int pos);
s32 Rewind();
s32 Read(u8 * buffer, s32 buffer_size, s32 pos);
protected:
void OpenFile();
struct mad_stream Stream;

View File

@ -67,7 +67,7 @@ OggDecoder::OggDecoder(const char * filepath)
OpenFile();
}
OggDecoder::OggDecoder(const u8 * snd, int len)
OggDecoder::OggDecoder(const u8 * snd, s32 len)
: SoundDecoder(snd, len)
{
SoundType = SOUND_OGG;
@ -110,26 +110,26 @@ void OggDecoder::OpenFile()
SampleRate = ogg_info->rate;
}
int OggDecoder::Rewind()
s32 OggDecoder::Rewind()
{
if(!file_fd)
return -1;
int ret = ov_time_seek(&ogg_file, 0);
s32 ret = ov_time_seek(&ogg_file, 0);
CurPos = 0;
EndOfFile = false;
return ret;
}
int OggDecoder::Read(u8 * buffer, int buffer_size, int pos)
s32 OggDecoder::Read(u8 * buffer, s32 buffer_size, s32 pos)
{
if(!file_fd)
return -1;
int bitstream = 0;
s32 bitstream = 0;
int read = ov_read(&ogg_file, (char *) buffer, buffer_size, &bitstream);
s32 read = (s32) ov_read(&ogg_file, (char *) buffer, (int) buffer_size, (int *)&bitstream);
if(read > 0)
CurPos += read;

View File

@ -32,10 +32,10 @@ class OggDecoder : public SoundDecoder
{
public:
OggDecoder(const char * filepath);
OggDecoder(const u8 * snd, int len);
OggDecoder(const u8 * snd, s32 len);
virtual ~OggDecoder();
int Rewind();
int Read(u8 * buffer, int buffer_size, int pos);
s32 Rewind();
s32 Read(u8 * buffer, s32 buffer_size, s32 pos);
protected:
void OpenFile();
OggVorbis_File ogg_file;

View File

@ -36,7 +36,7 @@ SoundDecoder::SoundDecoder(const std::string & filepath)
Init();
}
SoundDecoder::SoundDecoder(const u8 * buffer, int size)
SoundDecoder::SoundDecoder(const u8 * buffer, s32 size)
{
file_fd = new CFile(buffer, size);
Init();
@ -78,7 +78,7 @@ void SoundDecoder::Init()
ResampleRatio = 0;
}
int SoundDecoder::Rewind()
s32 SoundDecoder::Rewind()
{
CurPos = 0;
EndOfFile = false;
@ -87,9 +87,9 @@ int SoundDecoder::Rewind()
return 0;
}
int SoundDecoder::Read(u8 * buffer, int buffer_size, int pos)
s32 SoundDecoder::Read(u8 * buffer, s32 buffer_size, s32 pos)
{
int ret = file_fd->read(buffer, buffer_size);
s32 ret = file_fd->read(buffer, buffer_size);
CurPos += ret;
return ret;
@ -113,7 +113,7 @@ void SoundDecoder::EnableUpsample(void)
void SoundDecoder::Upsample(s16 *src, s16 *dst, u32 nr_src_samples, u32 nr_dst_samples)
{
int timer = 0;
s32 timer = 0;
for(u32 i = 0, n = 0; i < nr_dst_samples; i += 2)
{
@ -129,7 +129,7 @@ void SoundDecoder::Upsample(s16 *src, s16 *dst, u32 nr_src_samples, u32 nr_dst_s
timer += ResampleRatio;
if(timer >= (int)FixedPointScale) {
if(timer >= (s32)FixedPointScale) {
n += 2;
timer -= FixedPointScale;
}
@ -152,7 +152,7 @@ void SoundDecoder::Decode()
Decoding = true;
int done = 0;
s32 done = 0;
u8 * write_buf = SoundBuffer.GetBuffer(whichLoad);
if(!write_buf)
{
@ -166,7 +166,7 @@ void SoundDecoder::Decode()
while(done < SoundBlockSize)
{
int ret = Read(&write_buf[done], SoundBlockSize-done, Tell());
s32 ret = Read(&write_buf[done], SoundBlockSize-done, Tell());
if(ret <= 0)
{
@ -192,8 +192,8 @@ void SoundDecoder::Decode()
{
memcpy(ResampleBuffer, write_buf, done);
int src_samples = done >> 1;
int dest_samples = ( src_samples * FixedPointScale ) / ResampleRatio;
s32 src_samples = done >> 1;
s32 dest_samples = ( src_samples * FixedPointScale ) / ResampleRatio;
dest_samples &= ~0x01;
Upsample((s16*)ResampleBuffer, (s16*)write_buf, src_samples, dest_samples);
done = dest_samples << 1;
@ -205,7 +205,7 @@ void SoundDecoder::Decode()
s16* monoBuf = (s16*)write_buf;
done = done >> 1;
for(int i = 0; i < done; i++)
for(s32 i = 0; i < done; i++)
monoBuf[i] = monoBuf[i << 1];
}

View File

@ -35,14 +35,14 @@ class SoundDecoder
public:
SoundDecoder();
SoundDecoder(const std::string & filepath);
SoundDecoder(const u8 * buffer, int size);
SoundDecoder(const u8 * buffer, s32 size);
virtual ~SoundDecoder();
virtual void Lock() { mutex.lock(); }
virtual void Unlock() { mutex.unlock(); }
virtual int Read(u8 * buffer, int buffer_size, int pos);
virtual int Tell() { return CurPos; }
virtual int Seek(int pos) { CurPos = pos; return file_fd->seek(CurPos, SEEK_SET); }
virtual int Rewind();
virtual s32 Read(u8 * buffer, s32 buffer_size, s32 pos);
virtual s32 Tell() { return CurPos; }
virtual s32 Seek(s32 pos) { CurPos = pos; return file_fd->seek(CurPos, SEEK_SET); }
virtual s32 Rewind();
virtual u16 GetFormat() { return Format; }
virtual u16 GetSampleRate() { return SampleRate; }
virtual void Decode();
@ -87,8 +87,8 @@ protected:
u8 SoundType;
u16 whichLoad;
u16 SoundBlocks;
int SoundBlockSize;
int CurPos;
s32 SoundBlockSize;
s32 CurPos;
bool ResampleTo48kHz;
bool Loop;
bool EndOfFile;

View File

@ -61,7 +61,7 @@ SoundHandler::~SoundHandler()
ClearDecoderList();
}
void SoundHandler::AddDecoder(int voice, const char * filepath)
void SoundHandler::AddDecoder(s32 voice, const char * filepath)
{
if(voice < 0 || voice >= MAX_DECODERS)
return;
@ -72,7 +72,7 @@ void SoundHandler::AddDecoder(int voice, const char * filepath)
DecoderList[voice] = GetSoundDecoder(filepath);
}
void SoundHandler::AddDecoder(int voice, const u8 * snd, int len)
void SoundHandler::AddDecoder(s32 voice, const u8 * snd, s32 len)
{
if(voice < 0 || voice >= MAX_DECODERS)
return;
@ -83,7 +83,7 @@ void SoundHandler::AddDecoder(int voice, const u8 * snd, int len)
DecoderList[voice] = GetSoundDecoder(snd, len);
}
void SoundHandler::RemoveDecoder(int voice)
void SoundHandler::RemoveDecoder(s32 voice)
{
if(voice < 0 || voice >= MAX_DECODERS)
return;
@ -137,7 +137,7 @@ static inline bool CheckMP3Signature(const u8 * buffer)
return true;
}
for(int i = 1; i < 13; i++)
for(s32 i = 1; i < 13; i++)
{
if(buffer[0] == MP3_Magic[i][0] && buffer[1] == MP3_Magic[i][1])
return true;
@ -182,10 +182,10 @@ SoundDecoder * SoundHandler::GetSoundDecoder(const char * filepath)
return new SoundDecoder(filepath);
}
SoundDecoder * SoundHandler::GetSoundDecoder(const u8 * sound, int length)
SoundDecoder * SoundHandler::GetSoundDecoder(const u8 * sound, s32 length)
{
const u8 * check = sound;
int counter = 0;
s32 counter = 0;
while(check[0] == 0 && counter < length)
{
@ -235,7 +235,7 @@ void SoundHandler::executeThread()
// we would need MAX_DECODERS > Voice::PRIO_MAX
for(u32 i = 0; i < MAX_DECODERS; ++i)
{
int priority = (MAX_DECODERS - i) * Voice::PRIO_MAX / MAX_DECODERS;
s32 priority = (MAX_DECODERS - i) * Voice::PRIO_MAX / MAX_DECODERS;
voiceList[i] = new Voice(priority); // allocate voice 0 with highest priority
}

View File

@ -45,12 +45,12 @@ public:
static void DestroyInstance() { delete handlerInstance; handlerInstance = NULL; }
void AddDecoder(int voice, const char * filepath);
void AddDecoder(int voice, const u8 * snd, int len);
void RemoveDecoder(int voice);
void AddDecoder(s32 voice, const char * filepath);
void AddDecoder(s32 voice, const u8 * snd, s32 len);
void RemoveDecoder(s32 voice);
SoundDecoder * getDecoder(int i) { return ((i < 0 || i >= MAX_DECODERS) ? NULL : DecoderList[i]); };
Voice * getVoice(int i) { return ((i < 0 || i >= MAX_DECODERS) ? NULL : voiceList[i]); };
SoundDecoder * getDecoder(s32 i) { return ((i < 0 || i >= MAX_DECODERS) ? NULL : DecoderList[i]); };
Voice * getVoice(s32 i) { return ((i < 0 || i >= MAX_DECODERS) ? NULL : voiceList[i]); };
void ThreadSignal() { resumeThread(); };
bool IsDecoding() { return Decoding; };
@ -64,7 +64,7 @@ protected:
void ClearDecoderList();
SoundDecoder * GetSoundDecoder(const char * filepath);
SoundDecoder * GetSoundDecoder(const u8 * sound, int length);
SoundDecoder * GetSoundDecoder(const u8 * sound, s32 length);
static SoundHandler * handlerInstance;

View File

@ -38,7 +38,7 @@ public:
STATE_STOP,
};
Voice(int prio)
Voice(s32 prio)
: state(STATE_STOPPED)
{
lastLoopCounter = 0;

View File

@ -40,7 +40,7 @@ WavDecoder::WavDecoder(const char * filepath)
OpenFile();
}
WavDecoder::WavDecoder(const u8 * snd, int len)
WavDecoder::WavDecoder(const u8 * snd, s32 len)
: SoundDecoder(snd, len)
{
SoundType = SOUND_WAV;
@ -93,7 +93,7 @@ void WavDecoder::OpenFile()
{
DataOffset += 8+le32(DataChunk.size);
file_fd->seek(DataOffset, SEEK_SET);
int ret = file_fd->read((u8 *) &DataChunk, sizeof(SWaveChunk));
s32 ret = file_fd->read((u8 *) &DataChunk, sizeof(SWaveChunk));
if(ret <= 0)
{
CloseFile();
@ -124,20 +124,20 @@ void WavDecoder::CloseFile()
file_fd = NULL;
}
int WavDecoder::Read(u8 * buffer, int buffer_size, int pos)
s32 WavDecoder::Read(u8 * buffer, s32 buffer_size, s32 pos)
{
if(!file_fd)
return -1;
if(CurPos >= (int) DataSize)
if(CurPos >= (s32) DataSize)
return 0;
file_fd->seek(DataOffset+CurPos, SEEK_SET);
if(buffer_size > (int) DataSize-CurPos)
if(buffer_size > (s32) DataSize-CurPos)
buffer_size = DataSize-CurPos;
int read = file_fd->read(buffer, buffer_size);
s32 read = file_fd->read(buffer, buffer_size);
if(read > 0)
{
if (Is16Bit)

View File

@ -57,9 +57,9 @@ class WavDecoder : public SoundDecoder
{
public:
WavDecoder(const char * filepath);
WavDecoder(const u8 * snd, int len);
WavDecoder(const u8 * snd, s32 len);
virtual ~WavDecoder();
int Read(u8 * buffer, int buffer_size, int pos);
s32 Read(u8 * buffer, s32 buffer_size, s32 pos);
protected:
void OpenFile();
void CloseFile();

View File

@ -29,7 +29,7 @@ public:
typedef void (* Callback)(CThread *thread, void *arg);
//! constructor
CThread(int iAttr, int iPriority = 16, int iStackSize = 0x8000, CThread::Callback callback = NULL, void *callbackArg = NULL)
CThread(s32 iAttr, s32 iPriority = 16, s32 iStackSize = 0x8000, CThread::Callback callback = NULL, void *callbackArg = NULL)
: pThread(NULL)
, pThreadStack(NULL)
, pCallback(callback)
@ -49,7 +49,7 @@ public:
//! destructor
virtual ~CThread() { shutdownThread(); }
static CThread *create(CThread::Callback callback, void *callbackArg, int iAttr = eAttributeNone, int iPriority = 16, int iStackSize = 0x8000)
static CThread *create(CThread::Callback callback, void *callbackArg, s32 iAttr = eAttributeNone, s32 iPriority = 16, s32 iStackSize = 0x8000)
{
return ( new CThread(iAttr, iPriority, iStackSize, callback, callbackArg) );
}
@ -67,7 +67,7 @@ public:
//! Resume thread
virtual void resumeThread(void) { if(!isThreadSuspended()) return; if(pThread) OSResumeThread(pThread); }
//! Set thread priority
virtual void setThreadPriority(int prio) { if(pThread) OSSetThreadPriority(pThread, prio); }
virtual void setThreadPriority(s32 prio) { if(pThread) OSSetThreadPriority(pThread, prio); }
//! Check if thread is suspended
virtual bool isThreadSuspended(void) const { if(pThread) return OSIsThreadSuspended(pThread); return false; }
//! Check if thread is terminated
@ -105,13 +105,13 @@ public:
eAttributePinnedAff = 0x10
};
private:
static int threadCallback(int argc, void *arg)
static s32 threadCallback(s32 argc, void *arg)
{
//! After call to start() continue with the internal function
((CThread *) arg)->executeThread();
return 0;
}
int iAttributes;
s32 iAttributes;
void *pThread;
u8 *pThreadStack;
Callback pCallback;

View File

@ -80,7 +80,7 @@ static const char exception_print_formats[18][45] = {
static unsigned char exception_cb(void * c, unsigned char exception_type) {
char buf[850];
int pos = 0;
s32 pos = 0;
OSContext *context = (OSContext *) c;
/*

Some files were not shown because too many files have changed in this diff Show More