| 
									
										
										
										
											2013-04-17 23:09:55 -04:00
										 |  |  | // Copyright 2013 Dolphin Emulator Project
 | 
					
						
							|  |  |  | // Licensed under GPLv2
 | 
					
						
							|  |  |  | // Refer to the license.txt file included.
 | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-21 01:47:53 +01:00
										 |  |  | #include <string>
 | 
					
						
							|  |  |  | #include <vector>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "Common/Common.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-17 05:18:15 -05:00
										 |  |  | #include "DiscIO/Volume.h"
 | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace DiscIO | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | IVolume::ECountry CountrySwitch(u8 CountryCode) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-10-29 01:23:17 -04:00
										 |  |  | 	switch (CountryCode) | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-05-30 17:16:06 +00:00
										 |  |  | 		// Region free - fall through to European defaults for now
 | 
					
						
							| 
									
										
										
										
											2010-05-30 16:33:01 +00:00
										 |  |  | 		case 'A': | 
					
						
							| 
									
										
										
										
											2010-05-30 17:16:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-29 01:23:17 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-30 17:16:06 +00:00
										 |  |  | 		// PAL
 | 
					
						
							| 
									
										
										
										
											2010-12-22 00:48:59 +00:00
										 |  |  | 		case 'D': // German
 | 
					
						
							| 
									
										
										
										
											2013-01-09 22:53:04 -06:00
										 |  |  | 			return IVolume::COUNTRY_GERMANY; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-22 00:48:59 +00:00
										 |  |  | 		case 'X': // Used by a couple PAL games
 | 
					
						
							|  |  |  | 		case 'Y': // German, french
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-30 17:16:06 +00:00
										 |  |  | 		case 'L': // Japanese import to PAL regions
 | 
					
						
							|  |  |  | 		case 'M': // Japanese import to PAL regions
 | 
					
						
							|  |  |  | 		case 'S': // Spanish-speaking regions
 | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 		case 'P': | 
					
						
							| 
									
										
										
										
											2013-10-29 01:23:17 -04:00
										 |  |  | 		case 'U': // Australia
 | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 			return IVolume::COUNTRY_EUROPE; | 
					
						
							|  |  |  | 			break; | 
					
						
							| 
									
										
										
										
											2013-10-29 01:23:17 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 		case 'F': | 
					
						
							|  |  |  | 			return IVolume::COUNTRY_FRANCE; | 
					
						
							|  |  |  | 			break; | 
					
						
							| 
									
										
										
										
											2013-10-29 01:23:17 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 		case 'I': | 
					
						
							|  |  |  | 			return IVolume::COUNTRY_ITALY; | 
					
						
							|  |  |  | 			break; | 
					
						
							| 
									
										
										
										
											2013-10-29 01:23:17 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-03 06:10:14 +00:00
										 |  |  | 		case 'R': | 
					
						
							|  |  |  | 			return IVolume::COUNTRY_RUSSIA; | 
					
						
							|  |  |  | 			break; | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// NTSC
 | 
					
						
							|  |  |  | 		case 'E': | 
					
						
							| 
									
										
										
										
											2010-05-30 17:31:52 +00:00
										 |  |  | 		case 'N': // Japanese import to USA and other NTSC regions
 | 
					
						
							| 
									
										
										
										
											2010-05-23 08:41:58 +00:00
										 |  |  | 		case 'Z': // Prince Of Persia - The Forgotten Sands (WII)
 | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 			return IVolume::COUNTRY_USA; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		case 'J': | 
					
						
							|  |  |  | 			return IVolume::COUNTRY_JAPAN; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		case 'K': | 
					
						
							| 
									
										
										
										
											2010-05-30 17:16:06 +00:00
										 |  |  | 		case 'T': // Korea with English language
 | 
					
						
							|  |  |  | 		case 'Q': // Korea with Japanese language
 | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 			return IVolume::COUNTRY_KOREA; | 
					
						
							| 
									
										
										
										
											2013-04-16 23:14:36 -04:00
										 |  |  | 			break; | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		case 'O': | 
					
						
							|  |  |  | 			return IVolume::COUNTRY_SDK; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		case 'W': | 
					
						
							|  |  |  | 			return IVolume::COUNTRY_TAIWAN; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		default: | 
					
						
							| 
									
										
										
										
											2010-09-06 04:36:58 +00:00
										 |  |  | 			if (CountryCode > 'A') // Silently ignore IOS wads
 | 
					
						
							|  |  |  | 				WARN_LOG(DISCIO, "Unknown Country Code! %c", CountryCode); | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 			return IVolume::COUNTRY_UNKNOWN; | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2010-12-16 07:36:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | u8 GetSysMenuRegion(u16 _TitleVersion) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2014-03-11 00:30:55 +13:00
										 |  |  | 	switch (_TitleVersion) | 
					
						
							| 
									
										
										
										
											2010-12-16 07:36:26 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2014-02-16 15:30:18 -05:00
										 |  |  | 	case 128: case 192: case 224: case 256: | 
					
						
							|  |  |  | 	case 288: case 352: case 384: case 416: | 
					
						
							|  |  |  | 	case 448: case 480: case 512: | 
					
						
							| 
									
										
										
										
											2010-12-16 07:36:26 +00:00
										 |  |  | 		return 'J'; | 
					
						
							| 
									
										
										
										
											2014-02-16 15:30:18 -05:00
										 |  |  | 	case 97:  case 193: case 225: case 257: | 
					
						
							|  |  |  | 	case 289: case 353: case 385: case 417: | 
					
						
							|  |  |  | 	case 449: case 481: case 513: | 
					
						
							| 
									
										
										
										
											2010-12-16 07:36:26 +00:00
										 |  |  | 		return 'E'; | 
					
						
							| 
									
										
										
										
											2014-02-16 15:30:18 -05:00
										 |  |  | 	case 130: case 162: case 194: case 226: | 
					
						
							|  |  |  | 	case 258: case 290: case 354: case 386: | 
					
						
							|  |  |  | 	case 418: case 450: case 482: case 514: | 
					
						
							| 
									
										
										
										
											2010-12-16 07:36:26 +00:00
										 |  |  | 		return 'P'; | 
					
						
							| 
									
										
										
										
											2014-02-16 15:30:18 -05:00
										 |  |  | 	case 326: case 390: case 454: case 486: | 
					
						
							| 
									
										
										
										
											2010-12-16 07:36:26 +00:00
										 |  |  | 	case 518: | 
					
						
							|  |  |  | 		return 'K'; | 
					
						
							|  |  |  | 	default: | 
					
						
							|  |  |  | 		return 'A'; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-02 19:46:55 -06:00
										 |  |  | std::string IVolume::GetName() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	auto names = GetNames(); | 
					
						
							|  |  |  | 	if (names.empty()) | 
					
						
							|  |  |  | 		return ""; | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		return names[0]; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-07-03 22:51:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-02 19:46:55 -06:00
										 |  |  | } |