mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 12:46:53 +01:00
*Fixed booting games for huge ext2/3/4 drives
*Rewrote complete main menu function *Moved ext2/3/4 disc cache to mem2 as on FAT/NTFS (added ext2 as custom lib due to that) *Added missing header files from R1011 for ext support *Fixed crash on Numpad when pressing a button *Fixed boot of WiiMC *Changed SVN line ending to LF (Unix style)
This commit is contained in:
parent
2213b45351
commit
18a26d7e1a
5
Makefile
5
Makefile
@ -64,7 +64,8 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80B00
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lpngu -lpng -lgd -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -lmxml -ljpeg -lzip -lext2fs
|
||||
LIBS := -lpngu -lpng -lgd -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec \
|
||||
-lmad -lmxml -ljpeg -lzip -lcustomext2fs
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
@ -127,7 +128,7 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -L$(CURDIR)/source/libs/libext2fs/ \
|
||||
-L$(LIBOGC_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 103 KiB |
File diff suppressed because one or more lines are too long
@ -21,7 +21,7 @@ void gprintf(const char *format, ...)
|
||||
if((vasprintf(&tmp, format, va) >= 0) && tmp)
|
||||
{
|
||||
u32 level = IRQ_Disable();
|
||||
usb_sendbuffer(1, tmp, strlen(tmp));
|
||||
usb_sendbuffer_safe(1, tmp, strlen(tmp));
|
||||
IRQ_Restore(level);
|
||||
}
|
||||
va_end(va);
|
||||
|
@ -8,52 +8,57 @@
|
||||
|
||||
#include "dolloader.h"
|
||||
|
||||
typedef struct _dolheader
|
||||
{
|
||||
u32 text_pos[7];
|
||||
u32 data_pos[11];
|
||||
u32 text_start[7];
|
||||
u32 data_start[11];
|
||||
u32 text_size[7];
|
||||
u32 data_size[11];
|
||||
u32 bss_start;
|
||||
u32 bss_size;
|
||||
u32 entry_point;
|
||||
typedef struct _dolheader {
|
||||
u32 text_pos[7];
|
||||
u32 data_pos[11];
|
||||
u32 text_start[7];
|
||||
u32 data_start[11];
|
||||
u32 text_size[7];
|
||||
u32 data_size[11];
|
||||
u32 bss_start;
|
||||
u32 bss_size;
|
||||
u32 entry_point;
|
||||
} dolheader;
|
||||
|
||||
u32 load_dol(const void *dolstart, struct __argv *argv)
|
||||
{
|
||||
u32 i;
|
||||
dolheader *dolfile;
|
||||
u32 i;
|
||||
dolheader *dolfile;
|
||||
|
||||
if (dolstart)
|
||||
{
|
||||
dolfile = (dolheader *) dolstart;
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) continue;
|
||||
ICInvalidateRange((void *) dolfile->text_start[i], dolfile->text_size[i]);
|
||||
memcpy((void *) dolfile->text_start[i], dolstart + dolfile->text_pos[i], dolfile->text_size[i]);
|
||||
}
|
||||
if (dolstart)
|
||||
{
|
||||
dolfile = (dolheader *) dolstart;
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100))
|
||||
continue;
|
||||
|
||||
for (i = 0; i < 11; i++)
|
||||
{
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) continue;
|
||||
memcpy((void *) dolfile->data_start[i], dolstart + dolfile->data_pos[i], dolfile->data_size[i]);
|
||||
DCFlushRangeNoSync((void *) dolfile->data_start[i], dolfile->data_size[i]);
|
||||
}
|
||||
memmove((void *) dolfile->text_start[i], dolstart
|
||||
+ dolfile->text_pos[i], dolfile->text_size[i]);
|
||||
|
||||
memset((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
||||
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
||||
DCFlushRange ((void *) dolfile->text_start[i], dolfile->text_size[i]);
|
||||
ICInvalidateRange((void *) dolfile->text_start[i], dolfile->text_size[i]);
|
||||
}
|
||||
|
||||
if (argv && argv->argvMagic == ARGV_MAGIC)
|
||||
{
|
||||
void *new_argv = (void *) (dolfile->entry_point + 8);
|
||||
memcpy(new_argv, argv, sizeof(*argv));
|
||||
DCFlushRange(new_argv, sizeof(*argv));
|
||||
}
|
||||
for (i = 0; i < 11; i++)
|
||||
{
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100))
|
||||
continue;
|
||||
|
||||
return dolfile->entry_point;
|
||||
}
|
||||
return 0;
|
||||
memmove((void *) dolfile->data_start[i], dolstart
|
||||
+ dolfile->data_pos[i], dolfile->data_size[i]);
|
||||
|
||||
DCFlushRange((void *) dolfile->data_start[i],
|
||||
dolfile->data_size[i]);
|
||||
}
|
||||
|
||||
if (argv && argv->argvMagic == ARGV_MAGIC)
|
||||
{
|
||||
void *new_argv = (void *) (dolfile->entry_point + 8);
|
||||
memmove(new_argv, argv, sizeof(*argv));
|
||||
DCFlushRange(new_argv, sizeof(*argv));
|
||||
}
|
||||
return dolfile->entry_point;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -2,14 +2,14 @@
|
||||
#define _DOLLOADER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void __exception_closeall();
|
||||
typedef void (*entrypoint)(void);
|
||||
extern void __exception_closeall();
|
||||
typedef void (*entrypoint) (void);
|
||||
|
||||
u32 load_dol(const void *dolstart, struct __argv *argv);
|
||||
|
||||
u32 load_dol(const void *dolstart, struct __argv *argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
638
source/libs/libext2fs/bitops.h
Normal file
638
source/libs/libext2fs/bitops.h
Normal file
@ -0,0 +1,638 @@
|
||||
/*
|
||||
* bitops.h --- Bitmap frobbing code. The byte swapping routines are
|
||||
* also included here.
|
||||
*
|
||||
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
#ifndef _BITOPS_H_
|
||||
#define _BITOPS_H_
|
||||
|
||||
extern int ext2fs_set_bit(unsigned int nr,void * addr);
|
||||
extern int ext2fs_clear_bit(unsigned int nr, void * addr);
|
||||
extern int ext2fs_test_bit(unsigned int nr, const void * addr);
|
||||
extern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
|
||||
extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
|
||||
extern int ext2fs_set_bit64(__u64 nr,void * addr);
|
||||
extern int ext2fs_clear_bit64(__u64 nr, void * addr);
|
||||
extern int ext2fs_test_bit64(__u64 nr, const void * addr);
|
||||
extern void ext2fs_fast_set_bit64(__u64 nr,void * addr);
|
||||
extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr);
|
||||
extern __u16 ext2fs_swab16(__u16 val);
|
||||
extern __u32 ext2fs_swab32(__u32 val);
|
||||
extern __u64 ext2fs_swab64(__u64 val);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define ext2fs_cpu_to_le64(x) ext2fs_swab64((x))
|
||||
#define ext2fs_le64_to_cpu(x) ext2fs_swab64((x))
|
||||
#define ext2fs_cpu_to_le32(x) ext2fs_swab32((x))
|
||||
#define ext2fs_le32_to_cpu(x) ext2fs_swab32((x))
|
||||
#define ext2fs_cpu_to_le16(x) ext2fs_swab16((x))
|
||||
#define ext2fs_le16_to_cpu(x) ext2fs_swab16((x))
|
||||
#define ext2fs_cpu_to_be32(x) ((__u32)(x))
|
||||
#define ext2fs_be32_to_cpu(x) ((__u32)(x))
|
||||
#define ext2fs_cpu_to_be16(x) ((__u16)(x))
|
||||
#define ext2fs_be16_to_cpu(x) ((__u16)(x))
|
||||
#else
|
||||
#define ext2fs_cpu_to_le64(x) ((__u64)(x))
|
||||
#define ext2fs_le64_to_cpu(x) ((__u64)(x))
|
||||
#define ext2fs_cpu_to_le32(x) ((__u32)(x))
|
||||
#define ext2fs_le32_to_cpu(x) ((__u32)(x))
|
||||
#define ext2fs_cpu_to_le16(x) ((__u16)(x))
|
||||
#define ext2fs_le16_to_cpu(x) ((__u16)(x))
|
||||
#define ext2fs_cpu_to_be32(x) ext2fs_swab32((x))
|
||||
#define ext2fs_be32_to_cpu(x) ext2fs_swab32((x))
|
||||
#define ext2fs_cpu_to_be16(x) ext2fs_swab16((x))
|
||||
#define ext2fs_be16_to_cpu(x) ext2fs_swab16((x))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* EXT2FS bitmap manipulation routines.
|
||||
*/
|
||||
|
||||
/* Support for sending warning messages from the inline subroutines */
|
||||
extern const char *ext2fs_block_string;
|
||||
extern const char *ext2fs_inode_string;
|
||||
extern const char *ext2fs_mark_string;
|
||||
extern const char *ext2fs_unmark_string;
|
||||
extern const char *ext2fs_test_string;
|
||||
extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
|
||||
const char *description);
|
||||
extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
|
||||
int code, unsigned long arg);
|
||||
|
||||
extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
|
||||
extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block);
|
||||
extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
|
||||
|
||||
extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
|
||||
extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
|
||||
|
||||
extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block);
|
||||
extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block);
|
||||
extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block);
|
||||
|
||||
extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
|
||||
extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
|
||||
extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
|
||||
extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
|
||||
|
||||
extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap,
|
||||
ino_t inode, int num);
|
||||
extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
|
||||
|
||||
/* These routines moved to gen_bitmap.c (actually, some of the above, too) */
|
||||
extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
||||
__u32 bitno);
|
||||
extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
||||
blk_t bitno);
|
||||
extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
||||
blk_t bitno);
|
||||
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap);
|
||||
extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap);
|
||||
|
||||
/* 64-bit versions */
|
||||
|
||||
extern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
extern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
extern int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
|
||||
extern int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
|
||||
extern void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
extern void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
extern int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
|
||||
extern void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap);
|
||||
extern ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap);
|
||||
extern blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap);
|
||||
extern ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap);
|
||||
|
||||
extern int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num);
|
||||
extern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num);
|
||||
extern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num);
|
||||
/* These routines moved to gen_bitmap64.c */
|
||||
extern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
|
||||
extern errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
|
||||
ext2fs_generic_bitmap bm1,
|
||||
ext2fs_generic_bitmap bm2);
|
||||
extern void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
|
||||
extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
blk64_t bitno);
|
||||
extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
blk64_t bitno);
|
||||
extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
blk64_t bitno);
|
||||
extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block, unsigned int num);
|
||||
extern __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap);
|
||||
extern __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap);
|
||||
extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block, unsigned int num);
|
||||
extern void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block, unsigned int num);
|
||||
extern void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block, unsigned int num);
|
||||
|
||||
/*
|
||||
* The inline routines themselves...
|
||||
*
|
||||
* If NO_INLINE_FUNCS is defined, then we won't try to do inline
|
||||
* functions at all; they will be included as normal functions in
|
||||
* inline.c
|
||||
*/
|
||||
#ifdef NO_INLINE_FUNCS
|
||||
#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
|
||||
defined(__i586__) || defined(__mc68000__)))
|
||||
/* This prevents bitops.c from trying to include the C */
|
||||
/* function version of these functions */
|
||||
#define _EXT2_HAVE_ASM_BITOPS_
|
||||
#endif
|
||||
#endif /* NO_INLINE_FUNCS */
|
||||
|
||||
#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
|
||||
#ifdef INCLUDE_INLINE_FUNCS
|
||||
#define _INLINE_ extern
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define _INLINE_ extern __inline__
|
||||
#else /* For Watcom C */
|
||||
#define _INLINE_ extern inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fast bit set/clear functions that doesn't need to return the
|
||||
* previous bit value.
|
||||
*/
|
||||
|
||||
_INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr)
|
||||
{
|
||||
unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
*ADDR |= (1 << (nr & 0x07));
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr)
|
||||
{
|
||||
unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
*ADDR &= ~(1 << (nr & 0x07));
|
||||
}
|
||||
|
||||
|
||||
_INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr)
|
||||
{
|
||||
unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
*ADDR |= (1 << (nr & 0x07));
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr)
|
||||
{
|
||||
unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
*ADDR &= ~(1 << (nr & 0x07));
|
||||
}
|
||||
|
||||
|
||||
#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
|
||||
(defined(__i386__) || defined(__i486__) || defined(__i586__)))
|
||||
|
||||
#define _EXT2_HAVE_ASM_BITOPS_
|
||||
#define _EXT2_HAVE_ASM_SWAB_
|
||||
|
||||
/*
|
||||
* These are done by inline assembly for speed reasons.....
|
||||
*
|
||||
* All bitoperations return 0 if the bit was cleared before the
|
||||
* operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32
|
||||
* is the LSB of (addr+1).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Some hacks to defeat gcc over-optimizations..
|
||||
*/
|
||||
struct __dummy_h { unsigned long a[100]; };
|
||||
#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
|
||||
#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
|
||||
|
||||
_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
addr = (void *) (((unsigned char *) addr) + (nr >> 3));
|
||||
__asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
|
||||
:"=r" (oldbit),"+m" (EXT2FS_ADDR)
|
||||
:"r" (nr & 7));
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
addr = (void *) (((unsigned char *) addr) + (nr >> 3));
|
||||
__asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
|
||||
:"=r" (oldbit),"+m" (EXT2FS_ADDR)
|
||||
:"r" (nr & 7));
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
addr = (const void *) (((const unsigned char *) addr) + (nr >> 3));
|
||||
__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
|
||||
:"=r" (oldbit)
|
||||
:"m" (EXT2FS_CONST_ADDR),"r" (nr & 7));
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
_INLINE_ __u32 ext2fs_swab32(__u32 val)
|
||||
{
|
||||
#ifdef EXT2FS_REQUIRE_486
|
||||
__asm__("bswap %0" : "=r" (val) : "0" (val));
|
||||
#else
|
||||
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
|
||||
"rorl $16,%0\n\t" /* swap words */
|
||||
"xchgb %b0,%h0" /* swap higher bytes */
|
||||
:"=q" (val)
|
||||
: "0" (val));
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
_INLINE_ __u16 ext2fs_swab16(__u16 val)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0" /* swap bytes */ \
|
||||
: "=q" (val) \
|
||||
: "0" (val)); \
|
||||
return val;
|
||||
}
|
||||
|
||||
#undef EXT2FS_ADDR
|
||||
|
||||
#endif /* i386 */
|
||||
|
||||
#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
|
||||
(defined(__mc68000__)))
|
||||
|
||||
#define _EXT2_HAVE_ASM_BITOPS_
|
||||
|
||||
_INLINE_ int ext2fs_set_bit(unsigned int nr,void * addr)
|
||||
{
|
||||
char retval;
|
||||
|
||||
__asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
|
||||
: "=d" (retval) : "d" (nr^7), "a" (addr));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
|
||||
{
|
||||
char retval;
|
||||
|
||||
__asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
|
||||
: "=d" (retval) : "d" (nr^7), "a" (addr));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
|
||||
{
|
||||
char retval;
|
||||
|
||||
__asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
|
||||
: "=d" (retval) : "d" (nr^7), "a" (addr));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif /* __mc68000__ */
|
||||
|
||||
|
||||
#if !defined(_EXT2_HAVE_ASM_SWAB_)
|
||||
|
||||
_INLINE_ __u16 ext2fs_swab16(__u16 val)
|
||||
{
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
|
||||
_INLINE_ __u32 ext2fs_swab32(__u32 val)
|
||||
{
|
||||
return ((val>>24) | ((val>>8)&0xFF00) |
|
||||
((val<<8)&0xFF0000) | (val<<24));
|
||||
}
|
||||
|
||||
#endif /* !_EXT2_HAVE_ASM_SWAB */
|
||||
|
||||
_INLINE_ __u64 ext2fs_swab64(__u64 val)
|
||||
{
|
||||
return (ext2fs_swab32(val >> 32) |
|
||||
(((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32));
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num)
|
||||
{
|
||||
return ext2fs_test_block_bitmap_range(bitmap, block, num);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num)
|
||||
{
|
||||
ext2fs_mark_block_bitmap_range(bitmap, block, num);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num)
|
||||
{
|
||||
ext2fs_unmark_block_bitmap_range(bitmap, block, num);
|
||||
}
|
||||
|
||||
/* 64-bit versions */
|
||||
|
||||
_INLINE_ int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num)
|
||||
{
|
||||
return ext2fs_test_block_bitmap_range2(bitmap, block, num);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num)
|
||||
{
|
||||
ext2fs_mark_block_bitmap_range2(bitmap, block, num);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num)
|
||||
{
|
||||
ext2fs_unmark_block_bitmap_range2(bitmap, block, num);
|
||||
}
|
||||
|
||||
#undef _INLINE_
|
||||
#endif
|
||||
|
||||
#endif
|
70
source/libs/libext2fs/com_err.h
Normal file
70
source/libs/libext2fs/com_err.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Header file for common error description library.
|
||||
*
|
||||
* Copyright 1988, Student Information Processing Board of the
|
||||
* Massachusetts Institute of Technology.
|
||||
*
|
||||
* For copyright and distribution info, see the documentation supplied
|
||||
* with this package.
|
||||
*/
|
||||
|
||||
#if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define COM_ERR_ATTR(x) __attribute__(x)
|
||||
#else
|
||||
#define COM_ERR_ATTR(x)
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_GEKKO
|
||||
#define OMIT_COM_ERR
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef long errcode_t;
|
||||
|
||||
struct error_table {
|
||||
char const * const * msgs;
|
||||
long base;
|
||||
int n_msgs;
|
||||
};
|
||||
struct et_list;
|
||||
|
||||
extern void com_err (const char *, long, const char *, ...)
|
||||
COM_ERR_ATTR((format(printf, 3, 4)));
|
||||
|
||||
extern void com_err_va (const char *whoami, errcode_t code, const char *fmt,
|
||||
va_list args)
|
||||
COM_ERR_ATTR((format(printf, 3, 0)));
|
||||
|
||||
extern char const *error_message (long);
|
||||
extern void (*com_err_hook) (const char *, long, const char *, va_list);
|
||||
extern void (*set_com_err_hook (void (*) (const char *, long,
|
||||
const char *, va_list)))
|
||||
(const char *, long, const char *, va_list);
|
||||
extern void (*reset_com_err_hook (void)) (const char *, long,
|
||||
const char *, va_list);
|
||||
extern int init_error_table(const char * const *msgs, long base, int count);
|
||||
|
||||
extern errcode_t add_error_table(const struct error_table * et);
|
||||
extern errcode_t remove_error_table(const struct error_table * et);
|
||||
extern void add_to_error_table(struct et_list *new_table);
|
||||
|
||||
/* Provided for Heimdall compatibility */
|
||||
extern const char *com_right(struct et_list *list, long code);
|
||||
extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len);
|
||||
extern void initialize_error_table_r(struct et_list **list,
|
||||
const char **messages,
|
||||
int num_errors,
|
||||
long base);
|
||||
extern void free_error_table(struct et_list *et);
|
||||
|
||||
/* Provided for compatibility with other com_err libraries */
|
||||
extern int et_list_lock(void);
|
||||
extern int et_list_unlock(void);
|
||||
|
||||
#define __COM_ERR_H
|
||||
#define __COM_ERR_H__
|
||||
#endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/
|
152
source/libs/libext2fs/ext2_err.h
Normal file
152
source/libs/libext2fs/ext2_err.h
Normal file
@ -0,0 +1,152 @@
|
||||
//
|
||||
// Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
|
||||
//
|
||||
// This file may be redistributed under the terms of the GNU Public
|
||||
// License.
|
||||
#ifndef EXT2_ERR_H_
|
||||
#define EXT2_ERR_H_
|
||||
|
||||
#define EXT2_ET_OK 0
|
||||
#define EXT2_ET_BASE -1
|
||||
#define EXT2_ET_MAGIC_EXT2FS_FILSYS -2
|
||||
#define EXT2_ET_MAGIC_BADBLOCKS_LIST -3
|
||||
#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE -4
|
||||
#define EXT2_ET_MAGIC_INODE_SCAN -5
|
||||
#define EXT2_ET_MAGIC_IO_CHANNEL -6
|
||||
#define EXT2_ET_MAGIC_UNIX_IO_CHANNEL -7
|
||||
#define EXT2_ET_MAGIC_IO_MANAGER -8
|
||||
#define EXT2_ET_MAGIC_BLOCK_BITMAP -9
|
||||
#define EXT2_ET_MAGIC_INODE_BITMAP -10
|
||||
#define EXT2_ET_MAGIC_GENERIC_BITMAP -11
|
||||
#define EXT2_ET_MAGIC_TEST_IO_CHANNEL -12
|
||||
#define EXT2_ET_MAGIC_DBLIST -13
|
||||
#define EXT2_ET_MAGIC_ICOUNT -14
|
||||
#define EXT2_ET_MAGIC_PQ_IO_CHANNEL -15
|
||||
#define EXT2_ET_MAGIC_EXT2_FILE -16
|
||||
#define EXT2_ET_MAGIC_E2IMAGE -17
|
||||
#define EXT2_ET_MAGIC_INODE_IO_CHANNEL -18
|
||||
#define EXT2_ET_MAGIC_EXTENT_HANDLE -19
|
||||
#define EXT2_ET_BAD_MAGIC -20
|
||||
#define EXT2_ET_REV_TOO_HIGH -21
|
||||
#define EXT2_ET_RO_FILSYS -22
|
||||
#define EXT2_ET_GDESC_READ -23
|
||||
#define EXT2_ET_GDESC_WRITE -24
|
||||
#define EXT2_ET_GDESC_BAD_BLOCK_MAP -25
|
||||
#define EXT2_ET_GDESC_BAD_INODE_MAP -26
|
||||
#define EXT2_ET_GDESC_BAD_INODE_TABLE -27
|
||||
#define EXT2_ET_INODE_BITMAP_WRITE -28
|
||||
#define EXT2_ET_INODE_BITMAP_READ -29
|
||||
#define EXT2_ET_BLOCK_BITMAP_WRITE -30
|
||||
#define EXT2_ET_BLOCK_BITMAP_READ -31
|
||||
#define EXT2_ET_INODE_TABLE_WRITE -32
|
||||
#define EXT2_ET_INODE_TABLE_READ -33
|
||||
#define EXT2_ET_NEXT_INODE_READ -34
|
||||
#define EXT2_ET_UNEXPECTED_BLOCK_SIZE -35
|
||||
#define EXT2_ET_DIR_CORRUPTED -36
|
||||
#define EXT2_ET_SHORT_READ -37
|
||||
#define EXT2_ET_SHORT_WRITE -38
|
||||
#define EXT2_ET_DIR_NO_SPACE -39
|
||||
#define EXT2_ET_NO_INODE_BITMAP -40
|
||||
#define EXT2_ET_NO_BLOCK_BITMAP -41
|
||||
#define EXT2_ET_BAD_INODE_NUM -42
|
||||
#define EXT2_ET_BAD_BLOCK_NUM -45
|
||||
#define EXT2_ET_EXPAND_DIR_ERR -46
|
||||
#define EXT2_ET_TOOSMALL -47
|
||||
#define EXT2_ET_BAD_BLOCK_MARK -48
|
||||
#define EXT2_ET_BAD_BLOCK_UNMARK -49
|
||||
#define EXT2_ET_BAD_BLOCK_TEST -50
|
||||
#define EXT2_ET_BAD_INODE_MARK -51
|
||||
#define EXT2_ET_BAD_INODE_UNMARK -52
|
||||
#define EXT2_ET_BAD_INODE_TEST -53
|
||||
#define EXT2_ET_FUDGE_BLOCK_BITMAP_END -54
|
||||
#define EXT2_ET_FUDGE_INODE_BITMAP_END -55
|
||||
#define EXT2_ET_BAD_IND_BLOCK -56
|
||||
#define EXT2_ET_BAD_DIND_BLOCK -57
|
||||
#define EXT2_ET_BAD_TIND_BLOCK -58
|
||||
#define EXT2_ET_NEQ_BLOCK_BITMAP -59
|
||||
#define EXT2_ET_NEQ_INODE_BITMAP -60
|
||||
#define EXT2_ET_BAD_DEVICE_NAME -61
|
||||
#define EXT2_ET_MISSING_INODE_TABLE -62
|
||||
#define EXT2_ET_CORRUPT_SUPERBLOCK -63
|
||||
#define EXT2_ET_BAD_GENERIC_MARK -64
|
||||
#define EXT2_ET_BAD_GENERIC_UNMARK -65
|
||||
#define EXT2_ET_BAD_GENERIC_TEST -66
|
||||
#define EXT2_ET_SYMLINK_LOOP -67
|
||||
#define EXT2_ET_CALLBACK_NOTHANDLED -68
|
||||
#define EXT2_ET_BAD_BLOCK_IN_INODE_TABLE -69
|
||||
#define EXT2_ET_UNSUPP_FEATURE -70
|
||||
#define EXT2_ET_RO_UNSUPP_FEATURE -71
|
||||
#define EXT2_ET_LLSEEK_FAILED -72
|
||||
#define EXT2_ET_NO_MEMORY -73
|
||||
#define EXT2_ET_INVALID_ARGUMENT -74
|
||||
#define EXT2_ET_BLOCK_ALLOC_FAIL -75
|
||||
#define EXT2_ET_INODE_ALLOC_FAIL -76
|
||||
#define EXT2_ET_NO_DIRECTORY -77
|
||||
#define EXT2_ET_TOO_MANY_REFS -78
|
||||
#define EXT2_ET_FILE_NOT_FOUND -79
|
||||
#define EXT2_ET_FILE_RO -80
|
||||
#define EXT2_ET_DB_NOT_FOUND -81
|
||||
#define EXT2_ET_DIR_EXISTS -82
|
||||
#define EXT2_ET_UNIMPLEMENTED -83
|
||||
#define EXT2_ET_CANCEL_REQUESTED -84
|
||||
#define EXT2_ET_FILE_TOO_BIG -85
|
||||
#define EXT2_ET_JOURNAL_NOT_BLOCK -86
|
||||
#define EXT2_ET_NO_JOURNAL_SB -87
|
||||
#define EXT2_ET_JOURNAL_TOO_SMALL -88
|
||||
#define EXT2_ET_JOURNAL_UNSUPP_VERSION -89
|
||||
#define EXT2_ET_LOAD_EXT_JOURNAL -90
|
||||
#define EXT2_ET_NO_JOURNAL -91
|
||||
#define EXT2_ET_DIRHASH_UNSUPP -92
|
||||
#define EXT2_ET_BAD_EA_BLOCK_NUM -93
|
||||
#define EXT2_ET_TOO_MANY_INODES -94
|
||||
#define EXT2_ET_NOT_IMAGE_FILE -95
|
||||
#define EXT2_ET_RES_GDT_BLOCKS -96
|
||||
#define EXT2_ET_RESIZE_INODE_CORRUPT -97
|
||||
#define EXT2_ET_SET_BMAP_NO_IND -98
|
||||
#define EXT2_ET_TDB_SUCCESS -99
|
||||
#define EXT2_ET_TDB_ERR_CORRUPT -100
|
||||
#define EXT2_ET_TDB_ERR_IO -101
|
||||
#define EXT2_ET_TDB_ERR_LOCK -102
|
||||
#define EXT2_ET_TDB_ERR_OOM -103
|
||||
#define EXT2_ET_TDB_ERR_EXISTS -104
|
||||
#define EXT2_ET_TDB_ERR_NOLOCK -105
|
||||
#define EXT2_ET_TDB_ERR_EINVAL -106
|
||||
#define EXT2_ET_TDB_ERR_NOEXIST -107
|
||||
#define EXT2_ET_TDB_ERR_RDONLY -108
|
||||
#define EXT2_ET_DBLIST_EMPTY -109
|
||||
#define EXT2_ET_RO_BLOCK_ITERATE -110
|
||||
#define EXT2_ET_MAGIC_EXTENT_PATH -111
|
||||
#define EXT2_ET_MAGIC_RESERVED_10 -112
|
||||
#define EXT2_ET_MAGIC_RESERVED_11 -113
|
||||
#define EXT2_ET_MAGIC_RESERVED_12 -114
|
||||
#define EXT2_ET_MAGIC_RESERVED_13 -115
|
||||
#define EXT2_ET_MAGIC_RESERVED_14 -116
|
||||
#define EXT2_ET_MAGIC_RESERVED_15 -117
|
||||
#define EXT2_ET_MAGIC_RESERVED_16 -118
|
||||
#define EXT2_ET_MAGIC_RESERVED_17 -119
|
||||
#define EXT2_ET_MAGIC_RESERVED_18 -120
|
||||
#define EXT2_ET_MAGIC_RESERVED_19 -121
|
||||
#define EXT2_ET_EXTENT_HEADER_BAD -122
|
||||
#define EXT2_ET_EXTENT_INDEX_BAD -123
|
||||
#define EXT2_ET_EXTENT_LEAF_BAD -124
|
||||
#define EXT2_ET_EXTENT_NO_SPACE -125
|
||||
#define EXT2_ET_INODE_NOT_EXTENT -126
|
||||
#define EXT2_ET_EXTENT_NO_NEXT -127
|
||||
#define EXT2_ET_EXTENT_NO_PREV -128
|
||||
#define EXT2_ET_EXTENT_NO_UP -129
|
||||
#define EXT2_ET_EXTENT_NO_DOWN -130
|
||||
#define EXT2_ET_NO_CURRENT_NODE -131
|
||||
#define EXT2_ET_OP_NOT_SUPPORTED -132
|
||||
#define EXT2_ET_CANT_INSERT_EXTENT -133
|
||||
#define EXT2_ET_CANT_SPLIT_EXTENT -134
|
||||
#define EXT2_ET_EXTENT_NOT_FOUND -135
|
||||
#define EXT2_ET_EXTENT_NOT_SUPPORTED -136
|
||||
#define EXT2_ET_EXTENT_INVALID_LENGTH -137
|
||||
#define EXT2_ET_IO_CHANNEL_NO_SUPPORT_64 -138
|
||||
#define EXT2_NO_MTAB_FILE -139
|
||||
#define EXT2_ET_MAGIC_GENERIC_BITMAP64 -140
|
||||
#define EXT2_ET_MAGIC_BLOCK_BITMAP64 -141
|
||||
#define EXT2_ET_MAGIC_INODE_BITMAP64 -142
|
||||
#define EXT2_ET_CANT_USE_LEGACY_BITMAPS -143
|
||||
|
||||
#endif
|
71
source/libs/libext2fs/ext2_ext_attr.h
Normal file
71
source/libs/libext2fs/ext2_ext_attr.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
File: linux/ext2_ext_attr.h
|
||||
|
||||
On-disk format of extended attributes for the ext2 filesystem.
|
||||
|
||||
(C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
|
||||
*/
|
||||
|
||||
#ifndef _EXT2_EXT_ATTR_H
|
||||
#define _EXT2_EXT_ATTR_H
|
||||
/* Magic value in attribute blocks */
|
||||
#define EXT2_EXT_ATTR_MAGIC_v1 0xEA010000
|
||||
#define EXT2_EXT_ATTR_MAGIC 0xEA020000
|
||||
|
||||
/* Maximum number of references to one attribute block */
|
||||
#define EXT2_EXT_ATTR_REFCOUNT_MAX 1024
|
||||
|
||||
struct ext2_ext_attr_header {
|
||||
__u32 h_magic; /* magic number for identification */
|
||||
__u32 h_refcount; /* reference count */
|
||||
__u32 h_blocks; /* number of disk blocks used */
|
||||
__u32 h_hash; /* hash value of all attributes */
|
||||
__u32 h_reserved[4]; /* zero right now */
|
||||
};
|
||||
|
||||
struct ext2_ext_attr_entry {
|
||||
__u8 e_name_len; /* length of name */
|
||||
__u8 e_name_index; /* attribute name index */
|
||||
__u16 e_value_offs; /* offset in disk block of value */
|
||||
__u32 e_value_block; /* disk block attribute is stored on (n/i) */
|
||||
__u32 e_value_size; /* size of attribute value */
|
||||
__u32 e_hash; /* hash value of name and value */
|
||||
#if 0
|
||||
char e_name[0]; /* attribute name */
|
||||
#endif
|
||||
};
|
||||
|
||||
#define EXT2_EXT_ATTR_PAD_BITS 2
|
||||
#define EXT2_EXT_ATTR_PAD ((unsigned) 1<<EXT2_EXT_ATTR_PAD_BITS)
|
||||
#define EXT2_EXT_ATTR_ROUND (EXT2_EXT_ATTR_PAD-1)
|
||||
#define EXT2_EXT_ATTR_LEN(name_len) \
|
||||
(((name_len) + EXT2_EXT_ATTR_ROUND + \
|
||||
sizeof(struct ext2_ext_attr_entry)) & ~EXT2_EXT_ATTR_ROUND)
|
||||
#define EXT2_EXT_ATTR_NEXT(entry) \
|
||||
( (struct ext2_ext_attr_entry *)( \
|
||||
(char *)(entry) + EXT2_EXT_ATTR_LEN((entry)->e_name_len)) )
|
||||
#define EXT2_EXT_ATTR_SIZE(size) \
|
||||
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
|
||||
#define EXT2_EXT_IS_LAST_ENTRY(entry) (*((__u32 *)(entry)) == 0UL)
|
||||
#define EXT2_EXT_ATTR_NAME(entry) \
|
||||
(((char *) (entry)) + sizeof(struct ext2_ext_attr_entry))
|
||||
#define EXT2_XATTR_LEN(name_len) \
|
||||
(((name_len) + EXT2_EXT_ATTR_ROUND + \
|
||||
sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND)
|
||||
#define EXT2_XATTR_SIZE(size) \
|
||||
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
# ifdef CONFIG_EXT2_FS_EXT_ATTR
|
||||
extern int ext2_get_ext_attr(struct inode *, const char *, char *, size_t, int);
|
||||
extern int ext2_set_ext_attr(struct inode *, const char *, char *, size_t, int);
|
||||
extern void ext2_ext_attr_free_inode(struct inode *inode);
|
||||
extern void ext2_ext_attr_put_super(struct super_block *sb);
|
||||
extern int ext2_ext_attr_init(void);
|
||||
extern void ext2_ext_attr_done(void);
|
||||
# else
|
||||
# define ext2_get_ext_attr NULL
|
||||
# define ext2_set_ext_attr NULL
|
||||
# endif
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _EXT2_EXT_ATTR_H */
|
@ -7,10 +7,10 @@ typedef struct _PrivData
|
||||
void * callback_data;
|
||||
} PrivDataST;
|
||||
|
||||
static int block_iter_callback(ext2_filsys fs, blk_t *blocknr, int blockcnt, void *privateData)
|
||||
static int block_iter_callback(ext2_filsys fs, blk64_t *blocknr, e2_blkcnt_t blockcnt, blk64_t ref_block, int ref_offset, void *privateData)
|
||||
{
|
||||
PrivDataST *priv = (PrivDataST *) privateData;
|
||||
blk_t block;
|
||||
blk64_t block;
|
||||
block = *blocknr;
|
||||
|
||||
return priv->append_fragment(priv->callback_data, blockcnt*fs->io->block_size/512, block*fs->io->block_size/512, fs->io->block_size/512);
|
||||
@ -47,9 +47,10 @@ int _EXT2_get_fragments(const char *in_path, _ext2_frag_append_t append_fragment
|
||||
priv.callback_data = callback_data;
|
||||
priv.append_fragment = append_fragment;
|
||||
|
||||
ext2fs_block_iterate(vd->fs, ni->ino, 0, NULL, block_iter_callback, &priv);
|
||||
int ret = ext2fs_block_iterate3(vd->fs, ni->ino, BLOCK_FLAG_DATA_ONLY, NULL, block_iter_callback, &priv);
|
||||
|
||||
int ret = priv.append_fragment(callback_data, EXT2_I_SIZE(&ni->ni) >> 9, 0, 0);
|
||||
if(ret == 0)
|
||||
ret = priv.append_fragment(callback_data, EXT2_I_SIZE(&ni->ni) >> 9, 0, 0);
|
||||
|
||||
ext2UpdateTimes(vd, ni, EXT2_UPDATE_ATIME);
|
||||
|
||||
|
107
source/libs/libext2fs/ext2_frag.j
Normal file
107
source/libs/libext2fs/ext2_frag.j
Normal file
@ -0,0 +1,107 @@
|
||||
#include "ext2_internal.h"
|
||||
#include "ext2_frag.h"
|
||||
#include "mem_allocate.h"
|
||||
|
||||
typedef struct _DataBlocks
|
||||
{
|
||||
u32 block;
|
||||
u32 blockcnt;
|
||||
} DataBlocks;
|
||||
|
||||
typedef struct _PrivData
|
||||
{
|
||||
DataBlocks * blocks;
|
||||
u32 blocksCnt;
|
||||
} PrivDataST;
|
||||
|
||||
static int block_iter_callback(ext2_filsys fs, blk_t *blocknr, int blockcnt, void *privateData)
|
||||
{
|
||||
PrivDataST *priv = (PrivDataST *) privateData;
|
||||
|
||||
if(!priv->blocks)
|
||||
priv->blocks = (DataBlocks *) mem_alloc(sizeof(DataBlocks));
|
||||
|
||||
priv->blocksCnt++;
|
||||
|
||||
DataBlocks * tmp = (DataBlocks *) mem_realloc(priv->blocks, priv->blocksCnt*sizeof(DataBlocks));
|
||||
if(!tmp)
|
||||
{
|
||||
free(priv->blocks);
|
||||
priv->blocks = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
priv->blocks = tmp;
|
||||
|
||||
priv->blocks[priv->blocksCnt-1].block = *blocknr;
|
||||
priv->blocks[priv->blocksCnt-1].blockcnt = blockcnt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _EXT2_get_fragments(const char *in_path, _ext2_frag_append_t append_fragment, void *callback_data)
|
||||
{
|
||||
ext2_inode_t *ni = NULL;
|
||||
ext2_vd *vd;
|
||||
|
||||
vd = ext2GetVolume(in_path);
|
||||
|
||||
if(!vd)
|
||||
{
|
||||
errno = EXDEV;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Get the actual path of the entry
|
||||
const char * path = ext2RealPath(in_path);
|
||||
if (!path) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Find the entry
|
||||
ni = ext2OpenEntry(vd, path);
|
||||
if (!ni) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
PrivDataST priv;
|
||||
priv.blocks = NULL;
|
||||
priv.blocksCnt = 0;
|
||||
|
||||
int ret = ext2fs_block_iterate(vd->fs, ni->ino, BLOCK_FLAG_DATA_ONLY, NULL, block_iter_callback, &priv);
|
||||
if(ret == 0 && priv.blocksCnt > 0)
|
||||
{
|
||||
int i = 0;
|
||||
u32 size = 1;
|
||||
u32 block_size = vd->fs->io->block_size/512;
|
||||
int printfs = 30;
|
||||
|
||||
for(i = 0; i < priv.blocksCnt-1; ++i)
|
||||
{
|
||||
//size = priv.blocks[i+1].blockcnt-priv.blocks[i].blockcnt;
|
||||
ret = append_fragment(callback_data, priv.blocks[i].blockcnt*block_size, priv.blocks[i].block*block_size, size*block_size);
|
||||
if(ret)
|
||||
break;
|
||||
if(printfs > 0)
|
||||
{
|
||||
printfs--;
|
||||
}
|
||||
}
|
||||
|
||||
if(ret == 0)
|
||||
ret = append_fragment(callback_data, priv.blocks[i].blockcnt*block_size, priv.blocks[i].block*block_size, block_size);
|
||||
}
|
||||
|
||||
if(ret == 0)
|
||||
ret = append_fragment(callback_data, EXT2_I_SIZE(&ni->ni) >> 9, 0, 0);
|
||||
|
||||
if(priv.blocks)
|
||||
mem_free(priv.blocks);
|
||||
|
||||
ext2UpdateTimes(vd, ni, EXT2_UPDATE_ATIME);
|
||||
|
||||
ext2CloseEntry(vd, ni);
|
||||
|
||||
return ret;
|
||||
}
|
136
source/libs/libext2fs/ext2_io.h
Normal file
136
source/libs/libext2fs/ext2_io.h
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* io.h --- the I/O manager abstraction
|
||||
*
|
||||
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef _EXT2FS_EXT2_IO_H
|
||||
#define _EXT2FS_EXT2_IO_H
|
||||
|
||||
#include "ext2fs.h"
|
||||
|
||||
/*
|
||||
* ext2_loff_t is defined here since unix_io.c needs it.
|
||||
*/
|
||||
typedef long long ext2_loff_t;
|
||||
|
||||
/* llseek.c */
|
||||
ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int);
|
||||
|
||||
typedef struct struct_io_manager *io_manager;
|
||||
typedef struct struct_io_channel *io_channel;
|
||||
typedef struct struct_io_stats *io_stats;
|
||||
|
||||
#define CHANNEL_FLAGS_WRITETHROUGH 0x01
|
||||
|
||||
struct struct_io_channel {
|
||||
errcode_t magic;
|
||||
io_manager manager;
|
||||
char *name;
|
||||
int block_size;
|
||||
errcode_t (*read_error)(io_channel channel,
|
||||
unsigned long block,
|
||||
int count,
|
||||
void *data,
|
||||
size_t size,
|
||||
int actual_bytes_read,
|
||||
errcode_t error);
|
||||
errcode_t (*write_error)(io_channel channel,
|
||||
unsigned long block,
|
||||
int count,
|
||||
const void *data,
|
||||
size_t size,
|
||||
int actual_bytes_written,
|
||||
errcode_t error);
|
||||
int refcount;
|
||||
int flags;
|
||||
long reserved[14];
|
||||
void *private_data;
|
||||
void *app_data;
|
||||
};
|
||||
|
||||
struct struct_io_stats {
|
||||
int num_fields;
|
||||
int reserved;
|
||||
unsigned long long bytes_read;
|
||||
unsigned long long bytes_written;
|
||||
};
|
||||
|
||||
struct struct_io_manager {
|
||||
errcode_t magic;
|
||||
const char *name;
|
||||
errcode_t (*open)(const char *name, int flags, io_channel *channel);
|
||||
errcode_t (*close)(io_channel channel);
|
||||
errcode_t (*set_blksize)(io_channel channel, int blksize);
|
||||
errcode_t (*read_blk)(io_channel channel, unsigned long block,
|
||||
int count, void *data);
|
||||
errcode_t (*write_blk)(io_channel channel, unsigned long block,
|
||||
int count, const void *data);
|
||||
errcode_t (*flush)(io_channel channel);
|
||||
errcode_t (*write_byte)(io_channel channel, unsigned long offset,
|
||||
int count, const void *data);
|
||||
errcode_t (*set_option)(io_channel channel, const char *option,
|
||||
const char *arg);
|
||||
errcode_t (*get_stats)(io_channel channel, io_stats *io_stats);
|
||||
errcode_t (*read_blk64)(io_channel channel, unsigned long long block,
|
||||
int count, void *data);
|
||||
errcode_t (*write_blk64)(io_channel channel, unsigned long long block,
|
||||
int count, const void *data);
|
||||
long reserved[16];
|
||||
};
|
||||
|
||||
#define IO_FLAG_RW 0x0001
|
||||
#define IO_FLAG_EXCLUSIVE 0x0002
|
||||
#define IO_FLAG_DIRECT_IO 0x0004
|
||||
|
||||
/*
|
||||
* Convenience functions....
|
||||
*/
|
||||
#define io_channel_close(c) ((c)->manager->close((c)))
|
||||
#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s))
|
||||
#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d))
|
||||
#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d))
|
||||
#define io_channel_flush(c) ((c)->manager->flush((c)))
|
||||
#define io_channel_bumpcount(c) ((c)->refcount++)
|
||||
|
||||
/* io_manager.c */
|
||||
extern errcode_t io_channel_set_options(io_channel channel,
|
||||
const char *options);
|
||||
extern errcode_t io_channel_write_byte(io_channel channel,
|
||||
unsigned long offset,
|
||||
int count, const void *data);
|
||||
extern errcode_t io_channel_read_blk64(io_channel channel,
|
||||
unsigned long long block,
|
||||
int count, void *data);
|
||||
extern errcode_t io_channel_write_blk64(io_channel channel,
|
||||
unsigned long long block,
|
||||
int count, const void *data);
|
||||
|
||||
/* unix_io.c */
|
||||
extern io_manager unix_io_manager;
|
||||
|
||||
/* undo_io.c */
|
||||
extern io_manager undo_io_manager;
|
||||
extern errcode_t set_undo_io_backing_manager(io_manager manager);
|
||||
extern errcode_t set_undo_io_backup_file(char *file_name);
|
||||
|
||||
/* test_io.c */
|
||||
extern io_manager test_io_manager, test_io_backing_manager;
|
||||
extern void (*test_io_cb_read_blk)
|
||||
(unsigned long block, int count, errcode_t err);
|
||||
extern void (*test_io_cb_write_blk)
|
||||
(unsigned long block, int count, errcode_t err);
|
||||
extern void (*test_io_cb_read_blk64)
|
||||
(unsigned long long block, int count, errcode_t err);
|
||||
extern void (*test_io_cb_write_blk64)
|
||||
(unsigned long long block, int count, errcode_t err);
|
||||
extern void (*test_io_cb_set_blksize)
|
||||
(int blksize, errcode_t err);
|
||||
|
||||
#endif /* _EXT2FS_EXT2_IO_H */
|
||||
|
18
source/libs/libext2fs/ext2_types.h
Normal file
18
source/libs/libext2fs/ext2_types.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* If linux/types.h is already been included, assume it has defined
|
||||
* everything we need. (cross fingers) Other header files may have
|
||||
* also defined the types that we need.
|
||||
*/
|
||||
#ifndef _EXT2_TYPES_H
|
||||
#define _EXT2_TYPES_H
|
||||
|
||||
typedef unsigned char __u8;
|
||||
typedef signed char __s8;
|
||||
typedef unsigned short __u16;
|
||||
typedef short __s16;
|
||||
typedef unsigned int __u32;
|
||||
typedef int __s32;
|
||||
typedef unsigned long long __u64;
|
||||
typedef signed long long __s64;
|
||||
|
||||
#endif /* _EXT2_TYPES_H */
|
@ -1356,6 +1356,7 @@ extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b);
|
||||
|
||||
#ifndef EXT2_CUSTOM_MEMORY_ROUTINES
|
||||
#include <string.h>
|
||||
#include "mem_allocate.h"
|
||||
/*
|
||||
* Allocate memory
|
||||
*/
|
||||
@ -1363,7 +1364,7 @@ _INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr)
|
||||
{
|
||||
void *pp;
|
||||
|
||||
pp = malloc(size);
|
||||
pp = mem_alloc(size);
|
||||
if (!pp)
|
||||
return EXT2_ET_NO_MEMORY;
|
||||
memcpy(ptr, &pp, sizeof (pp));
|
||||
@ -1376,9 +1377,9 @@ _INLINE_ errcode_t ext2fs_get_memalign(unsigned long size,
|
||||
void *pp;
|
||||
|
||||
#ifdef HWRVL
|
||||
pp = memalign(32, size);
|
||||
pp = mem_align(32, size);
|
||||
#else
|
||||
pp = malloc(size);
|
||||
pp = mem_alloc(size);
|
||||
#endif
|
||||
if (!pp)
|
||||
return EXT2_ET_NO_MEMORY;
|
||||
@ -1402,7 +1403,7 @@ _INLINE_ errcode_t ext2fs_free_mem(void *ptr)
|
||||
void *p;
|
||||
|
||||
memcpy(&p, ptr, sizeof(p));
|
||||
free(p);
|
||||
mem_free(p);
|
||||
p = 0;
|
||||
memcpy(ptr, &p, sizeof(p));
|
||||
return 0;
|
||||
@ -1419,7 +1420,7 @@ _INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_siz
|
||||
/* Use "memcpy" for pointer assignments here to avoid problems
|
||||
* with C99 strict type aliasing rules. */
|
||||
memcpy(&p, ptr, sizeof(p));
|
||||
p = realloc(p, size);
|
||||
p = mem_realloc(p, size);
|
||||
if (!p)
|
||||
return EXT2_ET_NO_MEMORY;
|
||||
memcpy(ptr, &p, sizeof(p));
|
||||
|
109
source/libs/libext2fs/ext3_extents.h
Normal file
109
source/libs/libext2fs/ext3_extents.h
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2003,2004 Cluster File Systems, Inc, info@clusterfs.com
|
||||
* Written by Alex Tomas <alex@clusterfs.com>
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_EXT3_EXTENTS
|
||||
#define _LINUX_EXT3_EXTENTS
|
||||
|
||||
/*
|
||||
* ext3_inode has i_block array (total 60 bytes)
|
||||
* first 4 bytes are used to store:
|
||||
* - tree depth (0 mean there is no tree yet. all extents in the inode)
|
||||
* - number of alive extents in the inode
|
||||
*/
|
||||
|
||||
/*
|
||||
* this is extent on-disk structure
|
||||
* it's used at the bottom of the tree
|
||||
*/
|
||||
struct ext3_extent {
|
||||
__u32 ee_block; /* first logical block extent covers */
|
||||
__u16 ee_len; /* number of blocks covered by extent */
|
||||
__u16 ee_start_hi; /* high 16 bits of physical block */
|
||||
__u32 ee_start; /* low 32 bigs of physical block */
|
||||
};
|
||||
|
||||
/*
|
||||
* this is index on-disk structure
|
||||
* it's used at all the levels, but the bottom
|
||||
*/
|
||||
struct ext3_extent_idx {
|
||||
__u32 ei_block; /* index covers logical blocks from 'block' */
|
||||
__u32 ei_leaf; /* pointer to the physical block of the next *
|
||||
* level. leaf or next index could bet here */
|
||||
__u16 ei_leaf_hi; /* high 16 bits of physical block */
|
||||
__u16 ei_unused;
|
||||
};
|
||||
|
||||
/*
|
||||
* each block (leaves and indexes), even inode-stored has header
|
||||
*/
|
||||
struct ext3_extent_header {
|
||||
__u16 eh_magic; /* probably will support different formats */
|
||||
__u16 eh_entries; /* number of valid entries */
|
||||
__u16 eh_max; /* capacity of store in entries */
|
||||
__u16 eh_depth; /* has tree real underlaying blocks? */
|
||||
__u32 eh_generation; /* generation of the tree */
|
||||
};
|
||||
|
||||
#define EXT3_EXT_MAGIC 0xf30a
|
||||
|
||||
/*
|
||||
* array of ext3_ext_path contains path to some extent
|
||||
* creation/lookup routines use it for traversal/splitting/etc
|
||||
* truncate uses it to simulate recursive walking
|
||||
*/
|
||||
struct ext3_ext_path {
|
||||
__u32 p_block;
|
||||
__u16 p_depth;
|
||||
struct ext3_extent *p_ext;
|
||||
struct ext3_extent_idx *p_idx;
|
||||
struct ext3_extent_header *p_hdr;
|
||||
struct buffer_head *p_bh;
|
||||
};
|
||||
|
||||
/*
|
||||
* EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
|
||||
* initialized extent. This is 2^15 and not (2^16 - 1), since we use the
|
||||
* MSB of ee_len field in the extent datastructure to signify if this
|
||||
* particular extent is an initialized extent or an uninitialized (i.e.
|
||||
* preallocated).
|
||||
* EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an
|
||||
* uninitialized extent.
|
||||
* If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
|
||||
* uninitialized one. In other words, if MSB of ee_len is set, it is an
|
||||
* uninitialized extent with only one special scenario when ee_len = 0x8000.
|
||||
* In this case we can not have an uninitialized extent of zero length and
|
||||
* thus we make it as a special case of initialized extent with 0x8000 length.
|
||||
* This way we get better extent-to-group alignment for initialized extents.
|
||||
* Hence, the maximum number of blocks we can have in an *initialized*
|
||||
* extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767).
|
||||
*/
|
||||
#define EXT_INIT_MAX_LEN (1UL << 15)
|
||||
#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
|
||||
|
||||
#define EXT_FIRST_EXTENT(__hdr__) \
|
||||
((struct ext3_extent *) (((char *) (__hdr__)) + \
|
||||
sizeof(struct ext3_extent_header)))
|
||||
#define EXT_FIRST_INDEX(__hdr__) \
|
||||
((struct ext3_extent_idx *) (((char *) (__hdr__)) + \
|
||||
sizeof(struct ext3_extent_header)))
|
||||
#define EXT_HAS_FREE_INDEX(__path__) \
|
||||
((__path__)->p_hdr->eh_entries < (__path__)->p_hdr->eh_max)
|
||||
#define EXT_LAST_EXTENT(__hdr__) \
|
||||
(EXT_FIRST_EXTENT((__hdr__)) + (__hdr__)->eh_entries - 1)
|
||||
#define EXT_LAST_INDEX(__hdr__) \
|
||||
(EXT_FIRST_INDEX((__hdr__)) + (__hdr__)->eh_entries - 1)
|
||||
#define EXT_MAX_EXTENT(__hdr__) \
|
||||
(EXT_FIRST_EXTENT((__hdr__)) + (__hdr__)->eh_max - 1)
|
||||
#define EXT_MAX_INDEX(__hdr__) \
|
||||
(EXT_FIRST_INDEX((__hdr__)) + (__hdr__)->eh_max - 1)
|
||||
|
||||
#endif /* _LINUX_EXT3_EXTENTS */
|
||||
|
BIN
source/libs/libext2fs/libcustomext2fs.a
Normal file
BIN
source/libs/libext2fs/libcustomext2fs.a
Normal file
Binary file not shown.
@ -2,25 +2,22 @@
|
||||
#define _MEM_ALLOCATE_H
|
||||
|
||||
#include <malloc.h>
|
||||
#include "memory/mem2.h"
|
||||
|
||||
static inline void* mem_alloc (size_t size) {
|
||||
return malloc(size);
|
||||
extern __inline__ void* mem_alloc (size_t size) {
|
||||
return MEM2_alloc(size);
|
||||
}
|
||||
|
||||
static inline void* mem_realloc (void *p, size_t size) {
|
||||
return realloc(p, size);
|
||||
extern __inline__ void* mem_realloc (void *p, size_t size) {
|
||||
return MEM2_realloc(p, size);
|
||||
}
|
||||
|
||||
static inline void* mem_align (size_t size) {
|
||||
#ifdef __wii__
|
||||
return memalign(32, size);
|
||||
#else
|
||||
return malloc(size);
|
||||
#endif
|
||||
extern __inline__ void* mem_align (size_t a, size_t size) {
|
||||
return MEM2_alloc(size);
|
||||
}
|
||||
|
||||
static inline void mem_free (void* mem) {
|
||||
free(mem);
|
||||
extern __inline__ void mem_free (void* mem) {
|
||||
MEM2_free(mem);
|
||||
}
|
||||
|
||||
#endif /* _MEM_ALLOCATE_H */
|
||||
|
@ -968,8 +968,6 @@ class GuiNumpad: public GuiWindow
|
||||
GuiImageData * keyTextbox;
|
||||
GuiImageData * keyMedium;
|
||||
GuiImageData * keyMediumOver;
|
||||
GuiSound * keySoundOver;
|
||||
GuiSound * keySoundClick;
|
||||
GuiTrigger * trigA;
|
||||
GuiTrigger * trigB;
|
||||
};
|
||||
@ -1026,8 +1024,6 @@ class GuiOptionBrowser: public GuiElement
|
||||
GuiImageData * scrollbarBox;
|
||||
GuiImageData * scrollbarBoxOver;
|
||||
|
||||
GuiSound * btnSoundOver;
|
||||
GuiSound * btnSoundClick;
|
||||
GuiTrigger * trigA;
|
||||
GuiTrigger * trigB;
|
||||
GuiTrigger * trigHeldA;
|
||||
@ -1088,8 +1084,6 @@ class GuiFileBrowser: public GuiElement
|
||||
GuiImageData * arrowUp;
|
||||
GuiImageData * scrollbarBox;
|
||||
|
||||
GuiSound * btnSoundOver;
|
||||
GuiSound * btnSoundClick;
|
||||
GuiTrigger * trigA;
|
||||
GuiTrigger * trigHeldA;
|
||||
};
|
||||
|
@ -27,15 +27,15 @@ int txtscroll = 0;
|
||||
/**
|
||||
* Constructor for the GuiGameBrowser class.
|
||||
*/
|
||||
GuiGameBrowser::GuiGameBrowser(int w, int h, int selected, int offset)
|
||||
GuiGameBrowser::GuiGameBrowser(int w, int h, int selectedGame)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
pagesize = Theme.pagesize;
|
||||
scrollbaron = (gameList.size() > pagesize) ? 1 : 0;
|
||||
selectable = true;
|
||||
listOffset = MAX( 0, MIN( offset, ( gameList.size() - pagesize ) ) );
|
||||
selectedItem = selected - offset;
|
||||
listOffset = selectedGame - (selectedGame % pagesize);
|
||||
selectedItem = selectedGame - listOffset;
|
||||
focus = 1; // allow focus
|
||||
|
||||
trigA = new GuiTrigger;
|
||||
|
@ -7,7 +7,7 @@
|
||||
class GuiGameBrowser: public GuiElement
|
||||
{
|
||||
public:
|
||||
GuiGameBrowser(int w, int h, int selected = 0, int offset = 0);
|
||||
GuiGameBrowser(int w, int h, int selectedGame = 0);
|
||||
~GuiGameBrowser();
|
||||
int FindMenuItem(int c, int d);
|
||||
int GetClickedOption();
|
||||
|
@ -45,13 +45,13 @@ static GuiImageData *GameCarouselLoadCoverImage(void * Arg)
|
||||
/**
|
||||
* Constructor for the GuiGameCarousel class.
|
||||
*/
|
||||
GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, const u8 *imagebg, int imagebgsize, int selected, int offset) :
|
||||
GuiGameCarousel::GuiGameCarousel(int w, int h, const char *themePath, const u8 *imagebg, int imagebgsize, int selectedGame) :
|
||||
noCover(nocover_png, nocover_png_size)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
pagesize = (gameList.size() < 11) ? gameList.size() : 11;
|
||||
listOffset = 0;
|
||||
listOffset = (selectedGame >= 0 && selectedGame < gameList.size()) ? selectedGame : 0;
|
||||
selectable = true;
|
||||
selectedItem = -1;
|
||||
focus = 1; // allow focus
|
||||
|
@ -7,7 +7,7 @@ class GuiImageAsync;
|
||||
class GuiGameCarousel: public GuiElement
|
||||
{
|
||||
public:
|
||||
GuiGameCarousel(int w, int h, const char *themePath, const u8 *imagebg, int imagebgsize, int selected = 0, int offset = 0);
|
||||
GuiGameCarousel(int w, int h, const char *themePath, const u8 *imagebg, int imagebgsize, int selectedGame = 0);
|
||||
~GuiGameCarousel();
|
||||
int FindMenuItem(int c, int d);
|
||||
int GetClickedOption();
|
||||
|
@ -201,7 +201,7 @@ static GuiImageData *GameGridLoadCoverImage(void * Arg)
|
||||
/**
|
||||
* Constructor for the GuiGamegrid class.
|
||||
*/
|
||||
GuiGameGrid::GuiGameGrid(int w, int h, const char *themePath, const u8 *imagebg, int selected, int offset) :
|
||||
GuiGameGrid::GuiGameGrid(int w, int h, const char *themePath, const u8 *imagebg, int selectedGame) :
|
||||
noCover(nocoverFlat_png, nocoverFlat_png_size)
|
||||
{
|
||||
width = w;
|
||||
|
@ -7,7 +7,7 @@ class GuiImageAsync;
|
||||
class GuiGameGrid: public GuiElement
|
||||
{
|
||||
public:
|
||||
GuiGameGrid(int w, int h, const char *themePath, const u8 *imagebg, int selected = 0, int offset = 0);
|
||||
GuiGameGrid(int w, int h, const char *themePath, const u8 *imagebg, int selectedGame = 0);
|
||||
~GuiGameGrid();
|
||||
int FindMenuItem(int c, int d);
|
||||
int GetClickedOption();
|
||||
|
@ -61,8 +61,7 @@ GuiNumpad::GuiNumpad(char * t, u32 max)
|
||||
keyBackText = new GuiText("Back", 20, ( GXColor )
|
||||
{ 0, 0, 0, 0xff});
|
||||
|
||||
keyBack = new GuiButton(keyBackImg, keyBackOverImg, ALIGN_CENTRE, ALIGN_MIDDLE, 90, 80, trigA, keySoundOver,
|
||||
keySoundClick, 1);
|
||||
keyBack = new GuiButton(keyBackImg, keyBackOverImg, ALIGN_CENTRE, ALIGN_MIDDLE, 90, 80, trigA, btnSoundOver, btnSoundClick, 1);
|
||||
keyBack->SetLabel(keyBackText);
|
||||
keyBack->SetTrigger(trigB);
|
||||
this->Append(keyBack);
|
||||
@ -71,8 +70,7 @@ GuiNumpad::GuiNumpad(char * t, u32 max)
|
||||
keyClearOverImg = new GuiImage(keyMediumOver);
|
||||
keyClearText = new GuiText("Clear", 20, ( GXColor )
|
||||
{ 0, 0, 0, 0xff});
|
||||
keyClear = new GuiButton(keyClearImg, keyClearOverImg, ALIGN_CENTRE, ALIGN_MIDDLE, -90, 80, trigA, keySoundOver,
|
||||
keySoundClick, 1);
|
||||
keyClear = new GuiButton(keyClearImg, keyClearOverImg, ALIGN_CENTRE, ALIGN_MIDDLE, -90, 80, trigA, btnSoundOver, btnSoundClick, 1);
|
||||
keyClear->SetLabel(keyClearText);
|
||||
this->Append(keyClear);
|
||||
|
||||
@ -92,7 +90,7 @@ GuiNumpad::GuiNumpad(char * t, u32 max)
|
||||
keyTxt[i]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
||||
keyTxt[i]->SetPosition(0, -10);
|
||||
keyBtn[i] = new GuiButton(keyImg[i], keyImgOver[i], ALIGN_CENTRE, ALIGN_MIDDLE, -90 + 90 * col, -70 + 50
|
||||
* row, trigA, keySoundOver, keySoundClick, 1);
|
||||
* row, trigA, btnSoundOver, btnSoundClick, 1);
|
||||
keyBtn[i]->SetLabel(keyTxt[i]);
|
||||
|
||||
this->Append(keyBtn[i]);
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifndef GUI_SEARCHBAR_H_
|
||||
#define GUI_SEARCHBAR_H_
|
||||
#include "gui.h"
|
||||
|
||||
class cSearchButton;
|
||||
@ -32,3 +34,5 @@ class GuiSearchBar: public GuiWindow
|
||||
GuiTrigger trig;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
1341
source/menu/GameBrowseMenu.cpp
Normal file
1341
source/menu/GameBrowseMenu.cpp
Normal file
File diff suppressed because it is too large
Load Diff
155
source/menu/GameBrowseMenu.hpp
Normal file
155
source/menu/GameBrowseMenu.hpp
Normal file
@ -0,0 +1,155 @@
|
||||
#ifndef GAMEBROWSEMENU_HPP_
|
||||
#define GAMEBROWSEMENU_HPP_
|
||||
|
||||
#include "libwiigui/gui.h"
|
||||
#include "libwiigui/gui_gamebrowser.h"
|
||||
#include "libwiigui/gui_gamegrid.h"
|
||||
#include "libwiigui/gui_gamecarousel.h"
|
||||
#include "libwiigui/gui_searchbar.h"
|
||||
|
||||
class GameBrowseMenu : public GuiWindow
|
||||
{
|
||||
public:
|
||||
GameBrowseMenu();
|
||||
~GameBrowseMenu();
|
||||
int Show();
|
||||
protected:
|
||||
int MainLoop();
|
||||
void ReloadBrowser();
|
||||
int OpenClickedGame();
|
||||
int GetSelectedGame();
|
||||
int GetClickedGame();
|
||||
void UpdateGameInfoText(const u8 * gameId);
|
||||
void LoadCover(struct discHdr *header);
|
||||
void CheckAlternativeDOL(const char * IDfull);
|
||||
void CheckOcarina(const char * IDfull);
|
||||
void CoverDownload();
|
||||
static void UpdateCallback(void * e);
|
||||
|
||||
GuiImageData * btnInstall;
|
||||
GuiImageData * btnInstallOver;
|
||||
GuiImageData * btnSettings;
|
||||
GuiImageData * btnSettingsOver;
|
||||
GuiImageData * btnpwroff;
|
||||
GuiImageData * btnpwroffOver;
|
||||
GuiImageData * btnhome;
|
||||
GuiImageData * btnhomeOver;
|
||||
GuiImageData * btnsdcardOver;
|
||||
GuiImageData * btnsdcard;
|
||||
GuiImageData * imgfavIcon;
|
||||
GuiImageData * imgfavIcon_gray;
|
||||
GuiImageData * imgsearchIcon;
|
||||
GuiImageData * imgsearchIcon_gray;
|
||||
GuiImageData * imgabcIcon;
|
||||
GuiImageData * imgrankIcon;
|
||||
GuiImageData * imgplayCountIcon;
|
||||
GuiImageData * imgarrangeGrid;
|
||||
GuiImageData * imgarrangeGrid_gray;
|
||||
GuiImageData * imgarrangeCarousel;
|
||||
GuiImageData * imgarrangeCarousel_gray;
|
||||
GuiImageData * imgarrangeList;
|
||||
GuiImageData * imgarrangeList_gray;
|
||||
GuiImageData * imgdvd;
|
||||
GuiImageData * imgdvd_gray;
|
||||
GuiImageData * imgLock;
|
||||
GuiImageData * imgLock_gray;
|
||||
GuiImageData * imgUnlock;
|
||||
GuiImageData * imgUnlock_gray;
|
||||
GuiImageData * homebrewImgData;
|
||||
GuiImageData * homebrewImgDataOver;
|
||||
GuiImageData * gameCover;
|
||||
|
||||
GuiTrigger * trigA;
|
||||
GuiTrigger * trigHome;
|
||||
GuiTrigger * trig1;
|
||||
GuiTrigger * trig2;
|
||||
|
||||
GuiImage * installBtnImg;
|
||||
GuiImage * installBtnImgOver;
|
||||
GuiImage * settingsBtnImg;
|
||||
GuiImage * settingsBtnImgOver;
|
||||
GuiImage * homeBtnImg;
|
||||
GuiImage * homeBtnImgOver;
|
||||
GuiImage * poweroffBtnImg;
|
||||
GuiImage * poweroffBtnImgOver;
|
||||
GuiImage * sdcardImg;
|
||||
GuiImage * sdcardImgOver;
|
||||
GuiImage * favoriteBtnImg;
|
||||
GuiImage * favoriteBtnImg_g;
|
||||
GuiImage * searchBtnImg;
|
||||
GuiImage * searchBtnImg_g;
|
||||
GuiImage * sortBtnImg;
|
||||
GuiImage * listBtnImg;
|
||||
GuiImage * listBtnImg_g;
|
||||
GuiImage * gridBtnImg;
|
||||
GuiImage * gridBtnImg_g;
|
||||
GuiImage * carouselBtnImg;
|
||||
GuiImage * carouselBtnImg_g;
|
||||
GuiImage * lockBtnImg;
|
||||
GuiImage * lockBtnImg_g;
|
||||
GuiImage * unlockBtnImg;
|
||||
GuiImage * unlockBtnImg_g;
|
||||
GuiImage * dvdBtnImg;
|
||||
GuiImage * dvdBtnImg_g;
|
||||
GuiImage * homebrewImg;
|
||||
GuiImage * homebrewImgOver;
|
||||
GuiImage * gameCoverImg;
|
||||
|
||||
GuiText * usedSpaceTxt;
|
||||
GuiText * gamecntTxt;
|
||||
GuiText * clockTimeBack;
|
||||
GuiText * clockTime;
|
||||
|
||||
GuiButton * gamecntBtn;
|
||||
GuiButton * installBtn;
|
||||
GuiButton * settingsBtn;
|
||||
GuiButton * homeBtn;
|
||||
GuiButton * poweroffBtn;
|
||||
GuiButton * sdcardBtn;
|
||||
GuiButton * gameInfo;
|
||||
GuiButton * favoriteBtn;
|
||||
GuiButton * searchBtn;
|
||||
GuiButton * sortBtn;
|
||||
GuiButton * listBtn;
|
||||
GuiButton * gridBtn;
|
||||
GuiButton * carouselBtn;
|
||||
GuiButton * lockBtn;
|
||||
GuiButton * dvdBtn;
|
||||
GuiButton * homebrewBtn;
|
||||
GuiButton * DownloadBtn;
|
||||
GuiButton * idBtn;
|
||||
|
||||
GuiTooltip * installBtnTT;
|
||||
GuiTooltip * settingsBtnTT;
|
||||
GuiTooltip * homeBtnTT;
|
||||
GuiTooltip * poweroffBtnTT;
|
||||
GuiTooltip * sdcardBtnTT;
|
||||
GuiTooltip * favoriteBtnTT;
|
||||
GuiTooltip * searchBtnTT;
|
||||
GuiTooltip * sortBtnTT;
|
||||
GuiTooltip * listBtnTT;
|
||||
GuiTooltip * gridBtnTT;
|
||||
GuiTooltip * carouselBtnTT;
|
||||
GuiTooltip * lockBtnTT;
|
||||
GuiTooltip * dvdBtnTT;
|
||||
GuiTooltip * homebrewBtnTT;
|
||||
GuiTooltip * DownloadBtnTT;
|
||||
GuiTooltip * IDBtnTT;
|
||||
|
||||
GuiGameBrowser * gameBrowser;
|
||||
GuiGameGrid * gameGrid;
|
||||
GuiGameCarousel * gameCarousel;
|
||||
GuiSearchBar * searchBar;
|
||||
char theTime[50];
|
||||
u32 DiscDriveCover;
|
||||
u32 DiscDriveCoverOld;
|
||||
int gameSelectedOld;
|
||||
int gameClicked;
|
||||
time_t lastrawtime;
|
||||
time_t ScreensaverTimer;
|
||||
bool show_searchwindow;
|
||||
wchar_t searchChar;
|
||||
std::vector<GuiButton *> ToolBar;
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ int cntMissFiles = 0;
|
||||
static char missingFiles[500][12];
|
||||
|
||||
/*** Extern variables ***/
|
||||
s32 gameSelected = 0, gameStart = 0;
|
||||
s32 gameStart = 0;
|
||||
extern float gamesize;
|
||||
extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
@ -445,7 +445,6 @@ void WindowCredits()
|
||||
int WindowScreensaver()
|
||||
{
|
||||
gprintf("WindowScreenSaver()\n");
|
||||
int i = 0;
|
||||
bool exit = false;
|
||||
|
||||
/* initialize random seed: */
|
||||
@ -473,18 +472,15 @@ int WindowScreensaver()
|
||||
|
||||
while (!exit)
|
||||
{
|
||||
i++;
|
||||
if (IsWpadConnected())
|
||||
{
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
/* Set position only every 400000th loop */
|
||||
if ((i % 8000000) == 0)
|
||||
{
|
||||
/* Set random position */
|
||||
GXlogoImg.SetPosition((rand() % 345), (rand() % 305));
|
||||
}
|
||||
GXlogoImg.SetPosition((rand() % 345), (rand() % 305));
|
||||
|
||||
sleep(4);
|
||||
}
|
||||
|
||||
HaltGui();
|
||||
@ -1127,7 +1123,7 @@ void SetFavoriteImages(const u8 * gameid, GuiImage *b1, GuiImage *b2, GuiImage *
|
||||
* Displays a prompt window to user, with information, an error message, or
|
||||
* presenting a user with a choice
|
||||
***************************************************************************/
|
||||
int GameWindowPrompt()
|
||||
int GameWindowPrompt(int gameSelected)
|
||||
{
|
||||
int choice = -1, angle = 0;
|
||||
f32 size = 0.0;
|
||||
@ -1531,8 +1527,32 @@ int GameWindowPrompt()
|
||||
|
||||
else if (nameBtn.GetState() == STATE_CLICKED) //rename
|
||||
{
|
||||
nameBtn.ResetState();
|
||||
if(mountMethod == 3)
|
||||
{
|
||||
WindowPrompt(tr("ERROR:"), tr("You can't rename this game"), tr("OK"));
|
||||
continue;
|
||||
}
|
||||
|
||||
choice = 3;
|
||||
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||
while(promptWindow.GetEffect() > 0) usleep(100);
|
||||
|
||||
wiilight(0);
|
||||
//re-evaluate header now in case they changed games while on the game prompt
|
||||
struct discHdr *header = gameList[gameSelected];
|
||||
|
||||
//enter new game title
|
||||
char entered[60];
|
||||
snprintf(entered, sizeof(entered), "%s", GameTitles.GetTitle(header));
|
||||
int result = OnScreenKeyboard(entered, 60, 0);
|
||||
if (result == 1)
|
||||
{
|
||||
WBFS_RenameGame(header->id, entered);
|
||||
wString oldFilter(gameList.GetCurrentFilter());
|
||||
gameList.ReadGameList();
|
||||
gameList.FilterList(oldFilter.c_str());
|
||||
}
|
||||
}
|
||||
else if (btnFavorite1.GetState() == STATE_CLICKED) //switch favorite
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ void WindowCredits();
|
||||
int OnScreenKeyboard(char * var, u32 maxlen, int min);
|
||||
int OnScreenNumpad(char * var, u32 maxlen);
|
||||
int WindowExitPrompt();
|
||||
int GameWindowPrompt();
|
||||
int GameWindowPrompt(int gameSelected);
|
||||
int DiscWait(const char *title, const char *msg, const char *btn1Label, const char *btn2Label, int IsDeviceWait);
|
||||
int FormatingPartition(const char *title, partitionEntry *entry);
|
||||
bool SearchMissingImages(int choice2);
|
||||
|
@ -101,7 +101,7 @@ FlyingButtonsMenu::~FlyingButtonsMenu()
|
||||
ResumeGui();
|
||||
|
||||
SetEffect(EFFECT_FADE, -FADE_SPEED);
|
||||
while(this->GetEffect() > 0) usleep(100);
|
||||
while(parentElement && this->GetEffect() > 0) usleep(100);
|
||||
|
||||
HaltGui();
|
||||
if(parentElement)
|
||||
@ -321,9 +321,8 @@ void FlyingButtonsMenu::AddMainButtons()
|
||||
void FlyingButtonsMenu::ShowButtonsEffects(int effect, int effect_speed)
|
||||
{
|
||||
int FirstItem = currentPage*DISPLAY_BUTTONS;
|
||||
|
||||
if(FirstItem >= (int) MainButton.size())
|
||||
return;
|
||||
if(FirstItem < 0)
|
||||
FirstItem = 0;
|
||||
|
||||
HaltGui();
|
||||
|
||||
@ -335,11 +334,14 @@ void FlyingButtonsMenu::ShowButtonsEffects(int effect, int effect_speed)
|
||||
|
||||
ResumeGui();
|
||||
|
||||
if(FirstItem < 0 || FirstItem >= (int) MainButton.size())
|
||||
return;
|
||||
|
||||
//! Don't lock on fade in for initiation purpose
|
||||
if(effect & EFFECT_FADE && effect_speed > 0)
|
||||
return;
|
||||
|
||||
while (MainButton[FirstItem]->GetEffect() > 0)
|
||||
while (parentElement && MainButton[FirstItem]->GetEffect() > 0)
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,11 @@ int GuiSettingsMenu::GetMenuInternal()
|
||||
returnhere = MenuLanguageSelect();
|
||||
|
||||
if (returnhere == 2)
|
||||
{
|
||||
//! Language changed. Reload game titles with new lang code.
|
||||
GameTitles.LoadTitlesFromWiiTDB(Settings.titlestxt_path);
|
||||
return MENU_SETTINGS;
|
||||
}
|
||||
|
||||
HaltGui();
|
||||
if(parentElement)
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "prompts/PromptWindows.h"
|
||||
#include "language/gettext.h"
|
||||
#include "usbloader/wbfs.h"
|
||||
#include "usbloader/GameList.h"
|
||||
#include "wstring.hpp"
|
||||
|
||||
extern int mountMethod;
|
||||
|
||||
@ -97,6 +99,14 @@ int UninstallSM::GetMenuInternal()
|
||||
int ret = 0;
|
||||
if(!mountMethod)
|
||||
ret = WBFS_RemoveGame(DiscHeader->id);
|
||||
|
||||
if(ret >= 0)
|
||||
{
|
||||
wString oldFilter(gameList.GetCurrentFilter());
|
||||
gameList.ReadGameList();
|
||||
gameList.FilterList(oldFilter.c_str());
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
WindowPrompt(tr( "Can't delete:" ), Title.c_str(), tr( "OK" ));
|
||||
else
|
||||
|
@ -142,7 +142,7 @@ void Sys_Shutdown(void)
|
||||
_Sys_Shutdown(ShutdownToDefault);
|
||||
}
|
||||
|
||||
void Sys_ShutdownToIdel(void)
|
||||
void Sys_ShutdownToIdle(void)
|
||||
{
|
||||
_Sys_Shutdown(ShutdownToIdle);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ void ExitApp(void); //! Like AppCleanUp() and additional device unmount
|
||||
void Sys_Init(void);
|
||||
void Sys_Reboot(void);
|
||||
void Sys_Shutdown(void);
|
||||
void Sys_ShutdownToIdel(void);
|
||||
void Sys_ShutdownToIdle(void);
|
||||
void Sys_ShutdownToStandby(void);
|
||||
void Sys_LoadMenu(void);
|
||||
void Sys_BackToLoader(void);
|
||||
|
@ -257,6 +257,7 @@ out:
|
||||
SAFE_FREE(fs);
|
||||
SAFE_FREE(fa);
|
||||
SAFE_FREE(fw);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
35
source/utils/rockout.cpp
Normal file
35
source/utils/rockout.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include "libwiigui/gui.h"
|
||||
#include "themes/CTheme.h"
|
||||
#include "usbloader/GameList.h"
|
||||
#include "settings/GameTitles.h"
|
||||
#include "menu/menus.h"
|
||||
|
||||
extern GuiImageData * pointer[4];
|
||||
|
||||
void rockout(int gameSelected, int f)
|
||||
{
|
||||
HaltGui();
|
||||
|
||||
if (gameSelected >= 0 && gameSelected < gameList.size() && (strcasestr(GameTitles.GetTitle(gameList[gameSelected]), "guitar")
|
||||
|| strcasestr(GameTitles.GetTitle(gameList[gameSelected]), "band") || strcasestr(GameTitles.GetTitle(gameList[gameSelected]),
|
||||
"rock")))
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
delete pointer[i];
|
||||
pointer[0] = Resources::GetImageData("rplayer1_point.png");
|
||||
pointer[1] = Resources::GetImageData("rplayer2_point.png");
|
||||
pointer[2] = Resources::GetImageData("rplayer3_point.png");
|
||||
pointer[3] = Resources::GetImageData("rplayer4_point.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
delete pointer[i];
|
||||
pointer[0] = Resources::GetImageData("player1_point.png");
|
||||
pointer[1] = Resources::GetImageData("player2_point.png");
|
||||
pointer[2] = Resources::GetImageData("player3_point.png");
|
||||
pointer[3] = Resources::GetImageData("player4_point.png");
|
||||
}
|
||||
ResumeGui();
|
||||
}
|
6
source/utils/rockout.h
Normal file
6
source/utils/rockout.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef ROCKOUT_H_
|
||||
#define ROCKOUT_H_
|
||||
|
||||
void rockout(int gameSelected, int f = 0);
|
||||
|
||||
#endif
|
6
source/utils/tools.h
Normal file
6
source/utils/tools.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef TOOLS_H_
|
||||
#define TOOLS_H_
|
||||
|
||||
#define cut_bounds(x, min, max) ( ((x) < (min)) ? (min) : ((x) > (max)) ? (max) : (x) )
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user