Skip to content

Commit

Permalink
Merge pull request #471 from fjtrujy/improve_fileio
Browse files Browse the repository at this point in the history
Improve mixing usage `fileio` and `fileXio`
  • Loading branch information
uyjulian authored Dec 15, 2023
2 parents 0d48a75 + b9be021 commit e48581d
Show file tree
Hide file tree
Showing 25 changed files with 1,988 additions and 713 deletions.
1 change: 1 addition & 0 deletions ee/font/samples/font.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <dma.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tamtypes.h>

Expand Down
24 changes: 17 additions & 7 deletions ee/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,26 @@ GLUE_OBJS += SyncDCache.o iSyncDCache.o InvalidDCache.o iInvalidDCache.o
SIO_OBJS = sio_init.o sio_putc.o sio_getc.o sio_write.o sio_read.o sio_puts.o \
sio_gets.o sio_getc_block.o sio_flush.o sio_putsn.o

ROM0_OBJS = _info_internals.o GetRomName.o IsDESRMachine.o IsT10K.o
ROM0_OBJS = _info_internals.o GetRomNameWithIODriver.o GetRomName.o IsDESRMachineWithIODriver.o IsDESRMachine.o IsT10KWithIODriver.o IsT10K.o

### Config objects

CONFIG_OBJS = _config_internals.o IsEarlyJap.o configGetLanguage.o \
configSetLanguage.o configGetTvScreenType.o configSetTvScreenType.o \
configGetDateFormat.o configSetDateFormat.o configGetTimeFormat.o \
configSetTimeFormat.o configGetTimezone.o configSetTimezone.o \
configIsSpdifEnabled.o configSetSpdifEnabled.o configGetTime.o \
configIsDaylightSavingEnabled.o configSetDaylightSavingEnabled.o
CONFIG_OBJS = _config_internals.o converttobcd.o convertfrombcd.o __adjustTime.o IsEarlyJap.o \
configGetLanguageWithIODriver.o configGetLanguage.o \
configSetLanguageWithIODriver.o configSetLanguage.o \
configGetTvScreenTypeWithIODriver.o configGetTvScreenType.o \
configSetTvScreenTypeWithIODriver.o configSetTvScreenType.o \
configGetDateFormatWithIODriver.o configGetDateFormat.o \
configSetDateFormatWithIODriver.o configSetDateFormat.o \
configGetTimeFormatWithIODriver.o configGetTimeFormat.o \
configSetTimeFormatWithIODriver.o configSetTimeFormat.o \
configGetTimezoneWithIODriver.o configGetTimezone.o \
configSetTimezoneWithIODriver.o configSetTimezone.o \
configIsSpdifEnabledWithIODriver.o configIsSpdifEnabled.o \
configSetSpdifEnabledWithIODriver.o configSetSpdifEnabled.o \
configIsDaylightSavingEnabledWithIODriver.o configIsDaylightSavingEnabled.o \
configSetDaylightSavingEnabledWithIODriver.o configSetDaylightSavingEnabled.o \
configConvertToGmtTime.o configConvertToLocalTimeWithIODriver.o configConvertToLocalTime.o

### Patch objects

Expand Down
30 changes: 23 additions & 7 deletions ee/kernel/include/osd_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define __OSD_CONFIG_H__

#include <tamtypes.h>
#include <rom0_info.h>
#ifndef OSD_CONFIG_NO_LIBCDVD
#include <libcdvd.h>
#endif
Expand Down Expand Up @@ -128,80 +129,95 @@ extern "C" {
* @return Language value (See OSD_LANGUAGES above)
*/
int configGetLanguage(void);
int configGetLanguageWithIODriver(_io_driver *driver);

/** sets the default language of the ps2
* @param language Language value (See OSD_LANGUAGES above)
*/
void configSetLanguage(int language);
void configSetLanguageWithIODriver(int language, _io_driver *driver);


/** get the tv screen type the ps2 is setup for
* @return 0 = 4:3; 1 = fullscreen; 2 = 16:9
*/
int configGetTvScreenType(void);
int configGetTvScreenTypeWithIODriver(_io_driver *driver);

/** set the tv screen type
* @param screenType 0 = 4:3; 1 = fullscreen; 2 = 16:9
*/
void configSetTvScreenType(int screenType);

void configSetTvScreenTypeWithIODriver(int screenType, _io_driver *driver);

/** gets the date display format
* @return 0 = yyyy/mm/dd; 1 = mm/dd/yyyy; 2 = dd/mm/yyyy
*/
int configGetDateFormat(void);
int configGetDateFormatWithIODriver(_io_driver *driver);

/** sets the date display format
* @param dateFormat 0 = yyyy/mm/dd; 1 = mm/dd/yyyy; 2 = dd/mm/yyyy
*/
void configSetDateFormat(int dateFormat);

void configSetDateFormatWithIODriver(int dateFormat, _io_driver *driver);

/** gets the time display format
* (whether 24hour time or not)
* @return 0 = 24hour; 1 = 12hour
*/
int configGetTimeFormat(void);
int configGetTimeFormatWithIODriver(_io_driver *driver);

/** sets the time display format
* (whether 24hour time or not)
* @param timeFormat 0 = 24hour; 1 = 12hour
*/
void configSetTimeFormat(int timeFormat);
void configSetTimeFormatWithIODriver(int timeFormat, _io_driver *driver);

/** get timezone
* @return offset in minutes from GMT
*/
int configGetTimezone(void);
int configGetTimezoneWithIODriver(_io_driver *driver);

/** set timezone
* @param offset offset in minutes from GMT
*/
void configSetTimezone(int offset);
void configSetTimezoneWithIODriver(int timezoneOffset, _io_driver *driver, void (*finishedCallback)(void));

/** checks whether the spdif is enabled or not
* @return 1 = on; 0 = off
*/
int configIsSpdifEnabled(void);
int configIsSpdifEnabledWithIODriver(_io_driver *driver);

/** sets whether the spdif is enabled or not
* @param enabled 1 = on; 0 = off
*/
void configSetSpdifEnabled(int enabled);
void configSetSpdifEnabledWithIODriver(int enabled, _io_driver *driver);

/** checks whether daylight saving is currently set
* @return 1 = on; 0 = off
*/
int configIsDaylightSavingEnabled(void);
int configIsDaylightSavingEnabledWithIODriver(_io_driver *driver);

/** sets daylight saving
* @param enabled 1 = on; 0 = off
*/
void configSetDaylightSavingEnabled(int enabled);
void configSetDaylightSavingEnabledWithIODriver(int daylightSaving, _io_driver *driver, void (*finishedCallback)(void));

#ifndef OSD_CONFIG_NO_LIBCDVD
/** converts the time returned from the ps2's clock into GMT time
* (ps2 clock is in JST time)
*/
void configConvertToGmtTime(sceCdCLOCK *time);

/** converts the time returned from the ps2's clock into LOCAL time
* (ps2 clock is in JST time)
*/
void configConvertToLocalTime(sceCdCLOCK *time);
void configConvertToLocalTimeWithIODriver(sceCdCLOCK *time, _io_driver *driver);
#endif

// Internal functions.
Expand Down
9 changes: 9 additions & 0 deletions ee/kernel/include/rom0_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,25 @@
extern "C" {
#endif

typedef struct {
int (*open)(const char *name, int flags, ...);
int (*close)(int fd);
int (*read)(int fd, void *buf, int nbyte);
} _io_driver;

/** check whether the PlayStation 2 is actually a DESR-XXXX machine
*
* @return 1 if DESR-XXXX machine; 0 if not
*/
int IsDESRMachine(void);
int IsDESRMachineWithIODriver(_io_driver *driver);

/** check whether the PlayStation 2 is actually a TOOL DTL-T10000(H)
*
* @return 1 if DTL-T10000(H); 0 if not
*/
int IsT10K(void);
int IsT10KWithIODriver(_io_driver *driver);

/** gets the romname from the current ps2
* 14 chars - doesnt set a null terminator
Expand All @@ -40,6 +48,7 @@ int IsT10K(void);
* @return pointer to buffer containing romname
*/
char *GetRomName(char *romname);
char *GetRomNameWithIODriver(char *romname, _io_driver *driver);

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit e48581d

Please sign in to comment.