Skip to content

Commit

Permalink
force ntsc: we need to merge the arguments if command 0x20 is already…
Browse files Browse the repository at this point in the history
… used

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
  • Loading branch information
sahlberg committed Sep 18, 2023
1 parent e4276b0 commit 510d51d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pop-fe-ps3.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ def on_create_pkg(self):
if self.builder.get_variable('force_ntsc_variable').get() == 'on':
resolution = 1
for idx in range(len(self.cue_files)):
self.configs[idx] = self.configs[idx] + bytes([0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00])
self.configs[idx] = popfe.force_ntsc_config(self.configs[idx])

self.master.config(cursor='watch')
self.master.update()

Expand Down
23 changes: 20 additions & 3 deletions pop-fe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,22 @@ def generate_aea_files(cue_files, img_files, subdir):
return aea_files


#
# This one is special since the same command may be used for other things
# so we need to merge the argument if teh command is already there
#
def force_ntsc_config(ps3config):
c = bytearray(ps3config)
merged = False
for i in range(0, len(c), 8):
if c[i] == 0x20:
c[i + 4] = c[i + 4] | 0x40
merged = True
if not merged:
c = c + bytes([0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00])
return c


# ICON0 is the game cover
# PIC0 is logo
# PIC1 is background image/poster
Expand Down Expand Up @@ -2145,9 +2161,6 @@ def generate_aea_files(cue_files, img_files, subdir):
if not ps3configs:
ps3configs = []
ps3configs.append(bytes())
if args.resolution == '1':
ps3configs[-1] = ps3configs[-1] + bytes([0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00])
print('Inject config to force NTSC') if verbose else None

real_cue_file = cue_file
real_cue_files.append(real_cue_file)
Expand Down Expand Up @@ -2270,13 +2283,17 @@ def generate_aea_files(cue_files, img_files, subdir):
with open(games[disc_id]['ps3config'], 'rb') as f:
f.seek(8)
ps3configs[i] = ps3configs[i] + f.read()
if args.resolution == '1':
print('Inject config to force NTSC') if verbose else None
ps3configs[i] = force_ntsc_config(ps3configs[i])
#
# Force use of ps1_newemu, this disables all other config settings
#
if args.ps1_newemu and args.ps3_pkg:
print('Forcing ps1_newemu on all disks for this game')
for i in range(len(real_disc_ids)):
ps3configs[i] = bytes([0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00])

#
# Apply all PPF fixes we might need
#
Expand Down

0 comments on commit 510d51d

Please sign in to comment.