Make all final roms 4 MiB to hide enemizer
This commit is contained in:
		
							parent
							
								
									3080925950
								
							
						
					
					
						commit
						b0284c9fe2
					
				
							
								
								
									
										2
									
								
								Main.py
								
								
								
								
							
							
						
						
									
										2
									
								
								Main.py
								
								
								
								
							| 
						 | 
					@ -235,7 +235,7 @@ def main(args, seed=None):
 | 
				
			||||||
                                                              "-nohints" if not world.hints[
 | 
					                                                              "-nohints" if not world.hints[
 | 
				
			||||||
                                                                  player] else "")) if not args.outputname else ''
 | 
					                                                                  player] else "")) if not args.outputname else ''
 | 
				
			||||||
        rompath = output_path(f'{outfilebase}{outfilepname}{outfilesuffix}.sfc')
 | 
					        rompath = output_path(f'{outfilebase}{outfilepname}{outfilesuffix}.sfc')
 | 
				
			||||||
        rom.write_to_file(rompath)
 | 
					        rom.write_to_file(rompath, hide_enemizer=True)
 | 
				
			||||||
        if args.create_diff:
 | 
					        if args.create_diff:
 | 
				
			||||||
            Patch.create_patch_file(rompath)
 | 
					            Patch.create_patch_file(rompath)
 | 
				
			||||||
        return player, team, bytes(rom.name).decode()
 | 
					        return player, team, bytes(rom.name).decode()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										11
									
								
								Rom.py
								
								
								
								
							
							
						
						
									
										11
									
								
								Rom.py
								
								
								
								
							| 
						 | 
					@ -44,7 +44,16 @@ class LocalRom(object):
 | 
				
			||||||
    def write_bytes(self, startaddress: int, values):
 | 
					    def write_bytes(self, startaddress: int, values):
 | 
				
			||||||
        self.buffer[startaddress:startaddress + len(values)] = values
 | 
					        self.buffer[startaddress:startaddress + len(values)] = values
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def write_to_file(self, file):
 | 
					    def write_to_file(self, file, hide_enemizer=False):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if hide_enemizer:
 | 
				
			||||||
 | 
					            extra_zeroes = 0x400000 - len(self.buffer)
 | 
				
			||||||
 | 
					            logging.info(extra_zeroes)
 | 
				
			||||||
 | 
					            if extra_zeroes > 0:
 | 
				
			||||||
 | 
					                buffer = self.buffer + bytes([0x00] * extra_zeroes)
 | 
				
			||||||
 | 
					                with open(file, 'wb') as outfile:
 | 
				
			||||||
 | 
					                    outfile.write(buffer)
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
        with open(file, 'wb') as outfile:
 | 
					        with open(file, 'wb') as outfile:
 | 
				
			||||||
            outfile.write(self.buffer)
 | 
					            outfile.write(self.buffer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue