Skip to content

Commit 4c2eb86

Browse files
authored
[Games Menu] - Extract PVR's, optimizations and refactoring (#39)
* [Games Menu] - Extract PVR * [Games Menu] - Extract PVRs * [Games Menu] - Performace CDDA * [core] - depure source * [games_menu] - pvrs changes * [games_menu] - check optimized gdi * [games_menu] - fix check gdi optimized * [games_menu] - check optimized more fixes * [games_menu] - optimize source * [games_menu] - CDDA optimizations * [games_menu] - pvr remove functions
1 parent e6cf3d0 commit 4c2eb86

File tree

32 files changed

+22616
-1339
lines changed

32 files changed

+22616
-1339
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ SRC_DIR = $(DS_BASE)/src
3434
LIB_DIR = $(DS_BASE)/lib
3535

3636
KOS_LDFLAGS += -L$(LIB_DIR)
37-
KOS_CFLAGS += -I$(INC_DIR) -I$(INC_DIR)/SDL -I$(INC_DIR)/fatfs \
37+
KOS_CFLAGS += -I$(INC_DIR) -I$(INC_DIR)/img -I$(INC_DIR)/SDL -I$(INC_DIR)/fatfs \
3838
-I$(INC_DIR)/tsunami \
3939
-DHAVE_SDLIMAGE $(TRAGET_VERSION)
4040

@@ -109,7 +109,9 @@ OBJS = $(SRC_DIR)/main.o $(SRC_DIR)/video.o $(SRC_DIR)/console.o \
109109
$(SRC_DIR)/module.o $(SRC_DIR)/events.o $(SRC_DIR)/fs/fs.o \
110110
$(SRC_DIR)/lua/lua.o $(SRC_DIR)/lua/lua_ds.o $(SRC_DIR)/lua/packlib.o \
111111
$(SRC_DIR)/app/app.o $(SRC_DIR)/app/load.o $(SRC_DIR)/list.o \
112-
$(SRC_DIR)/img/pvr.o $(SRC_DIR)/cmd_elf.o $(SRC_DIR)/vmu/vmu.o \
112+
$(SRC_DIR)/img/SegaPVRImage.o $(SRC_DIR)/img/load.o \
113+
$(SRC_DIR)/img/convert.o $(SRC_DIR)/cmd_elf.o \
114+
$(SRC_DIR)/vmu/vmu.o \
113115
$(SRC_DIR)/irq/exceptions.o $(SRC_DIR)/irq/setjmp.o \
114116
$(SRC_DIR)/settings.o $(SRC_DIR)/sfx.o \
115117
$(DRIVERS_OBJ) $(GUI_OBJS) $(CONSOLE_OBJ) \
564 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

applications/games_menu/modules/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
APP_NAME = games_menu
88
TARGET_NAME = app_$(APP_NAME)
9-
OBJS = module.o utils.o
9+
OBJS = module.o utils.o menu.o
1010
DBG_LIBS = -lds -lisofs -lisoldr -lwave
1111
EXPORTS_FILE = exports.txt
1212

applications/games_menu/modules/app_definition.h

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,21 @@ enum SearchCoverEnum
2121
SC_DEFAULT = 2
2222
};
2323

24-
// #pragma pack(push, 1)
24+
enum CoverStatusEnum
25+
{
26+
CSE_EXISTS = 1,
27+
CSE_PROCESSING = 2,
28+
CSE_COMPLETED = 3
29+
};
30+
31+
enum CheckCDDAGameEnum
32+
{
33+
CCGE_NOT_CHECKED = -1,
34+
CCGE_CDDA = 1,
35+
CCGE_CDDA_BIG_SIZE = 2,
36+
CCGE_NOT_CDDA = 3
37+
};
38+
2539
typedef struct MenuOptionStructure
2640
{
2741
int max_page_size;
@@ -33,15 +47,19 @@ typedef struct MenuOptionStructure
3347
int padding_y;
3448
float image_size;
3549
} MenuOptionStruct;
36-
// #pragma pack(pop)
3750

3851
typedef struct GameItemStructure
3952
{
4053
char *game;
4154
char *folder;
4255
bool is_folder_name;
43-
int8 exists_cover;
56+
int16 exists_cover;
4457
uint8 cover_type;
58+
bool check_pvr;
59+
bool is_pvr_cover;
60+
bool check_optimized;
61+
bool is_gdi_optimized;
62+
int16 is_cdda;
4563

4664
} GameItemStruct;
4765

@@ -51,4 +69,14 @@ typedef struct ImageDimensionStructure
5169
unsigned int height;
5270
} ImageDimensionStruct;
5371

54-
#endif //__APP_DEFINITION_H
72+
#pragma pack(push, 4)
73+
typedef struct CoverScannedStructure
74+
{
75+
char last_game_scanned[NAME_MAX];
76+
uint32 last_game_index;
77+
uint32 last_game_status;
78+
uint32 games_count;
79+
} CoverScannedStruct;
80+
#pragma pack(pop)
81+
82+
#endif //__APP_DEFINITION_H
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#ifndef __APP_MENU_H
2+
#define __APP_MENU_H
3+
4+
#include <ds.h>
5+
#include "app_utils.h"
6+
#include "app_definition.h"
7+
#include "tsunami/tsudefinition.h"
8+
9+
#define MOTOSHORT(p) ((*(p)) << 8) + *(p + 1)
10+
#define IN_CACHE_GAMES
11+
#define MAX_SIZE_CDDA 0
12+
#define MAX_TRIGGER_VALUE 255
13+
14+
typedef void SendMessageCallBack(const char *fmt, const char *message);
15+
typedef void PostPVRCoverCallBack(bool new_cover);
16+
17+
struct menu_structure
18+
{
19+
bool rescan_covers;
20+
bool convert_pvr_to_png;
21+
volatile bool finished_menu;
22+
volatile bool cdda_game_changed;
23+
volatile bool stop_load_pvr_cover;
24+
int menu_type;
25+
int games_array_count;
26+
int current_dev;
27+
char default_dir[20];
28+
char games_path[NAME_MAX];
29+
char covers_path[50];
30+
31+
CoverScannedStruct cover_scanned_app;
32+
MenuOptionStruct menu_option;
33+
GameItemStruct *games_array;
34+
35+
SendMessageCallBack *send_message_scan;
36+
PostPVRCoverCallBack *post_pvr_cover;
37+
38+
kthread_t *play_cdda_thread;
39+
kthread_t *load_pvr_cover_thread;
40+
};
41+
42+
void CreateMenuData(SendMessageCallBack *send_message_scan, PostPVRCoverCallBack *post_pvr_cover);
43+
void DestroyMenuData();
44+
bool CheckGdiOptimized();
45+
const char *GetFullGamePathByIndex(int game_index);
46+
void StopCDDA();
47+
bool CheckCDDA(int game_index);
48+
void *PlayCDDAThread(void *params);
49+
void PlayCDDA(int game_index);
50+
ImageDimensionStruct *GetImageDimension(const char *image_file);
51+
bool IsValidImage(const char *image_file);
52+
int16 CheckCover(int game_index);
53+
bool GetGameCoverPath(int game_index, char **game_cover_path);
54+
void SetMenuType(int menu_type);
55+
void FreeGames();
56+
void FreeGamesForce();
57+
bool SaveScannedCover();
58+
bool LoadScannedCover();
59+
void CleanIncompleteCover();
60+
bool ExtractPVRCover(int game_index);
61+
void *LoadPVRCoverThread(void *params);
62+
bool IsUniqueFileGame(const char *full_path_folder);
63+
void RetrieveGamesRecursive(const char *full_path_folder, const char *folder, int level);
64+
bool RetrieveGames();
65+
66+
#endif // __APP_MENU_H

applications/games_menu/modules/app_utils.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
66
*/
77

8+
#ifndef __APP_UTILS_H
9+
#define __APP_UTILS_H
10+
811
/* Indexes of devices */
912
enum {
1013
APP_DEVICE_CD = 0,
@@ -31,16 +34,20 @@ void trim_spaces(char *input, char *output, int size);
3134
char *trim_spaces2(char *txt);
3235
char *fix_spaces(char *str);
3336
int conf_parse(isoldr_conf *cfg, const char *filename);
37+
bool IsGdiOptimized(const char *full_path_game);
3438
const char* GetLastPart(const char *source, const char separator, int option_path);
3539

3640
int GetDeviceType(const char *dir);
3741
bool ReadBootSector(const char *track_file, uint8* bootSector);
3842
// int checkGDI(char *filepath, const char *fmPath, char *dirname, char *filename);
3943
char *MakePresetFilename(const char *dir, uint8 *md5);
4044

41-
size_t GetCDDATrackFilename(int num, const char *full_path_game, char *result);
45+
size_t GetCDDATrackFilename(int num, const char *full_path_game, char **result);
4246
void PlayCDDATrack(const char *file, int loop);
4347
void StopCDDATrack();
4448

4549
// char *lib_get_name();
4650
// uint32 lib_get_version();
51+
52+
53+
#endif // __APP_UTILS_H

0 commit comments

Comments
 (0)