From adb2f10e5e1a2526bb462148195a5b15bdc8ebb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 25 Jun 2025 12:59:33 +0200 Subject: [PATCH 01/25] Merge pull request #20553 from DDinghoya/patch-36 Update ko_KR.ini --- assets/lang/ko_KR.ini | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/assets/lang/ko_KR.ini b/assets/lang/ko_KR.ini index fc28157ede..2ab7391e8d 100644 --- a/assets/lang/ko_KR.ini +++ b/assets/lang/ko_KR.ini @@ -67,7 +67,7 @@ Audio Error = 오디오 오류 Audio file format not supported. Must be WAV or MP3. = 오디오 파일 형식은 지원되지 않습니다. WAV/MP3여야 합니다. AudioBufferingForBluetooth = 블루투스 친화적 버퍼 (느림) Auto = 자동 -Buffer size = Buffer size +Buffer size = 버퍼 크기 Device = 장치 Disabled = 비활성화 DSound (compatible) = DSound (호환) @@ -295,7 +295,7 @@ Audio Debug = 오디오 디버그 Backspace = 백스페이스 Block address = 주소 차단 By Address = 주소별 -Clear the JIT cache = Clear the JIT cache +Clear the JIT cache = JIT 캐시 지우기 Control Debug = 디버그 제어 Copy savestates to memstick root = 메모리 스틱 루트에 저장 상태 복사 Create frame dump = 프레임 덤프 생성 @@ -308,13 +308,13 @@ Dev Tools = 개발 도구 DevMenu = 개발메뉴 Disabled JIT functionality = 비활성화된 JIT 기능 Display refresh rate = 스플레이 새로고침 빈도 -Don't download infra-dns.json = Don't download infra-dns.json +Don't download infra-dns.json = infra-dns.json을 다운로드 하지 않기 Draw Frametimes Graph = 프레임 시간 그래프 그리기 Dump Decrypted Eboot = 게임 부팅 시 해독된 EBOOT.BIN 덤프 Dump next frame to log = 다음 프레임을 로그로 덤프 Enable driver bug workarounds = 드라이버 버그 해결 방법 활성화 Enable Logging = 디버그 로깅 활성화 -Enable shader cache = Enable shader cache +Enable shader cache = 셰이더 캐시 활성화 Enter address = 주소 입력 Fast = 빠름 Fast-forward mode = 빨리 감기 @@ -334,7 +334,7 @@ Jit Compare = JIT 비교 JIT debug tools = JIT 디버그 도구 Log Dropped Frame Statistics = 삭제된 프레임 통계 기록 Log Level = 로그 레벨 -Log to file = Log to file +Log to file = 파일에 로그 기록 Log View = 로그 보기 Logging Channels = 로깅 채널 Medium = 중간 @@ -364,7 +364,7 @@ Texture Replacement = 텍스쳐 교체 Toggle Freeze = 프리징 토글 Touchscreen Test = 터치화면 테스트 Ubershaders = 우버셰이더 -Use FFMPEG for all compressed audio = Use FFMPEG for all compressed audio +Use FFMPEG for all compressed audio = 모든 압축 오디오에 FFMPEG 사용 Use the old sceAtrac implementation = 이전 sceAtrac 구현 사용 Vertex = 꼭짓점 VFPU = VFPU @@ -877,12 +877,12 @@ Swipe Up = 위로 밀기 tap to customize = 탭하여 맞춤 설정 Texture Dumping = 텍스처 덤핑 Texture Replacement = 텍스처 교체 -Toggle Debugger = Toggle Debugger -Toggle Fullscreen = 전체 화면 토글 +Toggle Debugger = 디버거 전환 +Toggle Fullscreen = 전체 화면 전환 Toggle mode = 모드 토글 Toggle mouse input = 마우스 입력 전환 Toggle touch controls = 터치 컨트롤 전환 -Toggle WLAN = 무선랜 토글 +Toggle WLAN = 무선랜 전환 Triangle = 세모 Fast-forward = 빨리 감기 Up = 십자 패드 위쪽 @@ -897,7 +897,7 @@ Display Portrait Reversed = 세로방향 반전 표시 [Networking] AdHoc server = Ad hoc 서버 AdhocServer Failed to Bind Port = Ad Hoc 서버가 포트 바인딩 실패함 -Allow speed control while connected (not recommended) = Allow speed control while connected (not recommended) +Allow speed control while connected (not recommended) = 연결된 동안 속도 제어 허용 (권장하지 않음) AM: Data from Unknown Port = AM: 알 수 없는 포트의 데이터 Auto = 자동 Autoconfigure = 자동구성 @@ -1010,7 +1010,7 @@ PSPColor = PSP 색상 RedBlue = 빨간/파란 안경 Saturation = 채도 Scanlines = 스캔라인 (CRT) -Sharp Bilinear Upscaler = Sharp Bilinear Upscaler +Sharp Bilinear Upscaler = 샤프 바이리니어 업스케일러 Sharpen = 선명함 SideBySide = 나란 (SBS) SSAA(Gauss) = 슈퍼샘플 AA (가우스) @@ -1089,7 +1089,7 @@ No data will be changed = 데이터가 변경되지 않습니다. PPSSPP will restart after the change = 변경 후 PPSSPP가 다시 시작됩니다. Starting move... = 이동 시작 중... That folder doesn't work as a memstick folder. = 해당 폴더는 메모리스틱 폴더로 작동하지 않습니다. -The new folder is inside the previous one = The new folder is inside the previous one +The new folder is inside the previous one = 새 폴더는 이전 폴더 안에 있음 USBAccessThrough = Android/data/org.ppsspp.ppsspp/files를 통한 USB 접속 USBAccessThroughGold = Android/data/org.ppsspp.ppssppgold/files를 통한 USB 접속 Use App Private Data = 앱 개인 데이터 사용 @@ -1259,7 +1259,7 @@ D3DCompiler Version = D3D컴파일러 버전 Debug = 디버그 Debugger Present = 디버거 탐지 Depth buffer format = 깊이 버퍼 형식 -Device API version = Device API version +Device API version = 장치 API 버전 Device Info = 장치 정보 Directories = 디렉터리 Display Information = 정보 표시 @@ -1320,7 +1320,7 @@ Auto = 자동 Auto Load Savestate = 상태 저장 자동 불러오기 AVI Dump started. = AVI 덤프가 시작됨 AVI Dump stopped. = AVI 덤프가 중지됨 -Bouncing icon = Bouncing icon +Bouncing icon = 튀는 아이콘 Cache ISO in RAM = RAM에 전체 ISO 캐시 Change CPU Clock = 에뮬레이트된 PSP의 CPU 클럭 변경 (불안정) CPU Core = CPU 코어 @@ -1445,11 +1445,11 @@ Color Saturation = 채도 Show Memory Stick folder = 메모리 스틱 폴더 표시 [Themes] -Alpine = Alpine +Alpine = 알파인 Dark = 어두움 Default = 기본 -Slate Forest = Slate Forest -Strawberry = Strawberry +Slate Forest = 슬레이트 숲 +Strawberry = 딸기 [TextureShaders] Off = 끔 From c3c814175c99ff3a5e9538d633e874ab92bdcd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 23 Jun 2025 09:31:04 +0200 Subject: [PATCH 02/25] Merge pull request #20561 from hrydgard/akira-pt-br AkiraJkr's pt_BR translation update --- assets/lang/pt_BR.ini | 150 +++++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/assets/lang/pt_BR.ini b/assets/lang/pt_BR.ini index 15f39badad..510121b57c 100644 --- a/assets/lang/pt_BR.ini +++ b/assets/lang/pt_BR.ini @@ -39,10 +39,10 @@ Allow Save State in Hardcore Mode (but not Load State) = Permitir o Save State n Almost completed achievements = Conquistas quase completadas Can't log in to RetroAchievements right now = Não consegue logar no RetroAchievements agora Challenge indicator = Indicador do desafio -Contacting RetroAchievements server... = Contactando o servidor do RetroAchievements... +Contacting RetroAchievements server... = Conectando com o servidor do RetroAchievements... Customize = Personalizar Earned = Você ganhou %1 de %2 conquistas e %3 de %4 pontos -Enable RAIntegration (for achievement development) = Ativar RAIntegration (pro desenvolvimento das conquistas) +Enable RAIntegration (for achievement development) = Ativar RAIntegration (para desenvolvimento das conquistas) Encore Mode = Modo de Repetição Failed logging in to RetroAchievements = Falhou em logar no RetroAchievements Failed to connect to RetroAchievements. Achievements will not unlock. = Falhou em conectar com o RetroAchievements. As conquistas não destrancarão. @@ -86,12 +86,12 @@ Unofficial achievements = Conquistas não oficiais [Audio] Alternate speed volume = Velocidade alternativa do volume -Audio backend = Backed do áudio (requer reiniciar) +Audio backend = Backend do áudio (requer reiniciar) Audio Error = Erro do Áudio Audio file format not supported. Must be WAV or MP3. = Formato do arquivo de áudio não suportado. Deve ser WAV ou MP3. -AudioBufferingForBluetooth = Buffer amigável do Bluetooth (mais lento) +AudioBufferingForBluetooth = Buffer amigável para Bluetooth (mais lento) Auto = Automático -Buffer size = Buffer size +Buffer size = Tamanho do Buffer Device = Dispositivo Disabled = Desativado DSound (compatible) = DirectSound (compatível) @@ -102,7 +102,7 @@ Microphone Device = Dispositivo Microfone Mix audio with other apps = Misturar o áudio com os outros aplicativos Mute = Mudo Respect silent mode = Respeitar o modo silencioso -Reverb volume = Reverberar volume +Reverb volume = Volume da Reverberação UI sound = Som da Interface do Usuário UI volume = Volume da Interface do Usuário Use new audio devices automatically = Usar novos dispositivos de áudio automaticamente @@ -152,7 +152,7 @@ HapticFeedback = Feedback háptico (vibração) Hide touch analog stick background circle = Esconder o círculo de fundo do direcional de toque analógico Icon = Ícone Ignore gamepads when not focused = Ignorar os gamepads quando não focado -Ignore Windows Key = Desativar a tecla do Windows +Ignore Windows Key = Ignorar a tecla do Windows Invert Axes = Inverter eixos Invert Tilt along X axis = Inverter a inclinação junto ao eixo X Invert Tilt along Y axis = Inverter a inclinação junto ao eixo Y @@ -238,7 +238,7 @@ Enable Sound = Ativar s&om Exit = S&air Extract File... = E&xtrair arquivo... File = &Arquivo -Frame Skipping = &Pulo dos frames +Frame Skipping = &Pulo de frames Frame Skipping Type = Tipo de pulo dos frames Fullscreen = Te&la cheia Game Settings = &Configurações do jogo @@ -263,10 +263,10 @@ Load State File... = &Carregar arquivo do state... Log Console = &Console dos registros Memory View... = Visualização da &memória... More Settings... = &Mais configurações... -Nearest = &Mais próximo -Pause when not focused = &Pausar quando não está focado +Nearest = &Mais próximo (Nearest) +Pause when not focused = Pausar quando não está focado Restart Graphics = Reiniciar os Gráficos -Save frame dump = Salvar o dump dos f&rames +Save frame dump = Salvar uma dump do f&rame Skip Buffer Effects = &Ignorar efeitos do buffer Off = &Desligado Open Chat = Abrir Bate-Papo @@ -284,7 +284,7 @@ Record = &Gravar Record Audio = Gravar &áudio Record Display = Gravar &exibição Rendering Mode = Modo de r&enderização -Rendering Resolution = &Resolução da renderização +Rendering Resolution = &Resolução interna da renderização Reset = R&esetar Reset Symbol Table = Resetar a t&abela dos símbolos Run = &Executar @@ -295,18 +295,18 @@ Save State File... = &Salvar arquivo do state... Savestate Slot = Slo&t do save state Screen Scaling Filter = Fi<ro do dimensionamento da tela Show Debug Statistics = Mostrar as estatíst&icas do debug -Show FPS Counter = Mostrar o contador dos &FPS -Skip Number of Frames = Ignorar o número dos frames -Skip Percent of FPS = Ignorar porcentagem do FPS +Show FPS Counter = Mostrar o contador de &FPS +Skip Number of Frames = Pular um número dos frames +Skip Percent of FPS = Pular uma porcentagem do FPS Smart 2D texture filtering = Filtragem inteligente das texturas 2D Stop = &Parar Switch UMD = Trocar UMD Take Screenshot = &Criar screenshot Texture Filtering = Fi<ragem das texturas -Texture Scaling = &Dimensionamento das texturas +Texture Scaling = &Upscaling das texturas Use Lossless Video Codec (FFV1) = &Usar codec de vídeo sem perdas (FFV1) Use output buffer for video = Usar buffer de saída pro vídeo -VSync = VS&ync +VSync = Sincronização Vertical (VSync) Vulkan = Vulkan Window Size = &Tamanho da janela www.ppsspp.org = Visite www.&ppsspp.org @@ -323,7 +323,7 @@ Clear the JIT cache = Clear the JIT cache Control Debug = Debug dos Controles Copy savestates to memstick root = Copiar os save states pra raiz do cartão de memória Create frame dump = Criar dump do frame -Create/Open textures.ini file for current game = Criar/Abrir o arquivo textures.ini pro jogo atual +Create/Open textures.ini file for current game = Criar/Abrir o arquivo textures.ini para o jogo atual Current = Atual Debug overlay = Sobreposição do debug Debug stats = Estatísticas do debug @@ -376,7 +376,7 @@ Reset limited logging = Resetar o registro limitado RestoreDefaultSettings = Restaurar estas configurações de volta aos padrões delas?\nVocê não pode desfazer isto.\nPor favor reinicie o PPSSPP após restaurar as configurações. RestoreGameDefaultSettings = Você tem certeza que você quer restaurar as configurações específicas do jogo\nde volta para os padrões do PPSSPP? Resume = Resumo -Save new textures = Salvar novas texturas +Save new textures = Salvar texturas novas Shader Viewer = Visualizador dos shaders Show Developer Menu = Mostrar menu do desenvolvedor Show GPO LEDs = Mostrar os LEDS do GPO @@ -388,7 +388,7 @@ Texture Replacement = Substituição das texturas Toggle Freeze = Alternar congelamento Touchscreen Test = Teste do Touchscreen Ubershaders = Ubershaders -Use FFMPEG for all compressed audio = Use FFMPEG for all compressed audio +Use FFMPEG for all compressed audio = Usar FFMPEG para todo o aúdio comprimido Use the old sceAtrac implementation = Usar a implementação antiga do sceAtrac Vertex = Vértice VFPU = VFPU @@ -410,7 +410,7 @@ Cancel = Cancelar Center = Centro Center Left = A esquerda do centro Center Right = A direita do centro -Channel: = Canaal: +Channel: = Canal: Changing this setting requires PPSSPP to restart. = Mudar esta configuração requer que o PPSSPP reinicie. Choose PPSSPP save folder = Escolha a pasta de salvamento do PPSSPP Confirm Overwrite = Você quer sobrescrever os dados? @@ -419,8 +419,8 @@ ConfirmLoad = Carregar estes dados? ConnectingAP = Conectando ao ponto de acesso.\nPor favor espere... ConnectingPleaseWait = Conectando.\nPor favor espere... ConnectionName = Nome da conexão -Copied to clipboard: %1 = Copiou pra área de transferência: %1 -Copy to clipboard = Copiar pra área de transferência +Copied to clipboard: %1 = Copiou para a área de transferência: %1 +Copy to clipboard = Copiar para a área de transferência Corrupted Data = Dados corrompidos Delete = Apagar Delete all = Apagar tudo @@ -447,9 +447,9 @@ Failed to connect to server, check your internet connection. = Falhou em conecta Filter = Filtro Finish = Concluir GE Frame Dumps = Dumps do Frame do GE -GoldOverview1 = Compre o PPSSPP Gold para apoiar o projeto PPSSPP.\nVocê também ganha um ícone brilhante para mostrar! +GoldOverview1 = Compre o PPSSPP Gold para apoiar o projeto PPSSPP.\nVocê também ganha um ícone brilhante se mostrar! GoldOverview2 = Seu apoio torna possível a continuidade do trabalho no PPSSPP.\nObrigado! -GoldThankYou = Obrigado por apoiar o projeto PPSSPP! +GoldThankYou = Obrigado por apoiar o projeto do PPSSPP! Grid = Grade Inactive = Inativo Installing... = Instalando... @@ -508,8 +508,8 @@ Top Left = A esquerda do topo Top Right = A direita do topo Unsupported = Não suportado Username = Nome de usuário -When you save, it will load on a PSP, but not an older PPSSPP = Quando você salvar ele carregará num PSP mas não num PPSSPP mais antigo -When you save, it will not work on outdated PSP Firmware anymore = Quando você salvar ele não funcionará mais num firmware de PSP desatualizado +When you save, it will load on a PSP, but not an older PPSSPP = Quando você salvar ele carregará num PSP mas não em um PPSSPP desatualizado/antigo +When you save, it will not work on outdated PSP Firmware anymore = Quando você salvar ele não funcionará mais em um firmware de PSP desatualizado Yes = Sim You haven't saved your progress for %1. = Você não salvou seu progresso do %1. Zoom = Zoom @@ -528,10 +528,10 @@ Disk full while writing data = O disco ficou cheio enquanto gravava os dados. ELF file truncated - can't load = Arquivo ELF truncado - não pôde carregar Error loading file = Não pôde carregar o arquivo. Error reading file = Erro ao ler o arquivo. -Failed initializing CPU/Memory = Falhou em inicializar a CPU ou a memória +Failed initializing CPU/Memory = Falha ao inicializar a CPU ou a memória Failed to load executable: = Falhou em carregar o executável: File corrupt = Arquivo corrompido -File not found: %1 = O arquivo não foi achado: %1 +File not found: %1 = O arquivo não foi encontrado: %1 Game disc read error - ISO corrupt = Erro de leitura do disco do jogo: ISO corrompida. GenericAllStartupError = O PPSSPP falhou em iniciar com qualquer backend gráfico. Tente atualizar seus gráficos e outros drivers. GenericBackendSwitchCrash = O PPSSPP teve um crash enquanto iniciava.\n\nIsto geralmente significa um problema do driver gráfico. Tente atualizar seus drivers gráficos.\n\nO backend dos gráficos foi trocado: @@ -561,7 +561,7 @@ RAR file detected (Require WINRAR) = O arquivo está comprimido (RAR).\nPor favo Running slow: try frameskip, sound is choppy when slow = Rodando lento: tente o frameskip, o som é instável quando lento. Running slow: Try turning off Software Rendering = Rodando lento: Tente desligar a "renderização por software" Save encryption failed. This save won't work on real PSP = Falhou em encriptar o save. Este save não funcionará num PSP de verdade -textures.ini filenames may not be cross-platform = Os nomes dos arquivos em "textures.ini" podem não ser multi-plataforma. +textures.ini filenames may not be cross-platform = Os nomes dos arquivos em "textures.ini" podem não funcionar em outras plataformas. The file is not a valid zip file = Erro ao ler o arquivo. This is a saved state, not a game. = Este é um state salvo, não um jogo. This is save data, not a game. = Isto são dados do save, não um jogo. @@ -611,7 +611,7 @@ Use UI background = Usar cenário de fundo da interface do usuário % of viewport = % do visor %, 0:unlimited = %, 0 = ilimitado (supersampling) = (super amostragem) -(upscaling) = (ampliação) +(upscaling) = (upscaling) 1x PSP = 1× PSP 2x = 2× 2x PSP = 2× PSP @@ -634,12 +634,12 @@ Alternative Speed = Velocidade alternativa (em %, 0 = ilimitada) Alternative Speed 2 = Velocidade alternativa 2 (em %, 0 = ilimitada) Always on = Sempre ligado Anisotropic Filtering = Filtragem anisotrópica -Antialiasing (MSAA) = Anti-aliasing (MSAA) -Aspect Ratio = Proporção do Aspecto +Antialiasing (MSAA) = Anti-serrilhado (MSAA) +Aspect Ratio = Proporção da Tela Auto (default) = Auto (padrão) Auto = Auto Auto (1:1) = Auto (1:1) -Auto FrameSkip = Auto frameskip +Auto FrameSkip = Pulo de Quadros automático(Frameskip) Auto Max Quality = Auto-maximizar a qualidade Auto Scaling = Auto-redimensionamento Backend = Backend @@ -650,7 +650,7 @@ CPU texture upscaler (slow) = Tipo de ampliação Current GPU driver = Driver da GPU Atual Default GPU driver = Driver padrão da GPU Disable culling = Desativar o culling -Display layout & effects = Exibir o esquema & efeitos +Display layout & effects = Ajustar a tela & efeitos Driver requires Android API version %1, current is %2 = O driver requer a versão %1 da API do Android, a atual é %2 Drivers = Drivers GPU texture upscaler (fast) = Ampliador de texturas da GPU (rápido) @@ -677,9 +677,9 @@ Display Resolution (HW scaler) = Resolução da tela (Dimensionador do hardware) Enable Cardboard VR = Ativa o cartaz da realidade virtual FPS = FPS Frame Rate Control = Controle da taxa dos frames -Frame Skipping = Pulo dos frames -Frame Skipping Type = Tipo de pulo dos frames -FullScreen = Tela cheia +Frame Skipping = Pulo de frames +Frame Skipping Type = Tipo de pulo de frames +FullScreen = Tela Cheia Geometry shader culling = Abate do shader da geometria Hack Settings = Configurações dos hacks (pode causar erros gráficos) Hardware Tessellation = Tesselação por hardware @@ -688,26 +688,26 @@ hardware transform error - falling back to software = Erro de transformação pe HardwareTessellation Tip = Usa o hardware pra fazer as curvas High = Alta Hybrid = Híbrido -Hybrid + Bicubic = Híbrido + bi-cúbico -Ignore camera notch when centering = Ignora o nível da câmera quando centralizar +Hybrid + Bicubic = Híbrido + Bi-cúbico +Ignore camera notch when centering = Ignorar o furo da câmera ao centralizar a tela Install custom driver... = Instalar driver personalizado... Integer scale factor = Fator de escala do inteiro -Internal Resolution = Resolução interna -Lazy texture caching = Cache preguiçoso da textura (mais rápido) -Lazy texture caching Tip = Mais rápido mas pode causar problemas no texto em alguns jogos +Internal Resolution = Resolução Interna +Lazy texture caching = Cache de textura preguiçoso (mais rápido) +Lazy texture caching Tip = Mais rápido mas pode causar problemas para carregar textos em alguns jogos Lens flare occlusion = Oclusão da luz da lente Linear = Linear Low = Baixa LowCurves = Qualidade das curvas spline/bezier LowCurves Tip = Usado só por alguns jogos, controla a suavidade das curvas -Lower resolution for effects (reduces artifacts) = Resolução menor dos efeitos (reduz artefatos) +Lower resolution for effects (reduces artifacts) = Resolução menor para efeitos (reduz artefatos) Manual Scaling = Dimensionamento manual Medium = Média Mirror camera image = Espelhar a imagem da câmera Mode = Modo Must Restart = Você deve reiniciar o PPSSPP pra esta mudança ter efeito. Native device resolution = Resolução nativa do dispositivo -Nearest = Mais próximo +Nearest = Mais próximo (Nearest) No (default) = Não (padrão) No buffer = Sem buffer Same as Rendering resolution = Igual a resolução da renderização @@ -721,7 +721,7 @@ Off = Desligado OpenGL = OpenGL Overlay Information = Informações da sobreposição Partial Stretch = Esticamento parcial -Percent of FPS = Porcentagem dos FPS +Percent of FPS = Porcentagem de FPS Performance = Performance Postprocessing shaders = Shaders de pós-processamento Recreate Activity = Recriar atividade @@ -730,7 +730,7 @@ Render duplicate frames to 60hz = Renderizar frames duplicados a 60 Hz RenderDuplicateFrames Tip = Pode tornar a taxa dos frames mais suave em jogos que executam em taxas de frames menores Rendering Mode = Modo de renderização Rendering Resolution = Resolução da renderização -RenderingMode NonBuffered Tip = Mais rápido, mas nada pode ser desenhado em alguns jogos +RenderingMode NonBuffered Tip = Mais rápido, mas em alguns jogos pode renderizar nada/causar erros Rotation = Rotação Safe = Seguro Screen Scaling Filter = Filtro do dimensionamento da tela @@ -749,15 +749,15 @@ Stretch = Esticar Texture Filter = Filtragem das texturas Texture Filtering = Filtragem das texturas Texture replacement pack activated = Pacote de substituição das texturas ativado -Texture upscaling = Ampliação das texturas +Texture upscaling = Upscaling de texturas The chosen ZIP file doesn't contain a valid driver = O arquivo ZIP escolhido não contém um driver válido Unlimited = Ilimitado Up to 1 = Até 1 Up to 2 = Até 2 -Upscale Level = Nível da ampliação -UpscaleLevel Tip = Pesado pra CPU - alguns dimensionamentos podem ser atrasados pra evitar travamentos +Upscale Level = Nível do Upscaling das texturas +UpscaleLevel Tip = Pesado pra CPU - algumas texturas podem demorar para carregar para evitar travamentos Use all displays = Usar todas as telas -VSync = VSync +VSync = Sincronização Vertical (VSync) Vulkan = Vulkan Window Size = Tamanho da janela xBRZ = xBRZ @@ -810,7 +810,7 @@ Give PPSSPP permission to access storage = Dê ao PPSSPP permissão pra acessar Homebrew & Demos = Homebrew & Demos How to get games = Como eu posso obter jogos? How to get homebrew & demos = Como eu posso obter homebrew & demos? -Load = Carregar... +Load = Abrir... Loading... = Carregando... PinPath = Fixar PPSSPP can't load games or save right now = O PPSSPP não consegue carregar jogos ou salvar agora @@ -819,7 +819,7 @@ SavesAreTemporary = O PPSSPP está salvando na armazenagem temporária SavesAreTemporaryGuidance = Extraia o PPSSPP em algum lugar pra salvar permanentemente SavesAreTemporaryIgnore = Ignorar aviso UnpinPath = Desafixar -UseBrowseOrLoad = Use o Procurar pra escolher uma pasta ou Carregar pra escolher um arquivo. +UseBrowseOrLoad = Use o Procurar pra escolher uma pasta ou Abrir pra escolher um arquivo. www.ppsspp.org = www.ppsspp.org [MainSettings] @@ -829,7 +829,7 @@ Graphics = Gráficos Networking = Rede System = Sistema Tools = Ferramentas -Search = Busca +Search = Pesquisar [MappableControls] Alt speed 1 = Velocidade alternativa 1 @@ -854,18 +854,18 @@ Dev-kit L2 = Dev-kit L2 Dev-kit L3 = Dev-kit L3 Dev-kit R2 = Dev-kit R2 Dev-kit R3 = Dev-kit R3 -DevMenu = Menu dos desenvolvedores +DevMenu = Menu de desenvolvedores Double tap button = Botão do toque duplo Down = Direcional pra Baixo Dpad = Direcional Exit App = Sair do Aplicativo -Frame Advance = Avanço dos frames +Frame Advance = Avançar um frame Hold = Segurar Home = Home L = L Left = Direcional Esquerdo Load State = Carregar state -Mute toggle = Alternar pro mudo +Mute toggle = Mutar/Desmutar o aúdio Next Slot = Próximo slot None = Nenhum Note = Nota @@ -899,14 +899,14 @@ Swipe Left = Deslizar pra Esquerda Swipe Right = Deslizar pra Direita Swipe Up = Deslizar pra Cima tap to customize = Toque pra personalizar -Texture Dumping = Dumpagem das texturas -Texture Replacement = Substituição das texturas -Toggle Debugger = Toggle Debugger -Toggle Fullscreen = Alternar pra tela cheia +Texture Dumping = Ligar/Desligar a dump de texturas +Texture Replacement = Ligar/Desligar a substituição de texturas +Toggle Debugger = Ligar/Desligar Debugger +Toggle Fullscreen = Ligar/Desligar a tela cheia Toggle mode = Alternar modo -Toggle mouse input = Alternar a entrada do mouse -Toggle touch controls = Alternar os controles do toque -Toggle WLAN = Alternar WLAN +Toggle mouse input = Ligar/Desligar entrada do mouse +Toggle touch controls = Ligar/Desligar botões da tela +Toggle WLAN = Ligar/Desligar WLAN Triangle = Triângulo Fast-forward = Avanço rápido Up = Direcional pra Cima @@ -921,7 +921,7 @@ Display Portrait Reversed = Exibir Retrato Revertido [Networking] AdHoc Server = Servidor Ad-hoc AdhocServer Failed to Bind Port = O servidor Ad-hoc falhou em se associar com a porta -Allow speed control while connected (not recommended) = Allow speed control while connected (not recommended) +Allow speed control while connected (not recommended) = Permitir controle de velocidade enquanto conectado (não recomendado) AM: Data from Unknown Port = AM: Dados de uma Porta Desconhecida Auto = Auto Autoconfigure = Auto-configurar @@ -966,7 +966,7 @@ Network initialized = Rede inicializada Other versions of this game that should work: = Outras versões deste jogo que devem funcionar: Please change your Port Offset = Por favor mude seu deslocamento da porta Port offset = Deslocamento da porta (0 = Compatibilidade com o PSP) -Open PPSSPP Multiplayer Wiki Page = Abrir a Página do Multiplayer do Wiki do PPSSPP +Open PPSSPP Multiplayer Wiki Page = Abrir a Página de Multiplayer do Wiki do PPSSPP proAdhocServer Address: = Endereço do servidor ad-hoc: Quick Chat 1 = Bate-papo rápido 1 Quick Chat 2 = Bate-papo rápido 2 @@ -976,7 +976,7 @@ Quick Chat 5 = Bate-papo rápido 5 QuickChat = Bate-papo rápido Randomize = Tornar aleatório Send = Enviar -Send Discord Presence information = Enviar informação da "Presença Rica" no Discord +Send Discord Presence information = Enviar informação da "Rich Presence" no Discord Some network functionality in this game is not working = Algumas funcionalidades da rede neste jogo não estão funcionando To play in Infrastructure Mode, you must enter a username = Pra jogar no Modo de Infra-estrutura você deve inserir um nome de usuário Unable to find UPnP device = Incapaz de achar o dispositivo UPnP @@ -1020,7 +1020,7 @@ ColorCorrection = Correção das cores ColorPreservation = Preservação das cores Contrast = Contraste CRT = Scanlines do CRT -FXAA = Anti-aliasing do FXAA +FXAA = Anti-serrilhado do FXAA Gamma = Gama GreenLevel = Nível verde FakeReflections = Reflexos falsos @@ -1051,13 +1051,13 @@ MitchellNetravali = Ampliador bi-cúbico (Mitchell-Netravali) [PSPCredits] all the forum mods = Todos os moderadores do fórum -build server = Servidor dos builds -check = Verifique também o Dolphin, o melhor emu de Wii/GC: +build server = Servidor de builds pré-lançamento +check = Verifique também o Dolphin, o melhor emulador de Wii/GC: CheckOutPPSSPP = Verifique o PPSSPP, o incrível emulador de PSP: https://www.ppsspp.org/ contributors = Contribuidores: created = Criado por Discord = Discord -info1 = O PPSSPP é destinado só pra propósitos educacionais. +info1 = O PPSSPP é destinado apenas para propósitos educacionais. info2 = Por favor tenha certeza que você possua os direitos pra quaisquer info3 = jogos que você joga possuindo o UMD ou comprando o download info4 = digital da loja da PSN no seu PSP real. @@ -1113,7 +1113,7 @@ No data will be changed = Nenhum dado será mudado PPSSPP will restart after the change = O PPSSPP reiniciará após a mudança Starting move... = Iniciando a movimentação... That folder doesn't work as a memstick folder. = Essa pasta não funciona como um cartão de memória. -The new folder is inside the previous one = The new folder is inside the previous one +The new folder is inside the previous one = A pasta nova está dentro da anterior USBAccessThrough = Acesso ao USB através do Android/data/org.ppsspp.ppsspp/files USBAccessThroughGold = Acesso ao USB através do Android/data/org.ppsspp.ppssppgold/files Use App Private Data = Use os Dados Privados do App @@ -1176,7 +1176,7 @@ FeedbackDisabled = Os relatórios da compatibilidade com o servidor devem estar FeedbackIncludeCRC = Nota: A bateria será usada pra enviar um CRC do disco FeedbackIncludeScreen = Incluir uma screenshot FeedbackSubmitDone = Seus dados foram submetidos. -FeedbackSubmitFail = Não pôde sumeter os dados pro servidor. Tente atualizar o PPSSPP. +FeedbackSubmitFail = Não foi possível enviar os dados pro servidor. Tente atualizar o PPSSPP. FeedbackThanks = Obrigado pelo seu feedback! Gameplay = Jogabilidade Graphics = Gráficos @@ -1197,7 +1197,7 @@ Plays Description = Totalmente jogável mas pode ter problemas gráficos ReportButton = Reportar feedback Show disc CRC = Mostrar CRC do disco Speed = Velocidade -Submit Feedback = Submeter feedback +Submit Feedback = Enviar feedback SuggestionConfig = Veja os relatórios no site da web pra obter boas configurações. SuggestionCPUSpeed0 = Desativa a configuração da velocidade do clock travado da CPU. SuggestionDowngrade = Retroceda pra uma versão mais antiga do PPSSPP (por favor reporte este bug). @@ -1426,7 +1426,7 @@ Recording = Gravando Reset Recording on Save/Load State = Resetar a gravação ao salvar/carregar o state Restore Default Settings = Restaurar as configurações do PPSSPP para os padrões RetroAchievements = RetroAchievements -Rewind Snapshot Interval = Retroceder a frequência dos snapshots (consome muita memória) +Rewind Snapshot Interval = Frequência dos snapshots para retroceder (consome muita memória) Savestate Slot = Slot do state salvo Savestate slot backups = Backups dos slots dos states salvos Screenshot mode = Modo screenshot From 297c6e23a8b8858113173c9c67ca923e96457eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 24 Jun 2025 18:56:30 +0200 Subject: [PATCH 03/25] Merge pull request #20565 from hrydgard/fix-unittest Try to fix the unittest on Windows --- Common/x64Emitter.h | 5 ++++- GPU/D3D11/D3D11Util.cpp | 6 +++--- GPU/Software/DrawPixelX86.cpp | 2 +- GPU/Software/SoftGpu.cpp | 2 +- unittest/UnitTest.cpp | 7 +++++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Common/x64Emitter.h b/Common/x64Emitter.h index 832ed767cb..8d9b31b200 100644 --- a/Common/x64Emitter.h +++ b/Common/x64Emitter.h @@ -281,7 +281,10 @@ inline OpArg MRegSum(X64Reg base, X64Reg offset) template inline bool Accessible(const T *t1, const T *t2) { ptrdiff_t diff = (const uint8_t *)t1 - (const uint8_t *)t2; - return diff > -0x7FFFFFE0 && diff < 0x7FFFFFE0; + if (diff < 0) { + diff = -diff; + } + return diff < (ptrdiff_t)0x7FFFFFE0; } template diff --git a/GPU/D3D11/D3D11Util.cpp b/GPU/D3D11/D3D11Util.cpp index e232abb74d..fe63c99653 100644 --- a/GPU/D3D11/D3D11Util.cpp +++ b/GPU/D3D11/D3D11Util.cpp @@ -28,7 +28,7 @@ std::vector CompileShaderToBytecodeD3D11(const char *code, size_t codeS HRESULT result = ptr_D3DCompile(code, codeSize, nullptr, nullptr, nullptr, "main", target, flags, 0, &compiledCode, &errorMsgs); std::string errors; if (errorMsgs) { - errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize()); + errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize() > 1 ? (errorMsgs->GetBufferSize() - 1) : 0); std::string numberedCode = LineNumberString(code); if (SUCCEEDED(result)) { std::vector lines; @@ -45,9 +45,9 @@ std::vector CompileShaderToBytecodeD3D11(const char *code, size_t codeS } } else { ERROR_LOG(Log::G3D, "%s: %s\n\n%s", "errors", errors.c_str(), numberedCode.c_str()); + OutputDebugStringA(errors.c_str()); + OutputDebugStringA(numberedCode.c_str()); } - OutputDebugStringA(errors.c_str()); - OutputDebugStringA(numberedCode.c_str()); } if (compiledCode) { // Success! diff --git a/GPU/Software/DrawPixelX86.cpp b/GPU/Software/DrawPixelX86.cpp index 187c3b2a0e..9ef65c52b4 100644 --- a/GPU/Software/DrawPixelX86.cpp +++ b/GPU/Software/DrawPixelX86.cpp @@ -149,7 +149,7 @@ RegCache::Reg PixelJitCache::GetColorOff(const PixelFuncID &id) { // Now add the pointer for the color buffer. if (loadDepthOff) { - _assert_(Accessible(&fb.data, &depthbuf.data)); + _assert_msg_(Accessible(&fb.data, &depthbuf.data), "fb.data and depthbuf.data too far apart: %p %p (fb=%08x d=%08x)", fb.data, depthbuf.data, gstate.getFrameBufAddress(), gstate.getDepthBufAddress()); depthTemp = regCache_.Alloc(RegCache::GEN_DEPTH_OFF); if (RipAccessible(&fb.data) && RipAccessible(&depthbuf.data)) { MOV(PTRBITS, R(argYReg), M(&fb.data)); diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index b9beca29a8..7797fb4306 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -1029,7 +1029,7 @@ void SoftGPU::Execute_FramebufPtr(u32 op, u32 diff) { // We assume fb.data won't change while we're drawing. if (diff) { drawEngine_->transformUnit.Flush(this, "framebuf"); - fb.data = Memory::GetPointerWrite(gstate.getFrameBufAddress()); + fb.data = Memory::GetPointerWriteUnchecked(gstate.getFrameBufAddress()); } } diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index 6c977c6cc9..be4b2deabc 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -55,6 +55,7 @@ #include "Common/Data/Encoding/Utf8.h" #include "Common/Buffer.h" #include "Common/File/Path.h" +#include "Common/Log/LogManager.h" #include "Common/Math/SIMDHeaders.h" #include "Common/Math/CrossSIMD.h" // Get some more instructions for testing @@ -1311,6 +1312,7 @@ int main(int argc, const char *argv[]) { cpu_info.bVFPv3 = true; cpu_info.bVFPv4 = true; g_Config.bEnableLogging = true; + g_logManager.DisableOutput(LogOutput::DebugString); // not really needed bool allTests = false; TestFunc testFunc = nullptr; @@ -1329,7 +1331,8 @@ int main(int argc, const char *argv[]) { if (allTests) { int passes = 0; int fails = 0; - for (auto f : availableTests) { + for (const auto &f : availableTests) { + printf("\n**** Running test %s ****\n", f.name); if (f.func()) { ++passes; } else { @@ -1344,7 +1347,7 @@ int main(int argc, const char *argv[]) { printf("%d tests failed!\n", fails); return 2; } - } else if (testFunc == nullptr) { + } else if (!testFunc) { fprintf(stderr, "You may select a test to run by passing an argument, either \"all\" or one or more of the below.\n"); fprintf(stderr, "\n"); fprintf(stderr, "Available tests:\n"); From 1301c2ef3f45b7ef600e50bb604c6b1a723eaeea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 25 Jun 2025 23:05:35 +0200 Subject: [PATCH 04/25] Merge pull request #20555 from ANR2MERefork/appimage-sdl2 Use SDL2 library instead of SDL2-compat with SDL3 library. --- .github/workflows/appimage.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index c2b69a841e..0c63f1d9de 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -89,6 +89,7 @@ jobs: sed -i 's/DownloadUser/#DownloadUser/g' /etc/pacman.conf ARCH=$(uname -m) + echo "ARCH=$ARCH" >> $GITHUB_ENV # Export ARCH to be reused on other steps if [[ "$ARCH" == "x86_64" ]]; then PKG_TYPE='x86_64.pkg.tar.zst' else @@ -107,6 +108,7 @@ jobs: desktop-file-utils \ git \ cmake \ + ninja \ clang \ llvm-libs \ llvm \ @@ -119,10 +121,10 @@ jobs: libc++ \ libc++abi \ glew \ - sdl2 \ sdl2_ttf \ python \ patchelf \ + pipewire \ pipewire-audio \ pulseaudio \ pulseaudio-alsa \ @@ -131,8 +133,12 @@ jobs: xorg-server-xvfb \ zsync \ vulkan-nouveau \ - vulkan-radeon - + vulkan-radeon \ + vulkan-headers \ + alsa-lib sndio hidapi ibus jack libdecor libgl libpulse libusb \ + libx11 libxcursor libxext libxinerama libxkbcommon libxrandr libxrender libxss libxtst \ + wayland wayland-protocols + if [[ "$ARCH" == "x86_64" ]]; then pacman -Syu --noconfirm vulkan-intel fi @@ -174,6 +180,17 @@ jobs: #clang --version #clang++ --version + # Install SDL2 from AUR + sed -i 's|EUID == 0|EUID == 69|g' /usr/bin/makepkg # because the docker image is ran as root this is needed lol + git clone https://aur.archlinux.org/sdl2.git + pushd sdl2 + sed -i "s|x86_64|$ARCH|" ./PKGBUILD + makepkg -f + pacman --noconfirm -Rsndd sdl2-compat + pacman --noconfirm -U *.pkg.tar.* + popd + # End of Install SDL2 from AUR + # Build ppsspp #./b.sh --release --no-sdl2 --no-png mkdir -p build From 81583700e1d04939f8d0bf247b4c64269c5ed129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 26 Jun 2025 19:44:48 +0200 Subject: [PATCH 05/25] Merge pull request #20574 from hrydgard/ffii-copy-texture-fix Make the check for framebuffer copy targets slightly more lenient for tiny copies. --- GPU/Common/FramebufferManagerCommon.cpp | 4 ++-- assets/compat.ini | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 95d62a6b8e..470651f2d3 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -2070,9 +2070,9 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, if (!ignoreDstBuffer && dst >= vfb_address && (dst + size <= vfb_address + vfb_size || dst == vfb_address)) { const u32 offset = dst - vfb_address; const u32 yOffset = offset / vfb_byteStride; - if ((offset % vfb_byteStride) == 0 && (size == vfb_byteWidth || (size % vfb_byteStride) == 0)) { + if ((offset % vfb_byteStride) == 0 && (size <= vfb_byteWidth || (size % vfb_byteStride) == 0)) { dstCandidate.y = yOffset; - dstCandidate.h = (size == vfb_byteWidth) ? 1 : std::min((u32)size / vfb_byteStride, (u32)vfb->height); + dstCandidate.h = (size <= vfb_byteWidth) ? 1 : std::min((u32)size / vfb_byteStride, (u32)vfb->height); dstCandidates.push_back(dstCandidate); } } diff --git a/assets/compat.ini b/assets/compat.ini index 5d931b685d..9760fff71e 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1164,6 +1164,9 @@ ULES01510 = true # Activision Hits Remixed ULES00640 = true ULUS10186 = true +# Fortix (#20436) +NPUZ00016 = true +NPEZ00096 = true [MemstickFixedFree] # Assassin's Creed : Bloodlines - issue #12761 From dde8d22ba6309464edd572b50fc9156f3717de48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 26 Jun 2025 14:53:29 +0200 Subject: [PATCH 06/25] Merge pull request #20573 from hrydgard/thug-fix Fix crash on second logo in Tony Hawk's Underground 2 --- Core/HLE/sceKernelModule.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index fb2970a936..2efecb0285 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1244,6 +1244,13 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load modinfo = (const PspModuleInfo *)Memory::GetPointerUnchecked(modinfoaddr); + // OK, even if it's an ELF module, it might be one we shouldn't fully load and execute! + // This is seen with mpeg.prx in Tony Hawk's Underground 2, see #20568. + if (ShouldHLEModule(modinfo->name)) { + // We load it, but at least we don't run any part of it. + module->isFake = true; + } + module->nm.nsegment = reader.GetNumSegments(); module->nm.attribute = modinfo->moduleAttrs; module->nm.version[0] = modinfo->moduleVersion & 0xFF; @@ -2074,7 +2081,7 @@ static u32 sceKernelStartModule(u32 moduleId, u32 argsize, u32 argAddr, u32 retu module->nm.status = MODULE_STATUS_STARTING; module->waitingThreads.push_back(mwt); } - return hleLogInfo(Log::sceModule, ret); + return hleLogInfo(Log::sceModule, ret, "'%.*s'", (int)sizeof(module->nm.name), module->nm.name); } } From db5ef6fb8721111d4d3117aeb720dbffa4290f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 25 Jun 2025 10:48:18 +0200 Subject: [PATCH 07/25] Merge pull request #20566 from hrydgard/atrac-cleanup Atrac code cleanup, logging and comment fixes --- Common/Log.h | 2 + Common/Log/LogManager.cpp | 8 +- Common/Log/LogManager.h | 2 +- Common/System/Request.cpp | 2 +- Core/Config.cpp | 6 +- Core/HLE/AtracCtx.cpp | 38 ++- Core/HLE/AtracCtx.h | 12 +- Core/HLE/AtracCtx2.cpp | 105 ++++++-- Core/HLE/AtracCtx2.h | 15 +- Core/HLE/sceAtrac.cpp | 268 +++++++++---------- Core/HLE/sceMpeg.cpp | 362 +++++++++++++------------- Core/HLE/sceReg.cpp | 4 +- Core/MIPS/JitCommon/JitBlockCache.cpp | 1 + Core/System.cpp | 4 +- UI/ImDebugger/ImDebugger.cpp | 14 +- ext/imgui/imgui_impl_platform.cpp | 4 + headless/Headless.cpp | 4 +- 17 files changed, 462 insertions(+), 389 deletions(-) diff --git a/Common/Log.h b/Common/Log.h index fdbc245e1d..f10bbbb18a 100644 --- a/Common/Log.h +++ b/Common/Log.h @@ -40,6 +40,8 @@ enum class Log { HLE, JIT, Loader, + Mpeg, + Atrac, ME, MemMap, SasMix, diff --git a/Common/Log/LogManager.cpp b/Common/Log/LogManager.cpp index d07e7c381b..2b5a070e9d 100644 --- a/Common/Log/LogManager.cpp +++ b/Common/Log/LogManager.cpp @@ -79,7 +79,9 @@ static const char * const g_logTypeNames[] = { "HLE", "JIT", "LOADER", - "ME", // Media Engine + "MPEG", + "ATRAC", + "ME", // Rest of the media Engine "MEMMAP", "SASMIX", "SAVESTATE", @@ -213,12 +215,12 @@ void LogManager::SaveConfig(Section *section) { } } -void LogManager::LoadConfig(const Section *section, bool debugDefaults) { +void LogManager::LoadConfig(const Section *section) { for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) { bool enabled = false; int level = 0; section->Get((std::string(g_logTypeNames[i]) + "Enabled"), &enabled, true); - section->Get((std::string(g_logTypeNames[i]) + "Level"), &level, (int)(debugDefaults ? LogLevel::LDEBUG : LogLevel::LERROR)); + section->Get((std::string(g_logTypeNames[i]) + "Level"), &level, (int)LogLevel::LERROR); g_log[i].enabled = enabled; g_log[i].level = (LogLevel)level; } diff --git a/Common/Log/LogManager.h b/Common/Log/LogManager.h index b522daf587..a366972866 100644 --- a/Common/Log/LogManager.h +++ b/Common/Log/LogManager.h @@ -153,7 +153,7 @@ public: const Path &GetLogFilePath() const { return logFilename_; } void SaveConfig(Section *section); - void LoadConfig(const Section *section, bool debugDefaults); + void LoadConfig(const Section *section); static const char *GetLogTypeName(Log type); diff --git a/Common/System/Request.cpp b/Common/System/Request.cpp index 532c28d443..739b61b6e0 100644 --- a/Common/System/Request.cpp +++ b/Common/System/Request.cpp @@ -72,7 +72,7 @@ bool RequestManager::MakeSystemRequest(SystemRequestType type, RequesterToken to callbackMap_[requestId] = { callback, failedCallback, token }; } - DEBUG_LOG(Log::System, "Making system request %s: id %d", RequestTypeAsString(type), requestId); + VERBOSE_LOG(Log::System, "Making system request %s: id %d", RequestTypeAsString(type), requestId); std::string p1(param1); std::string p2(param2); // TODO: Convert to string_view diff --git a/Core/Config.cpp b/Core/Config.cpp index 1dbf006dc4..d7a3986caa 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1223,11 +1223,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { Section *log = iniFile.GetOrCreateSection(logSectionName); - bool debugDefaults = false; -#ifdef _DEBUG - debugDefaults = true; -#endif - g_logManager.LoadConfig(log, debugDefaults); + g_logManager.LoadConfig(log); Section *recent = iniFile.GetOrCreateSection("Recent"); recent->Get("MaxRecent", &iMaxRecent, 60); diff --git a/Core/HLE/AtracCtx.cpp b/Core/HLE/AtracCtx.cpp index 9777085d3d..30673e517d 100644 --- a/Core/HLE/AtracCtx.cpp +++ b/Core/HLE/AtracCtx.cpp @@ -225,11 +225,11 @@ void Atrac::WriteContextToPSPMem() { } void Track::DebugLog() const { - DEBUG_LOG(Log::ME, "ATRAC analyzed: %s channels: %d filesize: %d bitrate: %d kbps jointStereo: %d", + DEBUG_LOG(Log::Atrac, "ATRAC analyzed: %s channels: %d filesize: %d bitrate: %d kbps jointStereo: %d", codecType == PSP_CODEC_AT3 ? "AT3" : "AT3Plus", channels, fileSize, bitrate / 1024, jointStereo); - DEBUG_LOG(Log::ME, "dataoff: %d firstSampleOffset: %d endSample: %d", dataByteOffset, firstSampleOffset, endSample); - DEBUG_LOG(Log::ME, "loopStartSample: %d loopEndSample: %d", loopStartSample, loopEndSample); - DEBUG_LOG(Log::ME, "sampleSize: %d (%03x", bytesPerFrame, bytesPerFrame); + DEBUG_LOG(Log::Atrac, "dataoff: %d firstSampleOffset: %d endSample: %d", dataByteOffset, firstSampleOffset, endSample); + DEBUG_LOG(Log::Atrac, "loopStartSample: %d loopEndSample: %d", loopStartSample, loopEndSample); + DEBUG_LOG(Log::Atrac, "sampleSize: %d (%03x)", bytesPerFrame, bytesPerFrame); } int Atrac::GetSoundSample(int *endSample, int *loopStartSample, int *loopEndSample) const { @@ -291,7 +291,7 @@ void Atrac::CalculateStreamInfo(u32 *outReadOffset) { // If you don't think this should be here, remove it. It's just a temporary safety check. if (first_.offset + first_.writableBytes > bufferMaxSize_) { - ERROR_LOG_REPORT(Log::ME, "Somehow calculated too many writable bytes: %d + %d > %d", first_.offset, first_.writableBytes, bufferMaxSize_); + ERROR_LOG_REPORT(Log::Atrac, "Somehow calculated too many writable bytes: %d + %d > %d", first_.offset, first_.writableBytes, bufferMaxSize_); first_.offset = 0; first_.writableBytes = bufferMaxSize_; } @@ -327,7 +327,7 @@ void AtracBase::CreateDecoder(int codecType, int bytesPerFrame, int channels) { } } -int Atrac::GetResetBufferInfo(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) { +int Atrac::GetBufferInfoForResetting(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) { *delay = false; if (BufferState() == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER && !HasSecondBuffer()) { return SCE_ERROR_ATRAC_SECOND_BUFFER_NEEDED; @@ -417,7 +417,7 @@ int Atrac::SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, first_._filesize_dontuse = track_.fileSize; if (outputChannels != track_.channels) { - WARN_LOG(Log::ME, "Atrac::SetData: outputChannels %d doesn't match track_.channels %d", outputChannels, track_.channels); + WARN_LOG(Log::Atrac, "Atrac::SetData: outputChannels %d doesn't match track_.channels %d", outputChannels, track_.channels); } first_.addr = buffer; @@ -438,7 +438,7 @@ int Atrac::SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, if (track_.codecType != PSP_CODEC_AT3 && track_.codecType != PSP_CODEC_AT3PLUS) { // Shouldn't have gotten here, Analyze() checks this. bufferState_ = ATRAC_STATUS_NO_DATA; - ERROR_LOG(Log::ME, "unexpected codec type %d in set data", track_.codecType); + ERROR_LOG(Log::Atrac, "unexpected codec type %d in set data", track_.codecType); return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; } @@ -467,10 +467,16 @@ int Atrac::SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, Memory::Memcpy(dataBuf_, buffer, copybytes, "AtracSetData"); } CreateDecoder(track.codecType, track.bytesPerFrame, track.channels); - INFO_LOG(Log::ME, "Atrac::SetData (buffer=%08x, readSize=%d, bufferSize=%d): %s %s (%d channels) audio", buffer, readSize, bufferSize, codecName, channelName, track_.channels); + INFO_LOG(Log::Atrac, "Atrac::SetData (buffer=%08x, readSize=%d, bufferSize=%d): %s %s (%d channels) audio", buffer, readSize, bufferSize, codecName, channelName, track_.channels); + INFO_LOG(Log::Atrac, "BufferState: %s", AtracStatusToString(bufferState_)); + INFO_LOG(Log::Atrac, + "buffer: %08x bufferSize: %d readSize: %d bufferPos: %d\n", + buffer, bufferSize, readSize, bufferPos_ + ); if (track_.channels == 2 && outputChannels == 1) { // We still do all the tasks, we just return this error. + WARN_LOG(Log::Atrac, "Tried to load a stereo track into a mono context, returning NOT_MONO"); return SCE_ERROR_ATRAC_NOT_MONO; } return 0; @@ -494,7 +500,7 @@ int Atrac::SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) { return 0; } -int Atrac::GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) { +int Atrac::GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) const { if (BufferState() != ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER) { // Writes zeroes in this error case. *fileOffset = 0; @@ -715,7 +721,8 @@ u32 Atrac::DecodeData(u8 *outbuf, u32 outbufPtr, int *SamplesNum, int *finish, i // Skip the initial frame used to load state for the looped frame. // TODO: We will want to actually read this in. // TODO again: This seems to happen on the first frame of playback regardless of loops. - // Can't be good. + // Actually, this is explained now if we look at AtracCtx2, although this isn't really accurate. + DEBUG_LOG(Log::Atrac, "Calling ConsumeFrame to skip the initial frame"); ConsumeFrame(); } @@ -723,6 +730,9 @@ u32 Atrac::DecodeData(u8 *outbuf, u32 outbufPtr, int *SamplesNum, int *finish, i bool gotFrame = false; u32 off = track_.FileOffsetBySample(currentSample_ - skipSamples); + + DEBUG_LOG(Log::Atrac, "Decode(%08x): nextFileOff: %d", outbufPtr, off); + if (off < first_.size) { uint8_t *indata = BufferStart() + off; int bytesConsumed = 0; @@ -846,7 +856,7 @@ int Atrac::ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrit // Reuse the same calculation as before. AtracResetBufferInfo bufferInfo; bool ignored; - GetResetBufferInfo(&bufferInfo, sample, &ignored); + GetBufferInfoForResetting(&bufferInfo, sample, &ignored); if ((u32)bytesWrittenFirstBuf < bufferInfo.first.minWriteBytes || (u32)bytesWrittenFirstBuf > bufferInfo.first.writableBytes) { return SCE_ERROR_ATRAC_BAD_FIRST_RESET_SIZE; @@ -979,9 +989,9 @@ void Atrac::NotifyGetContextAddress() { context_ = kernelMemory.Alloc(contextSize, false, StringFromFormat("AtracCtx/%d", atracID_).c_str()); if (context_.IsValid()) Memory::Memset(context_.ptr, 0, contextSize, "AtracContextClear"); - WARN_LOG(Log::ME, "%08x=_sceAtracGetContextAddress(%i): allocated new context", context_.ptr, atracID_); + WARN_LOG(Log::Atrac, "%08x=_sceAtracGetContextAddress(%i): allocated new context", context_.ptr, atracID_); } else { - WARN_LOG(Log::ME, "%08x=_sceAtracGetContextAddress(%i)", context_.ptr, atracID_); + WARN_LOG(Log::Atrac, "%08x=_sceAtracGetContextAddress(%i)", context_.ptr, atracID_); } WriteContextToPSPMem(); } diff --git a/Core/HLE/AtracCtx.h b/Core/HLE/AtracCtx.h index 276fd38a90..75fa627af1 100644 --- a/Core/HLE/AtracCtx.h +++ b/Core/HLE/AtracCtx.h @@ -124,18 +124,18 @@ public: virtual int BytesPerFrame() const = 0; virtual int SamplesPerFrame() const = 0; - virtual void GetStreamDataInfo(u32 *writePtr, u32 *writableBytes, u32 *readOffset) = 0; + virtual void GetStreamDataInfo(u32 *writePtr, u32 *writableBytes, u32 *readOffset) = 0; // This should be const, but the legacy impl stops it (it's wrong). virtual int AddStreamData(u32 bytesToAdd) = 0; virtual int ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf, bool *delay) = 0; - virtual int GetResetBufferInfo(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) = 0; + virtual int GetBufferInfoForResetting(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) = 0; // NOTE: Not const! This can cause SkipFrames! virtual int SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, int outputChannels) = 0; - virtual int GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) = 0; + virtual int GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) const = 0; virtual int SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) = 0; virtual u32 DecodeData(u8 *outbuf, u32 outbufPtr, int *SamplesNum, int *finish, int *remains) = 0; virtual int DecodeLowLevel(const u8 *srcData, int *bytesConsumed, s16 *dstData, int *bytesWritten) = 0; - virtual u32 GetNextSamples() = 0; + virtual u32 GetNextSamples() = 0; // This should be const, but the legacy impl stops it (it's wrong). virtual void InitLowLevel(const Atrac3LowLevelParams ¶ms, int codecType) = 0; virtual void CheckForSas() = 0; @@ -224,9 +224,9 @@ public: // Notify the player that the user has written some new data. int AddStreamData(u32 bytesToAdd) override; int ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf, bool *delay) override; - int GetResetBufferInfo(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) override; + int GetBufferInfoForResetting(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) override; // NOTE: Not const! This can cause SkipFrames! (although only in the AtracCtx2) int SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, int outputChannels) override; - int GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) override; + int GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) const override; int SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) override; u32 DecodeData(u8 *outbuf, u32 outbufPtr, int *SamplesNum, int *finish, int *remains) override; int DecodeLowLevel(const u8 *srcData, int *bytesConsumed, s16 *dstData, int *bytesWritten) override; diff --git a/Core/HLE/AtracCtx2.cpp b/Core/HLE/AtracCtx2.cpp index b758527c71..8fd967ac93 100644 --- a/Core/HLE/AtracCtx2.cpp +++ b/Core/HLE/AtracCtx2.cpp @@ -10,6 +10,9 @@ #include "Core/System.h" #include "Core/HLE/AtracCtx2.h" #include "Core/HW/Atrac3Standalone.h" +#include "Core/Config.h" +#include "Core/MemMap.h" +#include "Common/File/FileUtil.h" // Convenient command line: // Windows\x64\debug\PPSSPPHeadless.exe --root pspautotests/tests/../ -o --compare --new-atrac --timeout=30 --graphics=software pspautotests/tests/audio/atrac/stream.prx @@ -183,6 +186,24 @@ Atrac2::Atrac2(u32 contextAddr, int codecType) { } } +Atrac2::~Atrac2() { + DumpBufferToFile(); + // Nothing else to do here, the context is freed by the HLE. +} + +void Atrac2::DumpBufferToFile() { + if (dumped_) { + // Already dumped, no need to dump again. + return; + } + if (!dumpBuffer_.empty()) { + std::string filename = StringFromFormat("atrac3_%08x_incomplete.at3", context_->info.endSample); + DumpFileIfEnabled(dumpBuffer_.data(), (u32)dumpBuffer_.size(), filename, DumpFileType::Atrac3); + dumpBuffer_.clear(); + } + dumped_ = true; +} + void Atrac2::DoState(PointerWrap &p) { auto s = p.Section("Atrac2", 1, 3); if (!s) @@ -331,7 +352,8 @@ u32 Atrac2::ResetPlayPositionInternal(int seekPos, int bytesWrittenFirstBuf, int } // This is basically sceAtracGetBufferInfoForResetting. -int Atrac2::GetResetBufferInfo(AtracResetBufferInfo *bufferInfo, int seekPos, bool *delay) { +// NOTE: Not const! This can cause SkipFrames! +int Atrac2::GetBufferInfoForResetting(AtracResetBufferInfo *bufferInfo, int seekPos, bool *delay) { const SceAtracIdInfo &info = context_->info; if (info.state == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER && info.secondBufferByte == 0) { @@ -354,7 +376,7 @@ int Atrac2::GetResetBufferInfo(AtracResetBufferInfo *bufferInfo, int seekPos, bo return retval; } -void Atrac2::GetResetBufferInfoInternal(AtracResetBufferInfo *bufferInfo, int seekPos) { +void Atrac2::GetResetBufferInfoInternal(AtracResetBufferInfo *bufferInfo, int seekPos) const { const SceAtracIdInfo &info = context_->info; switch (info.state) { @@ -556,6 +578,12 @@ static void ComputeStreamBufferDataInfo(const SceAtracIdInfo &info, u32 *writePt const int loopStartFileOffset = ComputeFileOffset(info, info.loopStart); const int loopEndFileOffset = ComputeLoopEndFileOffset(info, info.loopEnd); + if (spaceLeftInBuffer < 0) { + // Most likely, the file was truncated. + WARN_LOG(Log::Atrac, "File corruption detected: spaceLeftInBuffer < 0: %d. Stumbling along.", spaceLeftInBuffer); + spaceLeftInBuffer = 0; + } + switch (info.state) { case ATRAC_STATUS_STREAMED_WITHOUT_LOOP: { @@ -666,6 +694,8 @@ u32 Atrac2::DecodeInternal(u32 outbufAddr, int *SamplesNum, int *finish) { return SCE_ERROR_ATRAC_ALL_DATA_DECODED; } + DEBUG_LOG(Log::Atrac, "Decode(%08x): samplesToDecode: %d nextFileOff: %d", outbufAddr, samplesToDecode, nextFileOff); + // Check for streaming buffer run-out. if (AtracStatusIsStreaming(info.state) && info.streamDataByte < info.sampleSize) { *finish = 0; @@ -710,7 +740,7 @@ u32 Atrac2::DecodeInternal(u32 outbufAddr, int *SamplesNum, int *finish) { context_->codec.outBuf = outbufAddr; if (!Memory::IsValidAddress(inAddr)) { - ERROR_LOG(Log::ME, "DecodeInternal: Bad inAddr %08x", inAddr); + ERROR_LOG(Log::Atrac, "DecodeInternal: Bad inAddr %08x", inAddr); return SCE_ERROR_ATRAC_API_FAIL; } @@ -821,19 +851,24 @@ int Atrac2::SetData(const Track &track, u32 bufferAddr, u32 readSize, u32 buffer if (track.codecType != PSP_CODEC_AT3 && track.codecType != PSP_CODEC_AT3PLUS) { // Shouldn't have gotten here, Analyze() checks this. - ERROR_LOG(Log::ME, "unexpected codec type %d in set data", track.codecType); + ERROR_LOG(Log::Atrac, "unexpected codec type %d in set data", track.codecType); return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; } if (outputChannels != track.channels) { - INFO_LOG(Log::ME, "Atrac2::SetData: outputChannels %d doesn't match track_.channels %d, decoder will expand.", outputChannels, track.channels); + INFO_LOG(Log::Atrac, "Atrac2::SetData: outputChannels %d doesn't match track_.channels %d, decoder will expand.", outputChannels, track.channels); } if (readSize >= track.fileSize) { - INFO_LOG(Log::ME, "The full file was set directly - we can dump it."); + INFO_LOG(Log::Atrac, "The full file was set directly - we can dump it."); char filename[512]; snprintf(filename, sizeof(filename), "%s_%d%s", track.codecType == PSP_CODEC_AT3 ? "at3" : "at3plus", track.endSample, track.channels == 1 ? "_mono" : ""); DumpFileIfEnabled(Memory::GetPointer(bufferAddr), readSize, filename, DumpFileType::Atrac3); + } else if (false && (int)g_Config.iDumpFileTypes & (int)DumpFileType::Atrac3) { + // TODO: This is disabled (using the false above) until we can properly append streamed data to the dump. + // Still can be useful for debugging by dumping the start of the file, so leaving it here. + dumpBuffer_.resize(readSize); + Memory::Memcpy(dumpBuffer_.data(), bufferAddr, readSize); } CreateDecoder(track.codecType, track.bytesPerFrame, track.channels); @@ -853,7 +888,7 @@ int Atrac2::SetData(const Track &track, u32 bufferAddr, u32 readSize, u32 buffer context_->codec.inBuf = bufferAddr; if (readSize > track.fileSize) { - INFO_LOG(Log::ME, "readSize (%d) > track_.fileSize (%d)", readSize, track.fileSize); + INFO_LOG(Log::Atrac, "readSize (%d) > track_.fileSize (%d)", readSize, track.fileSize); } if (bufferSize >= track.fileSize) { @@ -875,7 +910,7 @@ int Atrac2::SetData(const Track &track, u32 bufferAddr, u32 readSize, u32 buffer } } - DEBUG_LOG(Log::ME, "Atrac mode setup: %s", AtracStatusToString(info.state)); + DEBUG_LOG(Log::Atrac, "Atrac mode setup: %s", AtracStatusToString(info.state)); // Copy parameters into state struct. info.codec = track.codecType; @@ -899,14 +934,25 @@ int Atrac2::SetData(const Track &track, u32 bufferAddr, u32 readSize, u32 buffer info.numSkipFrames = info.firstValidSample / info.SamplesPerFrame(); // NOTE: we do not write into secondBuffer/secondBufferByte! they linger... + INFO_LOG(Log::Atrac, + "Atrac: sampleSize: %d buffer: %08x bufferByte: %d firstValidSample: %d\n" + "endSample: %d loopStart: %d loopEnd: %d\n" + "dataOff: %d curFileOff: %d streamOff: %d streamDataByte: %d\n" + "fileDataEnd: %d decodePos: %d numSkipFrames: %d", + info.sampleSize, info.buffer, info.bufferByte, info.firstValidSample, + info.endSample, info.loopStart, info.loopEnd, + info.dataOff, info.curFileOff, info.streamOff, info.streamDataByte, + info.fileDataEnd, info.decodePos, info.numSkipFrames + ); + int skipCount = 0; // TODO: use for delay u32 retval = SkipFrames(&skipCount); // Seen in Mui Mui house. Things go very wrong after this.. if (retval == SCE_ERROR_ATRAC_API_FAIL) { - ERROR_LOG(Log::ME, "Bad frame during initial skip"); + ERROR_LOG(Log::Atrac, "Bad frame during initial skip"); } else if (retval != 0) { - ERROR_LOG(Log::ME, "SkipFrames during InitContext returned an error: %08x", retval); + ERROR_LOG(Log::Atrac, "SkipFrames during InitContext returned an error: %08x", retval); } WrapLastPacket(); return retval; @@ -921,7 +967,7 @@ void Atrac2::WrapLastPacket() { int distanceToEnd = RoundDownToMultiple(info.bufferByte - info.streamOff, info.sampleSize); if (info.streamDataByte < distanceToEnd) { // There's space left without wrapping. Don't do anything. - // INFO_LOG(Log::ME, "Packets fit into the buffer fully. %08x < %08x", readSize, bufferSize); + // INFO_LOG(Log::Atrac, "Packets fit into the buffer fully. %08x < %08x", readSize, bufferSize); // In this case, seems we need to zero some bytes. In one test, this seems to be 336. // Maybe there's a logical bug and the copy happens even when not needed, it's just that it'll // copy zeroes. Either way, let's just copy some bytes to make our sanity check hexdump pass. @@ -931,7 +977,7 @@ void Atrac2::WrapLastPacket() { const int copyStart = info.streamOff + distanceToEnd; const int copyLen = info.bufferByte - copyStart; // Then, let's copy it. - DEBUG_LOG(Log::ME, "Packets didn't fit evenly. Last packet got split into %d/%d (sum=%d). Copying to start of buffer.", + DEBUG_LOG(Log::Atrac, "Packets didn't fit evenly. Last packet got split into %d/%d (sum=%d). Copying to start of buffer.", copyLen, info.sampleSize - copyLen, info.sampleSize); Memory::Memcpy(info.buffer, info.buffer + copyStart, copyLen); } @@ -949,9 +995,12 @@ u32 Atrac2::SkipFrames(int *skipCount) { u32 retval = DecodeInternal(0, 0, &finishIgnored); if (retval != 0) { if (retval == SCE_ERROR_ATRAC_API_FAIL) { + WARN_LOG(Log::Atrac, "Failed during skip-frame, ignoring: %08x", retval); (*skipCount)++; } return retval; + } else { + DEBUG_LOG(Log::Atrac, "Frame correctly decoded during skip. numSkipFrames == %d", info.numSkipFrames); } (*skipCount)++; } @@ -959,7 +1008,7 @@ u32 Atrac2::SkipFrames(int *skipCount) { } // Where to read from to fill the second buffer. -int Atrac2::GetSecondBufferInfo(u32 *fileOffset, u32 *readSize) { +int Atrac2::GetSecondBufferInfo(u32 *fileOffset, u32 *readSize) const { const SceAtracIdInfo &info = context_->info; if (info.state != ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER) { // No second buffer needed in this state. @@ -1030,7 +1079,7 @@ int Atrac2::DecodeLowLevel(const u8 *srcData, int *bytesConsumed, s16 *dstData, int outSamples = 0; bool success = decoder_->Decode(srcData, info.sampleSize, bytesConsumed, channels, dstData, &outSamples); if (!success) { - ERROR_LOG(Log::ME, "Low level decoding failed: sampleSize: %d bytesConsumed: %d", info.sampleSize, *bytesConsumed); + ERROR_LOG(Log::Atrac, "Low level decoding failed: sampleSize: %d bytesConsumed: %d", info.sampleSize, *bytesConsumed); // We proceed anyway, see issue #20452 /* *bytesConsumed = 0; @@ -1046,16 +1095,16 @@ int Atrac2::DecodeLowLevel(const u8 *srcData, int *bytesConsumed, s16 *dstData, void Atrac2::CheckForSas() { SceAtracIdInfo &info = context_->info; if (info.numChan != 1) { - WARN_LOG(Log::ME, "Caller forgot to set channels to 1"); + WARN_LOG(Log::Atrac, "Caller forgot to set channels to 1"); } if (info.state != 0x10) { - WARN_LOG(Log::ME, "Caller forgot to set state to 0x10"); + WARN_LOG(Log::Atrac, "Caller forgot to set state to 0x10"); } sas_.isStreaming = info.fileDataEnd > (s32)info.bufferByte; if (sas_.isStreaming) { - INFO_LOG(Log::ME, "SasAtrac stream mode"); + INFO_LOG(Log::Atrac, "SasAtrac stream mode"); } else { - INFO_LOG(Log::ME, "SasAtrac non-streaming mode"); + INFO_LOG(Log::Atrac, "SasAtrac non-streaming mode"); } } @@ -1068,10 +1117,10 @@ int Atrac2::EnqueueForSas(u32 address, u32 ptr) { } if (address == 0 && ptr == 0) { - WARN_LOG(Log::ME, "Caller tries to send us a zero buffer. Something went wrong."); + WARN_LOG(Log::Atrac, "Caller tries to send us a zero buffer. Something went wrong."); } - DEBUG_LOG(Log::ME, "EnqueueForSas: Second buffer updated to %08x, sz: %08x", address, ptr); + DEBUG_LOG(Log::Atrac, "EnqueueForSas: Second buffer updated to %08x, sz: %08x", address, ptr); info.secondBuffer = address; info.secondBufferByte = ptr; return 0; @@ -1101,12 +1150,12 @@ void Atrac2::DecodeForSas(s16 *dstData, int *bytesWritten, int *finish) { int bytesConsumed = 0; bool decodeResult = decoder_->Decode(srcData, info.sampleSize, &bytesConsumed, 1, dstData, bytesWritten); if (!decodeResult) { - ERROR_LOG(Log::ME, "SAS failed to decode regular packet"); + ERROR_LOG(Log::Atrac, "SAS failed to decode regular packet"); } sas_.streamOffset += bytesConsumed; } else if (sas_.isStreaming) { // TODO: Do we need special handling for the first buffer, since SetData will wrap around that packet? I think yes! - DEBUG_LOG(Log::ME, "Streaming atrac through sas, and hit the end of buffer %d", sas_.curBuffer); + DEBUG_LOG(Log::Atrac, "Streaming atrac through sas, and hit the end of buffer %d", sas_.curBuffer); // Compute the part sizes using the current size. int part1Size = sas_.bufSize[sas_.curBuffer] - sas_.streamOffset; @@ -1119,7 +1168,7 @@ void Atrac2::DecodeForSas(s16 *dstData, int *bytesWritten, int *finish) { // Check if we hit the end. if (sas_.fileOffset >= info.fileDataEnd) { - DEBUG_LOG(Log::ME, "Streaming and hit the file end."); + DEBUG_LOG(Log::Atrac, "Streaming and hit the file end."); *bytesWritten = 0; *finish = 1; return; @@ -1127,14 +1176,14 @@ void Atrac2::DecodeForSas(s16 *dstData, int *bytesWritten, int *finish) { // Check that a new buffer actually exists if (info.secondBuffer == sas_.bufPtr[sas_.curBuffer]) { - ERROR_LOG(Log::ME, "Can't enqueue the same buffer twice in a row!"); + ERROR_LOG(Log::Atrac, "Can't enqueue the same buffer twice in a row!"); *bytesWritten = 0; *finish = 1; return; } if ((int)info.secondBuffer < 0) { - ERROR_LOG(Log::ME, "AtracSas streaming ran out of data, no secondbuffer pending"); + ERROR_LOG(Log::Atrac, "AtracSas streaming ran out of data, no secondbuffer pending"); *bytesWritten = 0; *finish = 1; return; @@ -1153,13 +1202,13 @@ void Atrac2::DecodeForSas(s16 *dstData, int *bytesWritten, int *finish) { if (sas_.fileOffset >= info.fileDataEnd) { // We've reached the end. info.secondBuffer = 0; - DEBUG_LOG(Log::ME, "%08x >= %08x: Reached the end.", sas_.fileOffset, info.fileDataEnd); + DEBUG_LOG(Log::Atrac, "%08x >= %08x: Reached the end.", sas_.fileOffset, info.fileDataEnd); } else { // Signal to the caller that we accept a new next buffer. info.secondBuffer = 0xFFFFFFFF; } - DEBUG_LOG(Log::ME, "Switching over to buffer %d, updating buffer to %08x, sz: %08x. %s", sas_.curBuffer, info.secondBuffer, info.secondBufferByte, info.secondBuffer == 0xFFFFFFFF ? "Signalling for more data." : ""); + DEBUG_LOG(Log::Atrac, "Switching over to buffer %d, updating buffer to %08x, sz: %08x. %s", sas_.curBuffer, info.secondBuffer, info.secondBufferByte, info.secondBuffer == 0xFFFFFFFF ? "Signalling for more data." : ""); // Copy the second half (or if part1Size == 0, the whole packet) to the assembly buffer. Memory::Memcpy(assembly + part1Size, sas_.bufPtr[sas_.curBuffer], part2Size); @@ -1168,7 +1217,7 @@ void Atrac2::DecodeForSas(s16 *dstData, int *bytesWritten, int *finish) { int bytesConsumed = 0; bool decodeResult = decoder_->Decode(srcData, info.sampleSize, &bytesConsumed, 1, dstData, bytesWritten); if (!decodeResult) { - ERROR_LOG(Log::ME, "SAS failed to decode assembled packet"); + ERROR_LOG(Log::Atrac, "SAS failed to decode assembled packet"); } } } diff --git a/Core/HLE/AtracCtx2.h b/Core/HLE/AtracCtx2.h index 2a5554df66..f1645a0699 100644 --- a/Core/HLE/AtracCtx2.h +++ b/Core/HLE/AtracCtx2.h @@ -8,9 +8,7 @@ class Atrac2 : public AtracBase { public: // The default values are only used during save state load, in which case they get restored by DoState. Atrac2(u32 contextAddr = 0, int codecType = 0); - ~Atrac2() { - delete[] decodeTemp_; - } + ~Atrac2(); AtracStatus BufferState() const override { return context_->info.state; @@ -31,10 +29,10 @@ public: int CodecType() const override { return context_->info.codec; } void GetStreamDataInfo(u32 *writePtr, u32 *writableBytes, u32 *readOffset) override; - int GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) override; + int GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) const override; int AddStreamData(u32 bytesToAdd) override; int ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf, bool *delay) override; - int GetResetBufferInfo(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) override; + int GetBufferInfoForResetting(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) override; int SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, int outputChannels) override; int SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) override; bool HasSecondBuffer() const override; @@ -62,12 +60,14 @@ public: private: u32 DecodeInternal(u32 outbufAddr, int *SamplesNum, int *finish); - void GetResetBufferInfoInternal(AtracResetBufferInfo *bufferInfo, int sample); + void GetResetBufferInfoInternal(AtracResetBufferInfo *bufferInfo, int sample) const; u32 ResetPlayPositionInternal(int seekPos, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf); u32 SkipFrames(int *skippedCount); void WrapLastPacket(); + void DumpBufferToFile(); + // Just the current decoded frame, in order to be able to cut off the first part of it // to write the initial partial frame. // Does not need to be saved. @@ -76,4 +76,7 @@ private: // This is hidden state inside sceSas, really. Not visible in the context. // But it doesn't really matter whether it's here or there. AtracSasStreamState sas_; + + std::vector dumpBuffer_; // Used for dumping audio data to files. + bool dumped_ = false; // Whether we already dumped the audio data to a file. }; diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index baa457cb70..1fafd0b614 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -144,7 +144,7 @@ int __AtracMaxContexts() { void __AtracNotifyLoadModule(int version, u32 crc, u32 bssAddr, int bssSize) { atracLibVersion = version; atracLibCrc = crc; - INFO_LOG(Log::ME, "Atrac module loaded: atracLibVersion 0x%0x, atracLibcrc %x, bss: %x (%x bytes)", atracLibVersion, atracLibCrc, bssAddr, bssSize); + INFO_LOG(Log::Atrac, "Atrac module loaded: atracLibVersion 0x%0x, atracLibcrc %x, bss: %x (%x bytes)", atracLibVersion, atracLibCrc, bssAddr, bssSize); g_atracBSS = bssAddr; g_atracMaxContexts = atracLibVersion <= 0x101 ? 4 : 6; // Need to figure out where the cutoff is. _dbg_assert_(bssSize >= g_atracMaxContexts * sizeof(SceAtracContext)); @@ -155,7 +155,7 @@ void __AtracNotifyLoadModule(int version, u32 crc, u32 bssAddr, int bssSize) { void __AtracNotifyUnloadModule() { atracLibVersion = 0; atracLibCrc = 0; - INFO_LOG(Log::ME, "Atrac module unloaded."); + INFO_LOG(Log::Atrac, "Atrac module unloaded."); g_atracBSS = 0; g_atracMaxContexts = 6; // TODO: We should make this zero here. NotifyMemInfo(MemBlockFlags::FREE, g_atracBSS, g_atracMaxContexts * sizeof(SceAtracContext), "AtracContext"); @@ -256,15 +256,15 @@ static int UnregisterAndDeleteAtrac(int atracID) { // Useful to initialize a context for low level decode. static u32 sceAtracGetAtracID(int codecType) { if (codecType != PSP_CODEC_AT3 && codecType != PSP_CODEC_AT3PLUS) { - return hleReportError(Log::ME, SCE_ERROR_ATRAC_INVALID_CODECTYPE, "invalid codecType"); + return hleReportError(Log::Atrac, SCE_ERROR_ATRAC_INVALID_CODECTYPE, "invalid codecType"); } int atracID = AllocAndRegisterAtrac(codecType); if (atracID < 0) { - return hleLogError(Log::ME, atracID, "no free ID"); + return hleLogError(Log::Atrac, atracID, "no free ID"); } - return hleLogInfo(Log::ME, atracID); + return hleLogInfo(Log::Atrac, atracID); } static int AtracValidateData(const AtracBase *atrac) { @@ -299,18 +299,18 @@ static u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd) { AtracBase *atrac = getAtrac(atracID); int err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (atrac->BufferState() == ATRAC_STATUS_ALL_DATA_LOADED) { // Let's avoid spurious warnings. Some games call this with 0 which is pretty harmless. if (bytesToAdd == 0) - return hleLogDebug(Log::ME, SCE_ERROR_ATRAC_ALL_DATA_LOADED, "stream entirely loaded"); - return hleLogWarning(Log::ME, SCE_ERROR_ATRAC_ALL_DATA_LOADED, "stream entirely loaded"); + return hleLogDebug(Log::Atrac, SCE_ERROR_ATRAC_ALL_DATA_LOADED, "stream entirely loaded"); + return hleLogWarning(Log::Atrac, SCE_ERROR_ATRAC_ALL_DATA_LOADED, "stream entirely loaded"); } int ret = atrac->AddStreamData(bytesToAdd); - return hleLogDebugOrError(Log::ME, ret); + return hleLogDebugOrError(Log::Atrac, ret); } // Note that outAddr being null is completely valid here, used to skip data. @@ -318,11 +318,11 @@ static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (outAddr & 1) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_BAD_ALIGNMENT); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_BAD_ALIGNMENT); } int numSamplesWritten = 0; @@ -330,7 +330,7 @@ static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 int remains = 0; if (outAddr != 0 && !Memory::IsValidAddress(outAddr)) { // Dunno what error code to return here, but we have to bail in this case to avoid crashing PPSSPP. - return hleLogError(Log::ME, SCE_ERROR_ATRAC_SIZE_TOO_SMALL); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_SIZE_TOO_SMALL); } u8 *outPtr = outAddr ? Memory::GetPointerWrite(outAddr) : nullptr; @@ -345,7 +345,7 @@ static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 if (ret == 0 && Memory::IsValidAddress(remainAddr)) Memory::WriteUnchecked_U32(remains, remainAddr); } - DEBUG_LOG(Log::ME, "%08x=sceAtracDecodeData(%i, %08x, %08x[%08x], %08x[%08x], %08x[%d])", ret, atracID, outAddr, + DEBUG_LOG(Log::Atrac, "%08x=sceAtracDecodeData(%i, %08x, %08x[%08x], %08x[%08x], %08x[%d])", ret, atracID, outAddr, numSamplesAddr, numSamplesWritten, finishFlagAddr, finish, remainAddr, remains); @@ -364,7 +364,7 @@ static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 static u32 sceAtracReleaseResources() { // In the real implementation, this just calls sceAudioCodecReleaseEDRAM if any has been allocated. - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } // Obtains information about what needs to be in the buffer to seek (or "reset") @@ -375,21 +375,21 @@ static u32 sceAtracGetBufferInfoForResetting(int atracID, int sample, u32 buffer AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (!bufferInfo.IsValid()) { - return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid buffer, should crash"); + return hleLogError(Log::Atrac, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid buffer, should crash"); } // Note: If we error here, it's because of the internal SkipFrames. // We delayresult if we skip frames, which indeed can happen. bool delay = false; - int ret = atrac->GetResetBufferInfo(bufferInfo, sample, &delay); + int ret = atrac->GetBufferInfoForResetting(bufferInfo, sample, &delay); if (delay) { - return hleDelayResult(hleLogDebugOrError(Log::ME, ret), "getreset_frameskip", 300); + return hleDelayResult(hleLogDebugOrError(Log::Atrac, ret), "getreset_frameskip", 300); } else { - return hleLogDebugOrError(Log::ME, ret); + return hleLogDebugOrError(Log::Atrac, ret); } } @@ -397,15 +397,15 @@ static u32 sceAtracGetBitrate(int atracID, u32 outBitrateAddr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } int bitrate = atrac->Bitrate(); if (Memory::IsValidAddress(outBitrateAddr)) { Memory::WriteUnchecked_U32(atrac->Bitrate(), outBitrateAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } else { - return hleLogError(Log::ME, 0, "invalid address"); + return hleLogError(Log::Atrac, 0, "invalid address"); } } @@ -413,14 +413,14 @@ static u32 sceAtracGetChannel(int atracID, u32 channelAddr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (Memory::IsValidAddress(channelAddr)){ Memory::WriteUnchecked_U32(atrac->Channels(), channelAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } else { - return hleLogError(Log::ME, 0, "invalid address"); + return hleLogError(Log::Atrac, 0, "invalid address"); } } @@ -428,7 +428,7 @@ static u32 sceAtracGetLoopStatus(int atracID, u32 loopNumAddr, u32 statusAddr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (Memory::IsValidAddress(loopNumAddr)) { @@ -438,9 +438,9 @@ static u32 sceAtracGetLoopStatus(int atracID, u32 loopNumAddr, u32 statusAddr) { if (Memory::IsValidAddress(statusAddr)) { const int loopStatus = atrac->LoopStatus(); Memory::WriteUnchecked_U32(loopStatus, statusAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } else { - return hleLogError(Log::ME, 0, "invalid address"); + return hleLogError(Log::Atrac, 0, "invalid address"); } } @@ -448,7 +448,7 @@ static u32 sceAtracGetInternalErrorInfo(int atracID, u32 errorAddr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } const u32 errorCode = atrac->GetInternalCodecError(); @@ -457,9 +457,9 @@ static u32 sceAtracGetInternalErrorInfo(int atracID, u32 errorAddr) { } if (errorCode) { - return hleLogWarning(Log::ME, 0, "code: %08x", errorCode); + return hleLogWarning(Log::Atrac, 0, "code: %08x", errorCode); } else { - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } } @@ -467,14 +467,14 @@ static u32 sceAtracGetMaxSample(int atracID, u32 maxSamplesAddr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (Memory::IsValidAddress(maxSamplesAddr)) { Memory::WriteUnchecked_U32(atrac->SamplesPerFrame(), maxSamplesAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } else { - return hleLogError(Log::ME, 0, "invalid address"); + return hleLogError(Log::Atrac, 0, "invalid address"); } } @@ -482,11 +482,11 @@ static u32 sceAtracGetNextDecodePosition(int atracID, u32 outposAddr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (!Memory::IsValidAddress(outposAddr)) { - return hleLogError(Log::ME, 0, "invalid address"); + return hleLogError(Log::Atrac, 0, "invalid address"); } int pos = 0; @@ -494,28 +494,28 @@ static u32 sceAtracGetNextDecodePosition(int atracID, u32 outposAddr) { if (ret < 0) { if (ret == SCE_ERROR_ATRAC_ALL_DATA_DECODED) { // Benign. - return hleLogDebug(Log::ME, ret); + return hleLogDebug(Log::Atrac, ret); } else { - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } } Memory::WriteUnchecked_U32(pos, outposAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } static u32 sceAtracGetNextSample(int atracID, u32 outNAddr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } int numSamples = atrac->GetNextSamples(); if (Memory::IsValidAddress(outNAddr)) { Memory::WriteUnchecked_U32(numSamples, outNAddr); } - return hleLogDebug(Log::ME, 0, "%d samples left", numSamples); + return hleLogDebug(Log::Atrac, 0, "%d samples left", numSamples); } // Obtains the number of frames remaining in the buffer which can be decoded. @@ -524,17 +524,17 @@ static u32 sceAtracGetRemainFrame(int atracID, u32 remainAddr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (!Memory::IsValidAddress(remainAddr)) { // Would crash. - return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid remainingFrames pointer"); + return hleReportError(Log::Atrac, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid remainingFrames pointer"); } u32 remaining = atrac->RemainingFrames(); Memory::WriteUnchecked_U32(remaining, remainAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } static u32 sceAtracGetSecondBufferInfo(int atracID, u32 fileOffsetAddr, u32 desiredSizeAddr) { @@ -544,20 +544,20 @@ static u32 sceAtracGetSecondBufferInfo(int atracID, u32 fileOffsetAddr, u32 desi AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (!fileOffset.IsValid() || !desiredSize.IsValid()) { // Would crash. - return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid addresses"); + return hleReportError(Log::Atrac, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid addresses"); } int result = atrac->GetSecondBufferInfo(fileOffset, desiredSize); switch (result) { case (int)SCE_ERROR_ATRAC_SECOND_BUFFER_NOT_NEEDED: - return hleLogDebug(Log::ME, result); + return hleLogDebug(Log::Atrac, result); default: - return hleLogDebugOrError(Log::ME, result); + return hleLogDebugOrError(Log::Atrac, result); } } @@ -565,7 +565,7 @@ static u32 sceAtracGetSoundSample(int atracID, u32 outEndSampleAddr, u32 outLoop AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } int endSample = -1; @@ -573,7 +573,7 @@ static u32 sceAtracGetSoundSample(int atracID, u32 outEndSampleAddr, u32 outLoop int loopEnd = -1; int retval = atrac->GetSoundSample(&endSample, &loopStart, &loopEnd); if (retval < 0) { - return hleLogError(Log::ME, retval); + return hleLogError(Log::Atrac, retval); } if (Memory::IsValidAddress(outEndSampleAddr)) { Memory::WriteUnchecked_U32(endSample, outEndSampleAddr); @@ -584,7 +584,7 @@ static u32 sceAtracGetSoundSample(int atracID, u32 outEndSampleAddr, u32 outLoop if (Memory::IsValidAddress(outLoopEndSampleAddr)) { Memory::WriteUnchecked_U32(loopEnd, outLoopEndSampleAddr); } - return hleLogDebug(Log::ME, retval); + return hleLogDebug(Log::Atrac, retval); } // Games call this function to get some info for add more stream data, @@ -594,7 +594,7 @@ static u32 sceAtracGetStreamDataInfo(int atracID, u32 writePtrAddr, u32 writable AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } u32 writePtr; @@ -609,19 +609,19 @@ static u32 sceAtracGetStreamDataInfo(int atracID, u32 writePtrAddr, u32 writable if (Memory::IsValidAddress(readOffsetAddr)) Memory::WriteUnchecked_U32(readOffset, readOffsetAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } static u32 sceAtracReleaseAtracID(int atracID) { int result = UnregisterAndDeleteAtrac(atracID); if (result < 0) { if (atracID >= 0) { - return hleLogError(Log::ME, result, "did not exist"); + return hleLogError(Log::Atrac, result, "did not exist"); } else { - return hleLogWarning(Log::ME, result, "did not exist"); + return hleLogWarning(Log::Atrac, result, "did not exist"); } } - return hleLogDebug(Log::ME, result); + return hleLogDebug(Log::Atrac, result); } // This is called when a game wants to seek (or "reset") to a specific position in the audio data. @@ -631,16 +631,16 @@ static u32 sceAtracResetPlayPosition(int atracID, int sample, int bytesWrittenFi AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } bool delay = false; int res = atrac->ResetPlayPosition(sample, bytesWrittenFirstBuf, bytesWrittenSecondBuf, &delay); if (res < 0) { if (delay) { - return hleDelayResult(hleLogError(Log::ME, res), "reset play pos", 200); + return hleDelayResult(hleLogError(Log::Atrac, res), "reset play pos", 200); } else { - return hleLogError(Log::ME, res); + return hleLogError(Log::Atrac, res); } } @@ -651,74 +651,74 @@ static u32 sceAtracSetHalfwayBuffer(int atracID, u32 buffer, u32 readSize, u32 b AtracBase *atrac = getAtrac(atracID); // Don't use AtracValidateManaged here. if (!atrac) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_BAD_ATRACID, "invalid atrac ID"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_BAD_ATRACID, "invalid atrac ID"); } if (readSize > bufferSize) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); } Track track; std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), readSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } if (track.codecType != atracContextTypes[atracID]) { // TODO: Should this not change the buffer size? - return hleLogError(Log::ME, SCE_ERROR_ATRAC_WRONG_CODECTYPE, "atracID uses different codec type than data"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_WRONG_CODECTYPE, "atracID uses different codec type than data"); } ret = atrac->SetData(track, buffer, readSize, bufferSize, 2); if (ret < 0) { // Must not delay. - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } // not sure the real delay time - return hleDelayResult(hleLogDebug(Log::ME, ret), "atrac set data", 100); + return hleDelayResult(hleLogDebug(Log::Atrac, ret), "atrac set data", 100); } static u32 sceAtracSetSecondBuffer(int atracID, u32 secondBuffer, u32 secondBufferSize) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } - return hleLogDebugOrError(Log::ME, atrac->SetSecondBuffer(secondBuffer, secondBufferSize)); + return hleLogDebugOrError(Log::Atrac, atrac->SetSecondBuffer(secondBuffer, secondBufferSize)); } static u32 sceAtracSetData(int atracID, u32 buffer, u32 bufferSize) { AtracBase *atrac = getAtrac(atracID); if (!atrac) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); } Track track; std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), bufferSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } if (track.codecType != atracContextTypes[atracID]) { // TODO: Should this not change the buffer size? - return hleLogError(Log::ME, SCE_ERROR_ATRAC_WRONG_CODECTYPE, "atracID uses different codec type than data"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_WRONG_CODECTYPE, "atracID uses different codec type than data"); } ret = atrac->SetData(track, buffer, bufferSize, bufferSize, 2); if (ret < 0) { // Must not delay. - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } - return hleDelayResult(hleLogDebug(Log::ME, ret), "atrac set data", 100); + return hleDelayResult(hleLogDebug(Log::Atrac, ret), "atrac set data", 100); } static int sceAtracSetDataAndGetID(u32 buffer, int bufferSize) { // A large value happens in Tales of VS, and isn't handled somewhere properly as a u32. // It's impossible for it to be that big anyway, so cap it. if (bufferSize < 0) { - WARN_LOG(Log::ME, "sceAtracSetDataAndGetID(%08x, %08x): negative bufferSize", buffer, bufferSize); + WARN_LOG(Log::Atrac, "sceAtracSetDataAndGetID(%08x, %08x): negative bufferSize", buffer, bufferSize); bufferSize = 0x10000000; } @@ -728,51 +728,51 @@ static int sceAtracSetDataAndGetID(u32 buffer, int bufferSize) { // This is needed in Tomb Raider Legend (#20145). int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), bufferSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } int atracID = AllocAndRegisterAtrac(track.codecType); if (atracID < 0) { - return hleLogError(Log::ME, atracID, "no free ID"); + return hleLogError(Log::Atrac, atracID, "no free ID"); } ret = atracContexts[atracID]->SetData(track, buffer, bufferSize, bufferSize, 2); if (ret < 0) { UnregisterAndDeleteAtrac(atracID); - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } - return hleDelayResult(hleLogDebug(Log::ME, atracID), "atrac set data", 100); + return hleDelayResult(hleLogDebug(Log::Atrac, atracID), "atrac set data", 100); } static int sceAtracSetHalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize) { if (readSize > bufferSize) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); } Track track; std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), readSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } int atracID = AllocAndRegisterAtrac(track.codecType); if (atracID < 0) { - return hleLogError(Log::ME, atracID, "no free ID"); + return hleLogError(Log::Atrac, atracID, "no free ID"); } ret = atracContexts[atracID]->SetData(track, buffer, readSize, bufferSize, 2); if (ret < 0) { UnregisterAndDeleteAtrac(atracID); - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } - return hleDelayResult(hleLogDebug(Log::ME, atracID), "atrac set data", 100); + return hleDelayResult(hleLogDebug(Log::Atrac, atracID), "atrac set data", 100); } static u32 sceAtracStartEntry() { - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceAtracStartEntry()"); + ERROR_LOG_REPORT(Log::Atrac, "UNIMPL sceAtracStartEntry()"); return 0; } @@ -780,21 +780,21 @@ static u32 sceAtracSetLoopNum(int atracID, int loopNum) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } int ret = atrac->SetLoopNum(loopNum); if (ret == SCE_ERROR_ATRAC_NO_LOOP_INFORMATION && (loopNum == -1 || loopNum == 0)) { // Not really an issue - return hleLogDebug(Log::ME, ret); + return hleLogDebug(Log::Atrac, ret); } - return hleLogDebugOrError(Log::ME, ret); + return hleLogDebugOrError(Log::Atrac, ret); } static int sceAtracReinit(int at3Count, int at3plusCount) { for (int i = 0; i < PSP_MAX_ATRAC_IDS; ++i) { if (atracContexts[i] != nullptr) { - return hleReportError(Log::ME, SCE_KERNEL_ERROR_BUSY, "cannot reinit while IDs in use"); + return hleReportError(Log::Atrac, SCE_KERNEL_ERROR_BUSY, "cannot reinit while IDs in use"); } } @@ -805,7 +805,7 @@ static int sceAtracReinit(int at3Count, int at3plusCount) { // This seems to deinit things. Mostly, it cause a reschedule on next deinit (but -1, -1 does not.) if (at3Count == 0 && at3plusCount == 0) { atracInited = false; - return hleDelayResult(hleLogInfo(Log::ME, 0, "deinit"), "atrac reinit", 200); + return hleDelayResult(hleLogInfo(Log::Atrac, 0, "deinit"), "atrac reinit", 200); } // First, ATRAC3+. These IDs seem to cost double (probably memory.) @@ -827,10 +827,10 @@ static int sceAtracReinit(int at3Count, int at3plusCount) { int result = space >= 0 ? 0 : (int)SCE_KERNEL_ERROR_OUT_OF_MEMORY; if (atracInited || next == 0) { atracInited = true; - return hleLogInfo(Log::ME, result); + return hleLogInfo(Log::Atrac, result); } else { atracInited = true; - return hleDelayResult(hleLogInfo(Log::ME, result), "atrac reinit", 400); + return hleDelayResult(hleLogInfo(Log::Atrac, result), "atrac reinit", 400); } } @@ -838,13 +838,13 @@ static int sceAtracGetOutputChannel(int atracID, u32 outputChanPtr) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateData(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } if (Memory::IsValidAddress(outputChanPtr)) { Memory::WriteUnchecked_U32(atrac->GetOutputChannels(), outputChanPtr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Atrac, 0); } else { - return hleLogError(Log::ME, 0, "invalid address"); + return hleLogError(Log::Atrac, 0, "invalid address"); } } @@ -852,37 +852,37 @@ static int sceAtracIsSecondBufferNeeded(int atracID) { AtracBase *atrac = getAtrac(atracID); u32 err = AtracValidateManaged(atrac); if (err != 0) { - return hleLogError(Log::ME, err); + return hleLogError(Log::Atrac, err); } // Note that this returns true whether the buffer is already set or not. int needed = atrac->BufferState() == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER ? 1 : 0; - return hleLogDebug(Log::ME, needed); + return hleLogDebug(Log::Atrac, needed); } static int sceAtracSetMOutHalfwayBuffer(int atracID, u32 buffer, u32 readSize, u32 bufferSize) { AtracBase *atrac = getAtrac(atracID); // Don't use AtracValidate* here. if (!atrac) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); } if (readSize > bufferSize) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); } Track track; std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), readSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } ret = atrac->SetData(track, buffer, readSize, bufferSize, 1); if (ret < 0 && ret != SCE_ERROR_ATRAC_NOT_MONO) { // Must not delay. - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } - return hleDelayResult(hleLogDebugOrError(Log::ME, ret), "atrac set data mono", 100); + return hleDelayResult(hleLogDebugOrError(Log::Atrac, ret), "atrac set data mono", 100); } // Note: This doesn't seem to be part of any available libatrac3plus library. @@ -892,23 +892,23 @@ static u32 sceAtracSetMOutData(int atracID, u32 buffer, u32 bufferSize) { AtracBase *atrac = getAtrac(atracID); // Don't use AtracValidate* here. if (!atrac) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); } Track track; std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), bufferSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } ret = atrac->SetData(track, buffer, bufferSize, bufferSize, 1); if (ret < 0 && ret != SCE_ERROR_ATRAC_NOT_MONO) { // Must not delay. - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } // It's OK if this fails, at least with NO_MONO... - return hleDelayResult(hleLogDebugOrError(Log::ME, ret), "atrac set data mono", 100); + return hleDelayResult(hleLogDebugOrError(Log::Atrac, ret), "atrac set data mono", 100); } // Note: This doesn't seem to be part of any available libatrac3plus library. @@ -918,53 +918,53 @@ static int sceAtracSetMOutDataAndGetID(u32 buffer, u32 bufferSize) { std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), bufferSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } if (track.channels != 1) { - return hleReportError(Log::ME, SCE_ERROR_ATRAC_NOT_MONO, "not mono data"); + return hleReportError(Log::Atrac, SCE_ERROR_ATRAC_NOT_MONO, "not mono data"); } int atracID = AllocAndRegisterAtrac(track.codecType); if (atracID < 0) { - return hleLogError(Log::ME, atracID, "no free ID"); + return hleLogError(Log::Atrac, atracID, "no free ID"); } ret = atracContexts[atracID]->SetData(track, buffer, bufferSize, bufferSize, 1); if (ret < 0 && ret != SCE_ERROR_ATRAC_NOT_MONO) { UnregisterAndDeleteAtrac(atracID); - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } - return hleDelayResult(hleLogDebugOrError(Log::ME, atracID), "atrac set data", 100); + return hleDelayResult(hleLogDebugOrError(Log::Atrac, atracID), "atrac set data", 100); } static int sceAtracSetMOutHalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize) { if (readSize > bufferSize) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); } Track track; std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), readSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } if (track.channels != 1) { - return hleReportError(Log::ME, SCE_ERROR_ATRAC_NOT_MONO, "not mono data"); + return hleReportError(Log::Atrac, SCE_ERROR_ATRAC_NOT_MONO, "not mono data"); } int atracID = AllocAndRegisterAtrac(track.codecType); if (atracID < 0) { - return hleLogError(Log::ME, atracID, "no free ID"); + return hleLogError(Log::Atrac, atracID, "no free ID"); } ret = atracContexts[atracID]->SetData(track, buffer, readSize, bufferSize, 1); if (ret < 0 && ret != SCE_ERROR_ATRAC_NOT_MONO) { UnregisterAndDeleteAtrac(atracID); - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } - return hleDelayResult(hleLogDebug(Log::ME, atracID), "atrac set data", 100); + return hleDelayResult(hleLogDebug(Log::Atrac, atracID), "atrac set data", 100); } static int sceAtracSetAA3DataAndGetID(u32 buffer, u32 bufferSize, u32 fileSize, u32 metadataSizeAddr) { @@ -972,47 +972,47 @@ static int sceAtracSetAA3DataAndGetID(u32 buffer, u32 bufferSize, u32 fileSize, std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), bufferSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } int atracID = AllocAndRegisterAtrac(track.codecType); if (atracID < 0) { - return hleLogError(Log::ME, atracID, "no free ID"); + return hleLogError(Log::Atrac, atracID, "no free ID"); } ret = atracContexts[atracID]->SetData(track, buffer, bufferSize, bufferSize, 2); if (ret < 0) { UnregisterAndDeleteAtrac(atracID); - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } - return hleDelayResult(hleLogDebug(Log::ME, atracID), "atrac set aa3 data", 100); + return hleDelayResult(hleLogDebug(Log::Atrac, atracID), "atrac set aa3 data", 100); } static int sceAtracSetAA3HalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize, u32 fileSize) { if (readSize > bufferSize) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_INCORRECT_READ_SIZE, "read size too large"); } Track track; std::string error; int ret = AnalyzeAtracTrack(Memory::GetPointerOrNull(buffer), readSize, &track, &error); if (ret < 0) { - return hleLogError(Log::ME, ret, "%s", error.c_str()); + return hleLogError(Log::Atrac, ret, "%s", error.c_str()); } int atracID = AllocAndRegisterAtrac(track.codecType); if (atracID < 0) { - return hleLogError(Log::ME, atracID, "no free ID"); + return hleLogError(Log::Atrac, atracID, "no free ID"); } ret = atracContexts[atracID]->SetData(track, buffer, readSize, bufferSize, 2); if (ret < 0) { UnregisterAndDeleteAtrac(atracID); - return hleLogError(Log::ME, ret); + return hleLogError(Log::Atrac, ret); } - return hleDelayResult(hleLogDebug(Log::ME, atracID), "atrac set data", 100); + return hleDelayResult(hleLogDebug(Log::Atrac, atracID), "atrac set data", 100); } // TODO: Should see if these are stored contiguously in memory somewhere, or if there really are @@ -1020,23 +1020,23 @@ static int sceAtracSetAA3HalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 buf static u32 _sceAtracGetContextAddress(int atracID) { AtracBase *atrac = getAtrac(atracID); if (!atrac) { - return hleLogError(Log::ME, 0, "bad atrac id"); + return hleLogError(Log::Atrac, 0, "bad atrac id"); } // Only the old context needs this. The new one will always have a context pointer. atrac->NotifyGetContextAddress(); - return hleLogDebug(Log::ME, atrac->context_.ptr); + return hleLogDebug(Log::Atrac, atrac->context_.ptr); } static int sceAtracLowLevelInitDecoder(int atracID, u32 paramsAddr) { AtracBase *atrac = getAtrac(atracID); if (!atrac) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); } if (!Memory::IsValidRange(paramsAddr, 12)) { // The real library will probably just crash here. - return hleReportError(Log::ME, 0, "invalid pointers"); + return hleReportError(Log::Atrac, 0, "invalid pointers"); } auto params = PSPPointer::Create(paramsAddr); @@ -1047,7 +1047,7 @@ static int sceAtracLowLevelInitDecoder(int atracID, u32 paramsAddr) { const char *codecName = codecType == PSP_CODEC_AT3 ? "atrac3" : "atrac3+"; const char *encodedChannelName = params->encodedChannels == 1 ? "mono" : "stereo"; const char *outputChannelName = params->outputChannels == 1 ? "mono" : "stereo"; - return hleLogInfo(Log::ME, 0, "%s %s->%s audio", codecName, encodedChannelName, outputChannelName); + return hleLogInfo(Log::Atrac, 0, "%s %s->%s audio", codecName, encodedChannelName, outputChannelName); } static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesConsumedAddr, u32 samplesAddr, u32 sampleBytesAddr) { @@ -1058,12 +1058,12 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo AtracBase *atrac = getAtrac(atracID); if (!atrac) { - return hleLogError(Log::ME, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::Atrac, SCE_ERROR_ATRAC_BAD_ATRACID, "bad atrac ID"); } if (!srcp.IsValid() || !srcConsumed.IsValid() || !outp.IsValid() || !outWritten.IsValid()) { // TODO: Returning zero as code was before. Needs testing. - return hleReportError(Log::ME, 0, "invalid pointers"); + return hleReportError(Log::Atrac, 0, "invalid pointers"); } int bytesConsumed = 0; @@ -1078,7 +1078,7 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo } NotifyMemInfo(MemBlockFlags::WRITE, samplesAddr, bytesWritten, "AtracLowLevelDecode"); - return hleDelayResult(hleLogDebug(Log::ME, retval), "low level atrac decode data", atracDecodeDelay); + return hleDelayResult(hleLogDebug(Log::Atrac, retval), "low level atrac decode data", atracDecodeDelay); } // These three are the external interface used by sceSas' AT3 integration. @@ -1092,7 +1092,7 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo u32 AtracSasAddStreamData(int atracID, u32 bufPtr, u32 bytesToAdd) { AtracBase *atrac = getAtrac(atracID); if (!atrac) { - WARN_LOG(Log::ME, "bad atrac ID"); + WARN_LOG(Log::Atrac, "bad atrac ID"); } return atrac->EnqueueForSas(bufPtr, bytesToAdd); } @@ -1100,7 +1100,7 @@ u32 AtracSasAddStreamData(int atracID, u32 bufPtr, u32 bytesToAdd) { void AtracSasDecodeData(int atracID, u8* outbuf, int *SamplesNum, int *finish) { AtracBase *atrac = getAtrac(atracID); if (!atrac) { - WARN_LOG(Log::ME, "bad atrac ID"); + WARN_LOG(Log::Atrac, "bad atrac ID"); } // NOTE: If streaming, this will write 0xFFFFFFFF to secondBuffer in the context when close to running // out of data. It'll then expect __sceSasConcatenateATRAC3 to concatenate a new buffer, which cannot diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 90040a6654..20cf6fa97f 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -269,7 +269,7 @@ static void AnalyzeMpeg(const u8 *buffer, u32 validSize, MpegContext *ctx) { // Sanity Check ctx->mpegFirstTimestamp if (ctx->mpegFirstTimestamp != 90000) { - WARN_LOG_REPORT(Log::ME, "Unexpected mpeg first timestamp: %llx / %lld", ctx->mpegFirstTimestamp, ctx->mpegFirstTimestamp); + WARN_LOG_REPORT(Log::Mpeg, "Unexpected mpeg first timestamp: %llx / %lld", ctx->mpegFirstTimestamp, ctx->mpegFirstTimestamp); } if (ctx->mpegMagic != PSMF_MAGIC || ctx->mpegVersion < 0 || @@ -299,8 +299,8 @@ static void AnalyzeMpeg(const u8 *buffer, u32 validSize, MpegContext *ctx) { memcpy(ctx->mpegheader, buffer, validSize >= 2048 ? 2048 : validSize); *(u32_le*)(ctx->mpegheader + PSMF_STREAM_OFFSET_OFFSET) = 0x80000; - INFO_LOG(Log::ME, "Stream offset: %d, Stream size: 0x%X", ctx->mpegOffset, ctx->mpegStreamSize); - INFO_LOG(Log::ME, "First timestamp: %lld, Last timestamp: %lld", ctx->mpegFirstTimestamp, ctx->mpegLastTimestamp); + INFO_LOG(Log::Mpeg, "Stream offset: %d, Stream size: 0x%X", ctx->mpegOffset, ctx->mpegStreamSize); + INFO_LOG(Log::Mpeg, "First timestamp: %lld, Last timestamp: %lld", ctx->mpegFirstTimestamp, ctx->mpegLastTimestamp); } class PostPutAction : public PSPAction { @@ -388,11 +388,11 @@ void __MpegLoadModule(int version,u32 crc) { static u32 sceMpegInit() { if (isMpegInit) { - WARN_LOG(Log::ME, "sceMpegInit(): already initialized"); + WARN_LOG(Log::Mpeg, "sceMpegInit(): already initialized"); // TODO: Need to properly hook module load/unload for this to work right. //return SCE_MPEG_ERROR_ALREADY_INIT; } else { - INFO_LOG(Log::ME, "sceMpegInit(), mpegLibVersion 0x%0x, mpegLibcrc %x", mpegLibVersion, mpegLibCrc); + INFO_LOG(Log::Mpeg, "sceMpegInit(), mpegLibVersion 0x%0x, mpegLibcrc %x", mpegLibVersion, mpegLibCrc); } isMpegInit = true; return hleDelayResult(hleNoLog(0), "mpeg init", 750); @@ -404,27 +404,27 @@ static u32 __MpegRingbufferQueryMemSize(int packets) { static u32 sceMpegRingbufferQueryMemSize(int packets) { u32 size = __MpegRingbufferQueryMemSize(packets); - return hleLogDebug(Log::ME, size); + return hleLogDebug(Log::Mpeg, size); } static u32 sceMpegRingbufferConstruct(u32 ringbufferAddr, u32 numPackets, u32 data, u32 size, u32 callbackAddr, u32 callbackArg) { if (!Memory::IsValidAddress(ringbufferAddr)) { - ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): bad ringbuffer, should crash", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + ERROR_LOG_REPORT(Log::Mpeg, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): bad ringbuffer, should crash", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); return hleNoLog(SCE_KERNEL_ERROR_ILLEGAL_ADDRESS); } if ((int)size < 0) { - ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): invalid size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + ERROR_LOG_REPORT(Log::Mpeg, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): invalid size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); return hleNoLog(SCE_MPEG_ERROR_NO_MEMORY); } if (__MpegRingbufferQueryMemSize(numPackets) > size) { if (numPackets < 0x00100000) { - ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + ERROR_LOG_REPORT(Log::Mpeg, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); return hleNoLog(SCE_MPEG_ERROR_NO_MEMORY); } else { // The PSP's firmware allows some cases here, due to a bug in its validation. - ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer, bogus size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + ERROR_LOG_REPORT(Log::Mpeg, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer, bogus size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); } } @@ -442,13 +442,13 @@ static u32 sceMpegRingbufferConstruct(u32 ringbufferAddr, u32 numPackets, u32 da if (ring->semaID != 0) { // I'm starting to think this is just padding or something. // It's not written by this function. - WARN_LOG(Log::ME, "Detected semaID %d", ring->semaID); + WARN_LOG(Log::Mpeg, "Detected semaID %d", ring->semaID); } ring->mpeg = 0; // This isn't in ver 0104, but it is in 0105. if (mpegLibVersion >= 0x0105) ring->gp = __KernelGetModuleGP(__KernelGetCurThreadModuleId()); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static u32 MpegRequiredMem() { @@ -460,11 +460,11 @@ static u32 MpegRequiredMem() { static u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr, u32 frameWidth, u32 mode, u32 ddrTop) { if (!Memory::IsValidAddress(mpegAddr)) { - return hleLogWarning(Log::ME, -1, "invalid addresses"); + return hleLogWarning(Log::Mpeg, -1, "invalid addresses"); } if (size < MpegRequiredMem()) { - return hleLogWarning(Log::ME, SCE_MPEG_ERROR_NO_MEMORY); + return hleLogWarning(Log::Mpeg, SCE_MPEG_ERROR_NO_MEMORY); } auto ringbuffer = PSPPointer::Create(ringbufferAddr); @@ -520,41 +520,41 @@ static u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr ctx->isAnalyzed = false; ctx->mediaengine = new MediaEngine(); - return hleDelayResult(hleLogInfo(Log::ME, 0), "mpeg create", 29000); + return hleDelayResult(hleLogInfo(Log::Mpeg, 0), "mpeg create", 29000); } static int sceMpegDelete(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } delete ctx; g_mpegCtxs.erase(Memory::Read_U32(mpeg)); - return hleDelayResult(hleLogDebug(Log::ME, 0), "mpeg delete", 40000); + return hleDelayResult(hleLogDebug(Log::Mpeg, 0), "mpeg delete", 40000); } static int sceMpegAvcDecodeMode(u32 mpeg, u32 modeAddr) { if (!Memory::IsValidAddress(modeAddr)) { - return hleLogWarning(Log::ME, -1, "invalid addresses"); + return hleLogWarning(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } - DEBUG_LOG(Log::ME, "sceMpegAvcDecodeMode(%08x, %08x)", mpeg, modeAddr); + DEBUG_LOG(Log::Mpeg, "sceMpegAvcDecodeMode(%08x, %08x)", mpeg, modeAddr); int mode = Memory::Read_U32(modeAddr); int pixelMode = Memory::Read_U32(modeAddr + 4); if (pixelMode >= GE_CMODE_16BIT_BGR5650 && pixelMode <= GE_CMODE_32BIT_ABGR8888) { ctx->videoPixelMode = pixelMode; } else { - ERROR_LOG(Log::ME, "sceMpegAvcDecodeMode(%i, %i): unknown pixelMode ", mode, pixelMode); + ERROR_LOG(Log::Mpeg, "sceMpegAvcDecodeMode(%i, %i): unknown pixelMode ", mode, pixelMode); } return hleNoLog(0); } @@ -562,12 +562,12 @@ static int sceMpegAvcDecodeMode(u32 mpeg, u32 modeAddr) static int sceMpegQueryStreamOffset(u32 mpeg, u32 bufferAddr, u32 offsetAddr) { if (!Memory::IsValidAddress(bufferAddr) || !Memory::IsValidAddress(offsetAddr)) { - return hleLogWarning(Log::ME, -1, "invalid addresses"); + return hleLogWarning(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } // Kinda destructive, no? Shouldn't this just do what sceMpegQueryStreamSize does? @@ -575,23 +575,23 @@ static int sceMpegQueryStreamOffset(u32 mpeg, u32 bufferAddr, u32 offsetAddr) if (ctx->mpegMagic != PSMF_MAGIC) { Memory::WriteUnchecked_U32(0, offsetAddr); - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "Bad PSMF magic"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "Bad PSMF magic"); } else if (ctx->mpegVersion < 0) { Memory::WriteUnchecked_U32(0, offsetAddr); - return hleLogError(Log::ME, SCE_MPEG_ERROR_BAD_VERSION, "Bad version"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_BAD_VERSION, "Bad version"); } else if ((ctx->mpegOffset & 2047) != 0 || ctx->mpegOffset == 0) { Memory::WriteUnchecked_U32(0, offsetAddr); - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "Bad offset"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "Bad offset"); } Memory::WriteUnchecked_U32(ctx->mpegOffset, offsetAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static u32 sceMpegQueryStreamSize(u32 bufferAddr, u32 sizeAddr) { if (!Memory::IsValidAddress(bufferAddr) || !Memory::IsValidAddress(sizeAddr)) { - return hleLogWarning(Log::ME, -1, "invalid addresses"); + return hleLogWarning(Log::Mpeg, -1, "invalid addresses"); } MpegContext ctx; @@ -602,21 +602,21 @@ static u32 sceMpegQueryStreamSize(u32 bufferAddr, u32 sizeAddr) if (ctx.mpegMagic != PSMF_MAGIC) { Memory::WriteUnchecked_U32(0, sizeAddr); - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "Bad PSMF magic"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "Bad PSMF magic"); } else if ((ctx.mpegOffset & 2047) != 0 ) { Memory::WriteUnchecked_U32(0, sizeAddr); - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "Bad offset %08x", ctx.mpegOffset); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "Bad offset %08x", ctx.mpegOffset); } Memory::WriteUnchecked_U32(ctx.mpegStreamSize, sizeAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } switch (streamType) { @@ -639,7 +639,7 @@ static int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum) ctx->dataRegistered = true; break; default : - DEBUG_LOG(Log::ME, "sceMpegRegistStream(%i) : unknown stream type", streamType); + DEBUG_LOG(Log::Mpeg, "sceMpegRegistStream(%i) : unknown stream type", streamType); break; } // ... @@ -650,43 +650,43 @@ static int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum) info.sid = sid; info.needsReset = true; ctx->streamMap[sid] = info; - return hleLogInfo(Log::ME, sid); + return hleLogInfo(Log::Mpeg, sid); } static int sceMpegMallocAvcEsBuf(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } // Doesn't actually malloc, just keeps track of a couple of flags for (int i = 0; i < MPEG_DATA_ES_BUFFERS; i++) { if (!ctx->esBuffers[i]) { ctx->esBuffers[i] = true; - return hleLogDebug(Log::ME, i + 1); + return hleLogDebug(Log::Mpeg, i + 1); } } // No es buffer - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static int sceMpegFreeAvcEsBuf(u32 mpeg, int esBuf) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } if (esBuf == 0) { - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE); } if (esBuf >= 1 && esBuf <= MPEG_DATA_ES_BUFFERS) { // TODO: Check if it's already been free'd? ctx->esBuffers[esBuf - 1] = false; } - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } // check the existence of pmp media context @@ -721,14 +721,14 @@ static bool InitPmp(MpegContext * ctx){ // Create H264 video codec AVCodec * pmp_Codec = avcodec_find_decoder(AV_CODEC_ID_H264); if (pmp_Codec == NULL){ - ERROR_LOG(Log::ME, "Can not find H264 codec, please update ffmpeg"); + ERROR_LOG(Log::Mpeg, "Can not find H264 codec, please update ffmpeg"); return false; } // Create CodecContext AVCodecContext * pmp_CodecCtx = avcodec_alloc_context3(pmp_Codec); if (pmp_CodecCtx == NULL){ - ERROR_LOG(Log::ME, "Can not allocate pmp Codec Context"); + ERROR_LOG(Log::Mpeg, "Can not allocate pmp Codec Context"); return false; } @@ -746,7 +746,7 @@ static bool InitPmp(MpegContext * ctx){ // Open pmp video codec if (avcodec_open2(pmp_CodecCtx, pmp_Codec, NULL) < 0){ - ERROR_LOG(Log::ME, "Can not open pmp video codec"); + ERROR_LOG(Log::Mpeg, "Can not open pmp video codec"); return false; } @@ -870,7 +870,7 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA if (isContextExist(pmpctxAddr) == false){ bool ret = InitPmp(ctx); if (!ret){ - ERROR_LOG(Log::ME, "Pmp video initialization failed"); + ERROR_LOG(Log::Mpeg, "Pmp video initialization failed"); return false; } // add the initialized context into ContextList @@ -939,7 +939,7 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA #else int len = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, &packet); #endif - DEBUG_LOG(Log::ME, "got_picture %d", got_picture); + DEBUG_LOG(Log::Mpeg, "got_picture %d", got_picture); if (got_picture){ SwsContext *img_convert_ctx = NULL; img_convert_ctx = sws_getContext( @@ -953,7 +953,7 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA NULL, NULL, NULL); if (!img_convert_ctx) { - ERROR_LOG(Log::ME, "Cannot initialize sws conversion context"); + ERROR_LOG(Log::Mpeg, "Cannot initialize sws conversion context"); return false; } @@ -961,7 +961,7 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA int swsRet = sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize); if (swsRet < 0){ - ERROR_LOG(Log::ME, "sws_scale: Error while converting %d", swsRet); + ERROR_LOG(Log::Mpeg, "sws_scale: Error while converting %d", swsRet); return false; } // free sws context @@ -1046,7 +1046,7 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } if (frameWidth == 0) { // wtf, go sudoku passes in 0xcccccccc @@ -1062,22 +1062,22 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { - return hleLogError(Log::ME, -1, "Bogus mpegringbufferaddr"); + return hleLogError(Log::Mpeg, -1, "Bogus mpegringbufferaddr"); } u32 buffer = Memory::Read_U32(bufferAddr); u32 init = Memory::Read_U32(initAddr); - DEBUG_LOG(Log::ME, "video: bufferAddr = %08x, *buffer = %08x, *init = %08x", bufferAddr, buffer, init); + DEBUG_LOG(Log::Mpeg, "video: bufferAddr = %08x, *buffer = %08x, *init = %08x", bufferAddr, buffer, init); // check and decode pmp video bool ispmp = false; if (decodePmpVideo(ringbuffer, mpeg)){ - DEBUG_LOG(Log::ME, "Using ffmpeg to decode pmp video"); + DEBUG_LOG(Log::Mpeg, "Using ffmpeg to decode pmp video"); ispmp = true; } if (ringbuffer->packetsRead == 0 || ctx->mediaengine->IsVideoEnd()) { - return hleDelayResult(hleLogWarning(Log::ME, SCE_MPEG_ERROR_AVC_DECODE_FATAL, "mpeg buffer empty"), "mpeg buffer empty", avcEmptyDelayMs); + return hleDelayResult(hleLogWarning(Log::Mpeg, SCE_MPEG_ERROR_AVC_DECODE_FATAL, "mpeg buffer empty"), "mpeg buffer empty", avcEmptyDelayMs); } s32 beforeAvail = ringbuffer->packets - ctx->mediaengine->getRemainSize() / 2048; @@ -1135,9 +1135,9 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr ctx->avc.avcDecodeResult = MPEG_AVC_DECODE_SUCCESS; if (ctx->videoFrameCount <= 1) { - return hleDelayResult(hleLogDebug(Log::ME, 0), "mpeg decode", accumDelay + avcFirstDelayMs); + return hleDelayResult(hleLogDebug(Log::Mpeg, 0), "mpeg decode", accumDelay + avcFirstDelayMs); } else { - return hleDelayResult(hleLogDebug(Log::ME, 0), "mpeg decode", accumDelay + avcDecodeDelayMs); + return hleDelayResult(hleLogDebug(Log::Mpeg, 0), "mpeg decode", accumDelay + avcDecodeDelayMs); } //hleEatMicro(3300); //return hleDelayResult(0, "mpeg decode", 200); @@ -1145,23 +1145,23 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr static u32 sceMpegAvcDecodeStop(u32 mpeg, u32 frameWidth, u32 bufferAddr, u32 statusAddr) { if (!Memory::IsValidAddress(bufferAddr) || !Memory::IsValidAddress(statusAddr)) { - return hleLogError(Log::ME, -1, "invalid addresses"); + return hleLogError(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } // No last frame generated Memory::Write_U32(0, statusAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static u32 sceMpegUnRegistStream(u32 mpeg, int streamUid) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } StreamInfo info = {0}; @@ -1181,7 +1181,7 @@ static u32 sceMpegUnRegistStream(u32 mpeg, int streamUid) { ctx->dataRegistered = false; break; default : - DEBUG_LOG(Log::ME, "sceMpegUnRegistStream(%i) : unknown streamID ", streamUid); + DEBUG_LOG(Log::Mpeg, "sceMpegUnRegistStream(%i) : unknown streamID ", streamUid); break; } ctx->streamMap[streamUid] = info; @@ -1194,12 +1194,12 @@ static u32 sceMpegUnRegistStream(u32 mpeg, int streamUid) { static int sceMpegAvcDecodeDetail(u32 mpeg, u32 detailAddr) { if (!Memory::IsValidAddress(detailAddr)) { - return hleLogError(Log::ME, -1, "invalid addresses"); + return hleLogError(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } Memory::Write_U32(ctx->avc.avcDecodeResult, detailAddr + 0); @@ -1211,20 +1211,20 @@ static int sceMpegAvcDecodeDetail(u32 mpeg, u32 detailAddr) { Memory::Write_U32(0, detailAddr + 24); Memory::Write_U32(0, detailAddr + 28); Memory::Write_U32(ctx->avc.avcFrameStatus, detailAddr + 32); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static u32 sceMpegAvcDecodeStopYCbCr(u32 mpeg, u32 bufferAddr, u32 statusAddr) { if (!Memory::IsValidAddress(bufferAddr) || !Memory::IsValidAddress(statusAddr)) { - return hleLogError(Log::ME, -1, "UNIMPL + invalid addresses"); + return hleLogError(Log::Mpeg, -1, "UNIMPL + invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL + bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL + bad mpeg handle"); } - ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcDecodeStopYCbCr(%08x, %08x, %08x)", mpeg, bufferAddr, statusAddr); + ERROR_LOG(Log::Mpeg, "UNIMPL sceMpegAvcDecodeStopYCbCr(%08x, %08x, %08x)", mpeg, bufferAddr, statusAddr); Memory::Write_U32(0, statusAddr); return hleNoLog(0); } @@ -1233,7 +1233,7 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } SceMpegAu avcAu; @@ -1241,11 +1241,11 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { - return hleLogError(Log::ME, -1, "Bogus mpegringbufferaddr"); + return hleLogError(Log::Mpeg, -1, "Bogus mpegringbufferaddr"); } if (ringbuffer->packetsRead == 0 || ctx->mediaengine->IsVideoEnd()) { - return hleDelayResult(hleLogWarning(Log::ME, SCE_MPEG_ERROR_AVC_DECODE_FATAL, "mpeg buffer empty"), "mpeg buffer empty", avcEmptyDelayMs); + return hleDelayResult(hleLogWarning(Log::Mpeg, SCE_MPEG_ERROR_AVC_DECODE_FATAL, "mpeg buffer empty"), "mpeg buffer empty", avcEmptyDelayMs); } s32 beforeAvail = ringbuffer->packets - ctx->mediaengine->getRemainSize() / 2048; @@ -1255,7 +1255,7 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA u32 buffer = Memory::Read_U32(bufferAddr); u32 init = Memory::Read_U32(initAddr); - DEBUG_LOG(Log::ME, "*buffer = %08x, *init = %08x", buffer, init); + DEBUG_LOG(Log::Mpeg, "*buffer = %08x, *init = %08x", buffer, init); if (ctx->mediaengine->stepVideo(ctx->videoPixelMode)) { // Don't draw here, we'll draw in the Csc func. @@ -1288,9 +1288,9 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA ctx->avc.avcDecodeResult = MPEG_AVC_DECODE_SUCCESS; if (ctx->videoFrameCount <= 1) - return hleDelayResult(hleLogDebug(Log::ME, 0), "mpeg decode", avcFirstDelayMs); + return hleDelayResult(hleLogDebug(Log::Mpeg, 0), "mpeg decode", avcFirstDelayMs); else - return hleDelayResult(hleLogDebug(Log::ME, 0), "mpeg decode", avcDecodeDelayMs); + return hleDelayResult(hleLogDebug(Log::Mpeg, 0), "mpeg decode", avcDecodeDelayMs); //hleEatMicro(3300); //return hleDelayResult(0, "mpeg decode", 200); @@ -1299,19 +1299,19 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA static u32 sceMpegAvcDecodeFlush(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL + bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL + bad mpeg handle"); } if ( ctx->videoFrameCount > 0 || ctx->audioFrameCount > 0) { //__MpegFinish(); } - return hleLogWarning(Log::ME, 0, "UNIMPL"); + return hleLogWarning(Log::Mpeg, 0, "UNIMPL"); } static int sceMpegInitAu(u32 mpeg, u32 bufferAddr, u32 auPointer) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } SceMpegAu sceAu; @@ -1338,33 +1338,33 @@ static int sceMpegInitAu(u32 mpeg, u32 bufferAddr, u32 auPointer) { sceAu.write(auPointer); } - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static int sceMpegQueryAtracEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) { if (!Memory::IsValidAddress(esSizeAddr) || !Memory::IsValidAddress(outSizeAddr)) { - return hleLogError(Log::ME, -1, "invalid addresses"); + return hleLogError(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } Memory::Write_U32(MPEG_ATRAC_ES_SIZE, esSizeAddr); Memory::Write_U32(MPEG_ATRAC_ES_OUTPUT_SIZE, outSizeAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static int sceMpegRingbufferAvailableSize(u32 ringbufferAddr) { auto ringbuffer = PSPPointer::Create(ringbufferAddr); if (!ringbuffer.IsValid()) { - return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "invalid ringbuffer, should crash"); + return hleLogError(Log::Mpeg, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "invalid ringbuffer, should crash"); } MpegContext *ctx = getMpegCtx(ringbuffer->mpeg); if (!ctx) { - return hleLogError(Log::ME, SCE_MPEG_ERROR_NOT_YET_INIT, "bad mpeg handle"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_NOT_YET_INIT, "bad mpeg handle"); } ctx->mpegRingbufferAddr = ringbufferAddr; @@ -1373,10 +1373,10 @@ static int sceMpegRingbufferAvailableSize(u32 ringbufferAddr) { static int lastAvail = 0; if (lastAvail != ringbuffer->packetsAvail) { - DEBUG_LOG(Log::ME, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer->packets - ringbuffer->packetsAvail, ringbufferAddr); + DEBUG_LOG(Log::Mpeg, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer->packets - ringbuffer->packetsAvail, ringbufferAddr); lastAvail = ringbuffer->packetsAvail; } else { - VERBOSE_LOG(Log::ME, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer->packets - ringbuffer->packetsAvail, ringbufferAddr); + VERBOSE_LOG(Log::Mpeg, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer->packets - ringbuffer->packetsAvail, ringbufferAddr); } return hleNoLog(ringbuffer->packets - ringbuffer->packetsAvail); } @@ -1411,7 +1411,7 @@ void PostPutAction::run(MipsCall &call) { if (invalid) { // Bail out early - don't accept any of the packets, even the good ones. // This happens during legit playback at the Burnout Legends menu! - ERROR_LOG(Log::ME, "sceMpegRingbufferPut(): invalid mpeg data"); + ERROR_LOG(Log::Mpeg, "sceMpegRingbufferPut(): invalid mpeg data"); call.setReturnValue(SCE_MPEG_ERROR_INVALID_VALUE); if (mpegLibVersion <= 0x0103) { @@ -1430,20 +1430,20 @@ void PostPutAction::run(MipsCall &call) { } if (packetsAddedThisRound > 0) { if (packetsAddedThisRound > ringbuffer->packets - ringbuffer->packetsAvail) { - WARN_LOG(Log::ME, "sceMpegRingbufferPut clamping packetsAdded old=%i new=%i", packetsAddedThisRound, ringbuffer->packets - ringbuffer->packetsAvail); + WARN_LOG(Log::Mpeg, "sceMpegRingbufferPut clamping packetsAdded old=%i new=%i", packetsAddedThisRound, ringbuffer->packets - ringbuffer->packetsAvail); packetsAddedThisRound = ringbuffer->packets - ringbuffer->packetsAvail; } const u8 *data = Memory::GetPointer(ringbuffer->data + writeOffset * 2048); uint32_t dataSize = Memory::ValidSize(ringbuffer->data + writeOffset * 2048, packetsAddedThisRound * 2048); int actuallyAdded = ctx->mediaengine == NULL ? 8 : ctx->mediaengine->addStreamData(data, dataSize) / 2048; if (actuallyAdded != packetsAddedThisRound) { - WARN_LOG_REPORT(Log::ME, "sceMpegRingbufferPut(): unable to enqueue all added packets, going to overwrite some frames."); + WARN_LOG_REPORT(Log::Mpeg, "sceMpegRingbufferPut(): unable to enqueue all added packets, going to overwrite some frames."); } ringbuffer->packetsRead += packetsAddedThisRound; ringbuffer->packetsWritePos += packetsAddedThisRound; ringbuffer->packetsAvail += packetsAddedThisRound; } - DEBUG_LOG(Log::ME, "packetAdded: %i packetsRead: %i packetsTotal: %i", packetsAddedThisRound, ringbuffer->packetsRead, ringbuffer->packets); + DEBUG_LOG(Log::Mpeg, "packetAdded: %i packetsRead: %i packetsTotal: %i", packetsAddedThisRound, ringbuffer->packetsRead, ringbuffer->packets); if (packetsAddedThisRound < 0 && ringbufferPutPacketsAdded == 0) { // Return an error. @@ -1460,7 +1460,7 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl auto ringbuffer = PSPPointer::Create(ringbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior. - return hleLogError(Log::ME, -1, "invalid ringbuffer address"); + return hleLogError(Log::Mpeg, -1, "invalid ringbuffer address"); } numPackets = std::min(numPackets, available); @@ -1468,17 +1468,17 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl // Seems still need to check actual available, Patapon 3 for example. numPackets = std::min(numPackets, ringbuffer->packets - ringbuffer->packetsAvail); if (numPackets <= 0) { - return hleLogDebug(Log::ME, 0, "no packets to enqueue"); + return hleLogDebug(Log::Mpeg, 0, "no packets to enqueue"); } MpegContext *ctx = getMpegCtx(ringbuffer->mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle %08x", ringbuffer->mpeg); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle %08x", ringbuffer->mpeg); } ringbufferPutPacketsAdded = 0; // Execute callback function as a direct MipsCall, no blocking here so no messing around with wait states etc if (ringbuffer->callback_addr != 0) { - DEBUG_LOG(Log::ME, "sceMpegRingbufferPut(%08x, %i, %i)", ringbufferAddr, numPackets, available); + DEBUG_LOG(Log::Mpeg, "sceMpegRingbufferPut(%08x, %i, %i)", ringbufferAddr, numPackets, available); // Call this multiple times until we get numPackets. // Normally this would be if it did not read enough, but also if available > packets. @@ -1499,7 +1499,7 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl break; } } else { - ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferPut: callback_addr zero"); + ERROR_LOG_REPORT(Log::Mpeg, "sceMpegRingbufferPut: callback_addr zero"); } return hleNoLog(0); } @@ -1508,19 +1508,19 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogError(Log::ME, -1, "bad mpeg handle"); + return hleLogError(Log::Mpeg, -1, "bad mpeg handle"); } auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior. - return hleLogError(Log::ME, -1, "invalid ringbuffer address"); + return hleLogError(Log::Mpeg, -1, "invalid ringbuffer address"); } if (PSP_CoreParameter().compat.flags().MpegAvcWarmUp) { if (ctx->mpegwarmUp == 0) { ctx->mpegwarmUp++; - return hleLogDebug(Log::ME, SCE_MPEG_ERROR_NO_DATA, "warming up (%d)", ctx->mpegwarmUp); + return hleLogDebug(Log::Mpeg, SCE_MPEG_ERROR_NO_DATA, "warming up (%d)", ctx->mpegwarmUp); } } @@ -1532,12 +1532,12 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) avcAu.dts = -1; avcAu.write(auAddr); // TODO: Does this really reschedule? - return hleDelayResult(hleLogDebug(Log::ME, SCE_MPEG_ERROR_NO_DATA), "mpeg get avc", mpegDecodeErrorDelayMs); + return hleDelayResult(hleLogDebug(Log::Mpeg, SCE_MPEG_ERROR_NO_DATA), "mpeg get avc", mpegDecodeErrorDelayMs); } auto streamInfo = ctx->streamMap.find(streamId); if (streamInfo == ctx->streamMap.end()) { - return hleLogWarning(Log::ME, -1, "invalid video stream %08x", streamId); + return hleLogWarning(Log::Mpeg, -1, "invalid video stream %08x", streamId); } if (streamInfo->second.needsReset) { @@ -1552,7 +1552,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) /*// Wait for audio if too much ahead if (ctx->atracRegistered && (ctx->mediaengine->getVideoTimeStamp() > ctx->mediaengine->getAudioTimeStamp() + getMaxAheadTimestamp(mpegRingbuffer))) { - ERROR_LOG(Log::ME, "sceMpegGetAvcAu - video too much ahead"); + ERROR_LOG(Log::Mpeg, "sceMpegGetAvcAu - video too much ahead"); // TODO: Does this really reschedule? return hleDelayResult(SCE_MPEG_ERROR_NO_DATA, "mpeg get avc", mpegDecodeErrorDelayMs); }*/ @@ -1563,7 +1563,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) avcAu.dts = avcAu.pts - videoTimestampStep; if (ctx->mediaengine->IsVideoEnd()) { - INFO_LOG(Log::ME, "video end reach. pts: %i dts: %i", (int)avcAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); + INFO_LOG(Log::Mpeg, "video end reach. pts: %i dts: %i", (int)avcAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); ringbuffer->packetsAvail = 0; result = SCE_MPEG_ERROR_NO_DATA; @@ -1579,39 +1579,39 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) // TODO: sceMpegGetAvcAu seems to modify esSize, and delay when it's > 1000 or something. // There's definitely more to it, but ultimately it seems games should expect it to delay randomly. - return hleDelayResult(hleLogDebug(Log::ME, result), "mpeg get avc", 100); + return hleDelayResult(hleLogDebug(Log::Mpeg, result), "mpeg get avc", 100); } static u32 sceMpegFinish() { if (!isMpegInit) { - WARN_LOG(Log::ME, "sceMpegFinish(...): not initialized"); + WARN_LOG(Log::Mpeg, "sceMpegFinish(...): not initialized"); // TODO: Need to properly hook module load/unload for this to work right. //return SCE_MPEG_ERROR_NOT_YET_INIT; } else { - INFO_LOG(Log::ME, "sceMpegFinish()"); + INFO_LOG(Log::Mpeg, "sceMpegFinish()"); __VideoPmpShutdown(); } isMpegInit = false; //__MpegFinish(); - return hleDelayResult(hleLogDebug(Log::ME, 0), "mpeg finish", 250); + return hleDelayResult(hleLogDebug(Log::Mpeg, 0), "mpeg finish", 250); } static u32 sceMpegQueryMemSize() { - return hleLogDebug(Log::ME, MpegRequiredMem()); + return hleLogDebug(Log::Mpeg, MpegRequiredMem()); } static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior. - return hleLogWarning(Log::ME, -1, "invalid ringbuffer address"); + return hleLogWarning(Log::Mpeg, -1, "invalid ringbuffer address"); } SceMpegAu atracAu; @@ -1623,14 +1623,14 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) streamInfo->second.needsReset = false; } if (streamInfo == ctx->streamMap.end()) { - WARN_LOG_REPORT(Log::ME, "sceMpegGetAtracAu: invalid audio stream %08x", streamId); + WARN_LOG_REPORT(Log::Mpeg, "sceMpegGetAtracAu: invalid audio stream %08x", streamId); // TODO: Why was this changed to not return an error? } // The audio can end earlier than the video does. if (ringbuffer->packetsAvail == 0) { // TODO: Does this really delay? - return hleDelayResult(hleLogDebug(Log::ME, SCE_MPEG_ERROR_NO_DATA), "mpeg get atrac", mpegDecodeErrorDelayMs); + return hleDelayResult(hleLogDebug(Log::Mpeg, SCE_MPEG_ERROR_NO_DATA), "mpeg get atrac", mpegDecodeErrorDelayMs); } // esBuffer is the memory where this au data goes. We don't write the data to memory. @@ -1644,17 +1644,17 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) atracAu.pts = ctx->mediaengine->getAudioTimeStamp() + ctx->mpegFirstTimestamp; if (ctx->mediaengine->IsVideoEnd()) { - INFO_LOG(Log::ME, "video end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); + INFO_LOG(Log::Mpeg, "video end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); ringbuffer->packetsAvail = 0; // TODO: Is this correct? if (!ctx->mediaengine->IsNoAudioData()) { - WARN_LOG_REPORT(Log::ME, "Video end without audio end, potentially skipping some audio?"); + WARN_LOG_REPORT(Log::Mpeg, "Video end without audio end, potentially skipping some audio?"); } result = SCE_MPEG_ERROR_NO_DATA; } if (ctx->atracRegistered && ctx->mediaengine->IsNoAudioData() && !ctx->endOfAudioReached) { - WARN_LOG(Log::ME, "Audio end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); + WARN_LOG(Log::Mpeg, "Audio end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); ctx->endOfAudioReached = true; } if (ctx->mediaengine->IsNoAudioData()) { @@ -1669,23 +1669,23 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) } // TODO: Not clear on exactly when this delays. - return hleDelayResult(hleLogDebug(Log::ME, result), "mpeg get atrac", 100); + return hleDelayResult(hleLogDebug(Log::Mpeg, result), "mpeg get atrac", 100); } static int sceMpegQueryPcmEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) { if (!Memory::IsValidAddress(esSizeAddr) || !Memory::IsValidAddress(outSizeAddr)) { - return hleLogError(Log::ME, -1, "invalid addresses"); + return hleLogError(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } Memory::Write_U32(MPEG_PCM_ES_SIZE, esSizeAddr); Memory::Write_U32(MPEG_PCM_ES_OUTPUT_SIZE, outSizeAddr); - return hleLogError(Log::ME, 0, "UNIMPL"); + return hleLogError(Log::Mpeg, 0, "UNIMPL"); } @@ -1693,18 +1693,18 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "bad mpeg handle"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "bad mpeg handle"); } if (mode != MPEG_AU_MODE_DECODE && mode != MPEG_AU_MODE_SKIP) { - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "UNIMPL / bad mode"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "UNIMPL / bad mode"); } auto stream = ctx->streamMap.find(streamUid); if (stream == ctx->streamMap.end()) { - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "UNIMPL / unknown streamID"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "UNIMPL / unknown streamID"); } else { StreamInfo &info = stream->second; - DEBUG_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): changing type=%d", mpeg, streamUid, mode, info.type); + DEBUG_LOG(Log::Mpeg, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): changing type=%d", mpeg, streamUid, mode, info.type); switch (info.type) { case MPEG_AVC_STREAM: if (mode == MPEG_AU_MODE_DECODE) { @@ -1729,7 +1729,7 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) } break; default: - ERROR_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); + ERROR_LOG(Log::Mpeg, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); break; } } @@ -1738,15 +1738,15 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) static u32 sceMpegChangeGetAvcAuMode(u32 mpeg, u32 stream_addr, int mode) { if (!Memory::IsValidAddress(stream_addr)) { - return hleLogError(Log::ME, -1, "invalid addresses"); + return hleLogError(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL + bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL + bad mpeg handle"); } - ERROR_LOG_REPORT_ONCE(mpegChangeAvcAu, Log::ME, "UNIMPL sceMpegChangeGetAvcAuMode(%08x, %08x, %i)", mpeg, stream_addr, mode); + ERROR_LOG_REPORT_ONCE(mpegChangeAvcAu, Log::Mpeg, "UNIMPL sceMpegChangeGetAvcAuMode(%08x, %08x, %i)", mpeg, stream_addr, mode); return 0; } @@ -1754,22 +1754,22 @@ static u32 sceMpegGetPcmAu(u32 mpeg, int streamUid, u32 auAddr, u32 attrAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior - return hleLogWarning(Log::ME, -1, "invalid ringbuffer address"); + return hleLogWarning(Log::Mpeg, -1, "invalid ringbuffer address"); } if (!Memory::IsValidAddress(streamUid)) { - return hleLogWarning(Log::ME, SCE_MPEG_ERROR_INVALID_ADDR, "didn't get a fake stream, bad streamUid address"); + return hleLogWarning(Log::Mpeg, SCE_MPEG_ERROR_INVALID_ADDR, "didn't get a fake stream, bad streamUid address"); } SceMpegAu atracAu; atracAu.read(auAddr); auto streamInfo = ctx->streamMap.find(streamUid); if (streamInfo == ctx->streamMap.end()) { - return hleLogWarning(Log::ME, -1, "bad streamUid "); + return hleLogWarning(Log::Mpeg, -1, "bad streamUid "); } atracAu.write(auAddr); @@ -1778,7 +1778,7 @@ static u32 sceMpegGetPcmAu(u32 mpeg, int streamUid, u32 auAddr, u32 attrAddr) if (Memory::IsValidAddress(attrAddr)) Memory::WriteUnchecked_U32(attr, attrAddr); - ERROR_LOG_REPORT_ONCE(mpegPcmAu, Log::ME, "UNIMPL sceMpegGetPcmAu(%08x, %i, %08x, %08x)", mpeg, streamUid, auAddr, attrAddr); + ERROR_LOG_REPORT_ONCE(mpegPcmAu, Log::Mpeg, "UNIMPL sceMpegGetPcmAu(%08x, %i, %08x, %08x)", mpeg, streamUid, auAddr, attrAddr); return hleNoLog(0); } @@ -1787,14 +1787,14 @@ static int __MpegRingbufferQueryPackNum(u32 memorySize) { } static int sceMpegRingbufferQueryPackNum(u32 memorySize) { - DEBUG_LOG(Log::ME, "sceMpegRingbufferQueryPackNum(%i)", memorySize); + DEBUG_LOG(Log::Mpeg, "sceMpegRingbufferQueryPackNum(%i)", memorySize); return __MpegRingbufferQueryPackNum(memorySize); } static u32 sceMpegFlushAllStream(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL + bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL + bad mpeg handle"); } ctx->isAnalyzed = false; @@ -1806,47 +1806,47 @@ static u32 sceMpegFlushAllStream(u32 mpeg) { ringbuffer->packetsWritePos = 0; } - return hleLogWarning(Log::ME, 0, "UNIMPL"); + return hleLogWarning(Log::Mpeg, 0, "UNIMPL"); } static u32 sceMpegFlushStream(u32 mpeg, int stream_addr) { if (!Memory::IsValidAddress(stream_addr)) { - return hleLogError(Log::ME, -1, "UNIMPL / invalid addresses"); + return hleLogError(Log::Mpeg, -1, "UNIMPL / invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); return -1; } //__MpegFinish(); - return hleLogError(Log::ME, 0, "UNIMPL"); + return hleLogError(Log::Mpeg, 0, "UNIMPL"); } static u32 sceMpegAvcCopyYCbCr(u32 mpeg, u32 sourceAddr, u32 YCbCrAddr) { if (!Memory::IsValidAddress(sourceAddr) || !Memory::IsValidAddress(YCbCrAddr)) { - return hleLogError(Log::ME, -1, "UNIMPL / invalid address(es)"); + return hleLogError(Log::Mpeg, -1, "UNIMPL / invalid address(es)"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogError(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogError(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } // This is very common. - return hleLogDebug(Log::ME, 0, "UNIMPL"); + return hleLogDebug(Log::Mpeg, 0, "UNIMPL"); } static u32 sceMpegAtracDecode(u32 mpeg, u32 auAddr, u32 bufferAddr, int init) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } if (!Memory::IsValidAddress(bufferAddr)) { - return hleLogWarning(Log::ME, -1, "invalid addresses"); + return hleLogWarning(Log::Mpeg, -1, "invalid addresses"); } SceMpegAu atracAu; @@ -1861,7 +1861,7 @@ static u32 sceMpegAtracDecode(u32 mpeg, u32 auAddr, u32 bufferAddr, int init) atracAu.write(auAddr); - return hleDelayResult(hleLogDebug(Log::ME, 0), "mpeg atrac decode", atracDecodeDelayMs); + return hleDelayResult(hleLogDebug(Log::Mpeg, 0), "mpeg atrac decode", atracDecodeDelayMs); //hleEatMicro(4000); //return hleDelayResult(0, "mpeg atrac decode", 200); } @@ -1870,12 +1870,12 @@ static u32 sceMpegAtracDecode(u32 mpeg, u32 auAddr, u32 bufferAddr, int init) static u32 sceMpegAvcCsc(u32 mpeg, u32 sourceAddr, u32 rangeAddr, int frameWidth, u32 destAddr) { if (!Memory::IsValidAddress(sourceAddr) || !Memory::IsValidAddress(rangeAddr) || !Memory::IsValidAddress(destAddr)) { - return hleLogError(Log::ME, -1, "invalid addresses"); + return hleLogError(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } if (frameWidth == 0) { @@ -1892,7 +1892,7 @@ static u32 sceMpegAvcCsc(u32 mpeg, u32 sourceAddr, u32 rangeAddr, int frameWidth int height = Memory::Read_U32(rangeAddr + 12); if (x < 0 || y < 0 || width < 0 || height < 0) { - WARN_LOG(Log::ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x) returning ERROR_INVALID_VALUE", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); + WARN_LOG(Log::Mpeg, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x) returning ERROR_INVALID_VALUE", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); return SCE_KERNEL_ERROR_INVALID_VALUE; } @@ -1905,52 +1905,52 @@ static u32 sceMpegAvcCsc(u32 mpeg, u32 sourceAddr, u32 rangeAddr, int frameWidth // If do not use DelayResult,Wil cause flickering in Dengeki no Pilot: Tenkuu no Kizuna // https://github.com/hrydgard/ppsspp/issues/7549 - return hleDelayResult(hleLogDebug(Log::ME, 0), "mpeg avc csc", avcCscDelayMs); + return hleDelayResult(hleLogDebug(Log::Mpeg, 0), "mpeg avc csc", avcCscDelayMs); } static u32 sceMpegRingbufferDestruct(u32 ringbufferAddr) { // Apparently, does nothing. - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static u32 sceMpegAvcInitYCbCr(u32 mpeg, int mode, int width, int height, u32 ycbcr_addr) { if (!Memory::IsValidAddress(ycbcr_addr)) { - return hleLogError(Log::ME, -1, "invalid addresses"); + return hleLogError(Log::Mpeg, -1, "invalid addresses"); } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } - WARN_LOG_ONCE(sceMpegAvcInitYCbCr, Log::ME, "UNIMPL sceMpegAvcInitYCbCr(%08x, %i, %i, %i, %08x)", mpeg, mode, width, height, ycbcr_addr); + WARN_LOG_ONCE(sceMpegAvcInitYCbCr, Log::Mpeg, "UNIMPL sceMpegAvcInitYCbCr(%08x, %i, %i, %i, %08x)", mpeg, mode, width, height, ycbcr_addr); return hleNoLog(0); } static int sceMpegAvcQueryYCbCrSize(u32 mpeg, u32 mode, u32 width, u32 height, u32 resultAddr) { if ((width & 15) != 0 || (height & 15) != 0 || height > 272 || width > 480) { - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "sceMpegAvcQueryYCbCrSize: bad w/h %i x %i", width, height); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "sceMpegAvcQueryYCbCrSize: bad w/h %i x %i", width, height); } int size = (width / 2) * (height / 2) * 6 + 128; if (Memory::IsValidAddress(resultAddr)) { Memory::WriteUnchecked_U32(size, resultAddr); } - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static u32 sceMpegQueryUserdataEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) { if (!Memory::IsValidAddress(esSizeAddr) || !Memory::IsValidAddress(outSizeAddr)) { - ERROR_LOG(Log::ME, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x): invalid addresses", mpeg, esSizeAddr, outSizeAddr); + ERROR_LOG(Log::Mpeg, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x): invalid addresses", mpeg, esSizeAddr, outSizeAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(Log::ME, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x): bad mpeg handle", mpeg, esSizeAddr, outSizeAddr); + WARN_LOG(Log::Mpeg, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x): bad mpeg handle", mpeg, esSizeAddr, outSizeAddr); return -1; } @@ -1958,29 +1958,29 @@ static u32 sceMpegQueryUserdataEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) Memory::WriteUnchecked_U32(MPEG_DATA_ES_SIZE, esSizeAddr); Memory::WriteUnchecked_U32(MPEG_DATA_ES_OUTPUT_SIZE, outSizeAddr); - return hleLogDebug(Log::ME, 0); + return hleLogDebug(Log::Mpeg, 0); } static u32 sceMpegAvcResourceGetAvcDecTopAddr(u32 mpeg) { // it's just a random address - return hleLogError(Log::ME, 0x12345678, "UNIMPL"); + return hleLogError(Log::Mpeg, 0x12345678, "UNIMPL"); } static u32 sceMpegAvcResourceFinish(u32 mpeg) { - return hleLogInfo(Log::ME, 0, "UNIMPL"); + return hleLogInfo(Log::Mpeg, 0, "UNIMPL"); } static u32 sceMpegAvcResourceGetAvcEsBuf(u32 mpeg) { - ERROR_LOG_REPORT_ONCE(mpegResourceEsBuf, Log::ME, "UNIMPL sceMpegAvcResourceGetAvcEsBuf(%08x)", mpeg); + ERROR_LOG_REPORT_ONCE(mpegResourceEsBuf, Log::Mpeg, "UNIMPL sceMpegAvcResourceGetAvcEsBuf(%08x)", mpeg); return hleNoLog(0); } static u32 sceMpegAvcResourceInit(u32 mpeg) { if (mpeg != 1) { - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE); } - return hleLogError(Log::ME, 0, "UNIMPL"); + return hleLogError(Log::Mpeg, 0, "UNIMPL"); } // TODO: SIMD this (or rather, the caller). @@ -2023,7 +2023,7 @@ static int __MpegAvcConvertToYuv420(const void *data, u32 bufferOutputAddr, int u8 *Cr = Cb + sizeCb; if (!Y) - return hleLogError(Log::ME, 0, "Bad output buffer pointer for yuv conv: %08x", bufferOutputAddr); + return hleLogError(Log::Mpeg, 0, "Bad output buffer pointer for yuv conv: %08x", bufferOutputAddr); for (int y = 0; y < height; y += 2) { for (int x = 0; x < width; x += 2) { @@ -2051,14 +2051,14 @@ static int __MpegAvcConvertToYuv420(const void *data, u32 bufferOutputAddr, int static int sceMpegAvcConvertToYuv420(u32 mpeg, u32 bufferOutputAddr, u32 bufferAddr, int unknown2) { if (!Memory::IsValidAddress(bufferOutputAddr)) - return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "invalid addresses"); + return hleLogError(Log::Mpeg, SCE_MPEG_ERROR_INVALID_VALUE, "invalid addresses"); MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); if (ctx->mediaengine->m_buffer == 0) - return hleLogWarning(Log::ME, SCE_MPEG_ERROR_AVC_INVALID_VALUE, "m_buffer is zero"); + return hleLogWarning(Log::Mpeg, SCE_MPEG_ERROR_AVC_INVALID_VALUE, "m_buffer is zero"); const u8 *data = ctx->mediaengine->getFrameImage(); int width = ctx->mediaengine->m_desWidth; @@ -2067,13 +2067,13 @@ static int sceMpegAvcConvertToYuv420(u32 mpeg, u32 bufferOutputAddr, u32 bufferA if (data) { __MpegAvcConvertToYuv420(data, bufferOutputAddr, width, height); } - return hleLogDebug(Log::ME, (width << 16) | height); + return hleLogDebug(Log::Mpeg, (width << 16) | height); } static int sceMpegGetUserdataAu(u32 mpeg, u32 streamUid, u32 auAddr, u32 resultAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "bad mpeg handle"); } if (Memory::IsValidRange(resultAddr, 8)) { @@ -2084,76 +2084,76 @@ static int sceMpegGetUserdataAu(u32 mpeg, u32 streamUid, u32 auAddr, u32 resultA // We currently can't demux userdata so this seems like the best thing to return in the meantime.. // Then we probably shouldn't do the above writes? but it works... - return hleLogDebug(Log::ME, SCE_MPEG_ERROR_NO_DATA); + return hleLogDebug(Log::Mpeg, SCE_MPEG_ERROR_NO_DATA); } static u32 sceMpegNextAvcRpAu(u32 mpeg, u32 streamUid) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegNextAvcRpAu(%08x, %08x)", mpeg, streamUid); + ERROR_LOG_REPORT(Log::Mpeg, "UNIMPL sceMpegNextAvcRpAu(%08x, %08x)", mpeg, streamUid); return 0; } static u32 sceMpegGetAvcNalAu(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegGetAvcNalAu(%08x)", mpeg); + ERROR_LOG_REPORT(Log::Mpeg, "UNIMPL sceMpegGetAvcNalAu(%08x)", mpeg); return 0; } static u32 sceMpegAvcDecodeDetailIndex(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegAvcDecodeDetailIndex(%08x)", mpeg); + ERROR_LOG_REPORT(Log::Mpeg, "UNIMPL sceMpegAvcDecodeDetailIndex(%08x)", mpeg); return 0; } static u32 sceMpegAvcDecodeDetail2(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegAvcDecodeDetail2(%08x)", mpeg); + ERROR_LOG_REPORT(Log::Mpeg, "UNIMPL sceMpegAvcDecodeDetail2(%08x)", mpeg); return 0; } static u32 sceMpegGetAvcEsAu(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegGetAvcEsAu(%08x)", mpeg); + ERROR_LOG_REPORT(Log::Mpeg, "UNIMPL sceMpegGetAvcEsAu(%08x)", mpeg); return 0; } static u32 sceMpegAvcCscInfo(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegAvcCscInfo(%08x)", mpeg); + ERROR_LOG_REPORT(Log::Mpeg, "UNIMPL sceMpegAvcCscInfo(%08x)", mpeg); return 0; } static u32 sceMpegAvcCscMode(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegAvcCscMode(%08x)", mpeg); + ERROR_LOG_REPORT(Log::Mpeg, "UNIMPL sceMpegAvcCscMode(%08x)", mpeg); return 0; } @@ -2161,10 +2161,10 @@ static u32 sceMpegFlushAu(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - return hleLogWarning(Log::ME, -1, "UNIMPL / bad mpeg handle"); + return hleLogWarning(Log::Mpeg, -1, "UNIMPL / bad mpeg handle"); } - ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegFlushAu(%08x)", mpeg); + ERROR_LOG_REPORT(Log::Mpeg, "UNIMPL sceMpegFlushAu(%08x)", mpeg); return 0; } @@ -2254,7 +2254,7 @@ static u32 sceMpegBasePESpacketCopy(u32 p) ++lli; } - DEBUG_LOG(Log::ME, "sceMpegBasePESpacketCopy(%08x), received %d block(s)", pmp_videoSource, pmp_nBlocks); + DEBUG_LOG(Log::Mpeg, "sceMpegBasePESpacketCopy(%08x), received %d block(s)", pmp_videoSource, pmp_nBlocks); return 0; } diff --git a/Core/HLE/sceReg.cpp b/Core/HLE/sceReg.cpp index cb2249f8dc..b70ea5eb42 100644 --- a/Core/HLE/sceReg.cpp +++ b/Core/HLE/sceReg.cpp @@ -486,6 +486,8 @@ const KeyValue ROOT[] = { { "SYSPROFILE", ValueType::DIR, "", ARRAY_SIZE(tree_SYSPROFILE), tree_SYSPROFILE }, }; +// Updater checks for CONFIG/SYSTEM/XMB. + void __RegInit() { g_openRegistryMode = 0; g_handleGen = 1337; @@ -522,7 +524,7 @@ static const KeyValue *LookupCategory(std::string_view path, int *count) { } } if (!found) { - WARN_LOG(Log::sceReg, "Path not found: %.*s", (int)path.size(), path.data()); + WARN_LOG(Log::sceReg, "LookupCategory: Path not found: %.*s", (int)path.size(), path.data()); return nullptr; } } diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index 31bd2029ad..a68c52a274 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -235,6 +235,7 @@ void JitBlockCache::RemoveBlockMap(int block_num) { block_map_.erase(it); } else { // It wasn't in there, or it has the wrong key. Let's search... + // TODO: This is O(n), so O(n^2) when called for every block. for (auto it = block_map_.begin(); it != block_map_.end(); ++it) { if (it->second == (u32)block_num) { block_map_.erase(it); diff --git a/Core/System.cpp b/Core/System.cpp index fdc439e380..627c4c686d 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -295,7 +295,7 @@ static bool CPU_Init(FileLoader *fileLoader, IdentifiedFileType type, std::strin // TODO: Better would be to check that it was loaded successfully. if (!File::Exists(g_CoreParameter.fileToStart / INDEX_FILENAME)) { auto sc = GetI18NCategory(I18NCat::SCREEN); - g_OSD.Show(OSDType::MESSAGE_CENTERED_WARNING, sc->T("ExtractedIsoWarning", "Extracted ISOs often don't work.\nPlay the ISO file directly."), g_CoreParameter.fileToStart.ToVisualString(), 7.0f); + g_OSD.Show(OSDType::MESSAGE_WARNING, sc->T("ExtractedIsoWarning", "Extracted ISOs often don't work.\nPlay the ISO file directly."), g_CoreParameter.fileToStart.ToVisualString(), 7.0f); } else { INFO_LOG(Log::Loader, "Extracted ISO loaded without warning - %s is present.", INDEX_FILENAME.c_str()); } @@ -950,7 +950,7 @@ void DumpFileIfEnabled(const u8 *dataPtr, const u32 length, std::string_view nam fwrite(dataPtr, sizeof(u8), lengthToWrite, file); fclose(file); - INFO_LOG(Log::sceModule, "Successfully wrote %s to %s", DumpFileTypeToString(type), fullPath.c_str()); + INFO_LOG(Log::sceModule, "Successfully wrote %s to %s", DumpFileTypeToString(type), fullPath.ToVisualString().c_str()); char *path = new char[strlen(fullPath.c_str()) + 1]; strcpy(path, fullPath.c_str()); diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 47c6f202a3..a5459bbad9 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -1096,6 +1096,14 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) { ImGui::Checkbox("", mutePtr); } ImGui::TableNextColumn(); + + const AtracBase *ctx = __AtracGetCtx(i, &codecType); + if (!ctx) { + // Nothing more we can display about uninitialized contexts. + ImGui::PopID(); + continue; + } + switch (codecType) { case 0: ImGui::TextUnformatted("-"); // Uninitialized @@ -1111,12 +1119,6 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) { break; } - const AtracBase *ctx = __AtracGetCtx(i, &codecType); - if (!ctx) { - // Nothing more we can display about uninitialized contexts. - ImGui::PopID(); - continue; - } ImGui::TableNextColumn(); ImGui::TextUnformatted(AtracStatusToString(ctx->BufferState())); ImGui::TableNextColumn(); diff --git a/ext/imgui/imgui_impl_platform.cpp b/ext/imgui/imgui_impl_platform.cpp index 67450945d7..562d0ed722 100644 --- a/ext/imgui/imgui_impl_platform.cpp +++ b/ext/imgui/imgui_impl_platform.cpp @@ -247,6 +247,10 @@ ImGuiKey KeyCodeToImGui(InputKeyCode keyCode) { case NKCODE_EXT_PRINTSCREEN: return ImGuiKey_PrintScreen; + case NKCODE_EXT_PIPE: + // No valid mapping exists. + return ImGuiKey_None; + default: WARN_LOG(Log::System, "Unmapped ImGui keycode conversion from %d", keyCode); return ImGuiKey_None; diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 225e427329..6a492276ff 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -505,9 +505,10 @@ int main(int argc, const char* argv[]) coreParameter.pixelHeight = 272; coreParameter.fastForward = true; + g_Config.iDumpFileTypes = 0; g_Config.bEnableSound = false; g_Config.bFirstRun = false; - g_Config.bIgnoreBadMemAccess = true; + g_Config.bIgnoreBadMemAccess = true; // NOTE: A few tests rely on this, which is BAD: threads/mbx/refer/refer , threads/mbx/send/send, threads/vtimers/interrupt // Never report from tests. g_Config.sReportHost.clear(); g_Config.bAutoSaveSymbolMap = false; @@ -544,6 +545,7 @@ int main(int argc, const char* argv[]) g_Config.internalDataDirectory.clear(); g_Config.bUseOldAtrac = oldAtrac; g_Config.iForceEnableHLE = 0xFFFFFFFF; // Run all modules as HLE. We don't have anything to load in this context. + // g_Config.bUseOldAtrac = true; Path exePath = File::GetExeDirectory(); g_Config.flash0Directory = exePath / "assets/flash0"; From cc83071c2f4184be563f285842fefdd20970b79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 26 Jun 2025 12:33:12 +0200 Subject: [PATCH 08/25] Merge pull request #20571 from hrydgard/more-atrac-refactor More Atrac3 refactor --- CMakeLists.txt | 1 + Core/Core.vcxproj | 1 + Core/Core.vcxproj.filters | 3 + Core/HLE/AtracBase.h | 248 +++++++++++++++++++++++ Core/HLE/AtracCtx.cpp | 3 +- Core/HLE/AtracCtx.h | 132 +----------- Core/HLE/AtracCtx2.cpp | 281 +++++++++++++++----------- Core/HLE/AtracCtx2.h | 2 +- Core/HLE/sceAtrac.h | 99 +-------- Core/HLE/sceAudiocodec.cpp | 9 +- Core/HLE/sceAudiocodec.h | 4 +- Core/MIPS/JitCommon/JitBlockCache.cpp | 4 +- Core/Util/AtracTrack.cpp | 244 ++++++++++++++++++++-- Core/Util/AtracTrack.h | 20 +- UI/GameSettingsScreen.cpp | 1 + 15 files changed, 681 insertions(+), 371 deletions(-) create mode 100644 Core/HLE/AtracBase.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ed768462b3..4cb1106a47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2186,6 +2186,7 @@ add_library(${CoreLibName} ${CoreLinkType} Core/HLE/__sceAudio.h Core/HLE/sceAdler.cpp Core/HLE/sceAdler.h + Core/HLE/AtracBase.h Core/HLE/AtracCtx.cpp Core/HLE/AtracCtx.h Core/HLE/AtracCtx2.cpp diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 6322bcf448..bafe4e353c 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -1190,6 +1190,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 3c50aa21c9..e9d8adab35 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -2190,6 +2190,9 @@ FileLoaders + + HLE\Libraries + diff --git a/Core/HLE/AtracBase.h b/Core/HLE/AtracBase.h new file mode 100644 index 0000000000..c6b6c96619 --- /dev/null +++ b/Core/HLE/AtracBase.h @@ -0,0 +1,248 @@ +#pragma once + +#include "Common/CommonTypes.h" +#include "Common/Swap.h" + +#include "Core/MemMap.h" +#include "Core/HLE/sceAudiocodec.h" + +constexpr u32 ATRAC3_MAX_SAMPLES = 0x400; // 1024 +constexpr u32 ATRAC3PLUS_MAX_SAMPLES = 0x800; // 2048 + +// The "state" member of SceAtracIdInfo. +enum AtracStatus : u8 { + ATRAC_STATUS_UNINITIALIZED = 0, // bad state + + ATRAC_STATUS_NO_DATA = 1, + + // The entire file is loaded into memory, no further file access needed. + ATRAC_STATUS_ALL_DATA_LOADED = 2, + + // The buffer is sized to fit the entire file, but it's only partially loaded, so you can start playback before loading the whole file. + ATRAC_STATUS_HALFWAY_BUFFER = 3, + + // In these ones, the buffer is smaller than the file, and data is streamed into it as needed for playback. + // These are the most complex modes, both to implement and use. + ATRAC_STATUS_STREAMED_WITHOUT_LOOP = 4, + ATRAC_STATUS_STREAMED_LOOP_FROM_END = 5, + // This means there's additional audio after the loop. + // i.e. ~~before loop~~ [ ~~this part loops~~ ] ~~after loop~~ + // The "fork in the road" means a second buffer is needed for the second path. + ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER = 6, + + // In this mode, the only API to call is sceAtracLowLevelDecode, which decodes a stream packet by packet without any other metadata. + ATRAC_STATUS_LOW_LEVEL = 8, + + // This mode is for using an Atrac context as the audio source for an sceSas channel. Not used a lot (Sol Trigger). + ATRAC_STATUS_FOR_SCESAS = 16, + + // Bitwise-and the status with this to check for any of the streaming modes in a single test. + ATRAC_STATUS_STREAMED_MASK = 4, +}; + +const char *AtracStatusToString(AtracStatus status); + +inline bool AtracStatusIsStreaming(AtracStatus status) { + return (status & ATRAC_STATUS_STREAMED_MASK) != 0; +} +inline bool AtracStatusIsNormal(AtracStatus status) { + return (int)status >= ATRAC_STATUS_ALL_DATA_LOADED && (int)status <= ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER; +} + +struct SceAtracIdInfo { + s32 decodePos; // Sample position in the song that we'll next be decoding from. + s32 endSample; // Last sample index of the track. + s32 loopStart; // Start of the loop (sample index) + s32 loopEnd; // End of the loop (sample index) + s32 firstValidSample; // Seems to be the number of skipped samples at the start. After SetID, decodePos will match this. Was previously misnamed 'samplesPerChan'. + u8 numSkipFrames; // This is 1 for a single frame when a loop is triggered, otherwise seems to stay at 0. Likely mis-named. + AtracStatus state; // State enum, see AtracStatus. + u8 curBuffer; // Current buffer (1 == second, 2 == done?) Previously unk + u8 numChan; // Number of audio channels, usually 2 but 1 is possible. + u16 sampleSize; // Size in bytes of an encoded audio frame. + u16 codec; // Codec. 0x1000 is Atrac3+, 0x1001 is Atrac3. See the PSP_CODEC_ enum (only these two are supported). + s32 dataOff; // File offset in bytes where the Atrac3+ frames start appearing. The first dummy packet starts here. + s32 curFileOff; // File offset in bytes corresponding to the start of next packet that will be *decoded* (on the next call to sceAtracDecodeData). + s32 fileDataEnd; // File size in bytes. + s32 loopNum; // Current loop counter. If 0, will not loop. -1 loops for ever, positive numbers get decremented on the loop end. So to play a song 3 times and then end, set this to 2. + s32 streamDataByte; // Number of bytes of queued/buffered/uploaded data. In full and half-way modes, this isn't decremented as you decode. + s32 streamOff; // Streaming modes only: The byte offset inside the RAM buffer where sceAtracDecodeData will read from next. ONLY points to even packet boundaries. + s32 secondStreamOff; // A kind of stream position in the secondary buffer. + u32 buffer; // Address in RAM of the main buffer. + u32 secondBuffer; // Address in RAM of the second buffer, or 0 if not used. + u32 bufferByte; // Size in bytes of the main buffer. + u32 secondBufferByte; // Size in bytes of the second buffer. + // Offset 72 here. + // make sure the size is 128 + u32 unk[14]; + + // Simple helpers. Similar ones are on track_, but we shouldn't need track_ anymore when playing back. + + int SamplesPerFrame() const { + return codec == 0x1000 ? ATRAC3PLUS_MAX_SAMPLES : ATRAC3_MAX_SAMPLES; + } + int SamplesFrameMask() const { + return SamplesPerFrame() - 1; + } + int SkipSamples() const { + // These first samples are skipped, after first possibly skipping 0-2 full frames, it seems. + return codec == 0x1000 ? 0x170 : 0x45; + } + int BitRate() const { + int bitrate = (sampleSize * 352800) / 1000; + if (codec == PSP_CODEC_AT3PLUS) { + bitrate = ((bitrate >> 11) + 8) & 0xFFFFFFF0; + } else { + bitrate = (bitrate + 511) >> 10; + } + return bitrate; + } +}; + +// One of these structs is allocated for each Atrac context. +// The raw codec state is stored in 'codec'. +// The internal playback state is stored in 'info', and that is used for all state keeping in the Atrac2 implementation, +// imitating what happens on hardware as closely as possible. +struct SceAtracContext { + // size 128 + SceAudiocodecCodec codec; + // size 128 + SceAtracIdInfo info; +}; + +struct Atrac3LowLevelParams { + int encodedChannels; + int outputChannels; + int bytesPerFrame; +}; + +struct AtracSingleResetBufferInfo { + u32_le writePosPtr; + u32_le writableBytes; + u32_le minWriteBytes; + u32_le filePos; +}; + +struct AtracResetBufferInfo { + AtracSingleResetBufferInfo first; + AtracSingleResetBufferInfo second; +}; + +struct AtracSasStreamState { + u32 bufPtr[2]{}; + u32 bufSize[2]{}; + int streamOffset = 0; + int fileOffset = 0; + int curBuffer = 0; + bool isStreaming = false; + + int CurPos() const { + int retval = fileOffset - bufSize[curBuffer] + streamOffset; + _dbg_assert_(retval >= 0); + return retval; + } +}; + +const int PSP_ATRAC_ALLDATA_IS_ON_MEMORY = -1; +const int PSP_ATRAC_NONLOOP_STREAM_DATA_IS_ON_MEMORY = -2; +const int PSP_ATRAC_LOOP_STREAM_DATA_IS_ON_MEMORY = -3; + +// This is not a PSP-native struct. +// But, it's stored in its entirety in savestates, which makes it awkward to change it. +// This is used for both first_ and second_, but the latter doesn't use all the fields. +struct InputBuffer { + // Address of the buffer. + u32 addr; + // Size of data read so far into dataBuf_ (to be removed.) + u32 size; + // Offset into addr at which new data is added. + u32 offset; + // Last writableBytes number (to be removed.) + u32 writableBytes; + // Unused, always 0. + u32 neededBytes; + // Total size of the entire file data. + u32 _filesize_dontuse; + // Offset into the file at which new data is read. + u32 fileoffset; +}; + +class AudioDecoder; +class PointerWrap; +struct Track; + +class AtracBase { +public: + virtual ~AtracBase(); + + virtual void DoState(PointerWrap &p) = 0; + + // TODO: Find a way to get rid of this from the base class. + virtual void UpdateContextFromPSPMem() = 0; + + virtual int Channels() const = 0; + + int GetOutputChannels() const { + return outputChannels_; + } + void SetOutputChannels(int channels) { + // Only used for sceSas audio. To be refactored away in the future. + outputChannels_ = channels; + } + + virtual u32 GetInternalCodecError() const { return 0; } + + PSPPointer context_{}; + + virtual AtracStatus BufferState() const = 0; + + virtual int SetLoopNum(int loopNum) = 0; + virtual int LoopNum() const = 0; + virtual int LoopStatus() const = 0; + + virtual int CodecType() const = 0; + + AudioDecoder *Decoder() const { + return decoder_; + } + + void CreateDecoder(int codecType, int bytesPerFrame, int channels); + + virtual void NotifyGetContextAddress() = 0; + + virtual int GetNextDecodePosition(int *pos) const = 0; + virtual int RemainingFrames() const = 0; + virtual bool HasSecondBuffer() const = 0; + virtual int Bitrate() const = 0; + virtual int BytesPerFrame() const = 0; + virtual int SamplesPerFrame() const = 0; + + virtual void GetStreamDataInfo(u32 *writePtr, u32 *writableBytes, u32 *readOffset) = 0; // This should be const, but the legacy impl stops it (it's wrong). + virtual int AddStreamData(u32 bytesToAdd) = 0; + virtual int ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf, bool *delay) = 0; + virtual int GetBufferInfoForResetting(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) = 0; // NOTE: Not const! This can cause SkipFrames! + virtual int SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, int outputChannels) = 0; + + virtual int GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) const = 0; + virtual int SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) = 0; + virtual u32 DecodeData(u8 *outbuf, u32 outbufPtr, int *SamplesNum, int *finish, int *remains) = 0; + virtual int DecodeLowLevel(const u8 *srcData, int *bytesConsumed, s16 *dstData, int *bytesWritten) = 0; + + virtual u32 GetNextSamples() = 0; // This should be const, but the legacy impl stops it (it's wrong). + virtual void InitLowLevel(const Atrac3LowLevelParams ¶ms, int codecType) = 0; + + virtual void CheckForSas() = 0; + virtual int EnqueueForSas(u32 address, u32 ptr) = 0; + virtual void DecodeForSas(s16 *dstData, int *bytesWritten, int *finish) = 0; + virtual const AtracSasStreamState *StreamStateForSas() const { return nullptr; } + + virtual int GetSoundSample(int *endSample, int *loopStartSample, int *loopEndSample) const = 0; + + virtual int GetContextVersion() const = 0; + +protected: + u16 outputChannels_ = 2; + + // TODO: Save the internal state of this, now technically possible. + AudioDecoder *decoder_ = nullptr; +}; diff --git a/Core/HLE/AtracCtx.cpp b/Core/HLE/AtracCtx.cpp index 30673e517d..9f9b84271f 100644 --- a/Core/HLE/AtracCtx.cpp +++ b/Core/HLE/AtracCtx.cpp @@ -28,8 +28,7 @@ #include "Core/HLE/AtracCtx.h" #include "Core/HW/Atrac3Standalone.h" #include "Core/HLE/sceKernelMemory.h" -#include -#include + const size_t overAllocBytes = 16384; diff --git a/Core/HLE/AtracCtx.h b/Core/HLE/AtracCtx.h index 75fa627af1..17dea45e38 100644 --- a/Core/HLE/AtracCtx.h +++ b/Core/HLE/AtracCtx.h @@ -23,136 +23,8 @@ #include "Common/Swap.h" #include "Core/MemMap.h" -#include "Core/HLE/sceAtrac.h" - -struct AtracSingleResetBufferInfo { - u32_le writePosPtr; - u32_le writableBytes; - u32_le minWriteBytes; - u32_le filePos; -}; - -struct AtracResetBufferInfo { - AtracSingleResetBufferInfo first; - AtracSingleResetBufferInfo second; -}; - -struct AtracSasStreamState { - u32 bufPtr[2]{}; - u32 bufSize[2]{}; - int streamOffset = 0; - int fileOffset = 0; - int curBuffer = 0; - bool isStreaming = false; - - int CurPos() const { - int retval = fileOffset - bufSize[curBuffer] + streamOffset; - _dbg_assert_(retval >= 0); - return retval; - } -}; - -const int PSP_ATRAC_ALLDATA_IS_ON_MEMORY = -1; -const int PSP_ATRAC_NONLOOP_STREAM_DATA_IS_ON_MEMORY = -2; -const int PSP_ATRAC_LOOP_STREAM_DATA_IS_ON_MEMORY = -3; - -// This is not a PSP-native struct. -// But, it's stored in its entirety in savestates, which makes it awkward to change it. -// This is used for both first_ and second_, but the latter doesn't use all the fields. -struct InputBuffer { - // Address of the buffer. - u32 addr; - // Size of data read so far into dataBuf_ (to be removed.) - u32 size; - // Offset into addr at which new data is added. - u32 offset; - // Last writableBytes number (to be removed.) - u32 writableBytes; - // Unused, always 0. - u32 neededBytes; - // Total size of the entire file data. - u32 _filesize_dontuse; - // Offset into the file at which new data is read. - u32 fileoffset; -}; - -class AudioDecoder; - -class AtracBase { -public: - virtual ~AtracBase(); - - virtual void DoState(PointerWrap &p) = 0; - - // TODO: Find a way to get rid of this from the base class. - virtual void UpdateContextFromPSPMem() = 0; - - virtual int Channels() const = 0; - - int GetOutputChannels() const { - return outputChannels_; - } - void SetOutputChannels(int channels) { - // Only used for sceSas audio. To be refactored away in the future. - outputChannels_ = channels; - } - - virtual u32 GetInternalCodecError() const { return 0; } - - PSPPointer context_{}; - - virtual AtracStatus BufferState() const = 0; - - virtual int SetLoopNum(int loopNum) = 0; - virtual int LoopNum() const = 0; - virtual int LoopStatus() const = 0; - - virtual int CodecType() const = 0; - - AudioDecoder *Decoder() const { - return decoder_; - } - - void CreateDecoder(int codecType, int bytesPerFrame, int channels); - - virtual void NotifyGetContextAddress() = 0; - - virtual int GetNextDecodePosition(int *pos) const = 0; - virtual int RemainingFrames() const = 0; - virtual bool HasSecondBuffer() const = 0; - virtual int Bitrate() const = 0; - virtual int BytesPerFrame() const = 0; - virtual int SamplesPerFrame() const = 0; - - virtual void GetStreamDataInfo(u32 *writePtr, u32 *writableBytes, u32 *readOffset) = 0; // This should be const, but the legacy impl stops it (it's wrong). - virtual int AddStreamData(u32 bytesToAdd) = 0; - virtual int ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrittenSecondBuf, bool *delay) = 0; - virtual int GetBufferInfoForResetting(AtracResetBufferInfo *bufferInfo, int sample, bool *delay) = 0; // NOTE: Not const! This can cause SkipFrames! - virtual int SetData(const Track &track, u32 buffer, u32 readSize, u32 bufferSize, int outputChannels) = 0; - - virtual int GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) const = 0; - virtual int SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) = 0; - virtual u32 DecodeData(u8 *outbuf, u32 outbufPtr, int *SamplesNum, int *finish, int *remains) = 0; - virtual int DecodeLowLevel(const u8 *srcData, int *bytesConsumed, s16 *dstData, int *bytesWritten) = 0; - - virtual u32 GetNextSamples() = 0; // This should be const, but the legacy impl stops it (it's wrong). - virtual void InitLowLevel(const Atrac3LowLevelParams ¶ms, int codecType) = 0; - - virtual void CheckForSas() = 0; - virtual int EnqueueForSas(u32 address, u32 ptr) = 0; - virtual void DecodeForSas(s16 *dstData, int *bytesWritten, int *finish) = 0; - virtual const AtracSasStreamState *StreamStateForSas() const { return nullptr; } - - virtual int GetSoundSample(int *endSample, int *loopStartSample, int *loopEndSample) const = 0; - - virtual int GetContextVersion() const = 0; - -protected: - u16 outputChannels_ = 2; - - // TODO: Save the internal state of this, now technically possible. - AudioDecoder *decoder_ = nullptr; -}; +#include "Core/HLE/AtracBase.h" +#include "Core/Util/AtracTrack.h" class Atrac : public AtracBase { public: diff --git a/Core/HLE/AtracCtx2.cpp b/Core/HLE/AtracCtx2.cpp index 8fd967ac93..009e124860 100644 --- a/Core/HLE/AtracCtx2.cpp +++ b/Core/HLE/AtracCtx2.cpp @@ -9,6 +9,7 @@ #include "Core/HLE/FunctionWrappers.h" #include "Core/System.h" #include "Core/HLE/AtracCtx2.h" +#include "Core/Util/AtracTrack.h" #include "Core/HW/Atrac3Standalone.h" #include "Core/Config.h" #include "Core/MemMap.h" @@ -28,7 +29,19 @@ // cmd1> C:\dev\ppsspp\pspautotests\tests\audio\atrac>copy /Y ..\..\..\__testoutput.txt stream.expected // Then run the test, see above. -// TODO: Add an AT3 dumping facility (and/or replacement?). Although the old implementation could do it more easily... +struct AT3BitrateMeta { + u16 sampleSize; + u8 dataByte; + u8 jointStereo; // I think? +}; + +static const AT3BitrateMeta g_at3BitrateMeta[5] = { + {0x180, 0x04, 0}, + {0x130, 0x06, 0}, + {0x0C0, 0x0B, 1}, + {0x0C0, 0x0E, 0}, + {0x098, 0x0F, 0}, +}; // Needs to support negative numbers, and to handle non-powers-of-two. static int RoundDownToMultiple(int size, int grain) { @@ -130,6 +143,118 @@ static int ComputeRemainFrameLooped(const SceAtracIdInfo &info) { return remainFrames; } +static void InitLengthAndLoop(SceAtracIdInfo *ctx, int endSample, int waveDataSize, int firstSampleOffset, int loopBegin, int loopEnd) { + const int off = ctx->codec == 0x1001 ? 0x45 : 0x170; + const int blockShift = 0x100b - ctx->codec; + const int firstValidSample = firstSampleOffset + off; + int numSamplesInFile; + if (endSample == 0) { + numSamplesInFile = waveDataSize / ctx->sampleSize << (blockShift & 0x1f); + } else { + numSamplesInFile = endSample + firstValidSample; + } + ctx->decodePos = firstValidSample; + ctx->loopNum = 0; + ctx->endSample = numSamplesInFile - 1; + ctx->numSkipFrames = (char)(firstValidSample >> (blockShift & 0x1f)); + if (-1 < loopBegin) { + ctx->loopEnd = loopEnd + off; + ctx->loopStart = loopBegin + off; + return; + } + ctx->loopEnd = 0; + ctx->loopStart = 0; + return; +} + +static int ComputeAtracStateAndInitSecondBuffer(SceAtracIdInfo *info, u32 readSize, u32 bufferSize) { + AtracStatus state; + int loopEndFileOffset; + int loopEnd; + + if (bufferSize < (u32)info->fileDataEnd) { + if (info->streamDataByte < (s32)info->sampleSize * 3) { + return 0x80630011; + } + loopEnd = info->loopEnd; + state = ATRAC_STATUS_STREAMED_WITHOUT_LOOP; + if ((loopEnd != 0) && (state = ATRAC_STATUS_STREAMED_LOOP_FROM_END, loopEnd != info->endSample)) { + loopEndFileOffset = ComputeLoopEndFileOffset(*info, loopEnd); + loopEnd = (loopEndFileOffset - info->dataOff) + 1; + info->state = ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER; + if (loopEnd < info->streamDataByte) { + info->streamDataByte = loopEnd; + } + info->secondStreamOff = 0; + info->secondBuffer = 0; + info->secondBufferByte = 0; + return 0; + } + } else { + state = ATRAC_STATUS_HALFWAY_BUFFER; + if (readSize >= (u32)info->fileDataEnd) { + state = ATRAC_STATUS_ALL_DATA_LOADED; + } + } + info->state = state; + return 0; +} + +int InitContextFromTrackInfo(SceAtracContext *ctx, const TrackInfo *wave, u32 bufferAddr, int readSize, int bufferSize) { + (ctx->info).numChan = (char)wave->numChans; + const int extraSamples = (ctx->info).codec == 0x1001 ? 0x45 : 0x170; + (ctx->info).firstValidSample = extraSamples + wave->firstSampleOffset; + int endSample3 = wave->endSample; + (ctx->info).sampleSize = wave->blockAlign; + InitLengthAndLoop(&ctx->info, endSample3, wave->waveDataSize, wave->firstSampleOffset, wave->loopStart, + wave->loopEnd); + const int dataOff = wave->dataOff; + const int endSample = (ctx->info).endSample; + (ctx->info).streamDataByte = readSize - dataOff; + (ctx->info).buffer = bufferAddr; + (ctx->info).curFileOff = dataOff; + (ctx->info).dataOff = dataOff; + (ctx->info).fileDataEnd = wave->waveDataSize + dataOff; + (ctx->info).curBuffer = 0; + (ctx->info).bufferByte = bufferSize; + (ctx->info).streamOff = dataOff; + if ((ctx->info).loopEnd > endSample) { + return SCE_ERROR_ATRAC_BAD_CODEC_PARAMS; + } + + const int numChunks = (endSample >> (0x100b - (ctx->info).codec & 0x1f)); + + if ((numChunks * (u32)(ctx->info).sampleSize < (wave->waveDataSize + dataOff) - dataOff)) { + int retval = ComputeAtracStateAndInitSecondBuffer(&ctx->info, readSize, bufferSize); + if (retval < 0) { + return retval; + } + if ((ctx->info).codec != PSP_CODEC_AT3) { + // At3plus + // Configure the codec for the sample size, or whatever that data is. + (ctx->codec).unk40 = wave->sampleSizeMaybe; + (ctx->codec).unk48 = 0; + (ctx->codec).unk41 = wave->tailFlag; + return 0; + } + // At3. Set up the hardware codec (hopefully we can correctly support this in sceAudiocodec and thus sceAtrac LLE in the future) + // This is not actually necessary since we don't use the actual hardware codec. + for (int counter = 4; counter >= 0; counter--) { + if ((g_at3BitrateMeta[counter].sampleSize == (ctx->info).sampleSize) && + ((int)g_at3BitrateMeta[counter].dataByte == wave->sampleSizeMaybe)) { + (ctx->codec).unk40 = (char)g_at3BitrateMeta[counter].jointStereo; + (ctx->codec).unk41 = 0; + (ctx->codec).unk42 = 0; + (ctx->codec).unk43 = 0; + return 0; + } + } + return 0; + } else { + return SCE_ERROR_ATRAC_BAD_CODEC_PARAMS; + } +} + int Atrac2::RemainingFrames() const { const SceAtracIdInfo &info = context_->info; @@ -835,105 +960,27 @@ u32 Atrac2::DecodeInternal(u32 outbufAddr, int *SamplesNum, int *finish) { } int Atrac2::SetData(const Track &track, u32 bufferAddr, u32 readSize, u32 bufferSize, int outputChannels) { - // 72 is about the size of the minimum required data to even be valid. - if (readSize < 72) { - return SCE_ERROR_ATRAC_SIZE_TOO_SMALL; + TrackInfo trackInfo{}; + if (bufferAddr) { + int retval = ParseWaveAT3(Memory::GetPointerRange(bufferAddr, bufferSize), readSize, &trackInfo); + if (retval < 0) { + ERROR_LOG(Log::Atrac, "Atrac2::SetData: ParseWaveAT3 failed with %08x", retval); + return retval; + } } - // TODO: Check the range (addr, size) instead. - if (!Memory::IsValidAddress(bufferAddr)) { - return SCE_KERNEL_ERROR_ILLEGAL_ADDRESS; + int retval = InitContextFromTrackInfo(context_, &trackInfo, bufferAddr, readSize, bufferSize); + if (retval < 0) { + ERROR_LOG(Log::Atrac, "Atrac2::SetData: InitContextFromTrackInfo failed with %08x", retval); + return retval; } - track.DebugLog(); - SceAtracIdInfo &info = context_->info; - if (track.codecType != PSP_CODEC_AT3 && track.codecType != PSP_CODEC_AT3PLUS) { - // Shouldn't have gotten here, Analyze() checks this. - ERROR_LOG(Log::Atrac, "unexpected codec type %d in set data", track.codecType); - return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; - } - - if (outputChannels != track.channels) { - INFO_LOG(Log::Atrac, "Atrac2::SetData: outputChannels %d doesn't match track_.channels %d, decoder will expand.", outputChannels, track.channels); - } - - if (readSize >= track.fileSize) { - INFO_LOG(Log::Atrac, "The full file was set directly - we can dump it."); - char filename[512]; - snprintf(filename, sizeof(filename), "%s_%d%s", track.codecType == PSP_CODEC_AT3 ? "at3" : "at3plus", track.endSample, track.channels == 1 ? "_mono" : ""); - DumpFileIfEnabled(Memory::GetPointer(bufferAddr), readSize, filename, DumpFileType::Atrac3); - } else if (false && (int)g_Config.iDumpFileTypes & (int)DumpFileType::Atrac3) { - // TODO: This is disabled (using the false above) until we can properly append streamed data to the dump. - // Still can be useful for debugging by dumping the start of the file, so leaving it here. - dumpBuffer_.resize(readSize); - Memory::Memcpy(dumpBuffer_.data(), bufferAddr, readSize); - } - - CreateDecoder(track.codecType, track.bytesPerFrame, track.channels); + CreateDecoder(info.codec, info.sampleSize, info.numChan); outputChannels_ = outputChannels; - if (!track.loopinfo.empty()) { - info.loopNum = track.loopinfo[0].playCount; - info.loopStart = track.loopStartSample; - info.loopEnd = track.loopEndSample; - } else { - info.loopNum = 0; - info.loopStart = 0; - info.loopEnd = 0; - } - - context_->codec.inBuf = bufferAddr; - - if (readSize > track.fileSize) { - INFO_LOG(Log::Atrac, "readSize (%d) > track_.fileSize (%d)", readSize, track.fileSize); - } - - if (bufferSize >= track.fileSize) { - // Buffer is big enough to fit the whole track. - if (readSize < bufferSize) { - info.state = ATRAC_STATUS_HALFWAY_BUFFER; - } else { - info.state = ATRAC_STATUS_ALL_DATA_LOADED; - } - } else { - // Streaming cases with various looping types. - if (track.loopEndSample <= 0) { - // There's no looping, but we need to stream the data in our buffer. - info.state = ATRAC_STATUS_STREAMED_WITHOUT_LOOP; - } else if (track.loopEndSample == track.endSample + track.FirstSampleOffsetFull()) { - info.state = ATRAC_STATUS_STREAMED_LOOP_FROM_END; - } else { - info.state = ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER; - } - } - - DEBUG_LOG(Log::Atrac, "Atrac mode setup: %s", AtracStatusToString(info.state)); - - // Copy parameters into state struct. - info.codec = track.codecType; - info.numChan = track.channels; - info.sampleSize = track.bytesPerFrame; - info.buffer = bufferAddr; - info.bufferByte = bufferSize; - info.firstValidSample = track.FirstSampleOffsetFull(); - info.endSample = track.endSample + info.firstValidSample; - if (track.loopStartSample != 0xFFFFFFFF) { - info.loopStart = track.loopStartSample; - info.loopEnd = track.loopEndSample; - // Sanity check the loop points, useful for testing. - } - info.dataOff = track.dataByteOffset; - info.curFileOff = track.dataByteOffset; - info.streamOff = track.dataByteOffset; - info.streamDataByte = readSize - info.dataOff; - info.fileDataEnd = track.fileSize; - info.decodePos = track.FirstSampleOffsetFull(); - info.numSkipFrames = info.firstValidSample / info.SamplesPerFrame(); - // NOTE: we do not write into secondBuffer/secondBufferByte! they linger... - INFO_LOG(Log::Atrac, "Atrac: sampleSize: %d buffer: %08x bufferByte: %d firstValidSample: %d\n" "endSample: %d loopStart: %d loopEnd: %d\n" @@ -946,7 +993,7 @@ int Atrac2::SetData(const Track &track, u32 bufferAddr, u32 readSize, u32 buffer ); int skipCount = 0; // TODO: use for delay - u32 retval = SkipFrames(&skipCount); + retval = SkipFrames(&skipCount); // Seen in Mui Mui house. Things go very wrong after this.. if (retval == SCE_ERROR_ATRAC_API_FAIL) { @@ -961,26 +1008,28 @@ int Atrac2::SetData(const Track &track, u32 bufferAddr, u32 readSize, u32 buffer void Atrac2::WrapLastPacket() { SceAtracIdInfo &info = context_->info; - // We need to handle wrapping the overshot partial packet at the end. - if (AtracStatusIsStreaming(info.state)) { - // This logic is similar to GetStreamDataInfo. - int distanceToEnd = RoundDownToMultiple(info.bufferByte - info.streamOff, info.sampleSize); - if (info.streamDataByte < distanceToEnd) { - // There's space left without wrapping. Don't do anything. - // INFO_LOG(Log::Atrac, "Packets fit into the buffer fully. %08x < %08x", readSize, bufferSize); - // In this case, seems we need to zero some bytes. In one test, this seems to be 336. - // Maybe there's a logical bug and the copy happens even when not needed, it's just that it'll - // copy zeroes. Either way, let's just copy some bytes to make our sanity check hexdump pass. - Memory::Memset(info.buffer, 0, 128); - } else { - // Wraps around. - const int copyStart = info.streamOff + distanceToEnd; - const int copyLen = info.bufferByte - copyStart; - // Then, let's copy it. - DEBUG_LOG(Log::Atrac, "Packets didn't fit evenly. Last packet got split into %d/%d (sum=%d). Copying to start of buffer.", - copyLen, info.sampleSize - copyLen, info.sampleSize); - Memory::Memcpy(info.buffer, info.buffer + copyStart, copyLen); - } + // If streaming, we need to handle wrapping the overshot partial packet at the end. If not we don't. + if (!AtracStatusIsStreaming(info.state)) { + return; + } + + // This logic is similar to GetStreamDataInfo. + int distanceToEnd = RoundDownToMultiple(info.bufferByte - info.streamOff, info.sampleSize); + if (info.streamDataByte < distanceToEnd) { + // There's space left without wrapping. Don't do anything. + // INFO_LOG(Log::Atrac, "Packets fit into the buffer fully. %08x < %08x", readSize, bufferSize); + // In this case, seems we need to zero some bytes. In one test, this seems to be 336. + // Maybe there's a logical bug and the copy happens even when not needed, it's just that it'll + // copy zeroes. Either way, let's just copy some bytes to make our sanity check hexdump pass. + Memory::Memset(info.buffer, 0, 128); + } else { + // Wraps around. + const int copyStart = info.streamOff + distanceToEnd; + const int copyLen = info.bufferByte - copyStart; + // Then, let's copy it. + DEBUG_LOG(Log::Atrac, "Packets didn't fit evenly. Last packet got split into %d/%d (sum=%d). Copying to start of buffer.", + copyLen, info.sampleSize - copyLen, info.sampleSize); + Memory::Memcpy(info.buffer, info.buffer + copyStart, copyLen); } } @@ -1051,13 +1100,7 @@ u32 Atrac2::GetInternalCodecError() const { int Atrac2::Bitrate() const { const SceAtracIdInfo &info = context_->info; - - int bitrate = (info.sampleSize * 352800) / 1000; - if (info.codec == PSP_CODEC_AT3PLUS) - bitrate = ((bitrate >> 11) + 8) & 0xFFFFFFF0; - else - bitrate = (bitrate + 511) >> 10; - return bitrate; + return info.BitRate(); } void Atrac2::InitLowLevel(const Atrac3LowLevelParams ¶ms, int codecType) { diff --git a/Core/HLE/AtracCtx2.h b/Core/HLE/AtracCtx2.h index f1645a0699..f47f9a03bf 100644 --- a/Core/HLE/AtracCtx2.h +++ b/Core/HLE/AtracCtx2.h @@ -2,7 +2,7 @@ #include -#include "Core/HLE/AtracCtx.h" +#include "Core/HLE/AtracBase.h" class Atrac2 : public AtracBase { public: diff --git a/Core/HLE/sceAtrac.h b/Core/HLE/sceAtrac.h index 594b68c194..42e61576ab 100644 --- a/Core/HLE/sceAtrac.h +++ b/Core/HLE/sceAtrac.h @@ -19,6 +19,7 @@ #include "Core/HLE/sceAudiocodec.h" #include "Core/Util/AtracTrack.h" +#include "Core/HLE/AtracCtx.h" class PointerWrap; @@ -31,104 +32,6 @@ int __AtracMaxContexts(); void __AtracNotifyLoadModule(int version, u32 crc, u32 bssAddr, int bssSize); void __AtracNotifyUnloadModule(); -// The "state" member of SceAtracIdInfo. -enum AtracStatus : u8 { - ATRAC_STATUS_UNINITIALIZED = 0, // bad state - - ATRAC_STATUS_NO_DATA = 1, - - // The entire file is loaded into memory, no further file access needed. - ATRAC_STATUS_ALL_DATA_LOADED = 2, - - // The buffer is sized to fit the entire file, but it's only partially loaded, so you can start playback before loading the whole file. - ATRAC_STATUS_HALFWAY_BUFFER = 3, - - // In these ones, the buffer is smaller than the file, and data is streamed into it as needed for playback. - // These are the most complex modes, both to implement and use. - ATRAC_STATUS_STREAMED_WITHOUT_LOOP = 4, - ATRAC_STATUS_STREAMED_LOOP_FROM_END = 5, - // This means there's additional audio after the loop. - // i.e. ~~before loop~~ [ ~~this part loops~~ ] ~~after loop~~ - // The "fork in the road" means a second buffer is needed for the second path. - ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER = 6, - - // In this mode, the only API to call is sceAtracLowLevelDecode, which decodes a stream packet by packet without any other metadata. - ATRAC_STATUS_LOW_LEVEL = 8, - - // This mode is for using an Atrac context as the audio source for an sceSas channel. Not used a lot (Sol Trigger). - ATRAC_STATUS_FOR_SCESAS = 16, - - // Bitwise-and the status with this to check for any of the streaming modes in a single test. - ATRAC_STATUS_STREAMED_MASK = 4, -}; - -const char *AtracStatusToString(AtracStatus status); - -inline bool AtracStatusIsStreaming(AtracStatus status) { - return (status & ATRAC_STATUS_STREAMED_MASK) != 0; -} -inline bool AtracStatusIsNormal(AtracStatus status) { - return (int)status >= ATRAC_STATUS_ALL_DATA_LOADED && (int)status <= ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER; -} - -struct SceAtracIdInfo { - s32 decodePos; // Sample position in the song that we'll next be decoding from. - s32 endSample; // Last sample index of the track. - s32 loopStart; // Start of the loop (sample index) - s32 loopEnd; // End of the loop (sample index) - s32 firstValidSample; // Seems to be the number of skipped samples at the start. After SetID, decodePos will match this. Was previously misnamed 'samplesPerChan'. - u8 numSkipFrames; // This is 1 for a single frame when a loop is triggered, otherwise seems to stay at 0. Likely mis-named. - AtracStatus state; // State enum, see AtracStatus. - u8 curBuffer; // Current buffer (1 == second, 2 == done?) Previously unk - u8 numChan; // Number of audio channels, usually 2 but 1 is possible. - u16 sampleSize; // Size in bytes of an encoded audio frame. - u16 codec; // Codec. 0x1000 is Atrac3+, 0x1001 is Atrac3. See the PSP_CODEC_ enum (only these two are supported). - s32 dataOff; // File offset in bytes where the Atrac3+ frames start appearing. The first dummy packet starts here. - s32 curFileOff; // File offset in bytes corresponding to the start of next packet that will be *decoded* (on the next call to sceAtracDecodeData). - s32 fileDataEnd; // File size in bytes. - s32 loopNum; // Current loop counter. If 0, will not loop. -1 loops for ever, positive numbers get decremented on the loop end. So to play a song 3 times and then end, set this to 2. - s32 streamDataByte; // Number of bytes of queued/buffered/uploaded data. In full and half-way modes, this isn't decremented as you decode. - s32 streamOff; // Streaming modes only: The byte offset inside the RAM buffer where sceAtracDecodeData will read from next. ONLY points to even packet boundaries. - s32 secondStreamOff; // A kind of stream position in the secondary buffer. - u32 buffer; // Address in RAM of the main buffer. - u32 secondBuffer; // Address in RAM of the second buffer, or 0 if not used. - u32 bufferByte; // Size in bytes of the main buffer. - u32 secondBufferByte; // Size in bytes of the second buffer. - // Offset 72 here. - // make sure the size is 128 - u32 unk[14]; - - // Simple helpers. Similar ones are on track_, but we shouldn't need track_ anymore when playing back. - - int SamplesPerFrame() const { - return codec == 0x1000 ? ATRAC3PLUS_MAX_SAMPLES : ATRAC3_MAX_SAMPLES; - } - int SamplesFrameMask() const { - return SamplesPerFrame() - 1; - } - int SkipSamples() const { - // These first samples are skipped, after first possibly skipping 0-2 full frames, it seems. - return codec == 0x1000 ? 0x170 : 0x45; - } -}; - -// One of these structs is allocated for each Atrac context. -// The raw codec state is stored in 'codec'. -// The internal playback state is stored in 'info', and that is used for all state keeping in the Atrac2 implementation, -// imitating what happens on hardware as closely as possible. -struct SceAtracContext { - // size 128 - SceAudiocodecCodec codec; - // size 128 - SceAtracIdInfo info; -}; - -struct Atrac3LowLevelParams { - int encodedChannels; - int outputChannels; - int bytesPerFrame; -}; - constexpr int PSP_MAX_ATRAC_IDS = 6; class AtracBase; diff --git a/Core/HLE/sceAudiocodec.cpp b/Core/HLE/sceAudiocodec.cpp index bb3ad5022e..a8ae37276a 100644 --- a/Core/HLE/sceAudiocodec.cpp +++ b/Core/HLE/sceAudiocodec.cpp @@ -50,7 +50,14 @@ static_assert(sizeof(SceAudiocodecCodec) == 128); // Known byte values. // Atrac3 (0x1001) -// ------------------------------------------------ +// +// Frame size data byte JointStereo? +// ------------------------------------------------- +// 0x180 0x04 0 +// 0x130 0x06 0 +// 0x0C0 0x0B 1 +// 0x0C0 0x0E 0 +// 0x098 0x0F 0 // AAC (0x1003) // ------------------------------------------------ diff --git a/Core/HLE/sceAudiocodec.h b/Core/HLE/sceAudiocodec.h index 4d24a98e2b..ac3aaf9c45 100644 --- a/Core/HLE/sceAudiocodec.h +++ b/Core/HLE/sceAudiocodec.h @@ -44,8 +44,8 @@ struct SceAudiocodecCodec { // Probably, from here on out is a union with different fields for different codecs. union { // offset 40 / 0x28 struct { - s8 unk40; // 28 format or looping related - s8 unk41; // 29 format or looping related + s8 unk40; // 28 format or looping related . Aka tailrelated + s8 unk41; // 29 format or looping related . Aka tailflag s8 unk42; s8 unk43; }; diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index a68c52a274..1eb7020d66 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -120,10 +120,11 @@ void JitBlockCache::Shutdown() { // This clears the JIT cache. It's called from JitCache.cpp when the JIT cache // is full and when saving and loading states. void JitBlockCache::Clear() { + // Note: We intentionally clear the block_map_ first to avoid O(N^2) behavior in RemoveBlockMap + block_map_.clear(); for (int i = 0; i < num_blocks_; i++) { DestroyBlock(i, DestroyType::CLEAR); } - block_map_.clear(); proxyBlockMap_.clear(); links_to_.clear(); num_blocks_ = 0; @@ -238,6 +239,7 @@ void JitBlockCache::RemoveBlockMap(int block_num) { // TODO: This is O(n), so O(n^2) when called for every block. for (auto it = block_map_.begin(); it != block_map_.end(); ++it) { if (it->second == (u32)block_num) { + _dbg_assert_(false); block_map_.erase(it); break; } diff --git a/Core/Util/AtracTrack.cpp b/Core/Util/AtracTrack.cpp index 86586ba863..f2a00fd5f9 100644 --- a/Core/Util/AtracTrack.cpp +++ b/Core/Util/AtracTrack.cpp @@ -2,18 +2,20 @@ #include "Common/StringUtils.h" #include "Core/Util/AtracTrack.h" #include "Core/HLE/ErrorCodes.h" +#include "Common/Data/Format/RIFF.h" #include "Core/MemMap.h" // Atrac file parsing constants -#define AT3_MAGIC 0x0270 -#define AT3_PLUS_MAGIC 0xFFFE // This is normally a marker for WAVE_FORMAT_EXTENSIBLE -const int RIFF_CHUNK_MAGIC = 0x46464952; -const int RIFF_WAVE_MAGIC = 0x45564157; -const int FMT_CHUNK_MAGIC = 0x20746D66; -const int DATA_CHUNK_MAGIC = 0x61746164; -const int SMPL_CHUNK_MAGIC = 0x6C706D73; -const int FACT_CHUNK_MAGIC = 0x74636166; +constexpr int RIFF_CHUNK_MAGIC = 0x46464952; +constexpr int RIFF_WAVE_MAGIC = 0x45564157; +constexpr int FMT_CHUNK_MAGIC = 0x20746D66; +constexpr int DATA_CHUNK_MAGIC = 0x61746164; +constexpr int SMPL_CHUNK_MAGIC = 0x6C706D73; +constexpr int FACT_CHUNK_MAGIC = 0x74636166; + +constexpr u32 WAVE_FORMAT_EXTENSIBLE = 0xFFFE; +constexpr u32 WAVE_FORMAT_AT3 = 0x270; static u16 Read16(const u8 *buffer, int offset) { u16 value; @@ -27,6 +29,7 @@ static u32 Read32(const u8 *buffer, int offset) { return value; } +// Old WAVE parser. int AnalyzeAtracTrack(const u8 *buffer, u32 size, Track *track, std::string *error) { // 72 is about the size of the minimum required data to even be valid. if (size < 72) { @@ -108,14 +111,14 @@ int AnalyzeAtracTrack(const u8 *buffer, u32 size, Track *track, std::string *err } auto at3fmt = (const RIFFFmtChunk *)(buffer + offset); - if (chunkSize < 32 || (at3fmt->fmtTag == AT3_PLUS_MAGIC && chunkSize < 52)) { + if (chunkSize < 32 || (at3fmt->fmtTag == WAVE_FORMAT_EXTENSIBLE && chunkSize < 52)) { *error = "AnalyzeTrack: fmt definition too small(%d)"; return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; } - if (at3fmt->fmtTag == AT3_MAGIC) + if (at3fmt->fmtTag == WAVE_FORMAT_AT3) track->codecType = PSP_CODEC_AT3; - else if (at3fmt->fmtTag == AT3_PLUS_MAGIC) + else if (at3fmt->fmtTag == WAVE_FORMAT_EXTENSIBLE) track->codecType = PSP_CODEC_AT3PLUS; else { *error = "AnalyzeTrack: invalid fmt magic: %04x"; @@ -140,13 +143,12 @@ int AnalyzeAtracTrack(const u8 *buffer, u32 size, Track *track, std::string *err // TODO: There are some format specific bytes here which seem to have fixed values? // Probably don't need them. - if (at3fmt->fmtTag == AT3_MAGIC) { // 0x270 + if (at3fmt->fmtTag == WAVE_FORMAT_AT3) { // 0x270 // This is the offset to the jointStereo_ field. track->jointStereo = Read16(buffer, offset + 24); // Then there are more fields here. u16 unknown1_2 = Read16(buffer, offset + 30); - } else if (at3fmt->fmtTag == AT3_PLUS_MAGIC) { - _dbg_assert_(at3fmt->fmtTag == 0xFFFE); + } else if (at3fmt->fmtTag == WAVE_FORMAT_EXTENSIBLE) { // It's in an "Extensible" wave format. Let's read some more. } if (chunkSize > 16) { @@ -321,3 +323,217 @@ int AnalyzeAA3Track(const u8 *buffer, u32 size, u32 fileSize, Track *track, std: track->endSample -= 1; return 0; } + +static inline u32 Read16(const u8 *base, int *offset) { + // Little-endian reliance. + u32 value = 0; + memcpy(&value, base + *offset, 2); + *offset += 2; + return value; +} + +static inline u32 Read32(const u8 *base, int *offset) { + // Little-endian reliance. + u32 value = 0; + memcpy(&value, base + *offset, 4); + *offset += 4; + return value; +} + +static const u8 g_atrac3Checkbytes[] = { + 0xBF, 0xAA, 0x23, 0xE9, 0x58, 0xCB, 0x71, 0x44, + 0xA1, 0x19, 0xFF, 0xFA, 0x01, 0xE4, 0xCE, 0x62, +}; + +static inline int RoundUpToEven(int size) { + // Round up to the next even number. + return (size + 1) & ~1; +} + +int ParseWaveAT3(const u8 *data, int dataLength, TrackInfo *track) { + track->loopStart = 0xFFFFFFFF; + track->loopEnd = 0xFFFFFFFF; + track->firstSampleOffset = 0; + track->endSample = 0; + track->waveDataSize = 0; + + int retval = SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + int offset = 0; // byte offset into the data array. Is kept even. + + // Scan RIFF chunks for the RIFFWAVE header. Normally we find this immediately. + while (true) { + if (offset + 0xC >= dataLength) { + return SCE_ERROR_ATRAC_SIZE_TOO_SMALL; + } + const u32 blockID = Read32(data, &offset); + if (blockID != RIFF_CHUNK_MAGIC) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + const u32 blockSize = RoundUpToEven(Read32(data, &offset)); + const u32 waveID = Read32(data, &offset); + if (waveID == RIFF_WAVE_MAGIC) { + // We found the WAVE header. + break; + } + offset += blockSize - 4; + } + + // Now that we have the header, loop through the rest of the chunks. + bool modifiedSampleOffset = false; + while (true) { + if (offset + 8 >= dataLength) { + return SCE_ERROR_ATRAC_SIZE_TOO_SMALL; + } + const u32 chunkID = Read32(data, &offset); + const int chunkSize = RoundUpToEven(Read32(data, &offset)); + const int nextOffset = offset + chunkSize; + // We allow the data chunk to be bigger than readSize, as we may not have read the whole file. + if (offset + chunkSize > dataLength && chunkID != DATA_CHUNK_MAGIC) { + return SCE_ERROR_ATRAC_SIZE_TOO_SMALL; + } + int remainingBytes = 0; + switch (chunkID) { + case DATA_CHUNK_MAGIC: + { + // This should be the last chunk we find, it lasts to the end of the file. + // I guess another order is possible, but not if streaming. + track->waveDataSize = chunkSize; + track->dataOff = offset; + if (!track->firstSampleOffset) { + INFO_LOG(Log::Atrac, "DATA chunk found at offset %d with size %d", offset, chunkSize); + track->firstSampleOffset = retval == PSP_CODEC_AT3 ? 0x400 : 0x800; + } + if (modifiedSampleOffset && retval == PSP_CODEC_AT3PLUS) { + track->firstSampleOffset -= 0xb8; + if (track->loopEnd != 0xFFFFFFFF) { + track->loopEnd -= 0xb8; + track->loopStart -= 0xb8; + } + } + return retval; + } + case FMT_CHUNK_MAGIC: + { + if (retval != SCE_ERROR_ATRAC_UNKNOWN_FORMAT) { + // This means dual FMT chunks, which is not valid. + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + if (chunkSize < 0x20) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + const u16 fmtTag = Read16(data, &offset); + const u16 chans = Read16(data, &offset); + track->numChans = chans; + if (chans != 1 && chans != 2) { + // Only stereo and mono are supported. + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + const int sampleRate = Read32(data, &offset); + if (sampleRate != 44100) { + // Only a single sample rate is supported. + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + offset += 4; // skip avgBytesPerSec + track->blockAlign = (u16)Read16(data, &offset); + if (track->blockAlign == 0) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + if (fmtTag == WAVE_FORMAT_AT3) { + // Atrac3 format. + offset += 4; // skip the extra bytes + const u16 jointStereo = Read16(data, &offset); + if (jointStereo != 1) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + offset += 4; + const u16 sampleSizeTailFlag = Read16(data, &offset); + track->sampleSizeMaybe = (u8)sampleSizeTailFlag; + track->tailFlag = (u8)(sampleSizeTailFlag >> 8); + const u16 unknown2 = Read16(data, &offset); + if ((sampleSizeTailFlag & 0xffff) != unknown2) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + // Don't what this is, but it seems to be always 1. + const u32 supposedToBeOne = Read32(data, &offset); + if (supposedToBeOne != 1) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + retval = PSP_CODEC_AT3; // ATRAC3 + remainingBytes = chunkSize - 0x20; + } else if (fmtTag == WAVE_FORMAT_EXTENSIBLE) { + // Atrac3+ format, probably. + if (chunkSize < 0x34) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + if (memcmp(data + offset + 10, g_atrac3Checkbytes, sizeof(g_atrac3Checkbytes)) != 0) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + track->sampleSizeMaybe = data[offset + 0x1c]; + track->tailFlag = data[offset + 0x1d]; + if ((track->sampleSizeMaybe << 27) >> 29 != track->numChans) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + offset += 0x26; // Or, use the blocksize? + retval = PSP_CODEC_AT3PLUS; + remainingBytes = chunkSize - 0x34; + } else { + // Unsupported fmtTag. + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + if (remainingBytes) { + INFO_LOG(Log::Atrac, "FMT chunk has %d extra bytes", remainingBytes); + } + break; + } + case SMPL_CHUNK_MAGIC: + { + if ((int)track->loopStart < 0) { + if (chunkSize < 0x20) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + offset += 0x1c; + const int numLoops = Read32(data, &offset); + if (numLoops != 0) { + if (chunkSize < 0x34) { + return SCE_ERROR_ATRAC_SIZE_TOO_SMALL; + } + offset += 0xc; + track->loopStart = Read32(data, &offset); + track->loopEnd = Read32(data, &offset); + if (track->loopEnd <= (int)track->loopStart) { + return SCE_ERROR_ATRAC_BAD_CODEC_PARAMS; + } + } + } + break; + } + case FACT_CHUNK_MAGIC: + { + if (chunkSize < 4) { + return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; + } + track->endSample = Read32(data, &offset); + remainingBytes = chunkSize - 4; + if (remainingBytes == 4) { + track->firstSampleOffset = Read32(data, &offset); + remainingBytes = 0; + } else if (remainingBytes >= 8) { + // Extended FACT format. + offset += 4; + track->firstSampleOffset = Read32(data, &offset); + modifiedSampleOffset = true; + remainingBytes -= 8; + } + break; + } + default: + // Skip the unknown block. + INFO_LOG(Log::Atrac, "Skipping unknown block ID %08x at offset %d with size %d", chunkID, offset - 8, chunkSize); + break; + } + if (remainingBytes) { + INFO_LOG(Log::Atrac, "%08x chunk has %d extra bytes", chunkID, remainingBytes); + } + offset = nextOffset; + } +} diff --git a/Core/Util/AtracTrack.h b/Core/Util/AtracTrack.h index 1d670865b4..5090d61f00 100644 --- a/Core/Util/AtracTrack.h +++ b/Core/Util/AtracTrack.h @@ -6,9 +6,7 @@ #include #include "Core/HLE/sceAudiocodec.h" - -constexpr u32 ATRAC3_MAX_SAMPLES = 0x400; // 1024 -constexpr u32 ATRAC3PLUS_MAX_SAMPLES = 0x800; // 2048 +#include "Core/HLE/AtracBase.h" struct AtracLoopInfo { int cuePointID; @@ -108,3 +106,19 @@ struct Track { int AnalyzeAA3Track(const u8 *buffer, u32 size, u32 filesize, Track *track, std::string *error); int AnalyzeAtracTrack(const u8 *buffer, u32 size, Track *track, std::string *error); + +struct TrackInfo { + u16 numChans; + u16 blockAlign; + u8 sampleSizeMaybe; + u8 tailFlag; + u8 unused[2]; + u32 dataOff; + u32 endSample; + u32 waveDataSize; + u32 firstSampleOffset; + u32 loopStart; + u32 loopEnd; +}; + +int ParseWaveAT3(const u8 *data, int length, TrackInfo *track); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 9aa5f34c10..ea2d0fe18a 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1,3 +1,4 @@ + // Copyright (c) 2013- PPSSPP Project. // This program is free software: you can redistribute it and/or modify From 1ec87e044823e59ebf510f6f9ad4de0a137a3fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 2 Jul 2025 11:20:09 +0200 Subject: [PATCH 09/25] Merge pull request #20592 from Xmemes811/master Update ja_JP.ini --- assets/lang/ja_JP.ini | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/assets/lang/ja_JP.ini b/assets/lang/ja_JP.ini index fffd359a1a..71079d79f3 100644 --- a/assets/lang/ja_JP.ini +++ b/assets/lang/ja_JP.ini @@ -312,9 +312,9 @@ Dump Decrypted Eboot = 復号したEBOOT.BINを起動時にダンプする Dump next frame to log = 次のフレームをログにダンプする Enable driver bug workarounds = ドライバーバグの回避の有効化 Enable Logging = デバッグログを有効にする -Enable shader cache = Enable shader cache +Enable shader cache = シェーダーキャッシュを有効にする Enter address = アドレスを入力する -Fast = Fast +Fast = 速い Fast-forward mode = 速度制限を解除 FPU = FPU Fragment = フラグメント @@ -741,7 +741,7 @@ xBRZ = xBRZ [InstallZip] Data to import = インポートするデータ Delete ZIP file = ZIPファイルを削除 -Existing data = Existing data +Existing data = 既存データ Import savedata from ZIP file = ZIPファイルからセーブデータをインポートする Install = インストールする Install game from ZIP file? = ZIPファイルからゲームをインストールしますか? @@ -881,7 +881,7 @@ Swipe Up = スワイプ【上】 tap to customize = タップして設定 Texture Dumping = テクスチャのダンプ Texture Replacement = テクスチャの置換 -Toggle Debugger = Toggle Debugger +Toggle Debugger = デバッガーの切り替え Toggle Fullscreen = フルスクリーンの切り替え Toggle mode = モードの切り替え Toggle mouse input = マウス入力の切り替え @@ -897,7 +897,7 @@ Wlan = WLAN [Networking] AdHoc server = アドホックサーバー AdhocServer Failed to Bind Port = アドホックサーバーがポートのバインドに失敗しました -Allow speed control while connected (not recommended) = Allow speed control while connected (not recommended) +Allow speed control while connected (not recommended) = 接続中に速度制御を許可する(非推奨) AM: Data from Unknown Port = AM: 不明なポートからのデータ Auto = 自動 Autoconfigure = DNSの自動構成 @@ -1459,11 +1459,11 @@ Tex2xBRZ = Tex2xBRZ Tex4xBRZ = Tex4xBRZ [Themes] -Alpine = Alpine +Alpine = 高山 Dark = ダーク Default = デフォルト -Slate Forest = Slate Forest -Strawberry = Strawberry +Slate Forest = スレートフォレスト +Strawberry = いちご [UI Elements] %1 button = %1 ボタン From d1245ec336062f9cfe53f468a90df1529075c495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 8 Jul 2025 14:43:31 +0200 Subject: [PATCH 10/25] Merge pull request #20604 from hrydgard/minor-fixes Fix some small UI regressions --- Common/Input/KeyCodes.h | 4 +--- Core/KeyMap.cpp | 2 +- GPU/Common/TextureReplacer.cpp | 18 +++--------------- GPU/Common/TextureReplacer.h | 2 +- UI/EmuScreen.cpp | 11 ++++++----- UI/PauseScreen.cpp | 5 +++++ Windows/RawInput.cpp | 2 +- ext/imgui/imgui_impl_platform.cpp | 2 +- 8 files changed, 19 insertions(+), 27 deletions(-) diff --git a/Common/Input/KeyCodes.h b/Common/Input/KeyCodes.h index 925998945b..30365511ee 100644 --- a/Common/Input/KeyCodes.h +++ b/Common/Input/KeyCodes.h @@ -128,7 +128,7 @@ enum InputKeyCode { NKCODE_META_LEFT = 117, NKCODE_META_RIGHT = 118, NKCODE_FUNCTION = 119, - NKCODE_SYSRQ = 120, + NKCODE_PRINTSCREEN = 120, NKCODE_BREAK = 121, NKCODE_MOVE_HOME = 122, NKCODE_MOVE_END = 123, @@ -246,8 +246,6 @@ enum InputKeyCode { NKCODE_EXT_MOUSEWHEEL_UP = 1008, NKCODE_EXT_MOUSEWHEEL_DOWN = 1009, - NKCODE_EXT_PRINTSCREEN = 1010, - NKCODE_MAX }; diff --git a/Core/KeyMap.cpp b/Core/KeyMap.cpp index b4d96afab7..44bcbf83c5 100644 --- a/Core/KeyMap.cpp +++ b/Core/KeyMap.cpp @@ -225,7 +225,7 @@ static const KeyMap_IntStrPair key_names[] = { {NKCODE_APOSTROPHE, "'"}, {NKCODE_MINUS, "-"}, {NKCODE_PLUS, "+"}, - {NKCODE_SYSRQ, "Print"}, + {NKCODE_PRINTSCREEN, "Print"}, {NKCODE_SCROLL_LOCK, "ScrLock"}, {NKCODE_BREAK, "Pause"}, diff --git a/GPU/Common/TextureReplacer.cpp b/GPU/Common/TextureReplacer.cpp index 55b3032e85..b29feeb1e8 100644 --- a/GPU/Common/TextureReplacer.cpp +++ b/GPU/Common/TextureReplacer.cpp @@ -102,28 +102,16 @@ void TextureReplacer::NotifyConfigChanged() { // Even if just saving is enabled, it makes sense to reload the ini to get the correct // settings for saving. See issue #19086. This can be expensive though. std::string error; - bool result = LoadIni(&error); + bool result = LoadIni(&error, false); if (!result) { // Ignore errors here, just log if we successfully loaded an ini. } else { INFO_LOG(Log::G3D, "Loaded INI file for saving."); } } - - if (saveEnabled_) { - // Somewhat crude message, re-using translation strings. - auto d = GetI18NCategory(I18NCat::DEVELOPER); - auto di = GetI18NCategory(I18NCat::DIALOG); - std::string str(d->T("Save new textures")); - if (!str.empty()) { - str.append(": "); - str.append(di->T("Enabled")); - g_OSD.Show(OSDType::MESSAGE_INFO, str, 2.0f); - } - } } -bool TextureReplacer::LoadIni(std::string *error) { +bool TextureReplacer::LoadIni(std::string *error, bool notify) { hash_ = ReplacedTextureHash::QUICK; aliases_.clear(); hashranges_.clear(); @@ -214,7 +202,7 @@ bool TextureReplacer::LoadIni(std::string *error) { } auto gr = GetI18NCategory(I18NCat::GRAPHICS); - if (replaceEnabled_) { + if (replaceEnabled_ && notify) { g_OSD.Show(OSDType::MESSAGE_SUCCESS, gr->T("Texture replacement pack activated"), 3.0f); } diff --git a/GPU/Common/TextureReplacer.h b/GPU/Common/TextureReplacer.h index ea70bc09ea..9410dac6dd 100644 --- a/GPU/Common/TextureReplacer.h +++ b/GPU/Common/TextureReplacer.h @@ -131,7 +131,7 @@ public: protected: bool FindFiltering(u64 cachekey, u32 hash, TextureFiltering *forceFiltering); - bool LoadIni(std::string *error); + bool LoadIni(std::string *error, bool notify = true); bool LoadIniValues(IniFile &ini, VFSBackend *dir, bool isOverride, std::string *error); void ParseHashRange(const std::string &key, const std::string &value); void ParseFiltering(const std::string &key, const std::string &value); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 503a2ee25f..4a9e69b648 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -899,19 +899,20 @@ void EmuScreen::ProcessVKey(VirtKey virtKey) { case VIRTKEY_TEXTURE_DUMP: g_Config.bSaveNewTextures = !g_Config.bSaveNewTextures; if (g_Config.bSaveNewTextures) { - g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("saveNewTextures_true", "Textures will now be saved to your storage"), 2.0, "savetexturechanged"); - System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED); + g_OSD.Show(OSDType::MESSAGE_SUCCESS, sc->T("saveNewTextures_true", "Textures will now be saved to your storage"), 2.0, "savetexturechanged"); } else { g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("saveNewTextures_false", "Texture saving was disabled"), 2.0, "savetexturechanged"); } + System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED); break; case VIRTKEY_TEXTURE_REPLACE: g_Config.bReplaceTextures = !g_Config.bReplaceTextures; - if (g_Config.bReplaceTextures) - g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("replaceTextures_true", "Texture replacement enabled"), 2.0, "replacetexturechanged"); - else + if (g_Config.bReplaceTextures) { + g_OSD.Show(OSDType::MESSAGE_SUCCESS, sc->T("replaceTextures_true", "Texture replacement enabled"), 2.0, "replacetexturechanged"); + } else { g_OSD.Show(OSDType::MESSAGE_INFO, sc->T("replaceTextures_false", "Textures are no longer being replaced"), 2.0, "replacetexturechanged"); + } System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED); break; diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index 7336981174..f3874e3b3a 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -643,6 +643,11 @@ std::string GetConfirmExitMessage() { confirmMessage += '\n'; } + if (coreState == CORE_RUNTIME_ERROR) { + // The game crashed, or similar. Don't bother checking for timeout or network. + return confirmMessage; + } + if (IsNetworkConnected()) { auto nw = GetI18NCategory(I18NCat::NETWORKING); confirmMessage += nw->T("Network connected"); diff --git a/Windows/RawInput.cpp b/Windows/RawInput.cpp index 6872129716..21082ae555 100644 --- a/Windows/RawInput.cpp +++ b/Windows/RawInput.cpp @@ -177,7 +177,7 @@ namespace WindowsRawInput { { VK_MBUTTON, NKCODE_EXT_MOUSEBUTTON_3 }, { VK_XBUTTON1, NKCODE_EXT_MOUSEBUTTON_4 }, { VK_XBUTTON2, NKCODE_EXT_MOUSEBUTTON_5 }, - { VK_SNAPSHOT, NKCODE_EXT_PRINTSCREEN }, + { VK_SNAPSHOT, NKCODE_PRINTSCREEN }, }; void Init() { diff --git a/ext/imgui/imgui_impl_platform.cpp b/ext/imgui/imgui_impl_platform.cpp index 562d0ed722..17af2b342f 100644 --- a/ext/imgui/imgui_impl_platform.cpp +++ b/ext/imgui/imgui_impl_platform.cpp @@ -244,7 +244,7 @@ ImGuiKey KeyCodeToImGui(InputKeyCode keyCode) { case NKCODE_EXT_MOUSEWHEEL_UP: // Keys ignored for imgui return ImGuiKey_None; - case NKCODE_EXT_PRINTSCREEN: + case NKCODE_PRINTSCREEN: return ImGuiKey_PrintScreen; case NKCODE_EXT_PIPE: From 9158b590fc1c082204baf057de205c3f854ec46b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 8 Jul 2025 22:36:37 +0200 Subject: [PATCH 11/25] Merge pull request #20605 from hrydgard/more-minor-fixes Fix strange edge case when switching to auto-frameskip from non-buffered rendering --- Core/Config.cpp | 3 -- Core/HLE/sceDisplay.cpp | 10 ++++++- GPU/Common/FramebufferManagerCommon.cpp | 2 ++ GPU/Common/FramebufferManagerCommon.h | 4 +++ Windows/MainWindow.cpp | 38 +++++++++++++++---------- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index d7a3986caa..840986788e 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1462,9 +1462,6 @@ void Config::PostLoadCleanup(bool gameSpecific) { if (g_Config.sCustomDriver == "Default") { g_Config.sCustomDriver = ""; } - - // Convert old volume settings. - } void Config::PreSaveCleanup(bool gameSpecific) { diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index aa2258f35d..fe6436498c 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -425,7 +425,7 @@ static void DoFrameTiming(bool throttle, bool *skipFrame, float scaledTimestep, // Auto-frameskip automatically if speed limit is set differently than the default. int frameSkipNum = DisplayCalculateFrameSkip(); - if (g_Config.bAutoFrameSkip) { + if (g_Config.bAutoFrameSkip && !g_Config.bSkipBufferEffects) { // autoframeskip // Argh, we are falling behind! Let's skip a frame and see if we catch up. if (curFrameTime > nextFrameTime && doFrameSkip) { @@ -694,6 +694,14 @@ void __DisplayFlip(int cyclesLate) { } else { gstate_c.skipDrawReason &= ~SKIPDRAW_SKIPFRAME; numSkippedFrames = 0; + + // NOTE!! It can happen that if we just toggled frameskip (especially auto), we are still in a state + // where we don't have a framebuffer bound, from the last frame. But framebuffermanager still might think + // that we're in non-buffered mode. + if (gpu->GetFramebufferManagerCommon() && !gpu->GetFramebufferManagerCommon()->UseBufferedRendering() && !g_Config.bSkipBufferEffects) { + gpu->GetFramebufferManagerCommon()->ForceUseBufferedRendering(!g_Config.bSkipBufferEffects); + gstate_c.skipDrawReason &= ~SKIPDRAW_NON_DISPLAYED_FB; + } } // Returning here with coreState == CORE_NEXTFRAME causes a buffer flip to happen (next frame). diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 470651f2d3..edb180aca8 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -1707,6 +1707,8 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { } else if (useBufferedRendering_) { WARN_LOG(Log::FrameBuf, "Using buffered rendering, and current VFB lacks an FBO: %08x", vfb->fb_address); } else { + // This is OK because here we're in "skip buffered" mode, so even if we haven't presented + // we will have a render target. presentation_->NotifyPresent(); } diff --git a/GPU/Common/FramebufferManagerCommon.h b/GPU/Common/FramebufferManagerCommon.h index 63a3bf011f..1424191292 100644 --- a/GPU/Common/FramebufferManagerCommon.h +++ b/GPU/Common/FramebufferManagerCommon.h @@ -385,6 +385,10 @@ public: return useBufferedRendering_; } + void ForceUseBufferedRendering(bool buf) { + useBufferedRendering_ = true; + } + // TODO: Maybe just include the last depth buffer address in this, too. bool MayIntersectFramebufferColor(u32 start) const { // Clear the cache/kernel bits. diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index 65c8045f77..a095d76e90 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -152,8 +152,8 @@ namespace MainWindow bool trapMouse = true; // Handles some special cases(alt+tab, win menu) when game is running and mouse is confined #define MAX_LOADSTRING 100 - const TCHAR *szWindowClass = TEXT("PPSSPPWnd"); - const TCHAR *szDisplayClass = TEXT("PPSSPPDisplay"); + const wchar_t *const szWindowClass = L"PPSSPPWnd"; + const wchar_t *const szDisplayClass = L"PPSSPPDisplay"; // Forward declarations of functions included in this code module: LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); @@ -180,7 +180,7 @@ namespace MainWindow wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.hInstance = hInstance; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = NULL; // Always covered by display window + wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wcex.lpszMenuName = (LPCWSTR)IDR_MENU1; wcex.lpszClassName = szWindowClass; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_PPSSPP); @@ -544,8 +544,10 @@ namespace MainWindow WindowsRawInput::Init(); - SetFocus(hwndMain); + UpdateWindow(hwndMain); + UpdateWindow(hwndDisplay); + SetFocus(hwndMain); return TRUE; } @@ -615,8 +617,6 @@ namespace MainWindow } LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - static bool firstErase = true; - switch (message) { case WM_SIZE: break; @@ -652,12 +652,7 @@ namespace MainWindow break; case WM_ERASEBKGND: - if (firstErase) { - firstErase = false; - // Paint black on first erase while OpenGL stuff is loading - return DefWindowProc(hWnd, message, wParam, lParam); - } - // Then never erase, let the OpenGL drawing take care of everything. + // Don't erase, let OpenGL take care of it. return 1; // Mouse input. We send asynchronous touch events for minimal latency. @@ -852,8 +847,11 @@ namespace MainWindow return darkResult; } + static bool first = true; + switch (message) { case WM_CREATE: + first = true; if (!IsVistaOrHigher()) { // Remove the D3D11 choice on versions below XP RemoveMenu(GetMenu(hWnd), ID_OPTIONS_DIRECT3D11, MF_BYCOMMAND); @@ -968,8 +966,18 @@ namespace MainWindow break; case WM_ERASEBKGND: - // This window is always covered by DisplayWindow. No reason to erase. - return 0; + { + if (first) { + // Manually clearing on first boot looks better (only a brief white flash which I can't seem + // to get rid of). + HDC hdc = (HDC)wParam; + RECT rc; + GetClientRect(hWnd, &rc); + FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); + first = false; + } + return 1; + } case WM_MOVE: SavePosition(); @@ -1114,7 +1122,7 @@ namespace MainWindow // TODO: Translate? Or just not bother? MessageBox(hwndMain, L"You can only load one file at a time", L"Error", MB_ICONINFORMATION); } else { - TCHAR filename[1024]; + wchar_t filename[1024]; if (DragQueryFile(hdrop, 0, filename, ARRAY_SIZE(filename)) != 0) { const std::string utf8_filename = ReplaceAll(ConvertWStringToUTF8(filename), "\\", "/"); System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, utf8_filename); From 7231f8f2a11549143afc8beefdb03bc328547c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 6 Jul 2025 01:45:59 +0200 Subject: [PATCH 12/25] Merge pull request #20598 from Puniasterus/patch-2 Update es_ES.ini --- assets/lang/es_ES.ini | 117 +++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/assets/lang/es_ES.ini b/assets/lang/es_ES.ini index a81adbd654..f1395754a0 100644 --- a/assets/lang/es_ES.ini +++ b/assets/lang/es_ES.ini @@ -67,7 +67,7 @@ Audio Error = Error de audio Audio file format not supported. Must be WAV or MP3. = Formato de audio no compatible. Debe ser WAV o MP3. AudioBufferingForBluetooth = Búfer compatible con bluetooth (lento) Auto = Automático -Buffer size = Buffer size +Buffer size = Tamaño del búfer Device = Dispositivo Disabled = Desactivado DSound (compatible) = DirectSound (compatible) @@ -204,7 +204,7 @@ Copy PSP memory base address = Copiar dirección base de la memoría de PSP Debugging = &Depuración Deposterize = &Deposterizar Direct3D11 = Direct3D &11 -Direct3D9 = &Direct3D9 +Direct3D9 = Direct3D &9 Disassembly = &Desamblador... Discord = Discord Display Layout && Effects = Distribución de pantalla y shaders... @@ -309,18 +309,18 @@ Dev Tools = Herramientas de desarrollo DevMenu = DevMenu Disabled JIT functionality = Desactivar funcionalidad JIT Display refresh rate = Mostrar frecuencia de actualización -Don't download infra-dns.json = Don't download infra-dns.json +Don't download infra-dns.json = No descargar infra-dns.json Draw Frametimes Graph = Dibujar gráfico para tiempo de fotograma Dump Decrypted Eboot = Volcar EBOOT.BIN descifrado al iniciar juego Dump next frame to log = Volcar siguiente fotograma a registro -Enable driver bug workarounds = Activar soluciones alternativos a errores de driver +Enable driver bug workarounds = Activar soluciones alternativas a errores de controlador Enable Logging = Activar registro -Enable shader cache = Enable shader cache +Enable shader cache = Habilitar caché de shaders Enter address = Introducir dirección -Fast = Fast +Fast = Rápido Fast-forward mode = Modo de avance rápido FPU = FPU -Fragment = Fragmento +Fragment = Fragmentos Frame Profiler = Analizador de fotogramas Frame timing = Sincronización de fotogramas Framedump tests = Tests de volcado de fotogramas @@ -330,24 +330,24 @@ GPU Allocator Viewer = Visor de asignador de GPU GPU Driver Test = Test de controlador GPU GPU log profiler = Analizador de registro GPU GPU Profile = Perfil GPU -Instant (may stutter) = Instant (may stutter) +Instant (may stutter) = Instantáneo (puede provocar pequeños parones) Jit Compare = Comparación JIT JIT debug tools = Herramientas de depuración JIT Log Dropped Frame Statistics = Estadísticas de fotogramas perdidos en el registro Log Level = Nivel de registro -Log to file = Log to file +Log to file = Registrar en archivo Log View = Ver el registro Logging Channels = Canales de registro -Medium = Medium +Medium = Medio Multi-threaded rendering = Renderizado multiproceso Next = Siguiente No block = No bloquear -Off = Off +Off = Deshabilitar Prev = Anterior -Prevent loading overlays = Prevent loading overlays +Prevent loading overlays = Evitar la carga de superposiciones Random = Aleatorio Replace textures = Remplazar texturas -Replacement texture load speed = Replacement texture load speed +Replacement texture load speed = Velocidad de carga de texturas de reemplazo Reset = Restablecer Reset limited logging = Restablecer registro limitado RestoreDefaultSettings = ¿Seguro que quieres restaurar estos ajustes a sus valores predeterminados?\Esto no se puede deshacer.\Por favor, reinicia PPSSPP después de restaurar. @@ -356,18 +356,18 @@ Resume = Reanudar Save new textures = Guardar nuevas texturas Shader Viewer = Visor de shader Show Developer Menu = Mostrar menú de desarrollo -Show GPO LEDs = Mostra LEDs GPO -Slow (smooth) = Slow (smooth) +Show GPO LEDs = Mostrar LEDs GPO +Slow (smooth) = Lento (fluido) Stats = Estadísticas System Information = Información de sistema Texture ini file created = Creado archivo .ini de texturas -Texture Replacement = Texturas de repuesto +Texture Replacement = Reemplazo de texturas Toggle Freeze = Parar/Reanudar imagen Touchscreen Test = Test de pantalla táctil Ubershaders = Ubershaders -Use FFMPEG for all compressed audio = Use FFMPEG for all compressed audio -Use the old sceAtrac implementation = Use the old sceAtrac implementation -Vertex = Vertex +Use FFMPEG for all compressed audio = Usar FFMPEG para todo el audio comprimido +Use the old sceAtrac implementation = Usar la antigua implementación de sceAtrac +Vertex = Vértices VFPU = VFPU [Dialog] @@ -377,7 +377,7 @@ VFPU = VFPU %d seconds = %d segundos * PSP res = * resolución PSP Active = Activo -Are you sure you want to delete the file? = Are you sure you want to delete the file? +Are you sure you want to delete the file? = ¿Estás seguro de que quieres eliminar el archivo? Are you sure you want to exit? = ¿Estás seguro de que quieres salir? Back = Atrás Bottom Center = Inferior centrado @@ -443,7 +443,7 @@ Logging in... = Iniciando sesión... More info = Más información Move = Mover Move Down = Mover abajo -Move to trash = Move to trash +Move to trash = Mover a la papelera Move Up = Mover arriba Network Connection = Conexión de red NEW DATA = NUEVOS DATOS @@ -451,7 +451,7 @@ No = No None = Ninguno ObtainingIP = Obteniendo direcciónn IP.\nPor favor, espera... OK = Aceptar -Old savedata detected = Detectados viejos datos de juegos. +Old savedata detected = Encontrado guardado previo. Options = Opciones Password = Contraseña Remove = Borrar @@ -477,7 +477,7 @@ SSID = SSID Submit = Enviar Supported = Soportado There is no data = No hay datos. -This change will not take effect until PPSSPP is restarted. = This change will not take effect until PPSSPP is restarted. +This change will not take effect until PPSSPP is restarted. = Este cambio no tendrá efecto hasta que se reinicie PPSSPP. Toggle All = Cambiar todo Toggle List = Ver lista Top Center = Superior centrado @@ -494,12 +494,12 @@ Zoom = Acercar [Error] 7z file detected (Require 7-Zip) = Archivo 7z detectado (Necesario 7-Zip).\nPor favor, descomprima primero (pruebe 7-Zip o WinRAR). A PSP game couldn't be found on the disc. = No se pudo encontrar un juego de PSP en el disco. -Cannot boot ELF located outside mountRoot. = No se pudo inicar ELF ubicado fuera del mountRoot. +Cannot boot ELF located outside mountRoot. = No se pudo iniciar ELF ubicado fuera del mountRoot. Could not save screenshot file = No se pudo guardar la captura de pantalla. D3D11CompilerMissing = D3DCompiler_47.dll no encontrado. Instálelo o presione Sí para volver a intentarlo usando Direct3D 9. D3D11InitializationError = Error de inicialización de Direct3D 11. D3D11Missing = La versión de tu sistema operativo no incluye D3D11. Por favor, ejecute Windows Update.\n\nPresione Sí para volver a intentarlo usando Direct3D 9. -D3D11NotSupported = Parece que tu GPU no es compatible con Direct3D 11.\n\n¿¿Te gustaría volver a intentarlo usando Direct3D 9? +D3D11NotSupported = Parece que tu GPU no es compatible con Direct3D 11.\n\n¿Te gustaría volver a intentarlo usando Direct3D 9? D3D9or11 = ¿Direct3D 9? (o "no" para Direct3D 11) Disk full while writing data = El disco se ha llenado durante la escritura de datos. ELF file truncated - can't load = Archivo ELF defectuoso - no se puede cargar. @@ -510,13 +510,13 @@ Failed to load executable: = Error al cargar el ejecutable: File corrupt = Archivo corrupto File not found: %1 = Archivo no encontrado: %1 Game disc read error - ISO corrupt = Error de lectura del disco del juego: ISO dañado. -GenericAllStartupError = PPSSPP no pudo iniciarse con ningún servicio de gráficos. Intenta actualizar los gráficos y otros drivers. -GenericBackendSwitchCrash = PPSSPP se bloqueo al iniciarse.\n\nEsto suele indicar un problema con el driver de la gráfica. Intenta actualizar los driver de la gráfica.\n\nSe ha cambiado el servicio de gráficos: -GenericDirect3D9Error = Error al inicializar los gráficos. Intente actualizar los drivers de gráficos y el entorno de ejecución de DirectX 9.\n\n¿Le gustaría probar a cambiar a OpenGL?\n\nMensaje de error: +GenericAllStartupError = PPSSPP no pudo iniciarse con ningún servicio de gráficos. Intenta actualizar los gráficos y otros controladores. +GenericBackendSwitchCrash = PPSSPP se bloqueo al iniciarse.\n\nEsto suele indicar un problema con el controlador de la gráfica. Intenta actualizar los controladores de la gráfica.\n\nSe ha cambiado el servicio de gráficos: +GenericDirect3D9Error = Error al inicializar los gráficos. Intente actualizar los controladores de gráficos y el entorno de ejecución de DirectX 9.\n\n¿Le gustaría probar a cambiar a OpenGL?\n\nMensaje de error: GenericGraphicsError = Error de gráficos. -GenericOpenGLError = Error al inicializar los gráficos. Intente actualizar los drivers gráficos.\n\n¿Le gustaría probar a cambiar a DirectX 9?\n\nMensaje de error: -GenericVulkanError = Error al inicializar los gráficos. Intente actualizar los drivers gráficos.\n\n¿Le gustaría probar a cambiar a OpenGL?\n\nMensaje de error: -InsufficientOpenGLDriver = ¡Se detectó compatibilidad insuficiente con el driver OpenGL!\n\nTu GPU informa que no es compatible con OpenGL 2.0. ¿Te gustaría probar a usar DirectX en su lugar?\n\nDirectX es compatible actualmente con menos juegos, pero en tu GPU puede ser la única opción.\n\nVisita los foros en https://forums.ppsspp.org para obtener más información.\n\n +GenericOpenGLError = Error al inicializar los gráficos. Intente actualizar los controladores gráficos.\n\n¿Le gustaría probar a cambiar a DirectX 9?\n\nMensaje de error: +GenericVulkanError = Error al inicializar los gráficos. Intente actualizar los controladores gráficos.\n\n¿Le gustaría probar a cambiar a OpenGL?\n\nMensaje de error: +InsufficientOpenGLDriver = ¡Se detectó compatibilidad insuficiente con el controlador OpenGL!\n\nTu GPU informa que no es compatible con OpenGL 2.0. ¿Te gustaría probar a usar DirectX en su lugar?\n\nDirectX es compatible actualmente con menos juegos, pero en tu GPU puede ser la única opción.\n\nVisita los foros en https://forums.ppsspp.org para obtener más información.\n\n Just a directory. = Solo un directorio. Missing key = Clave ausente. MsgErrorCode = Código de error: @@ -526,7 +526,7 @@ MsgErrorSavedataNoData = AVISO: No se encontraron datos guardados. MsgErrorSavedataNoMS = Memory Stick no insertada. No EBOOT.PBP, misidentified game = Falta EBOOT.PBP, juego mal identificado. Not a valid disc image. = No es una imagen de disco válida. -OpenGLDriverError = Error del driver OpenGL. +OpenGLDriverError = Error del controlador OpenGL. PPSSPP doesn't support UMD Music. = PPSSPP no soporta UMDs de Música. PPSSPP doesn't support UMD Video. = PPSSPP no soporta UMDs de Vídeo. PPSSPP plays PSP games, not PlayStation 1 or 2 games. = PPSSPP solamente puede ejecutar juegos de PSP, no de PlayStation 1 o 2. @@ -544,7 +544,7 @@ This is a saved state, not a game. = Esto es un estado de guardado, no un juego. This is save data, not a game. = Esto es un dato de guardado, no un juego. Unable to create cheat file, disk may be full = No se pudo crear el archivo de trucos, es posible que el disco este lleno. Unable to initialize rendering engine. = No se pudo iniciar el motor de renderizado. -Unable to write savedata, disk may be full = No se pudieron escribir los datos de guardado, es posible que el disco este lleno.. +Unable to write savedata, disk may be full = No se pudieron escribir los datos de guardado, es posible que el disco este lleno. Warning: Video memory FULL, reducing upscaling and switching to slow caching mode = AVISO: memoria de vídeo LLENA, reduciendo escalado y cambiando a modo de caché lento. Warning: Video memory FULL, switching to slow caching mode = AVISO: memoria de vídeo LLENA, cambiando a modo de caché lento. WirelessSwitchOffError = A connection error has occurred.\nThe Wireless switch on the PSP system is off (network is disabled). @@ -605,7 +605,7 @@ Use UI background = Establecer imagen como fondo 8x = ×8 8x PSP = PSP x8 (4K) 9x PSP = PSP x9 -AdrenoTools driver manager = AdrenoTools driver manager +AdrenoTools driver manager = Administrador de controladores de AdrenoTools Aggressive = Agresivo Alternative Speed = Velocidad alternativa (en %, 0 = ilimitado) Alternative Speed 2 = Velocidad alternativa 2 (en %, 0 = ilimitado) @@ -639,7 +639,7 @@ Debugging = Depuración Default GPU driver = Controlador de GPU predeterminado DefaultCPUClockRequired = AVISO: Este juego requiere que el reloj de la CPU esté configurado en el valor por defecto. Deposterize = Deposterizar -Deposterize Tip = Corrige pequeños errores en las texturas causadas por el escalado +Deposterize Tip = Corrige pequeños errores en las texturas causados por el escalado Device = Dispositivo Direct3D 11 = Direct3D 11 Direct3D 9 = Direct3D 9 @@ -647,8 +647,8 @@ Disable culling = Desactivar selección Disabled = Desactivado Display layout & effects = Distribución de pantalla y efectos Display Resolution (HW scaler) = Resolución de pantalla (escalado por hardware) -Driver requires Android API version %1, current is %2 = El driver requiere la versión API de Android %1, la versión actual es %2 -Drivers = Drivers +Driver requires Android API version %1, current is %2 = El controlador requiere la versión API de Android %1, la versión actual es %2 +Drivers = Controladores Enable Cardboard VR = Activar Cardboard VR FPS = FPS Frame Rate Control = Control de tasa de fotogramas (FPS) @@ -689,7 +689,7 @@ No (default) = No (predeterminado) No buffer = Sin búfer None = Ninguno Number of Frames = Número de fotogramas -Off = Off +Off = Deshabilitar OpenGL = OpenGL Overlay Information = Información en pantalla Partial Stretch = Estiramiento parcial @@ -726,7 +726,7 @@ Stretch = Estirar Texture Filter = Filtro de texturas Texture Filtering = Filtrado de texturas Texture replacement pack activated = Paquete de reemplazo de textura activado -Texture upscaling = Texture upscaling +Texture upscaling = Escalado de texturas The chosen ZIP file doesn't contain a valid driver = El archivo ZIP seleccionado no contiene un controlador válido Unlimited = Ilimitado Up to 1 = Hasta 1 @@ -743,7 +743,7 @@ xBRZ = xBRZ Data to import = Datos a importar Delete ZIP file = Eliminar archivo ZIP Existing data = Datos existentes -Import savedata from ZIP file = Import savedata from ZIP file +Import savedata from ZIP file = Importar datos guardados desde archivo ZIP Install = Instalar Install game from ZIP file? = ¿Instalar juego desde archivo ZIP? Install in folder = Instalar en carpeta @@ -854,7 +854,7 @@ Note = Nota OpenChat = Abrir Chat Pause (no menu) = Pausa (sin menú) Pause = Pausa -Previous Slot = Previous Slot +Previous Slot = Ranura anterior R = R RapidFire = Disparo rápido Record = Grabar @@ -920,7 +920,7 @@ Selected PSP Data Folder = Carpeta de datos de PSP seleccionada Skip for now = Omitir por ahora Starting move... = Moviendo... That folder doesn't work as a memstick folder. = Esa carpeta no funciona como una carpeta memstick. -The new folder is inside the previous one = The new folder is inside the previous one +The new folder is inside the previous one = La nueva carpeta está dentro de la anterior USBAccessThrough = Acceso USB a través de Android/data/org.ppsspp.ppsspp/files USBAccessThroughGold = Acceso USB a través de Android/data/org.ppsspp.ppssppgold/files Use App Private Data = Usar datos privados de la aplicación @@ -931,7 +931,7 @@ WhatsThis = ¿Qué es esto? [Networking] AdHoc server = Servidor Ad-Hoc AdhocServer Failed to Bind Port = El servidor Ad-Hoc no pudo vincular el puerto -Allow speed control while connected (not recommended) = Allow speed control while connected (not recommended) +Allow speed control while connected (not recommended) = Permitir control de velocidad mientras está conectado (no recomendado) AM: Data from Unknown Port = AM: Datos de puerto desconocido Auto = Automático Autoconfigure = Autoconfigurar @@ -1020,7 +1020,7 @@ Cheats = Trucos Continue = Continuar Create Game Config = Crear configuración de juego Delete Game Config = Eliminar configuración de juego -Exit to menu = Salir a menú +Exit to menu = Salir al menú Game Settings = Ajustes de juego Load State = Cargar estado Rewind = Rebobinar @@ -1073,7 +1073,7 @@ Tex4xBRZ = 4xBRZ TexMMPX = MMPX UpscaleBicubic = UpscaleBicubic UpscaleSpline36 = Spline36 Escalador -VideoSmoothingAA = Suviado de vídeo AA +VideoSmoothingAA = Suavizado de vídeo AA Vignette = Viñeta [PSPCredits] @@ -1105,9 +1105,9 @@ testing = pruebas this translation by = Traducción realizada por... title = Un emulador de PSP rápido y portable tools = Software libre utilizado: -translators1 = Rafa Oliveros -translators2 = (última revisión febrero de 2025) -translators3 = +translators1 = PpmeiS, Puniasterus, Swyter y KAGE-008. +translators2 = Rafa Oliveros +translators3 = (última revisión julio de 2025) translators4 = translators5 = translators6 = @@ -1117,12 +1117,12 @@ X @PPSSPP_emu = X @PPSSPP_emu [RemoteISO] Browse Games = Buscar juegos -Choose directory = Choose directory +Choose directory = Elegir directorio Connect = Conectar Currently sharing = Actualmente compartiendo Files to share = Archivos a compartir Local Server Port = Puerto de servidor local -Looking for peers... = Looking for peers... +Looking for peers... = Buscando compañeros... Manual Mode Client = Configurar manualmente cliente Not currently sharing = No compartiendo actualmente Recent games = Juegos recientes @@ -1268,7 +1268,7 @@ D3DCompiler Version = Versión de compilador D3D Debug = Depuración Debugger Present = Depurador presente Depth buffer format = Formato de profundidad búfer -Device API version = Device API version +Device API version = Versión de la API del dispositivo Device Info = Información del dispositivo Directories = Directorios Display Color Formats = Formatos de color de la pantalla @@ -1285,7 +1285,7 @@ High precision float range = Alta precisión para rango de punto flotante High precision int range = Alta precision para rango de enteros Icon cache = Caché de iconos Instance = Instancia -JIT available = Disponible JIT +JIT available = JIT disponible Lang/Region = Idioma/Región Memory Page Size = Tamaño de página de memoria Native resolution = Resolución nativa @@ -1314,7 +1314,7 @@ System Version = Versión del sistema Threads = Hilos UI resolution = Resolución de interfaz Vendor = Modelo -Vendor (detected) = Proveedor +Vendor (detected) = Proveedor (detectado) Version Information = Información de la versión Vulkan Extensions = Extensiones Vulkan Vulkan Features = Funciones Vulkan @@ -1329,7 +1329,7 @@ Auto = Automático Auto Load Savestate = Carga automática de estados de guardado AVI Dump started. = Grabación iniciada AVI Dump stopped. = Grabación detenida -Bouncing icon = Bouncing icon +Bouncing icon = Icono rebotando Cache ISO in RAM = Cargar ISO completa en RAM Change CPU Clock = Cambiar velocidad de CPU de PSP emulada (inestable) Change Nickname = Cambiar nombre de usuario @@ -1454,17 +1454,17 @@ Waves = Ondas YYYYMMDD = YYYYMMDD [TextureShaders] -Off = Off +Off = Deshabilitar Tex2xBRZ = Tex2xBRZ Tex4xBRZ = Tex4xBRZ TexMMPX = TexMMPX [Themes] -Alpine = Alpine +Alpine = Alpino Dark = Oscuro Default = Por defecto -Slate Forest = Slate Forest -Strawberry = Strawberry +Slate Forest = Bosque de pizarra +Strawberry = Fresa [UI Elements] %1 button = %1 botón @@ -1495,3 +1495,4 @@ Stereoscopic vision (Experimental) = Visión Estereoscópica (Experimental) Virtual reality = Realidad virtual VR camera = Cámara VR VR controllers = Controles VR + From 025ad53a438bc4f1e656b03f4996aebfb7cf0a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 9 Jul 2025 17:12:01 +0200 Subject: [PATCH 13/25] Apply the important parts of the exit fix (#20607) --- Windows/EmuThread.cpp | 1 - Windows/MainWindow.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index 9a12ce5b84..ee4b647d89 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -312,7 +312,6 @@ void MainThreadFunc() { Core_StateProcessed(); NativeFrame(graphicsContext); } - Core_WaitInactive(); g_inLoop = false; diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index a095d76e90..a5eb3c8e46 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -1142,8 +1142,8 @@ namespace MainWindow case WM_DESTROY: InputDevice::StopPolling(); - MainThread_Stop(); WindowsRawInput::Shutdown(); + MainThread_Stop(); KillTimer(hWnd, TIMER_CURSORUPDATE); KillTimer(hWnd, TIMER_CURSORMOVEUPDATE); // Main window is gone, this tells the message loop to exit. From c388238df1d89b9d41a8adde579e3c8ed88b449e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 9 Jul 2025 12:13:46 +0200 Subject: [PATCH 14/25] Bump gradle again --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index ecf0fd7f51..67992faaca 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.10.1' + classpath 'com.android.tools.build:gradle:8.11.0' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 88fac8a038..ef4fb6efd1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,6 +3,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip android.useAndroidX=true android.enableJetifier=true From e28ffc168211886634a5e3951ff1eed338f3e271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 9 Jul 2025 17:31:27 +0200 Subject: [PATCH 15/25] Merge pull request #20608 from hrydgard/retroachievements-close-debugger If RetroAchievements' "Hardcore mode" is enabled, prevent debugger use --- Windows/Debugger/Debugger_Disasm.cpp | 4 ++++ Windows/GEDebugger/GEDebugger.cpp | 8 +++++++- Windows/MainWindow.cpp | 2 +- Windows/MainWindowMenu.cpp | 13 +++++++++++++ Windows/MainWindowMenu.h | 1 + Windows/main.cpp | 13 ++++++++----- 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 35df8d3ca8..8d6000efd6 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -576,6 +576,10 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { ProcessUpdateDialog(); updateDialogScheduled_ = false; KillTimer(GetDlgHandle(), wParam); + + if (Achievements::HardcoreModeActive()) { + SendMessage(m_hDlg, WM_CLOSE, 0, 0); + } } break; } diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index 7184a340a8..2aeaa8f64a 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -33,7 +33,7 @@ #include "Core/Config.h" #include "Core/Screenshot.h" - +#include "Core/RetroAchievements.h" #include "Windows/GEDebugger/GEDebugger.h" #include "Windows/GEDebugger/SimpleGLWindow.h" #include "Windows/GEDebugger/CtrlDisplayListView.h" @@ -950,6 +950,12 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { } else if (!PSP_IsInited() && primaryBuffer_) { SendMessage(m_hDlg, WM_COMMAND, IDC_GEDBG_RESUME, 0); } + if (Achievements::HardcoreModeActive()) { + if (g_activeWindow == WINDOW_GEDEBUGGER) { + g_activeWindow = WINDOW_OTHER; + } + SendMessage(m_hDlg, WM_CLOSE, 0, 0); + } break; case WM_NOTIFY: diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index a5eb3c8e46..c2533ab53d 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -1117,7 +1117,7 @@ namespace MainWindow return DefWindowProc(hWnd, message, wParam, lParam); HDROP hdrop = (HDROP)wParam; - int count = DragQueryFile(hdrop, 0xFFFFFFFF, 0, 0); + const int count = DragQueryFile(hdrop, 0xFFFFFFFF, 0, 0); if (count != 1) { // TODO: Translate? Or just not bother? MessageBox(hwndMain, L"You can only load one file at a time", L"Error", MB_ICONINFORMATION); diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index b116d4d2c3..3386646d70 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -981,6 +981,19 @@ namespace MainWindow { } } + void HideDebugWindows() { + if (disasmWindow) + disasmWindow->Show(false); +#if PPSSPP_API(ANY_GL) + if (geDebuggerWindow) + geDebuggerWindow->Show(false); +#endif + if (memoryWindow) + memoryWindow->Show(false); + if (vfpudlg) + vfpudlg->Show(false); + } + void UpdateMenus(bool isMenuSelect) { if (isMenuSelect) { menuShaderInfoLoaded = false; diff --git a/Windows/MainWindowMenu.h b/Windows/MainWindowMenu.h index 5a15f9950d..d7ed1a751f 100644 --- a/Windows/MainWindowMenu.h +++ b/Windows/MainWindowMenu.h @@ -12,4 +12,5 @@ namespace MainWindow { void BrowseAndBoot(RequesterToken token, std::string defaultPath, bool browseDirectory = false); void setTexScalingMultiplier(int level); void SetIngameMenuItemStates(HMENU menu, const GlobalUIState state); + void HideDebugWindows(); } diff --git a/Windows/main.cpp b/Windows/main.cpp index f2304fcdc0..985fddae91 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -48,13 +48,13 @@ #include "Common/Data/Encoding/Utf8.h" #include "Common/Net/Resolve.h" #include "Common/TimeUtil.h" -#include "W32Util/DarkMode.h" -#include "W32Util/ShellUtil.h" #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/SaveState.h" #include "Core/Instance.h" +#include "Core/HLE/Plugins.h" +#include "Core/RetroAchievements.h" #include "Windows/EmuThread.h" #include "Windows/WindowsAudio.h" #include "ext/disarm.h" @@ -77,6 +77,7 @@ #endif #include "Windows/W32Util/ContextMenu.h" #include "Windows/W32Util/DialogManager.h" +#include "Windows/W32Util/DarkMode.h" #include "Windows/W32Util/ShellUtil.h" #include "Windows/Debugger/CtrlDisAsmView.h" @@ -436,8 +437,11 @@ void System_Notify(SystemNotification notification) { g_symbolMap->SortSymbols(); // internal locking is performed here PostMessage(MainWindow::GetHWND(), WM_USER + 1, 0, 0); - if (disasmWindow) + if (Achievements::HardcoreModeActive()) { + MainWindow::HideDebugWindows(); + } else if (disasmWindow) { PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)Core_IsStepping()); + } break; } @@ -445,7 +449,7 @@ void System_Notify(SystemNotification notification) { { PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_UPDATE_UI, 0, 0); - int peers = GetInstancePeerCount(); + const int peers = GetInstancePeerCount(); if (PPSSPP_ID >= 1 && peers != g_lastNumInstances) { g_lastNumInstances = peers; PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_WINDOW_TITLE_CHANGED, 0, 0); @@ -520,7 +524,6 @@ void System_Notify(SystemNotification notification) { case SystemNotification::ROTATE_UPDATED: case SystemNotification::TEST_JAVA_EXCEPTION: break; - case SystemNotification::UI_STATE_CHANGED: case SystemNotification::AUDIO_MODE_CHANGED: case SystemNotification::APP_SWITCH_MODE_CHANGED: break; From 447d57634c281b63cf2df3704b3f07da42e406c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 10 Jul 2025 20:49:26 +0200 Subject: [PATCH 16/25] Merge pull request #20612 from hrydgard/mouse-mapping-fix SDL: Fix bug where the mouse got stuck in relative mode when mapping mouse inputs --- Common/Input/InputState.cpp | 2 ++ Common/Input/InputState.h | 3 +++ Core/Config.cpp | 1 - Core/Config.h | 1 - SDL/SDLMain.cpp | 2 +- UI/ControlMappingScreen.cpp | 12 +++++++----- UI/ControlMappingScreen.h | 3 +++ UI/NativeApp.cpp | 2 +- Windows/RawInput.cpp | 2 +- 9 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Common/Input/InputState.cpp b/Common/Input/InputState.cpp index 1586bedce0..9e7ad463ca 100644 --- a/Common/Input/InputState.cpp +++ b/Common/Input/InputState.cpp @@ -33,6 +33,8 @@ const char *GetDeviceName(int deviceId) { } } +bool g_IsMappingMouseInput; + std::vector dpadKeys; std::vector confirmKeys; std::vector cancelKeys; diff --git a/Common/Input/InputState.h b/Common/Input/InputState.h index d476498211..4d4dfe7e35 100644 --- a/Common/Input/InputState.h +++ b/Common/Input/InputState.h @@ -211,3 +211,6 @@ void SetInfoKeys(const std::vector &info); // 0 means unknown (attempt autodetect), -1 means flip, 1 means original direction. void SetAnalogFlipY(const std::unordered_map &flipYByDeviceId); int GetAnalogYDirection(InputDeviceID deviceId); + +// Gross hack unfortunately. +extern bool g_IsMappingMouseInput; diff --git a/Core/Config.cpp b/Core/Config.cpp index 840986788e..e492fb6c46 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -942,7 +942,6 @@ static const ConfigSetting controlSettings[] = { ConfigSetting("HideStickBackground", &g_Config.bHideStickBackground, false, CfgFlag::PER_GAME), ConfigSetting("UseMouse", &g_Config.bMouseControl, false, CfgFlag::PER_GAME), - ConfigSetting("MapMouse", &g_Config.bMapMouse, false, CfgFlag::PER_GAME), ConfigSetting("ConfineMap", &g_Config.bMouseConfine, false, CfgFlag::PER_GAME), ConfigSetting("MouseSensitivity", &g_Config.fMouseSensitivity, 0.1f, CfgFlag::PER_GAME), ConfigSetting("MouseSmoothing", &g_Config.fMouseSmoothing, 0.9f, CfgFlag::PER_GAME), diff --git a/Core/Config.h b/Core/Config.h index 8a9f5cf097..b3d32bfcf1 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -451,7 +451,6 @@ public: bool bStrictComboOrder; bool bMouseControl; - bool bMapMouse; // Workaround for mapping screen:| bool bMouseConfine; // Trap inside the window. float fMouseSensitivity; float fMouseSmoothing; diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 7a2d836c07..50e53393cf 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -881,7 +881,7 @@ static void EmuThreadJoin() { struct InputStateTracker { void MouseCaptureControl() { - bool captureMouseCondition = g_Config.bMouseControl && ((GetUIState() == UISTATE_INGAME && g_Config.bMouseConfine) || g_Config.bMapMouse); + bool captureMouseCondition = g_Config.bMouseControl && ((GetUIState() == UISTATE_INGAME && g_Config.bMouseConfine) || g_IsMappingMouseInput); if (mouseCaptured != captureMouseCondition) { mouseCaptured = captureMouseCondition; if (captureMouseCondition) diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index acd1abcffe..842e894f6f 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -57,7 +57,9 @@ using KeyMap::MultiInputMapping; class SingleControlMapper : public UI::LinearLayout { public: SingleControlMapper(int pspKey, std::string keyName, ScreenManager *scrm, UI::LinearLayoutParams *layoutParams = nullptr); - + ~SingleControlMapper() { + g_IsMappingMouseInput = false; + } int GetPspKey() const { return pspKey_; } private: @@ -196,7 +198,7 @@ void SingleControlMapper::MappedCallback(const MultiInputMapping &kdf) { break; } KeyMap::UpdateNativeMenuKeys(); - g_Config.bMapMouse = false; + g_IsMappingMouseInput = false; } UI::EventReturn SingleControlMapper::OnReplace(UI::EventParams ¶ms) { @@ -219,7 +221,7 @@ UI::EventReturn SingleControlMapper::OnAdd(UI::EventParams ¶ms) { } UI::EventReturn SingleControlMapper::OnAddMouse(UI::EventParams ¶ms) { action_ = ADD; - g_Config.bMapMouse = true; + g_IsMappingMouseInput = true; scrm_->push(new KeyMappingNewMouseKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING)); return UI::EVENT_DONE; } @@ -430,14 +432,14 @@ bool KeyMappingNewMouseKeyDialog::key(const KeyInput &key) { if (key.flags & KEY_DOWN) { if (key.keyCode == NKCODE_ESCAPE) { TriggerFinish(DR_OK); - g_Config.bMapMouse = false; + g_IsMappingMouseInput = false; return false; } mapped_ = true; TriggerFinish(DR_YES); - g_Config.bMapMouse = false; + g_IsMappingMouseInput = false; if (callback_) { MultiInputMapping kdf(InputMapping(key.deviceId, key.keyCode)); callback_(kdf); diff --git a/UI/ControlMappingScreen.h b/UI/ControlMappingScreen.h index 8820cc727b..ce373aabaf 100644 --- a/UI/ControlMappingScreen.h +++ b/UI/ControlMappingScreen.h @@ -97,6 +97,9 @@ class KeyMappingNewMouseKeyDialog : public PopupScreen { public: KeyMappingNewMouseKeyDialog(int btn, bool replace, std::function callback, I18NCat i18n) : PopupScreen(T(i18n, "Map Mouse"), "", ""), callback_(callback) {} + ~KeyMappingNewMouseKeyDialog() { + g_IsMappingMouseInput = false; + } const char *tag() const override { return "KeyMappingNewMouseKey"; } diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index e99cfc4ca1..67231f2d5f 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1420,7 +1420,7 @@ static void SendMouseDeltaAxis() { //NOTICE_LOG(Log::System, "delta: %0.2f %0.2f mx/my: %0.2f %0.2f dpi: %f sens: %f ", // g_mouseDeltaX, g_mouseDeltaY, mx, my, g_display.dpi_scale_x, g_Config.fMouseSensitivity); - if (GetUIState() == UISTATE_INGAME || g_Config.bMapMouse) { + if (GetUIState() == UISTATE_INGAME || g_IsMappingMouseInput) { NativeAxis(axis, 2); } } diff --git a/Windows/RawInput.cpp b/Windows/RawInput.cpp index 21082ae555..a565ea4b28 100644 --- a/Windows/RawInput.cpp +++ b/Windows/RawInput.cpp @@ -341,7 +341,7 @@ namespace WindowsRawInput { }; for (int i = 0; i < 5; i++) { - if (i > 0 || (g_Config.bMouseControl && (GetUIState() == UISTATE_INGAME || g_Config.bMapMouse))) { + if (i > 0 || (g_Config.bMouseControl && (GetUIState() == UISTATE_INGAME || g_IsMappingMouseInput))) { if (raw->data.mouse.usButtonFlags & rawInputDownID[i]) { key.flags = KEY_DOWN; key.keyCode = windowsTransTable[vkInputID[i]]; From 7a86e27bd75c9821261684575914052dda49c18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 11 Jul 2025 11:09:44 +0200 Subject: [PATCH 17/25] Merge pull request #20616 from hrydgard/fbmanager-black-screen Football Manager Handheld series: Fix blackscreen by forcing the software renderer --- assets/compat.ini | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/assets/compat.ini b/assets/compat.ini index 9760fff71e..2dd2a462b8 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1114,6 +1114,17 @@ ULES00016 = true ULUS10005 = true ULJM05005 = true +# Football Manager Handheld series (#5934) +ULES00248 = true # ?? +ULES00549 = true # 2007 +ULES00934 = true # 2008 +ULES01152 = true # 2009 +NPUH10036 = true # 2010 +ULES01338 = true # 2010 +ULES01455 = true # 2011 +ULES01555 = true # 2012 +ULES01582 = true # 2013 + [DarkStalkersPresentHack] # Darkstalkers ULES00016 = true From 4a4d62241af48e02a544629698f56b88d56cd99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 10 Jul 2025 11:19:15 +0200 Subject: [PATCH 18/25] Update README.md for 1.19.3 --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a95bcd8102..6c4d15f9c6 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,17 @@ To download fresh development builds for Android, Windows and Mac, [go to the /d For game compatibility, see [community compatibility feedback](https://report.ppsspp.org/games). +What's new in 1.19.3 +-------------------- + +- Regression fixed: Crash in Tony Hawk's Underground ([#20573]) +- Crash fixed when accessing the menu in FFII if readbacks were configured to copy-to-tex ([#20573]) +- Music and audio fixed in certain modded games (Various football (soccer) games, Crazy Taxi original soundtrack) ([#20566], [#20571]) +- Translation improvements +- Fix exiting not functioning correctly on Windows in some circumstances ([#20607]) +- Minor UI and key binding fixes ([#20604]) +- Fix crash/blackscreen when switching from skip buffer effects to auto-frameskip rendering ([#20605]) + What's new in 1.19.2 -------------------- @@ -376,4 +387,4 @@ What's new in 1.18 [#20518]: https://github.com/hrydgard/ppsspp/issues/20518 "Disable the Cache full ISO in RAM feature on 32-bit builds" [#20514]: https://github.com/hrydgard/ppsspp/issues/20514 "Developer tools: Add UI to force-enable HLE of modules that we have disabled HLE of" [#20502]: https://github.com/hrydgard/ppsspp/issues/20502 "Switching from IR Interpreter to JIT in-game crashes" -[#20515]: https://github.com/hrydgard/ppsspp/issues/20515 "Additional fixes for 1.19.2" \ No newline at end of file +[#20515]: https://github.com/hrydgard/ppsspp/issues/20515 "Additional fixes for 1.19.2" From 61c13ac5914e500084419d9dfed3a23fe6d51e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 11 Jul 2025 11:17:09 +0200 Subject: [PATCH 19/25] Additional README.md updates --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6c4d15f9c6..18555ac63f 100644 --- a/README.md +++ b/README.md @@ -28,13 +28,15 @@ For game compatibility, see [community compatibility feedback](https://report.pp What's new in 1.19.3 -------------------- -- Regression fixed: Crash in Tony Hawk's Underground ([#20573]) -- Crash fixed when accessing the menu in FFII if readbacks were configured to copy-to-tex ([#20573]) -- Music and audio fixed in certain modded games (Various football (soccer) games, Crazy Taxi original soundtrack) ([#20566], [#20571]) -- Translation improvements +- Fixed crash on startup in Tony Hawk's Underground 2 ([#20573]) +- Fixed crash/hang when accessing the menu in FFII if readbacks were configured to copy-to-tex ([#20573]) +- Fixed music and other audio in modded games (various football games, Crazy Taxi w/ original soundtrack, etc) ([#20566], [#20571]) - Fix exiting not functioning correctly on Windows in some circumstances ([#20607]) - Minor UI and key binding fixes ([#20604]) - Fix crash/blackscreen when switching from skip buffer effects to auto-frameskip rendering ([#20605]) +- Fix bug in Mac/Linux builds where the mouse got hidden and stuck if you enabled mouse input mapping ([#20612]) +- Fix black screen on save/load in the Football Manager Handheld games ([#20616]) +- Translation improvements What's new in 1.19.2 -------------------- @@ -388,3 +390,11 @@ What's new in 1.18 [#20514]: https://github.com/hrydgard/ppsspp/issues/20514 "Developer tools: Add UI to force-enable HLE of modules that we have disabled HLE of" [#20502]: https://github.com/hrydgard/ppsspp/issues/20502 "Switching from IR Interpreter to JIT in-game crashes" [#20515]: https://github.com/hrydgard/ppsspp/issues/20515 "Additional fixes for 1.19.2" +[#20573]: https://github.com/hrydgard/ppsspp/issues/20573 "Fix crash on second logo in Tony Hawk's Underground 2" +[#20566]: https://github.com/hrydgard/ppsspp/issues/20566 "Atrac code cleanup, logging and comment fixes" +[#20571]: https://github.com/hrydgard/ppsspp/issues/20571 "More Atrac3 refactor" +[#20607]: https://github.com/hrydgard/ppsspp/issues/20607 "Fix issue where PPSSPP wouldn't correctly quit if you closed it with the corner X button in-game" +[#20604]: https://github.com/hrydgard/ppsspp/issues/20604 "Fix some small UI regressions" +[#20605]: https://github.com/hrydgard/ppsspp/issues/20605 "Fix strange edge case when switching to auto-frameskip from non-buffered rendering" +[#20612]: https://github.com/hrydgard/ppsspp/issues/20612 "SDL: Fix bug where the mouse got stuck in relative mode when mapping mouse inputs" +[#20616]: https://github.com/hrydgard/ppsspp/issues/20616 "Football Manager Handheld series: Fix blackscreen" \ No newline at end of file From 958450bbe78a180870abd379e0677a5bcb5a4cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 12 Jul 2025 18:57:40 +0200 Subject: [PATCH 20/25] Layout fix on game screen. See #20524 --- UI/GameScreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index c9918a760e..280ae7cb22 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -106,7 +106,7 @@ void GameScreen::CreateViews() { // Scrolling action menu to the right. using namespace UI; - Margins actionMenuMargins(0, 100, 15, 0); + Margins actionMenuMargins(0, 15, 15, 0); root_ = new LinearLayout(ORIENT_HORIZONTAL); From 487dff3139da436938b3f41a51fcd6271bd16984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 13 Jul 2025 23:18:13 +0200 Subject: [PATCH 21/25] Fix tracking for the savedata reminder for several invisible save types Unlike on the main branch, no animated indicator. --- Core/Dialog/PSPSaveDialog.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 85502c7d56..0bfd97a1a5 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -138,8 +138,7 @@ int PSPSaveDialog::Init(int paramAddr) { INFO_LOG(Log::sceUtility,"sceUtilitySavedataInitStart(%08x) : Game key (hex): %s", paramAddr, param.GetKey(param.GetPspParam()).c_str()); yesnoChoice = 1; - switch ((SceUtilitySavedataFocus)(u32)param.GetPspParam()->focus) - { + switch ((SceUtilitySavedataFocus)(u32)param.GetPspParam()->focus) { case SCE_UTILITY_SAVEDATA_FOCUS_NAME: currentSelectedSave = param.GetSaveNameIndex(param.GetPspParam()); break; @@ -972,15 +971,15 @@ int PSPSaveDialog::Update(int animSpeed) DisplayBanner(DB_DELETE); if (IsButtonPressed(cancelButtonFlag) || (IsButtonPressed(okButtonFlag) && yesnoChoice == 0)) { - if(param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_LISTDELETE || param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_LISTALLDELETE) + if (param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_LISTDELETE || param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_LISTALLDELETE) display = DS_DELETE_LIST_CHOICE; else { param.GetPspParam()->common.result = SCE_UTILITY_DIALOG_RESULT_CANCEL; StartFade(false); } } else if (IsButtonPressed(okButtonFlag)) { - display = DS_DELETE_DELETING; - StartIOThread(); + display = DS_DELETE_DELETING; + StartIOThread(); } EndDraw(); @@ -1151,11 +1150,13 @@ void PSPSaveDialog::ExecuteNotVisibleIOAction() { case SCE_UTILITY_SAVEDATA_TYPE_LOAD: // Only load and exit case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD: result = param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave); + ResetSecondsSinceLastGameSave(); break; case SCE_UTILITY_SAVEDATA_TYPE_SAVE: // Only save and exit case SCE_UTILITY_SAVEDATA_TYPE_AUTOSAVE: SaveState::NotifySaveData(); result = param.Save(param.GetPspParam(), GetSelectedSaveDirName()); + ResetSecondsSinceLastGameSave(); break; case SCE_UTILITY_SAVEDATA_TYPE_SIZES: result = param.GetSizes(param.GetPspParam()); @@ -1199,16 +1200,19 @@ void PSPSaveDialog::ExecuteNotVisibleIOAction() { // TODO: Should reset the directory's other files. case SCE_UTILITY_SAVEDATA_TYPE_MAKEDATA: case SCE_UTILITY_SAVEDATA_TYPE_MAKEDATASECURE: - SaveState::NotifySaveData(); result = param.Save(param.GetPspParam(), GetSelectedSaveDirName(), param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_MAKEDATASECURE); if (result == SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE) { result = SCE_UTILITY_SAVEDATA_ERROR_RW_MEMSTICK_FULL; + } else { + SaveState::NotifySaveData(); + ResetSecondsSinceLastGameSave(); } break; case SCE_UTILITY_SAVEDATA_TYPE_WRITEDATA: case SCE_UTILITY_SAVEDATA_TYPE_WRITEDATASECURE: SaveState::NotifySaveData(); result = param.Save(param.GetPspParam(), GetSelectedSaveDirName(), param.GetPspParam()->mode == SCE_UTILITY_SAVEDATA_TYPE_WRITEDATASECURE); + ResetSecondsSinceLastGameSave(); break; case SCE_UTILITY_SAVEDATA_TYPE_READDATA: case SCE_UTILITY_SAVEDATA_TYPE_READDATASECURE: @@ -1217,6 +1221,7 @@ void PSPSaveDialog::ExecuteNotVisibleIOAction() { result = SCE_UTILITY_SAVEDATA_ERROR_RW_DATA_BROKEN; if (result == SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA) result = SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA; + ResetSecondsSinceLastGameSave(); break; case SCE_UTILITY_SAVEDATA_TYPE_ERASE: case SCE_UTILITY_SAVEDATA_TYPE_ERASESECURE: From efebdf470e81ac3ba4da5e64fb26a27c523478c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 14 Jul 2025 08:18:44 +0200 Subject: [PATCH 22/25] Bump gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 67992faaca..b25ab32551 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.11.0' + classpath 'com.android.tools.build:gradle:8.11.1' } } From 070ba069eb5750c95accc7c7ea386a91c9858650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 14 Jul 2025 08:28:10 +0200 Subject: [PATCH 23/25] Test commit to see if we can get Github CI to run even if there are conflicts --- .github/workflows/appimage.yml | 8 ++++++-- .github/workflows/build.yml | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 0c63f1d9de..f8e9578a30 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -2,7 +2,7 @@ name: Generate Linux AppImage on: push: branches: - - master + - '**' # For testing. #- test_arch tags: @@ -12,7 +12,7 @@ on: - 'Tools/**' - '.{editorconfig,gitattributes,gitignore}' - 'appveyor.yml' - pull_request: + pull_request_target: branches: - master paths-ignore: @@ -26,6 +26,10 @@ env: #SDL_VIDEODRIVER: "dummy" #BUILD_CONFIGURATION: Release #RelWithDebInfo +permissions: + contents: read + pull-requests: read + jobs: build: name: build (${{ matrix.id }}) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ed374a485..9128c32bd4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build on: push: branches: - - master + - '**' # For testing. - actions tags: @@ -13,7 +13,7 @@ on: - 'Tools/**' - '.{editorconfig,gitattributes,gitignore}' - 'appveyor.yml' - pull_request: + pull_request_target: branches: - master paths-ignore: @@ -25,6 +25,10 @@ on: env: BUILD_CONFIGURATION: Release +permissions: + contents: read + pull-requests: read + jobs: build-windows: strategy: From 7aaf86976faa194948bc62be155bfafe89267e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 14 Jul 2025 11:07:49 +0200 Subject: [PATCH 24/25] More README.md updates --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18555ac63f..429d8f1cd3 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ What's new in 1.19.3 - Fixed crash on startup in Tony Hawk's Underground 2 ([#20573]) - Fixed crash/hang when accessing the menu in FFII if readbacks were configured to copy-to-tex ([#20573]) +- Fix issue with detection of some types of saving, for the save reminders on exit ([#20623]) - Fixed music and other audio in modded games (various football games, Crazy Taxi w/ original soundtrack, etc) ([#20566], [#20571]) - Fix exiting not functioning correctly on Windows in some circumstances ([#20607]) - Minor UI and key binding fixes ([#20604]) @@ -397,4 +398,5 @@ What's new in 1.18 [#20604]: https://github.com/hrydgard/ppsspp/issues/20604 "Fix some small UI regressions" [#20605]: https://github.com/hrydgard/ppsspp/issues/20605 "Fix strange edge case when switching to auto-frameskip from non-buffered rendering" [#20612]: https://github.com/hrydgard/ppsspp/issues/20612 "SDL: Fix bug where the mouse got stuck in relative mode when mapping mouse inputs" -[#20616]: https://github.com/hrydgard/ppsspp/issues/20616 "Football Manager Handheld series: Fix blackscreen" \ No newline at end of file +[#20616]: https://github.com/hrydgard/ppsspp/issues/20616 "Football Manager Handheld series: Fix blackscreen" +[#20623]: https://github.com/hrydgard/ppsspp/issues/20623 "Fix tracking for the savedata reminder for several invisible save types" From 9c109b08d53dc8a711ca5a08469bcd8ddc6b8099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 14 Jul 2025 11:18:57 +0200 Subject: [PATCH 25/25] v1.19.3 --- UWP/Package.appxmanifest | 2 +- UWP/PackageGold.appxmanifest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UWP/Package.appxmanifest b/UWP/Package.appxmanifest index d242947b40..e18687e75f 100644 --- a/UWP/Package.appxmanifest +++ b/UWP/Package.appxmanifest @@ -1,6 +1,6 @@ - + PPSSPP - PSP emulator diff --git a/UWP/PackageGold.appxmanifest b/UWP/PackageGold.appxmanifest index ba5dad056f..16c4df00b6 100644 --- a/UWP/PackageGold.appxmanifest +++ b/UWP/PackageGold.appxmanifest @@ -1,6 +1,6 @@ - + PPSSPP Gold - PSP emulator