TV type is now passthrough by default

This commit is contained in:
Mateusz Faderewski 2023-04-04 14:46:22 +02:00
parent 79033bc648
commit 4ae1874fc1
7 changed files with 20 additions and 50 deletions

View File

@ -159,10 +159,10 @@ type: *enum* | default: `3`
- `0` - PAL TV type will be used - `0` - PAL TV type will be used
- `1` - NTSC TV type will be used - `1` - NTSC TV type will be used
- `2` - MPAL TV type will be used - `2` - MPAL TV type will be used
- `3` - TV type will be autodetected - `3` - Console native TV type will be used
Use this setting to force specific TV type. Use this setting to force specific TV type.
By setting value `3` bootloader will try to guess TV type from loaded ROM header. By setting value `3` bootloader will passthrough TV type native to the console.
This setting is not used when **BOOT_MODE** is set to `3` or `4` (direct boot). This setting is not used when **BOOT_MODE** is set to `3` or `4` (direct boot).
--- ---

View File

@ -37,33 +37,6 @@ static io32_t *boot_get_device_base (boot_info_t *info) {
return device_base_address; return device_base_address;
} }
static bool boot_get_tv_type (boot_info_t *info) {
io32_t *base = boot_get_device_base(info);
char region = ((pi_io_read(&base[15]) >> 8) & 0xFF);
switch (region) {
case 'P':
case 'U':
info->tv_type = BOOT_TV_TYPE_PAL;
break;
case 'E':
case 'J':
info->tv_type = BOOT_TV_TYPE_NTSC;
break;
case 'B':
info->tv_type = BOOT_TV_TYPE_MPAL;
break;
default:
return false;
}
return true;
}
static bool boot_get_cic_seed (boot_info_t *info) { static bool boot_get_cic_seed (boot_info_t *info) {
io32_t *base = boot_get_device_base(info); io32_t *base = boot_get_device_base(info);
@ -83,11 +56,9 @@ static bool boot_get_cic_seed (boot_info_t *info) {
return false; return false;
} }
void boot (boot_info_t *info, bool detect_tv_type, bool detect_cic_seed) { void boot (boot_info_t *info, bool detect_cic_seed) {
if (detect_tv_type) { if (info->tv_type == BOOT_TV_TYPE_PASSTHROUGH) {
if (!boot_get_tv_type(info)) { info->tv_type = OS_INFO->tv_type;
info->tv_type = OS_INFO->tv_type;
}
} }
if (detect_cic_seed) { if (detect_cic_seed) {

View File

@ -20,6 +20,7 @@ typedef enum {
BOOT_TV_TYPE_PAL = 0, BOOT_TV_TYPE_PAL = 0,
BOOT_TV_TYPE_NTSC = 1, BOOT_TV_TYPE_NTSC = 1,
BOOT_TV_TYPE_MPAL = 2, BOOT_TV_TYPE_MPAL = 2,
BOOT_TV_TYPE_PASSTHROUGH = 3,
} boot_tv_type_t; } boot_tv_type_t;
@ -31,7 +32,7 @@ typedef struct {
} boot_info_t; } boot_info_t;
void boot (boot_info_t *info, bool detect_tv_type, bool detect_cic_seed); void boot (boot_info_t *info, bool detect_cic_seed);
#endif #endif

View File

@ -30,14 +30,12 @@ void main (void) {
break; break;
} }
bool detect_tv_type = (sc64_boot_info.tv_type == TV_TYPE_UNKNOWN);
bool detect_cic_seed = (sc64_boot_info.cic_seed == CIC_SEED_UNKNOWN);
boot_info.reset_type = OS_INFO->reset_type; boot_info.reset_type = OS_INFO->reset_type;
boot_info.tv_type = sc64_boot_info.tv_type; boot_info.tv_type = sc64_boot_info.tv_type;
boot_info.cic_seed = (sc64_boot_info.cic_seed & 0xFF); boot_info.cic_seed = (sc64_boot_info.cic_seed & 0xFF);
bool detect_cic_seed = (sc64_boot_info.cic_seed == CIC_SEED_AUTO);
deinit(); deinit();
boot(&boot_info, detect_tv_type, detect_cic_seed); boot(&boot_info, detect_cic_seed);
} }

View File

@ -64,14 +64,14 @@ typedef enum {
} sc64_save_type_t; } sc64_save_type_t;
typedef enum { typedef enum {
CIC_SEED_UNKNOWN = 0xFFFF CIC_SEED_AUTO = 0xFFFF
} sc64_cic_seed_t; } sc64_cic_seed_t;
typedef enum { typedef enum {
TV_TYPE_PAL = 0, TV_TYPE_PAL = 0,
TV_TYPE_NTSC = 1, TV_TYPE_NTSC = 1,
TV_TYPE_MPAL = 2, TV_TYPE_MPAL = 2,
TV_TYPE_UNKNOWN = 3 TV_TYPE_PASSTHROUGH = 3
} sc64_tv_type_t; } sc64_tv_type_t;
typedef enum { typedef enum {

View File

@ -54,14 +54,14 @@ typedef enum {
} boot_mode_t; } boot_mode_t;
typedef enum { typedef enum {
CIC_SEED_UNKNOWN = 0xFFFF CIC_SEED_AUTO = 0xFFFF
} cic_seed_t; } cic_seed_t;
typedef enum { typedef enum {
TV_TYPE_PAL = 0, TV_TYPE_PAL = 0,
TV_TYPE_NTSC = 1, TV_TYPE_NTSC = 1,
TV_TYPE_MPAL = 2, TV_TYPE_MPAL = 2,
TV_TYPE_UNKNOWN = 3 TV_TYPE_PASSTHROUGH = 3
} tv_type_t; } tv_type_t;
typedef enum { typedef enum {
@ -340,7 +340,7 @@ bool cfg_update (uint32_t *args) {
p.cic_seed = (cic_seed_t) (args[1] & 0xFFFF); p.cic_seed = (cic_seed_t) (args[1] & 0xFFFF);
break; break;
case CFG_ID_TV_TYPE: case CFG_ID_TV_TYPE:
if (args[1] > TV_TYPE_UNKNOWN) { if (args[1] > TV_TYPE_PASSTHROUGH) {
return true; return true;
} }
p.tv_type = (tv_type_t) (args[1] & 0x03); p.tv_type = (tv_type_t) (args[1] & 0x03);
@ -443,8 +443,8 @@ void cfg_reset_state (void) {
dd_set_disk_state(DD_DISK_STATE_EJECTED); dd_set_disk_state(DD_DISK_STATE_EJECTED);
dd_set_sd_mode(false); dd_set_sd_mode(false);
isv_set_address(0); isv_set_address(0);
p.cic_seed = CIC_SEED_UNKNOWN; p.cic_seed = CIC_SEED_AUTO;
p.tv_type = TV_TYPE_UNKNOWN; p.tv_type = TV_TYPE_PASSTHROUGH;
p.boot_mode = BOOT_MODE_MENU; p.boot_mode = BOOT_MODE_MENU;
} }

View File

@ -340,7 +340,7 @@ pub enum TvType {
PAL, PAL,
NTSC, NTSC,
MPAL, MPAL,
Auto, Passthrough,
} }
impl Display for TvType { impl Display for TvType {
@ -349,7 +349,7 @@ impl Display for TvType {
Self::PAL => "PAL", Self::PAL => "PAL",
Self::NTSC => "NTSC", Self::NTSC => "NTSC",
Self::MPAL => "MPAL", Self::MPAL => "MPAL",
Self::Auto => "Auto", Self::Passthrough => "Passthrough",
}) })
} }
} }
@ -361,7 +361,7 @@ impl TryFrom<u32> for TvType {
0 => Self::PAL, 0 => Self::PAL,
1 => Self::NTSC, 1 => Self::NTSC,
2 => Self::MPAL, 2 => Self::MPAL,
3 => Self::Auto, 3 => Self::Passthrough,
_ => return Err(Error::new("Unknown TV type code")), _ => return Err(Error::new("Unknown TV type code")),
}) })
} }
@ -373,7 +373,7 @@ impl From<TvType> for u32 {
TvType::PAL => 0, TvType::PAL => 0,
TvType::NTSC => 1, TvType::NTSC => 1,
TvType::MPAL => 2, TvType::MPAL => 2,
TvType::Auto => 3, TvType::Passthrough => 3,
} }
} }
} }