@@ -3918,13 +3918,13 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
39183918					mself_header hdr{};
39193919
39203920					if  (mself.read (hdr) && hdr.get_count (mself.size ()))
3921- 					{
3921+ 					{						
3922+ 						std::set<u64 > offs;
3923+ 
39223924						for  (u32  j = 0 ; j < hdr.count ; j++)
39233925						{
39243926							mself_record rec{};
39253927
3926- 							std::set<u64 > offs;
3927- 
39283928							if  (mself.read (rec) && rec.get_pos (mself.size ()))
39293929							{
39303930								if  (rec.size  <= 0x20 )
@@ -4165,7 +4165,7 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
41654165			}
41664166
41674167			ppu_log.notice (" Failed to precompile '%s' (prx: %s, ovl: %s): Attempting compilation as executable file"  , path, prx_err, ovl_err);
4168- 			possible_exec_file_paths.push (path, offset, file_size );
4168+ 			possible_exec_file_paths.push (file_queue[func_i] );
41694169			inc_fdone = 0 ;
41704170		}
41714171
@@ -4680,8 +4680,15 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
46804680			//  Copy block or function entry
46814681			ppu_function& entry = part.funcs .emplace_back (func);
46824682
4683+ 			u32  og_func = entry.addr ;
4684+ 
4685+ 			if  (auto  it = info.duplicate_map .find (entry.addr ); it != info.duplicate_map .end ())
4686+ 			{
4687+ 				og_func = it->second ;
4688+ 			}
4689+ 
46834690			//  Fixup some information
4684- 			entry.name  = fmt::format (" __0x%x"  , entry. addr  - reloc);
4691+ 			entry.name  = fmt::format (" __0x%x"  , og_func  - reloc);
46854692
46864693			if  (has_mfvscr && g_cfg.core .ppu_set_sat_bit )
46874694			{
@@ -4848,7 +4855,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
48484855				settings += ppu_settings::contains_symbol_resolver; //  Avoid invalidating all modules for this purpose
48494856
48504857			//  Write version, hash, CPU, settings
4851- 			fmt::append (obj_name, " v6 -kusa-%s-%s-%s.obj"  , fmt::base57 (output, 16 ), fmt::base57 (settings), jit_compiler::cpu (g_cfg.core .llvm_cpu ));
4858+ 			fmt::append (obj_name, " v7 -kusa-%s-%s-%s.obj"  , fmt::base57 (output, 16 ), fmt::base57 (settings), jit_compiler::cpu (g_cfg.core .llvm_cpu ));
48524859		}
48534860
48544861		if  (cpu ? cpu->state .all_of (cpu_flag::exit) : Emu.IsStopped ())
@@ -5086,6 +5093,9 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
50865093	jit_mod.symbol_resolver (vm::g_exec_addr, info.segs [0 ].addr );
50875094
50885095	//  Find a BLR-only function in order to copy it to all BLRs (some games need it)
5096+ 	bool  early_exit = false ;
5097+ 
5098+ 	//  Get and install function addresses
50895099	for  (const  auto & func : info.funcs )
50905100	{
50915101		if  (func.size  == 4  && *info.get_ptr <u32 >(func.addr ) == ppu_instructions::BLR ())
@@ -5156,6 +5166,11 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module_part, co
51565166	{
51575167		if  (func.size )
51585168		{
5169+ 			if  (auto  it = module_part.duplicate_map .find (func.addr ); it != module_part.duplicate_map .end () && it->second  != it->first )
5170+ 			{
5171+ 				continue ;
5172+ 			}
5173+ 
51595174			const  auto  f = cast<Function>(_module->getOrInsertFunction (func.name , _func).getCallee ());
51605175			f->setCallingConv (CallingConv::GHC);
51615176			f->addParamAttr (1 , llvm::Attribute::NoAlias);
@@ -5229,6 +5244,15 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module_part, co
52295244
52305245			if  (module_part.funcs [fi].size )
52315246			{
5247+ 				const  u32  faddr = module_part.funcs [fi].addr ;
5248+ 				auto  it = module_part.duplicate_map .find (faddr);
5249+ 
5250+ 				if  (it != module_part.duplicate_map .end () && it->second  != faddr)
5251+ 				{
5252+ 					ppu_log.trace (" LLVM: Function 0x%x was skipped (duplicate)"  , faddr);
5253+ 					continue ;
5254+ 				}
5255+ 
52325256				//  Translate
52335257				if  (const  auto  func = translator.Translate (module_part.funcs [fi]))
52345258				{
0 commit comments