Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

feat(trophy): fortnite trophy builder, ucp generation, and unjail stabilization

Rafael Abud Ferreira841f9abfc380
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7638d3b..297b95b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,7 @@ add_library(xcloud_core STATIC
src/platform/toasts.cpp
src/input/gyro.cpp
)
-target_include_directories(xcloud_core PUBLIC src)
+target_include_directories(xcloud_core PUBLIC src extern/stb)
if(NOT MSVC)
target_compile_options(xcloud_core PUBLIC -g1 -fno-omit-frame-pointer PRIVATE -Wall -Wextra -Wno-unused-parameter)
endif()
diff --git a/TROPHY-NATIVE-HANDOFF.md b/TROPHY-NATIVE-HANDOFF.md
index d26f261..5f902cc 100644
--- a/TROPHY-NATIVE-HANDOFF.md
+++ b/TROPHY-NATIVE-HANDOFF.md
@@ -1,200 +1,167 @@
-# Troféus nativos no PSBox (xCloud-PS5) — Handoff técnico
+# PS5 Native Trophies & Session Handoff (xCloud-PS5)
-> **Público-alvo:** um desenvolvedor (ou agente) dando continuidade à feature de troféus
-> no console PS5 13.60 jailbroken do dono do projeto. Documento de estado + achados +
-> referências. Não é um manual de bypass passo-a-passo; a implementação do bypass de
-> aceitação do daemon é via o método público (PHU, MIT) referenciado no fim.
-
-Data: 2026-11-03. Firmware alvo: **13.60** (jailbreak Relapse, público; kstuff + ShadowMountPlus + nanoDNS).
+> **Documento de Hand-off Técnico e Estado Atual do Projeto**
+> **Data:** 2026-11-05
+> **Branch:** `feat/trophy-sync` (Worktree: `/home/notebook-storm/Documentos/PS5 Ports/xCloud-PS5-trophy`)
+> **Target Console:** PS5 FW 13.60 (IP: `192.168.15.17`, Portas: 2121 FTP, 8084 elfldr, 3232 klog)
+> **Usuário Alvo:** `0x1ea2f4da` (`devRafaelNGP`)
+> **Título Alvo:** Estritamente **Fortnite (`PPSA01922` / `NPWR20561_00`)** — regra AGENTS.md §8.1
---
-## 1. Objetivo
+## 1. Resumo Executivo e Status Geral
-Exibir, no **perfil local** do PS5, as conquistas que o usuário ganhou jogando via
-streaming no PSBox Cloud Gaming (xCloud) — nome do jogo, ícone, lista de troféus, grau,
-desbloqueado/bloqueado — **nativamente** (notificação do sistema + coleção de Troféus),
-como se fossem troféus de um jogo instalado.
+1. **Correção de Regressão Crítica de Login/Gravação (Resolvida)**:
+ - **Sintoma:** O app abria deslogado, sem carregar a conta existente (`account.json`), e ao tentar fazer login, este não salvava (`g_dataDirWritable = false`).
+ - **Causa Raiz 1 (Timing de Unjail):** Em `src/platform/ps5/platform_ps5.cpp`, a função `init()` disparava o unjail assíncrono via `127.0.0.1:8084` e aguardava apenas `150ms`. Quando o payload demorava mais de 150ms para unjail do PID, `writable("/data/psbox")` falhava com `errno 13` (EACCES) ou `errno 2` (ENOENT). A pasta de dados caía em fallback restrito (`/download0/psbox`) e `g_dataDirWritable` tornava-se `false`, ignorando o `account.json` existente e impedindo gravações.
+ - **Causa Raiz 2 (Autoplay Residual):** O arquivo `/data/psbox/autoplay.txt` continha `AUTOTEST 35 trophytest`. Toda inicialização ativava `guardSettingsForAutoplay()`, restaurando o backup anterior das configurações.
+ - **Solução Implementada:**
+ - Adicionado loop de retry polling em `platform_ps5.cpp:init()` de até 30 tentativas (100ms cada = até 3.0s de janela) para esperar o unjail antes de avaliar as pastas de dados.
+ - Higienizado o console: removidos todos os `autoplay.txt` residuais de `/data/psbox/` e `/data/homebrew/PPSA99810/`.
+ - Confirmado via FTP: `/data/psbox/account.json` (491 bytes, gamertag `RafaelNGP`, uid 1, permissão 0666) está preservado e intacto.
-Cenário: **100% offline** dos servidores da Sony (nanoDNS bloqueia). Nada sincroniza com
-a PSN. As conquistas são reais (ganhas pelo usuário em serviço oficial Xbox); o objetivo
-é só espelhá-las localmente, de forma organizada. Aceita-se marcar como local/não-sync.
+2. **Causa do Kernel Panic na Execução Anterior (Diagnosticada e Sanada)**:
+ - **Causa Raiz:** Em versões experimentais anteriores do payload `tools/ps5/payload_patch_test/main.c`, patches agressivos no SceShellCore (especialmente `B18`, que forçava retorno 0 em falhas de `FindTitle`) faziam o daemon desreferenciar ponteiros nulos no kernel/daemon, somado a um dump de heap de 32MB (`kernel_proc_copyout`) durante execução concorrente.
+ - **Solução Implementada:** Removidos todos os patches perigosos e instáveis (`B13`, `B14`, `B15`, `B16`, `B18`, `B21`, `B22`, e scan de heap). O payload `patch_test.elf` agora executa o unjail do PID na linha 1 do `main()` de forma determinística (< 1ms) e aplica `chmod 0777` seguro nas pastas de troféus. O ELF foi recompilado e atualizado em `/data/pldmgr/payloads/patch_test/patch_test.elf`.
---
-## 2. Como o sistema de troféus do PS5 funciona (conceitual)
-
-Dois subsistemas DISJUNTOS dentro do **SceShellCore** (o daemon de troféus, NPXS40082):
-
-- **(B) Desbloqueio** — encena o valor do troféu no contexto por-usuário e grava os bytes
- em disco via um **serviço externo** de troféus (IPC). É o que `sceNpTrophyUnlockTrophy`
- (jogo real) e as variantes System/Debug tocam.
-- **(A) Coleção / exibição** — é o que faz o título + troféus APARECEREM em Perfil →
- Troféus e dispara o popup. Num console normal, o **serviço externo** dispara esse passo
- de volta no SceShellCore DEPOIS de um desbloqueio aceito.
-
-Os dois NÃO se cruzam no grafo de chamadas. Desbloquear sem passar pela via (A) grava
-dados mas **não aparece nada**.
-
-Armazenamento:
-- Config (lista de troféus): `TROPHY.UCP` / `trophy00.ucp` + `npbind.dat` em
- `/system_data/priv/appmeta/<TitleID>/trophy2/` e `/user/trophy2/nobackup/conf/<NPWR>/`.
-- Estado por-usuário: `TRPTITLE.DAT` em `/user/home/<uid>/trophy2/nobackup/data/<NPWR>/`.
-- A **coleção que a UI lê** NÃO são esses arquivos crus — é um índice em memória/selado
- mantido pelo serviço; a entrada é criada pela via (A).
+## 2. Análise Profunda das Referências da Comunidade
+
+### 2.1 RecompTrophy (`cptlamarca/RecompTrophy`)
+Criado por **lamarking** para prover troféus PS5 nativos para portas e emuladores do Xbox 360 no console:
+- **Arquivos Manipulados (e apenas eles):**
+ 1. `/user/trophy2/nobackup/conf/<NPWR>/TROPHY.UCP`:
+ - Contém `tropconf.json` (`schemaVersion: "1.00"`, `trophyDefinitionRevision: 1`, `trophySetVersion: "01.00"`).
+ - Contém `tropmeta_<lang>.json` (`schemaVersion: "0.90"`).
+ - Contém os PNGs de ícones (`trop0000.png` até `tropXXXX.png`, 512x512).
+ - Header UCP `0xB228C60A`, versão 1, SHA-1 nos bytes `0x1C..0x2F`.
+ 2. `/user/home/<UID>/trophy2/nobackup/data/<NPWR>/TRPTITLE.DAT`:
+ - Clona os registros de cabeçalho `0x1` e `0x2` de um jogo PS5 existente no perfil (`NPWR39259_00`).
+ - Insere o SHA-1 do `TROPHY.UCP` no registro `0x100`.
+ - Configura o registro `0x300` com o NPWR e máscara de troféus.
+ - Grava os registros `0x800` (desbloqueios) com flags `0x11` e timestamps em microssegundos desde 0001-01-01 (`unix_time + 62135596800ULL * 1000000ULL`).
+ - Empacota em blocos de `0x400` bytes de dados + `0x20` bytes de SHA-256 (stride `0x420`).
+- **O que o RecompTrophy NÃO faz:**
+ - **NÃO toca no `app.db`**.
+ - **NÃO toca no `appinfo.db`**.
+ - **NÃO toca em `/system_data/priv/appmeta/`** nem em `npbind.dat`.
+ - **NÃO aplica patches de kernel nem de SceShellCore**.
+- **Como a UI do PS5 exibe os troféus:**
+ - O README do RecompTrophy estabelece expressamente: *"In a few seconds its trophies are in the PS5's Trophies list. If they don't show up yet, restart the console."*
+ - Popups durante o gameplay são gerados por um watcher em background chamando `sceNotificationSend(0xFE, true, json)` com template `InteractiveToastTrophy` e canal `Trophies`.
+
+### 2.2 TrophyManager (`kauansilvalopes/trophy`)
+- Lê os jogos instalados diretamente de `/appdb`.
+- Busca `/system_data/priv/appmeta/<TitleID>/trophy2/npbind.dat` para descobrir o NPWR associado ao título.
+- Acessa e edita `/user/home/<UID>/trophy2/nobackup/data/<NPWR>/TRPTITLE.DAT`.
+- Confirma que o PS5 valida estritamente a integridade SHA-256 dos blocos de `TRPTITLE.DAT`.
---
-## 3. Diagnóstico — por que a implementação atual NÃO funciona
-
-Testado e verificado neste console:
-
-1. **Usa o backdoor de debug** (`sceNpTrophy2SystemDebugUnlockTrophy`). Ele retorna
- `rc=0` mas está no subsistema (B) — **nunca** toca a coleção. Por isso "tudo dá certo
- nos logs e nada aparece". (Confirmado: 22 unlocks rc=0, nada no perfil.)
-2. **`RegisterContext` já é aceito** (rc=0) para o título — mas registrar sozinho coloca o
- contexto na tabela interna por-ctx, **não** na coleção. (Confirmado: registramos e o
- usuário checou o perfil — não apareceu.)
-3. **Reboot/rescan não ingere** os arquivos crus (confirmado pelo usuário).
-4. **Religar a função da via (A)** não teve efeito — ela só é alcançável pela via de
- comando/serviço que o nosso fluxo não aciona.
-5. **O unlock normal** (`sceNpTrophy2UnlockTrophy`) **crashou o app** quando chamado da
- nossa casca — provável símbolo não exportado / NID errado, OU a função falha porque o
- título não está "provisionado" o suficiente.
-
-**Por que os dumps do usuário funcionam e a nossa casca não:** um dump é um jogo real,
-com NPWR/commId/pacote de troféus **provisionados pela Sony** e rodando sob a identidade
-real do título. O serviço aceita o desbloqueio dele e dispara a via (A). A nossa casca
-(nuvem / homebrew) tem dados **fabricados** e/ou identidade de processo diferente → o
-serviço não dispara a via (A) para ela sem ajuste no daemon.
+## 3. Estado Atual dos Arquivos no Console PS5 (`192.168.15.17`)
+
+### 3.1 Fortnite (`PPSA01922` / `NPWR20561_00`)
+- **TRPTITLE.DAT** (`/user/home/1ea2f4da/trophy2/nobackup/data/NPWR20561_00/TRPTITLE.DAT`):
+ - Tamanho: 18.016 bytes.
+ - Total de troféus: 46 (22 já registrados como desbloqueados).
+ - Integridade: **17/17 blocos com SHA-256 100% válidos**.
+ - Registro 0x100: SHA-1 (`9053681804adefb38e52ced0d736baf80e899167`) bate **100% com o TROPHY.UCP**.
+- **TROPHY.UCP** (`/user/trophy2/nobackup/conf/NPWR20561_00/TROPHY.UCP`):
+ - Tamanho: 193.040 bytes.
+ - Total de arquivos: 50 (`tropconf.json`, `tropmeta_en-US.json`, `tropmeta_pt-BR.json`, 47 PNGs).
+ - Header: Magic `0xB228C60A`, Version 1, SHA-1 verificado.
+- **Banco de Dados do Sistema (`app.db` / `appinfo.db`)**:
+ - `PPSA01922` está atualmente registrado com `DISPLAYLOCATION: 138` (o que fez o jogo aparecer na Biblioteca de Jogos).
+ - **Decisão do Usuário:** O usuário solicitou manter o jogo oculto na Biblioteca (`visible = 0` / `DISPLAYLOCATION: 0`) a menos que a exibição na lista de troféus exija visibilidade, ou até que um forwarder executável funcional seja configurado.
+- **Higienização de Conflitos:**
+ - Removidos pacotes duplicados de `NPWR20561_00` que estavam em `/system_data/priv/appmeta/PPSA99810/trophy2/` para evitar colisão com o app principal PSBox.
---
-## 4. Arquitetura mapeada (achados de RE deste console, fw 13.60, mapbase 0x3059c000)
-
-Endereços como offset-de-mapbase (ao vivo = mapbase + offset). São ACHADOS factuais da RE,
-para orientar quem continuar — não um procedimento de patch.
-
-- Via (A) de exibição: handler de comando `0xe232e0` → `0xe1a4c0` → ingest no cache da
- coleção `call [cache_vtable+0x30]` (= `0xe39310`) → fan-out `0xe34e70` → `0xe330a0` →
- `0xe1f8f0` (porta do ShellUI).
-- `0xe1a4c0` só é alcançável de `0xe23487` (dentro de `0xe232e0`) e de `0xba7ce5`.
-- Serviço: ponteiro singleton em `[mapbase+0x22269a0]`; cache da coleção em `[svc+0x80]`
- (vtable `0x2035d60`, mapa de 32 buckets em `cache+0x18`, flags em `+0xc/+0xd/+0xe`);
- vtable do serviço `0x2035900`; init do serviço `0xe36250` registra handlers via
- `0xe1d420/0xe1d6e0/0xe1d9b0/0xe1dc80/0xe1df50`.
-- Subsistema (B) de unlock: handlers ~`0xe59610/0xe59b50/0xe5b110` → updater `0xe63570`
- → worker de registro `0xe65c10`.
-- `RegisterContext` = IPMI cmd `0x90016`.
-- Placeholder de commId `AAAA00000` (alvo "B1" do PHU) presente na rodata do 13.60, **não**
- patchado — confirma que o setup base do usuário não faz esse patch.
-
-Dumps descriptografados do SceShellCore 13.60 capturados (base para a RE da via de unlock):
-no diretório de scratchpad da sessão — `sc_text.bin` (mb+0xb00000), `sc_rodata.bin`
-(mb+0x1a00000), `sc_data.bin` (mb+0x1f00000). Payload read-only de dump:
-`tools/ps5/payload_patch_test/dump_shellcore.c`.
+## 4. Estado da Árvore Git (`xCloud-PS5-trophy`)
+
+Branch: `feat/trophy-sync`
+Principais arquivos modificados:
+1. `src/platform/ps5/platform_ps5.cpp`:
+ - Early unjail trigger via localhost:8084.
+ - Retry loop de até 3s para aguardar `writable(kDataDir)` após o unjail.
+ - Logs detalhados de diagnóstico da pasta de armazenamento.
+2. `src/platform/ps5/trophy_backend_ps5.cpp`:
+ - Geração e gravação direta dos arquivos `TRPTITLE.DAT` e `TROPHY.UCP`.
+ - Remoção de bips de áudio, vibração ou toasts intrusivos de debug.
+3. `src/trophy/trophy_builder.cpp`:
+ - Implementação fiel e testada do builder de `TRPTITLE.DAT` e `TROPHY.UCP`, espelhando a lógica de `RecompTrophy`.
+4. `tools/ps5/payload_patch_test/main.c`:
+ - Early unjail instantâneo no início da execução.
+ - Remoção de patches instáveis do SceShellCore que provocaram o kernel panic.
+5. `tools/ps5/register_title_db.py`:
+ - Script para manipulação e ajuste de `app.db`/`appinfo.db`.
---
-## 5. O caminho conhecido e PÚBLICO (referência de implementação)
-
-A cena homebrew já resolve "troféus de jogos dumpados aparecerem nativamente":
-
-- **ArkSama/PS5-PHU-Trophy-System** (MIT) — https://github.com/ArkSama/PS5-PHU-Trophy-System
- "PS5 trophy install + unlock for dumped games", 24 firmwares (4.03 → 12.70). Documenta,
- em `README.md` + `WORKFLOW.md`, exatamente como o daemon aceita/rejeita e onde ficam os
- pontos de ajuste ("B-patches": strings de commId, inventário de app, gate do LncManager,
- injeção de commId client-side no NpAsmClient do processo do jogo, e o register vindo do
- processo do jogo). **Esse repo é a referência de método.**
-- **kauansilvalopes/trophy** (Trophy Manager) — app nativo no console, sem PC/payload.
-- KIK-Trophy (edita TRPTITLE.DAT), PS5TrophyExtract0r (extrai trophy00.ucp), Hamad3bdulla/PS5-Trophy-Unlocker-.
-
-**Importante sobre 13.60:** o PHU para no 12.70. Para 13.60, os offsets equivalentes
-precisam ser **re-derivados** pelo MESMO método do PHU, usando os dumps da seção 4 como
-ponto de partida. Um perfil 13.60 "diagnóstico" (sem offsets chutados) existe no repo do
-Hamad3bdulla; a comunidade está adicionando offsets até 13.60 mas pelo menos um valor por
-perfil precisa ser verificado em console real.
-
-**Adaptação do caso nuvem (o que é novo além do PHU):** o PHU ancora no processo do JOGO
-real rodando. Na nuvem não há processo do jogo — o PSBox (PPSA99810) é o processo. Então a
-adaptação é fazer o título alvo ser uma identidade real no console (ex.: a ideia de
-**forwarder por jogo** — cada jogo um tile/título próprio com seu pacote de troféus) e o
-register/unlock sair sob essa identidade. Essa parte é genuinamente nova.
-
----
-
-## 6. Estado do repositório (tudo não-commitado, na working tree)
-
-- `src/platform/ps5/trophy_backend_ps5.cpp`:
- - **Correção de regressão (verificada): `waitForUnjail()`** antes de `deployTrophyPack`.
- Sem ela, o deploy dos arquivos falhava silencioso com `errno=2` (o unjail assíncrono não
- tinha efetivado). Depois da correção: `errno=2` = 0, arquivos reescritos. **Isso é um
- fix bom, independente do resto.**
- - Log honesto no `flush()` (não afirma "commit to OS database").
- - `runPsboxNativeSelfTest()` — auto-teste que registra um conjunto de troféus no título do
- próprio PSBox e tenta o unlock normal (crasha no unlock — ver §3.5). Gatilho: autoplay
- `psboxself`.
-- `tools/ps5/payload_patch_test/main.c`: **payload limpo de 19 → 12 patches** (removidos 7
- que eram chutes de agentes passados em funções off-path/inertes). Cabeçalho documenta o
- que saiu. #18 mudado de "stub" para "restaurar" a função de ingest.
-- `ps5/stubs/libSceNpTrophy2.c`: adicionado `sceNpTrophy2UnlockTrophy` (import).
-- `src/app/autoplay.cpp` / `autoplay.h`: gatilho `psboxself`.
-- `tools/ps5/payload_patch_test/dump_shellcore.c`: payload read-only de dump de memória.
-
-Observação: a feature inteira de troféus está **não-commitada** desde antes desta sessão.
-
----
-
-## 7. Precauções de engenharia (obrigatórias)
-
-Do AGENTS.md §8 e da experiência desta sessão:
-
-- **Um título por vez.** Validar em UM alvo até provar persistência; nunca o catálogo todo
- (já houve poluição de NPWR8xxxx virtuais de um sync de catálogo completo proibido).
-- **Nada de bips/vibração/toasts de debug** no caminho de troféu (§8.2); só a barra de
- progresso padrão.
-- **`serviceLabel` nunca 0** — usar 1 ou -1 (senão kernel `0x80553914`).
-- **Higiene do console:** matar o app antes de FTP; remover `autoplay.txt` ao final;
- relançar o app em foreground interativo. NUNCA deixar o console com app crashado.
-- **Backups antes de escrever em DB de sistema:** `app.db`/`appinfo.db` em `/system_data/
- priv/mms/` são sensíveis — fazer `.bak` antes e escrever só as linhas do título alvo.
-- **NÃO sobrescrever o `param.json` real do PSBox** no appmeta — escrever só o subdir
- `trophy2/` (escrita aditiva), senão arriscar a metadata do próprio app.
-- **NÃO tocar nos outros payloads** em `/data/pldmgr/payloads/` (ftpsrv, kstuff, etc.).
-- **Carregar o módulo de troféu ANTES do unjail** — depois do unjail o caminho
- `/<sandboxword>/common/lib/` quebra (erro `0x80020002`).
-- **Chamar só símbolos resolvidos** — chamar um import não-exportado crasha o app na hora
- (foi o que derrubou nas tentativas de unlock). Verificar o símbolo/NID antes.
-- **Rollback do daemon:** qualquer patch em memória no SceShellCore deve ter restauração dos
- bytes originais (e some no reboot, pois o jailbreak é tethered). Patches persistentes no
- daemon podem quebrar o fluxo de licença de jogos PS4 BC (ver PHU: rollback ao sair do jogo).
-- **Offline/não-sync:** manter o nanoDNS/bloqueio de PSN; nunca sincronizar na conta
- principal. Se possível, marcar os troféus como locais.
-- **Console de acesso:** 192.168.15.17 — FTP 2121 (anon), klog 3232, ps5vkctl 9111.
- Build/deploy: ver `tools/ps5/autotest.sh` e o README ("Particularidades do PS5").
-
----
-
-## 8. Pontos em aberto / próximos passos (conceitual)
-
-1. Descobrir o símbolo/caminho REAL do unlock normal no 13.60 (o `sceNpTrophy2UnlockTrophy`
- crashou) — e se, para um título provisionado, ele dispara a via (A).
-2. Determinar se algum comando IPMI cliente alcança o handler da coleção `0xe232e0`, ou se
- só o serviço externo o emite (decide "chamar via SDK" vs "acionar a via (A) por payload").
-3. Re-derivar, pelo método do PHU, os pontos de aceitação do daemon no 13.60 (usar os dumps
- da §4), se a via nativa exigir que o título seja aceito como provisionado.
-4. Fechar a adaptação da identidade para o caso nuvem (forwarder por jogo vs título do PSBox).
-5. Verificação sempre a nível de serviço (re-dump do cache `[svc+0x80]` após o unlock, checar
- a entrada do NPWR + flag `+0xe`) E visual (o dono olhando Perfil → Troféus na TV — não há
- como capturar a tela do sistema remotamente).
+## 5. Próximos Passos Imediatos para a Nova Sessão
+
+1. **Validação do Login e Persistência**:
+ - Recompilar e enviar a build atualizada de `xCloud-PS5-trophy` com o fix de retry loop:
+ ```bash
+ ninja -C build-ps5 xcloud_app
+ bash tools/ps5/link.sh build-ps5
+ XC_INCLUDE_ACCOUNT=1 bash tools/ps5/package.sh build-ps5
+ PS5_HOST=192.168.15.17 python3 ../PS5_Vulkan/tools/ps5_console.py kill PPSA99810
+ PS5_HOST=192.168.15.17 ./tools/ps5/deploy.sh build-ps5
+ ```
+ - Iniciar em modo interativo foreground:
+ ```bash
+ PS5_HOST=192.168.15.17 python3 ../PS5_Vulkan/tools/ps5_console.py launch PPSA99810
+ ```
+ - Confirmar que o app inicia já com a conta `RafaelNGP` autenticada e que qualquer alteração de configuração persiste em `/data/psbox/settings.json`.
+
+2. **Visibilidade do Título na Biblioteca vs Troféus**:
+ - Ajustar `DISPLAYLOCATION` de `PPSA01922` para `0` em `app.db` / `appinfo.db` (usando `register_title_db.py`) para que o título fique oculto na Biblioteca de Jogos conforme a preferência do usuário.
+ - Se os troféus precisarem de um gatilho de leitura do SceShellUI (como documentado no RecompTrophy), verificar se a reinicialização da interface/console ou o envio da notificação nativa (`sceNotificationSend`) indexa o conjunto no menu Perfil.
---
-## 9. O que já é ganho sólido, sem depender do resto
+## 6. Feedback Visual do Usuário no Console & Diagnóstico dos Pontos Faltantes
+
+### 6.1 Status Visual Confirmado pelo Usuário
+- **FORTNITE APARECE NA LISTA NATIVA DE TROFÉUS DO PS5!**
+- Exibe **22 troféus liberados (48% de conclusão)**.
+- Cada troféu exibe corretamente seu **nome**, **descrição** e **timestamp de quando foi desbloqueado**.
+
+### 6.2 Análise dos 3 Pontos Pendentes e Soluções:
+
+1. **Graus dos Troféus no PlayStation (Verificação Oficial via PSNProfiles / PlayStationTrophies)**:
+ - **No PlayStation, os 46 troféus do Fortnite NÃO são todos Bronze.**
+ - A distribuição oficial é:
+ - **1 Platina:** `Hero of the Storm` (Obtenha todos os outros troféus).
+ - **3 Ouro:**
+ 1. `All Tied Up` (Twine Peaks Storm Shield Defense 6)
+ 2. `Guardian Angel` (Salvar 10.000 sobreviventes em missões concluídas)
+ 3. `Plays Well with Others` (Completar 1.000 missões "Jogar com Outros")
+ - **10 Prata:**
+ 1. `Many Planks` (Missões principais de Plankerton)
+ 2. `Amped for Expansion` (Canny Valley Storm Shield Defense 6)
+ 3. `Uncanny!` (Missões principais de Canny Valley)
+ 4. `Into the Night` (Twine Peaks Storm Shield Defense 1)
+ 5. `Evil Things with Crazy Teeth` (Toxic Treasures - Estágio 10)
+ 6. `Talented Builder` (Construir 500.000 estruturas)
+ 7. `Go Gnome!` (Destruir 100 Gnomos de Jardim)
+ 8. `Loot Legend` (Abrir 300 Baús de Tesouro)
+ 9. `World Explorer` (Explorar 1.500 zonas completamente)
+ 10. `Unspeakable Horrors` (Eliminar 20.000 Monstros de Névoa)
+ - **32 Bronze:** Todos os outros 32 troféus.
+ - **Ação:** No próximo chat, mapear o array `set.items` no `trophy_sync.cpp` para atribuir exatamente esses graus oficiais (`Platinum`, `Gold`, `Silver`, `Bronze`), em vez do fallback genérico de Bronze.
+
+2. **Ícones dos Troféus e Ícone do Jogo (Círculo Verde)**:
+ - **Por que está repetido e verde:**
+ - Em `src/trophy/trophy_builder.cpp:425`, `icon0_en-US.png` foi montado usando `kDefaultIconPng`, que é um bitmap embutido de um círculo verde estático.
+ - Em `src/trophy/trophy_builder.cpp:431`, todos os `trop0001.png` .. `trop0045.png` foram montados usando `kDefaultTropPng`, que é um único ícone genérico de troféu.
+ - **Ação:** Substituir `icon0_en-US.png` pelo PNG real de capa do Fortnite (já presente em `/system_data/priv/appmeta/PPSA01922/icon0.png` no console) e carregar os PNGs de cada conquista retornados pela API da Xbox Live (`mediaAssets` / URLs de ícones) ao gerar o UCP.
+
+3. **Carregamento e Gravação da Conta**:
+ - O usuário testou com o binário antigo (anterior ao retry loop).
+ - O fix está implementado em `src/platform/ps5/platform_ps5.cpp` (loop de até 3s aguardando unjail) e o `autoplay.txt` foi removido do console.
+ - Ao rodar o deploy da nova build, o app lerá `/data/psbox/account.json` (que já existe e é válido) no primeiro frame.
-- A correção do `errno=2` (deploy de arquivos voltou a funcionar) — commitável.
-- O payload limpo (12 patches, documentado) — reduz "lixo" de tentativas passadas.
-- Todo o mapeamento/diagnóstico acima.
-- Alternativa pronta para construir: **tela de conquistas DENTRO do PSBox** (não é o perfil
- nativo do sistema, mas mostra nome/ícone/lista/grau/progresso de tudo que a pessoa
- conquistou) — 100% legítima, sem depender da via (A).
diff --git a/ps5/stubs/libSceNpTrophy2.c b/ps5/stubs/libSceNpTrophy2.c
index 3f15d23..598c4bb 100644
--- a/ps5/stubs/libSceNpTrophy2.c
+++ b/ps5/stubs/libSceNpTrophy2.c
@@ -4,8 +4,8 @@
* records the imports. Never packaged or executed. */
#include <stdint.h>
-int32_t sceNpTrophy2CreateContext(int32_t *context, int32_t userId, uint32_t unk, uint64_t unk2) {
- (void)context; (void)userId; (void)unk; (void)unk2;
+int32_t sceNpTrophy2CreateContext(int32_t *context, int32_t userId, uint32_t serviceLabel, uint64_t options) {
+ (void)context; (void)userId; (void)serviceLabel; (void)options;
return -1;
}
@@ -29,8 +29,8 @@ int32_t sceNpTrophy2AbortHandle(int32_t handle) {
return -1;
}
-int32_t sceNpTrophy2RegisterContext(int32_t context, int32_t handle, uint64_t unk) {
- (void)context; (void)handle; (void)unk;
+int32_t sceNpTrophy2RegisterContext(int32_t context, int32_t handle, uint64_t options) {
+ (void)context; (void)handle; (void)options;
return -1;
}
@@ -39,12 +39,7 @@ int32_t sceNpTrophy2SystemDebugUnlockTrophy(int32_t handle, int32_t context, con
return -1;
}
-int32_t sceNpTrophy2UnlockTrophy(int32_t context, int32_t handle, int32_t trophyId, int32_t *platinumId) {
- (void)context; (void)handle; (void)trophyId; (void)platinumId;
- return -1;
-}
-
-int32_t sceNpTrophy2ShowTrophyList(int32_t context, int32_t handle, uint64_t unk) {
- (void)context; (void)handle; (void)unk;
+int32_t sceNpTrophy2ShowTrophyList(int32_t handle, uint64_t options) {
+ (void)handle; (void)options;
return -1;
}
diff --git a/src/platform/ps5/platform_ps5.cpp b/src/platform/ps5/platform_ps5.cpp
index 5d58f54..439faf4 100644
--- a/src/platform/ps5/platform_ps5.cpp
+++ b/src/platform/ps5/platform_ps5.cpp
@@ -96,44 +96,78 @@ void migrateLegacy() {
}
bool init() {
+ // 1. Initialize networking early so we can trigger early unjail via localhost (127.0.0.1:8084)
+ int rc = sceNetInit();
+ if (rc < 0) XC_LOGW("sceNetInit: 0x%08x", static_cast<unsigned>(rc));
+ int pool = sceNetPoolCreate("xcloud", 32 * 1024, 0);
+ if (pool < 0) XC_LOGE("sceNetPoolCreate: 0x%08x (host names will not resolve)", static_cast<unsigned>(pool));
+ g_netPool = pool;
+
+ // 2. Trigger early unjail via elfldr / payload manager (127.0.0.1:8084)
+ int s = ::socket(AF_INET, SOCK_STREAM, 0);
+ if (s >= 0) {
+ struct sockaddr_in sin{};
+ sin.sin_family = AF_INET;
+ sin.sin_port = htons(8084);
+ sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ struct timeval tv{0, 250000}; // 250ms
+ ::setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+ ::setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+ if (::connect(s, reinterpret_cast<struct sockaddr*>(&sin), sizeof(sin)) == 0) {
+ const char req[] = "GET /loadpayload:/data/pldmgr/payloads/patch_test/patch_test.elf HTTP/1.1\r\nHost: 127.0.0.1:8084\r\nConnection: close\r\n\r\n";
+ ::send(s, req, sizeof(req) - 1, 0);
+ char buf[128];
+ ::recv(s, buf, sizeof(buf), 0);
+ }
+ ::close(s);
+ ::usleep(150000); // 150ms for payload to unjail PID
+ }
+
int errPsbox = 0;
int errLegacy = 0;
- if (writable(kDataDir, errPsbox)) {
- g_dataDirWritable = true;
- migrateLegacy();
- } else if (writable(kLegacyDir, errLegacy)) { // as before 0.9.7
- g_dataDirWritable = true;
- g_dataDir = kLegacyDir;
- g_dataNote = std::string(kDataDir) + " not writable (errno " + std::to_string(errPsbox) + "); using " + kLegacyDir;
- } else {
- // Try fallback directories on PS5 sandbox
- bool found = false;
- for (const char* fb : {"/download0/psbox", "/user/home/psbox", "/temp0/psbox"}) {
- int errFb = 0;
- if (writable(fb, errFb)) {
- g_dataDir = fb;
- g_dataDirWritable = true;
+ bool ok = false;
+ for (int retry = 0; retry < 30; ++retry) {
+ if (writable(kDataDir, errPsbox)) {
+ g_dataDir = kDataDir;
+ g_dataDirWritable = true;
+ migrateLegacy();
+ ok = true;
+ break;
+ }
+ ::usleep(100000); // 100ms * 30 = up to 3s wait for unjail
+ }
+
+ if (!ok) {
+ if (writable(kLegacyDir, errLegacy)) { // as before 0.9.7
+ g_dataDirWritable = true;
+ g_dataDir = kLegacyDir;
+ g_dataNote = std::string(kDataDir) + " not writable (errno " + std::to_string(errPsbox) + "); using " + kLegacyDir;
+ } else {
+ // Try fallback directories on PS5 sandbox
+ bool found = false;
+ for (const char* fb : {"/download0/psbox", "/user/home/psbox", "/temp0/psbox"}) {
+ int errFb = 0;
+ if (writable(fb, errFb)) {
+ g_dataDir = fb;
+ g_dataDirWritable = true;
+ g_dataNote = std::string("neither ") + kDataDir + " (errno " + std::to_string(errPsbox) +
+ ") nor " + kLegacyDir + " (errno " + std::to_string(errLegacy) +
+ ") writable; fallback to " + fb;
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ g_dataDirErrno = errPsbox ? errPsbox : errLegacy;
+ g_dataDirWritable = false;
g_dataNote = std::string("neither ") + kDataDir + " (errno " + std::to_string(errPsbox) +
") nor " + kLegacyDir + " (errno " + std::to_string(errLegacy) +
- ") writable; fallback to " + fb;
- found = true;
- break;
+ ") is writable: nothing will be kept";
}
}
- if (!found) {
- g_dataDirErrno = errPsbox ? errPsbox : errLegacy;
- g_dataDirWritable = false;
- g_dataNote = std::string("neither ") + kDataDir + " (errno " + std::to_string(errPsbox) +
- ") nor " + kLegacyDir + " (errno " + std::to_string(errLegacy) +
- ") is writable: nothing will be kept";
- }
}
- // libSceNet's resolver: 32 KiB pool.
- int rc = sceNetInit();
- if (rc < 0) XC_LOGW("sceNetInit: 0x%08x", static_cast<unsigned>(rc));
- int pool = sceNetPoolCreate("xcloud", 32 * 1024, 0);
- if (pool < 0) XC_LOGE("sceNetPoolCreate: 0x%08x (host names will not resolve)", static_cast<unsigned>(pool));
- g_netPool = pool;
+ XC_LOGI("platform ps5: storage dir=%s (writable=%d, errno=%d, note=%s)",
+ g_dataDir.c_str(), g_dataDirWritable ? 1 : 0, g_dataDirErrno, g_dataNote.c_str());
return true;
}
@@ -151,16 +185,29 @@ std::string appDir() {
// /app0 is the app's own folder; its real path where it has been
// tested to take updates (renames over the running eboot.bin).
struct stat legacy {}, running {};
- if (::stat((std::string(kLegacyDir) + "/eboot.bin").c_str(), &legacy) == 0 &&
- ::stat("/app0/eboot.bin", &running) == 0 && legacy.st_ino == running.st_ino)
+ if (::stat("/app0/eboot.bin", &running) == 0) {
+ if (::stat((std::string(kLegacyDir) + "/eboot.bin").c_str(), &legacy) == 0 &&
+ legacy.st_ino == running.st_ino)
+ return kLegacyDir;
+ return "/app0";
+ }
+ if (::stat((std::string(kLegacyDir) + "/eboot.bin").c_str(), &legacy) == 0)
return kLegacyDir;
return "/app0";
}
-std::string assetDir() { return "/app0/assets"; }
+std::string assetDir() {
+ struct stat st{};
+ if (::stat("/app0/assets/fonts/Inter-Regular.ttf", &st) == 0) return "/app0/assets";
+ std::string legacyAssets = std::string(kLegacyDir) + "/assets";
+ if (::stat((legacyAssets + "/fonts/Inter-Regular.ttf").c_str(), &st) == 0) return legacyAssets;
+ return appDir() + "/assets";
+}
std::string caBundlePath() {
- // Shipped in /app0/assets/cacert.pem
+ struct stat st{};
+ std::string p = assetDir() + "/cacert.pem";
+ if (::stat(p.c_str(), &st) == 0) return p;
return "/app0/assets/cacert.pem";
}
diff --git a/src/platform/ps5/trophy_backend_ps5.cpp b/src/platform/ps5/trophy_backend_ps5.cpp
index 3c0b913..a1ee88a 100644
--- a/src/platform/ps5/trophy_backend_ps5.cpp
+++ b/src/platform/ps5/trophy_backend_ps5.cpp
@@ -37,11 +37,7 @@ int32_t sceNpTrophy2DestroyHandle(int32_t handle);
int32_t sceNpTrophy2AbortHandle(int32_t handle);
int32_t sceNpTrophy2RegisterContext(int32_t context, int32_t handle, uint64_t options);
int32_t sceNpTrophy2SystemDebugUnlockTrophy(int32_t handle, int32_t context, const SceNpTrophy2DebugUnlockParam *param);
-int32_t sceNpTrophy2ShowTrophyList(int32_t context, int32_t handle, uint64_t options);
-
-// The NORMAL Trophy2 unlock (what a real game uses) — drives the native
-// collection + popup, unlike sceNpTrophy2SystemDebugUnlockTrophy.
-int32_t sceNpTrophy2UnlockTrophy(int32_t context, int32_t handle, int32_t trophyId, int32_t* platinumId);
+int32_t sceNpTrophy2ShowTrophyList(int32_t handle, uint64_t options);
}
namespace xc::trophy {
@@ -136,11 +132,11 @@ public:
sceUserServiceGetUserName(static_cast<int32_t>(userId_), userName, sizeof(userName));
XC_LOGI("trophy ps5: initialized for user 0x%08x (%s)", userId_, userName[0] ? userName : "devRafaelNGP");
- // Ensure SceShellCore debug unlock patch is active
- triggerSceShellCorePatch();
-
- // Load libSceNpTrophy2 module
+ // Load libSceNpTrophy2 module first so it is present in memory for patching
loadNpTrophyModule();
+
+ // Ensure SceShellCore patches are active, unjail eboot, and patch libSceNpTrophy2
+ triggerSceShellCorePatch();
initialized_ = true;
return true;
}
@@ -186,6 +182,9 @@ public:
std::vector<uint8_t> dummyUcp;
buildUcp(set, dummyUcp, &ucpSha1_);
+ // Re-trigger patch to guarantee client-side libSceNpTrophy2 and SceShellCore are patched
+ triggerSceShellCorePatch();
+
int rc = sceNpTrophy2CreateContext(&context_, static_cast<int32_t>(userId_), 1, 0);
XC_LOGI("trophy ps5: sceNpTrophy2CreateContext(user=0x%08x, serviceLabel=1) -> rc=0x%08x, context=%d",
userId_, static_cast<unsigned>(rc), context_);
@@ -195,10 +194,29 @@ public:
static_cast<unsigned>(rc), handle_);
}
if (context_ >= 0 && handle_ >= 0) {
- rc = sceNpTrophy2RegisterContext(context_, handle_, 0);
- XC_LOGI("trophy ps5: sceNpTrophy2RegisterContext(ctx=%d, hdl=%d) -> rc=0x%08x",
- context_, handle_, static_cast<unsigned>(rc));
- ::usleep(250000); // 250ms settle for SceShellCore async pack load
+ ::usleep(500000); // 500ms for SceShellCore CreateContextJob to settle and register context
+ for (int retry = 0; retry < 6; ++retry) {
+ rc = sceNpTrophy2RegisterContext(context_, handle_, 0);
+ if (rc == 0 || static_cast<uint32_t>(rc) == 0x80553921) {
+ XC_LOGI("trophy ps5: sceNpTrophy2RegisterContext(ctx=%d, hdl=%d) -> rc=0x%08x (attempt %d)",
+ context_, handle_, static_cast<unsigned>(rc), retry + 1);
+ break;
+ }
+ if ((static_cast<uint32_t>(rc) == 0x80553909 ||
+ static_cast<uint32_t>(rc) == 0x80020023 ||
+ static_cast<uint32_t>(rc) == 0x80553908) && retry < 5) {
+ XC_LOGI("trophy ps5: RegisterContext context %d not ready yet (rc=0x%08x), retrying in 800ms (%d/6)",
+ context_, static_cast<unsigned>(rc), retry + 1);
+ if (retry == 1) {
+ triggerSceShellCorePatch();
+ }
+ ::usleep(800000);
+ continue;
+ }
+ XC_LOGW("trophy ps5: sceNpTrophy2RegisterContext failed with rc=0x%08x", static_cast<unsigned>(rc));
+ break;
+ }
+ ::usleep(500000); // 500ms settle for SceShellCore async pack load
}
}
@@ -226,21 +244,28 @@ public:
int rc = -1;
if (context_ >= 0 && handle_ >= 0) {
SceNpTrophy2DebugUnlockParam param{};
- param.mode = 2; // Mode 2: Specific trophyId
- param.trophyId = trophyId; // Exact 1-based trophy id
+ param.mode = 1; // Mode 1: specific trophy_id
+ param.trophyId = trophyId;
- for (int retry = 0; retry < 15; ++retry) {
+ for (int retry = 0; retry < 10; ++retry) {
rc = sceNpTrophy2SystemDebugUnlockTrophy(handle_, context_, &param);
if (rc == 0 || static_cast<uint32_t>(rc) == 0x80553998) {
- rc = 0; // 0x80553998 = ALREADY_UNLOCKED (success)
+ rc = 0;
break;
}
- if (static_cast<uint32_t>(rc) == 0x80553909 && retry < 14) {
- XC_LOGI("trophy ps5: context %d not ready yet (0x80553909), retrying in 50ms (%d/15)",
- context_, retry + 1);
- ::usleep(50000);
+ if ((static_cast<uint32_t>(rc) == 0x80553909 ||
+ static_cast<uint32_t>(rc) == 0x80020023 ||
+ static_cast<uint32_t>(rc) == 0x80553908) && retry < 9) {
+ ::usleep(100000);
continue;
}
+ // Fallback to mode 2
+ param.mode = 2;
+ int dbg2 = sceNpTrophy2SystemDebugUnlockTrophy(handle_, context_, &param);
+ if (dbg2 == 0 || static_cast<uint32_t>(dbg2) == 0x80553998) {
+ rc = 0;
+ break;
+ }
break;
}
XC_LOGI("trophy ps5: sceNpTrophy2SystemDebugUnlockTrophy(%s, trophyId=%d, grade=%s) -> rc=0x%08x",
@@ -250,9 +275,8 @@ public:
}
if (rc != 0) {
- XC_LOGW("trophy ps5: sceNpTrophy2SystemDebugUnlockTrophy failed for %s trophyId=%d -> rc=0x%08x",
- npCommId.c_str(), trophyId, static_cast<unsigned>(rc));
- return false;
+ XC_LOGW("trophy ps5: sceNpTrophy2SystemDebugUnlockTrophy rc=0x%08x; recording direct TRPTITLE.DAT unlock for %s trophyId=%d",
+ static_cast<unsigned>(rc), npCommId.c_str(), trophyId);
}
sessionUnlockedTrophies_[npCommId].insert(trophyId);
@@ -322,6 +346,11 @@ private:
mod = sceKernelLoadStartModule("libSceNpTrophy2.sprx", 0, nullptr, 0, nullptr, &res);
}
XC_LOGI("trophy ps5: load libSceNpTrophy2.sprx -> 0x%08x (res=%d)", static_cast<unsigned>(mod), res);
+ int modMgr = sceKernelLoadStartModule(systemLib("libSceNpManager.sprx").c_str(), 0, nullptr, 0, nullptr, &res);
+ if (modMgr < 0) {
+ modMgr = sceKernelLoadStartModule("libSceNpManager.sprx", 0, nullptr, 0, nullptr, &res);
+ }
+ XC_LOGI("trophy ps5: load libSceNpManager.sprx -> 0x%08x (res=%d)", static_cast<unsigned>(modMgr), res);
}
void cleanupContext() {
@@ -424,17 +453,26 @@ void runPsboxNativeSelfTest() {
// NORMAL Trophy2 flow (like a real game): CreateContext -> CreateHandle ->
// RegisterContext -> UnlockTrophy (NOT the debug unlock). serviceLabel=1.
- int32_t ctx = -1, handle = -1, plat = -1;
+ triggerSceShellCorePatch();
+ int32_t ctx = -1, handle = -1;
int rc = sceNpTrophy2CreateContext(&ctx, static_cast<int32_t>(uid), 1, 0);
XC_LOGI("psbox selftest: CreateContext -> rc=0x%08x ctx=%d", static_cast<unsigned>(rc), ctx);
rc = sceNpTrophy2CreateHandle(&handle);
XC_LOGI("psbox selftest: CreateHandle -> rc=0x%08x handle=%d", static_cast<unsigned>(rc), handle);
- rc = sceNpTrophy2RegisterContext(ctx, handle, 0);
+ ::usleep(300000);
+ for (int retry = 0; retry < 15; ++retry) {
+ rc = sceNpTrophy2RegisterContext(ctx, handle, 0);
+ if (rc == 0 || static_cast<uint32_t>(rc) == 0x80553921) break;
+ ::usleep(100000);
+ }
XC_LOGI("psbox selftest: RegisterContext -> rc=0x%08x", static_cast<unsigned>(rc));
::usleep(250000);
for (int id = 1; id <= 2; ++id) {
- rc = sceNpTrophy2UnlockTrophy(ctx, handle, id, &plat);
- XC_LOGI("psbox selftest: sceNpTrophy2UnlockTrophy(id=%d) -> rc=0x%08x plat=%d", id, static_cast<unsigned>(rc), plat);
+ SceNpTrophy2DebugUnlockParam param{};
+ param.mode = 1;
+ param.trophyId = id;
+ rc = sceNpTrophy2SystemDebugUnlockTrophy(handle, ctx, &param);
+ XC_LOGI("psbox selftest: sceNpTrophy2SystemDebugUnlockTrophy(id=%d) -> rc=0x%08x", id, static_cast<unsigned>(rc));
::usleep(300000);
}
if (handle >= 0) sceNpTrophy2DestroyHandle(handle);
diff --git a/src/trophy/trophy_builder.cpp b/src/trophy/trophy_builder.cpp
index a12982f..1fed8b5 100644
--- a/src/trophy/trophy_builder.cpp
+++ b/src/trophy/trophy_builder.cpp
@@ -8,11 +8,27 @@
#include <algorithm>
#include <chrono>
#include <cstring>
+#include <dirent.h>
#include <fcntl.h>
#include <mbedtls/sha1.h>
+#include <mbedtls/sha256.h>
#include <sys/stat.h>
#include <unistd.h>
+#define STB_IMAGE_STATIC
+#define STB_IMAGE_IMPLEMENTATION
+#define STBI_ONLY_JPEG
+#define STBI_ONLY_PNG
+#define STBI_NO_STDIO
+#include "stb_image.h"
+
+#define STB_IMAGE_RESIZE_STATIC
+#define STB_IMAGE_RESIZE_IMPLEMENTATION
+#include "stb_image_resize2.h"
+
+#define STB_IMAGE_WRITE_STATIC
+#define STB_IMAGE_WRITE_IMPLEMENTATION
+#include "stb_image_write.h"
namespace xc::trophy {
@@ -76,33 +92,197 @@ inline void writeBe64(uint8_t* p, uint64_t val) {
p[7] = static_cast<uint8_t>(val & 0xFF);
}
-bool writeRawFile(const std::string& path, const void* data, size_t size) {
- int fd = ::open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
+inline uint32_t readBe32(const uint8_t* p) {
+ return (static_cast<uint32_t>(p[0]) << 24) | (static_cast<uint32_t>(p[1]) << 16) |
+ (static_cast<uint32_t>(p[2]) << 8) | p[3];
+}
+
+inline uint64_t readBe64(const uint8_t* p) {
+ return (static_cast<uint64_t>(readBe32(p)) << 32) | readBe32(p + 4);
+}
+
+constexpr size_t TRP_HEAD = 0x40;
+constexpr size_t TRP_CHUNK = 0x400;
+constexpr size_t TRP_STRIDE = 0x420;
+constexpr size_t TRP_MAX = 256 * 1024;
+
+bool readTrophyStream(const uint8_t* raw, size_t rawSize, std::vector<uint8_t>& stream) {
+ stream.clear();
+ if (!raw || rawSize < TRP_HEAD || (rawSize - TRP_HEAD) % TRP_STRIDE != 0 || std::memcmp(raw, "T2PD", 4) != 0) {
+ return false;
+ }
+ stream.assign(raw, raw + TRP_HEAD);
+ for (size_t o = TRP_HEAD; o + TRP_STRIDE <= rawSize; o += TRP_STRIDE) {
+ stream.insert(stream.end(), raw + o, raw + o + TRP_CHUNK);
+ }
+ return true;
+}
+
+bool writeTrophyFile(const uint8_t* stream, size_t streamSize, std::vector<uint8_t>& outDat) {
+ outDat.clear();
+ if (!stream || streamSize < TRP_HEAD || std::memcmp(stream, "T2PD", 4) != 0) {
+ return false;
+ }
+ outDat.assign(stream, stream + TRP_HEAD);
+ for (size_t o = TRP_HEAD; o + TRP_CHUNK <= streamSize; o += TRP_CHUNK) {
+ const uint8_t* chunk = stream + o;
+ outDat.insert(outDat.end(), chunk, chunk + TRP_CHUNK);
+ bool any = false;
+ for (size_t i = 0; i < TRP_CHUNK && !any; ++i) {
+ any = (chunk[i] != 0);
+ }
+ if (any) {
+ uint8_t hash[32];
+ mbedtls_sha256(chunk, TRP_CHUNK, hash, 0);
+ outDat.insert(outDat.end(), hash, hash + 32);
+ } else {
+ outDat.insert(outDat.end(), 32, 0);
+ }
+ }
+ return true;
+}
+
+bool dirRecord(const uint8_t* s, size_t sSize, uint32_t rtype, uint32_t* rsize, uint32_t* rcount, size_t* roffset) {
+ if (sSize < 0x70 || std::memcmp(s + 0x40, "T2TD", 4) != 0) return false;
+ uint32_t n = readBe32(s + 0x48);
+ for (uint32_t i = 0; i < n && i < 16; ++i) {
+ size_t e = 0x70 + i * 0x20;
+ if (e + 0x20 > sSize) break;
+ if (readBe32(s + e) == rtype) {
+ if (rsize) *rsize = readBe32(s + e + 4);
+ if (rcount) *rcount = readBe32(s + e + 12);
+ if (roffset) *roffset = 0x40 + static_cast<size_t>(readBe64(s + e + 16));
+ return true;
+ }
+ }
+ return false;
+}
+
+size_t findRecord(const uint8_t* s, size_t sSize, uint32_t kind, uint32_t recSize, size_t fromOff = 0x190) {
+ for (size_t o = fromOff; o + 0x10 <= sSize; o += 16) {
+ if (readBe32(s + o) == kind && readBe32(s + o + 4) == recSize) return o;
+ }
+ return 0;
+}
+
+void putMask(uint8_t* p, const std::vector<uint8_t>& ids) {
+ std::memset(p, 0, 16);
+ for (uint8_t tid : ids) {
+ if (tid < 128) {
+ p[tid / 8] |= static_cast<uint8_t>(1u << (tid % 8));
+ }
+ }
+}
+
+bool unlockInStream(uint8_t* s, size_t sSize, uint32_t tid, uint64_t whenTicks) {
+ size_t h = findRecord(s, sSize, 0x2, 0x60);
+ size_t r6 = findRecord(s, sSize, 0x600, 0x1f0);
+ size_t r7 = findRecord(s, sSize, 0x700, 0xb0);
+ if (!h || !r6 || !r7 || tid >= 128) return false;
+
+ size_t o = 0;
+ for (size_t at = findRecord(s, sSize, 0x800, 0x50); at != 0; at = findRecord(s, sSize, 0x800, 0x50, at + 0x60)) {
+ if (readBe32(s + at + 0x10) == tid) {
+ o = at;
+ break;
+ }
+ }
+ if (!o || o + 0x50 > sSize || readBe32(s + o + 0x14) == 0x11) return false;
+
+ static const uint8_t kTrailer[16] = {0x55, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 1};
+ writeBe32(s + o + 0x14, 0x11);
+ writeBe32(s + o + 0x18, 0x2000);
+ writeBe64(s + o + 0x20, whenTicks);
+ writeBe64(s + o + 0x30, whenTicks);
+ std::memcpy(s + o + 0x40, kTrailer, 16);
+
+ const size_t bitmaps[] = {r6 + 0x80, r6 + 0x180, r7 + 0x40};
+ for (int i = 0; i < 3; ++i) s[bitmaps[i] + tid / 8] |= static_cast<uint8_t>(1u << (tid % 8));
+
+ uint64_t last = readBe64(s + r6 + 0x40);
+ if (whenTicks > last) last = whenTicks;
+ const size_t lasts[] = {r6 + 0x40, r6 + 0x70, r7 + 0x20};
+ for (int i = 0; i < 3; ++i) writeBe64(s + lasts[i], last);
+
+ if (whenTicks > readBe64(s + h + 0x20)) {
+ writeBe64(s + h + 0x20, whenTicks);
+ writeBe64(s + h + 0x28, 0);
+ }
+ writeBe64(s + h + 0x18, readBe64(s + h + 0x18) + 2);
+ writeBe64(s + r6 + 0x10, readBe64(s + r6 + 0x10) + 1);
+ return true;
+}
+
+bool writeRawFile(const std::string& path, const void* data, size_t size, mode_t mode = 0770) {
+ int fd = ::open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd < 0) {
XC_LOGW("trophy builder: failed to open '%s' for write: errno=%d", path.c_str(), errno);
return false;
}
ssize_t written = ::write(fd, data, size);
::close(fd);
- ::chmod(path.c_str(), 0666);
+ ::chmod(path.c_str(), mode);
return (written == static_cast<ssize_t>(size));
}
-void ensureDir(const std::string& dir) {
+void ensureDir(const std::string& dir, mode_t mode = 0770) {
std::string s;
for (char c : dir) {
s += c;
if (c == '/' && s.size() > 1) {
- ::mkdir(s.c_str(), 0777);
- ::chmod(s.c_str(), 0777);
+ ::mkdir(s.c_str(), mode);
+ ::chmod(s.c_str(), mode);
}
}
- ::mkdir(dir.c_str(), 0777);
- ::chmod(dir.c_str(), 0777);
+ ::mkdir(dir.c_str(), mode);
+ ::chmod(dir.c_str(), mode);
}
} // namespace
+bool is512x512Png(const uint8_t* data, size_t size) {
+ if (!data || size < 24) return false;
+ static const uint8_t kPngSig[8] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
+ if (std::memcmp(data, kPngSig, 8) != 0) return false;
+ if (std::memcmp(data + 12, "IHDR", 4) != 0) return false;
+ uint32_t w = readBe32(data + 16);
+ uint32_t h = readBe32(data + 20);
+ return (w == 512 && h == 512);
+}
+
+bool convertTo512Png(const uint8_t* rawData, size_t rawSize, std::vector<uint8_t>& outPng) {
+ outPng.clear();
+ if (!rawData || rawSize == 0) return false;
+ int w = 0, h = 0, n = 0;
+ stbi_uc* pixels = stbi_load_from_memory(rawData, static_cast<int>(rawSize), &w, &h, &n, 4);
+ if (!pixels || w <= 0 || h <= 0) {
+ if (pixels) stbi_image_free(pixels);
+ return false;
+ }
+
+ int side = std::min(w, h);
+ int cx = (w - side) / 2;
+ int cy = (h - side) / 2;
+ const stbi_uc* srcStart = pixels + (static_cast<size_t>(cy) * w + cx) * 4;
+
+ std::vector<uint8_t> resized(512 * 512 * 4);
+ stbir_resize_uint8_srgb(srcStart, side, side, w * 4,
+ resized.data(), 512, 512, 512 * 4,
+ STBIR_RGBA);
+ stbi_image_free(pixels);
+
+ int pngLen = 0;
+ unsigned char* pngData = stbi_write_png_to_mem(resized.data(), 512 * 4, 512, 512, 4, &pngLen);
+ if (!pngData || pngLen <= 0) {
+ if (pngData) free(pngData);
+ return false;
+ }
+
+ outPng.assign(pngData, pngData + pngLen);
+ free(pngData);
+ return true;
+}
+
const uint8_t kNpTitleTrailer[128] = {
0x4d, 0x75, 0x39, 0xf0, 0xf9, 0x30, 0x94, 0x7a, 0x52, 0x04, 0x6a, 0xe7, 0x54, 0x08, 0x22, 0xb2,
0x02, 0x20, 0xb1, 0x83, 0x3d, 0xec, 0x0f, 0xe2, 0x62, 0x17, 0xcb, 0x16, 0x33, 0x2e, 0xfa, 0x08,
@@ -127,65 +307,31 @@ bool buildNpTitleDat(const std::string& titleId, std::vector<uint8_t>& outNpTitl
bool parseTrpTitleDat(const uint8_t* data, size_t size, std::map<uint32_t, ExistingTrophyRecord>& outTrophies) {
outTrophies.clear();
- if (!data || size < 0x200) return false;
- if (std::memcmp(data, "T2PD", 4) != 0) return false;
+ if (!data || size < 0x40) return false;
+
+ std::vector<uint8_t> streamBuf;
+ const uint8_t* s = nullptr;
+ size_t sSize = 0;
+
+ if (size >= TRP_HEAD && (size - TRP_HEAD) % TRP_STRIDE == 0 && std::memcmp(data, "T2PD", 4) == 0) {
+ if (!readTrophyStream(data, size, streamBuf)) return false;
+ s = streamBuf.data();
+ sSize = streamBuf.size();
+ } else if (size >= TRP_HEAD && std::memcmp(data, "T2PD", 4) == 0) {
+ s = data;
+ sSize = size;
+ } else {
+ return false;
+ }
- for (int i = 0; i < 9; ++i) {
- size_t descOffset = 0x70 + (i * 32);
- if (descOffset + 32 > size) break;
- uint32_t tag = (static_cast<uint32_t>(data[descOffset + 0]) << 24) |
- (static_cast<uint32_t>(data[descOffset + 1]) << 16) |
- (static_cast<uint32_t>(data[descOffset + 2]) << 8) |
- (static_cast<uint32_t>(data[descOffset + 3]));
- uint32_t itemLen = (static_cast<uint32_t>(data[descOffset + 4]) << 24) |
- (static_cast<uint32_t>(data[descOffset + 5]) << 16) |
- (static_cast<uint32_t>(data[descOffset + 6]) << 8) |
- (static_cast<uint32_t>(data[descOffset + 7]));
- uint32_t count = (static_cast<uint32_t>(data[descOffset + 12]) << 24) |
- (static_cast<uint32_t>(data[descOffset + 13]) << 16) |
- (static_cast<uint32_t>(data[descOffset + 14]) << 8) |
- (static_cast<uint32_t>(data[descOffset + 15]));
- uint64_t relOff = (static_cast<uint64_t>(data[descOffset + 16]) << 56) |
- (static_cast<uint64_t>(data[descOffset + 17]) << 48) |
- (static_cast<uint64_t>(data[descOffset + 18]) << 40) |
- (static_cast<uint64_t>(data[descOffset + 19]) << 32) |
- (static_cast<uint64_t>(data[descOffset + 20]) << 24) |
- (static_cast<uint64_t>(data[descOffset + 21]) << 16) |
- (static_cast<uint64_t>(data[descOffset + 22]) << 8) |
- (static_cast<uint64_t>(data[descOffset + 23]));
-
- if (tag == 0x0500) {
- size_t itemBase = 0x60 + relOff;
- size_t itemTotalSize = 0x10 + itemLen; // 0x10 header + 0xc0 payload = 208 bytes
- for (uint32_t t = 0; t < count; ++t) {
- size_t entryPos = itemBase + (t * itemTotalSize);
- if (entryPos + 40 > size) break;
- uint32_t tid = (static_cast<uint32_t>(data[entryPos + 16]) << 24) |
- (static_cast<uint32_t>(data[entryPos + 17]) << 16) |
- (static_cast<uint32_t>(data[entryPos + 18]) << 8) |
- (static_cast<uint32_t>(data[entryPos + 19]));
- uint32_t grade = (static_cast<uint32_t>(data[entryPos + 20]) << 24) |
- (static_cast<uint32_t>(data[entryPos + 21]) << 16) |
- (static_cast<uint32_t>(data[entryPos + 22]) << 8) |
- (static_cast<uint32_t>(data[entryPos + 23]));
- uint32_t state = (static_cast<uint32_t>(data[entryPos + 24]) << 24) |
- (static_cast<uint32_t>(data[entryPos + 25]) << 16) |
- (static_cast<uint32_t>(data[entryPos + 26]) << 8) |
- (static_cast<uint32_t>(data[entryPos + 27]));
- uint64_t ts = (static_cast<uint64_t>(data[entryPos + 32]) << 56) |
- (static_cast<uint64_t>(data[entryPos + 33]) << 48) |
- (static_cast<uint64_t>(data[entryPos + 34]) << 40) |
- (static_cast<uint64_t>(data[entryPos + 35]) << 32) |
- (static_cast<uint64_t>(data[entryPos + 36]) << 24) |
- (static_cast<uint64_t>(data[entryPos + 37]) << 16) |
- (static_cast<uint64_t>(data[entryPos + 38]) << 8) |
- (static_cast<uint64_t>(data[entryPos + 39]));
- outTrophies[tid] = {tid, grade, state, ts};
- }
- return true;
- }
+ for (size_t at = findRecord(s, sSize, 0x800, 0x50); at != 0; at = findRecord(s, sSize, 0x800, 0x50, at + 0x60)) {
+ uint32_t tid = readBe32(s + at + 0x10);
+ uint32_t flags = readBe32(s + at + 0x14);
+ uint64_t ts = readBe64(s + at + 0x20);
+ uint32_t state = (flags == 0x11 && ts != 0) ? 1 : 0;
+ outTrophies[tid] = {tid, 0, state, ts};
}
- return false;
+ return !outTrophies.empty();
}
@@ -277,8 +423,13 @@ bool buildUcp(const TitleTrophySet& set, std::vector<uint8_t>& outUcp, std::vect
json::Value tropMetaEn = json::Value::array();
json::Value platMetaEn = json::Value::object();
platMetaEn.set("id", "0000");
- platMetaEn.set("name", "Platinum: " + set.titleName);
- platMetaEn.set("detail", "Earn all trophies");
+ if (set.npCommId == "NPWR20561_00") {
+ platMetaEn.set("name", "Hero of the Storm");
+ platMetaEn.set("detail", "Earn all other Fortnite trophies.");
+ } else {
+ platMetaEn.set("name", "Platinum: " + set.titleName);
+ platMetaEn.set("detail", "Earn all trophies");
+ }
tropMetaEn.push(std::move(platMetaEn));
for (const auto& item : set.items) {
@@ -308,8 +459,13 @@ bool buildUcp(const TitleTrophySet& set, std::vector<uint8_t>& outUcp, std::vect
json::Value tropMetaPt = json::Value::array();
json::Value platMetaPt = json::Value::object();
platMetaPt.set("id", "0000");
- platMetaPt.set("name", "Platina: " + set.titleName);
- platMetaPt.set("detail", "Obtenha todos os troféus");
+ if (set.npCommId == "NPWR20561_00") {
+ platMetaPt.set("name", "Herói da Tempestade");
+ platMetaPt.set("detail", "Obtenha todos os outros troféus do Fortnite.");
+ } else {
+ platMetaPt.set("name", "Platina: " + set.titleName);
+ platMetaPt.set("detail", "Obtenha todos os troféus");
+ }
tropMetaPt.push(std::move(platMetaPt));
for (const auto& item : set.items) {
@@ -328,23 +484,98 @@ bool buildUcp(const TitleTrophySet& set, std::vector<uint8_t>& outUcp, std::vect
// 4. Collect file entries
struct Entry {
std::string name;
- const uint8_t* data;
- size_t size;
+ const uint8_t* data = nullptr;
+ size_t size = 0;
+ std::vector<uint8_t> owned;
};
std::vector<Entry> fileEntries;
- fileEntries.push_back({"icon0_en-US.png", kDefaultIconPng, sizeof(kDefaultIconPng)});
- fileEntries.push_back({"trop0000.png", kDefaultTropPng, sizeof(kDefaultTropPng)});
+ auto addEntry = [&](const std::string& name, std::vector<uint8_t>&& owned, const uint8_t* defData, size_t defSize) {
+ Entry e;
+ e.name = name;
+ if (!owned.empty()) {
+ e.owned = std::move(owned);
+ e.data = e.owned.data();
+ e.size = e.owned.size();
+ } else {
+ e.data = defData;
+ e.size = defSize;
+ }
+ fileEntries.push_back(std::move(e));
+ };
+ // Load game icon (icon0_en-US.png)
+ std::vector<uint8_t> icon0Png;
+ std::string candidatePaths[] = {
+ platform::dataDir() + "/trophies/icons/" + set.npCommId + "/icon0.png",
+ "/data/psbox/trophies/icons/" + set.npCommId + "/icon0.png",
+ "/system_data/priv/appmeta/" + set.sonyTitleId + "/icon0.png",
+ "/user/appmeta/" + set.sonyTitleId + "/icon0.png",
+ "/user/app/" + set.sonyTitleId + "/sce_sys/icon0.png"
+ };
+ for (const auto& path : candidatePaths) {
+ std::string raw;
+ if (platform::readFile(path, raw) && raw.size() > 100) {
+ const auto* udata = reinterpret_cast<const uint8_t*>(raw.data());
+ if (is512x512Png(udata, raw.size())) {
+ icon0Png.assign(udata, udata + raw.size());
+ break;
+ } else if (convertTo512Png(udata, raw.size(), icon0Png)) {
+ std::string cacheFile = platform::dataDir() + "/trophies/icons/" + set.npCommId + "/icon0.png";
+ platform::writeFileAtomic(cacheFile, std::string(reinterpret_cast<const char*>(icon0Png.data()), icon0Png.size()));
+ break;
+ }
+ }
+ }
+ addEntry("icon0_en-US.png", std::move(icon0Png), kDefaultIconPng, sizeof(kDefaultIconPng));
+
+ // Load trop0000.png (Platinum)
+ std::vector<uint8_t> trop0000Png;
+ std::string platCandidatePaths[] = {
+ platform::dataDir() + "/trophies/icons/" + set.npCommId + "/trop0000.png",
+ "/data/psbox/trophies/icons/" + set.npCommId + "/trop0000.png"
+ };
+ for (const auto& path : platCandidatePaths) {
+ std::string raw;
+ if (platform::readFile(path, raw) && raw.size() > 100) {
+ const auto* udata = reinterpret_cast<const uint8_t*>(raw.data());
+ if (is512x512Png(udata, raw.size())) {
+ trop0000Png.assign(udata, udata + raw.size());
+ break;
+ } else if (convertTo512Png(udata, raw.size(), trop0000Png)) {
+ break;
+ }
+ }
+ }
+ addEntry("trop0000.png", std::move(trop0000Png), kDefaultTropPng, sizeof(kDefaultTropPng));
+
+ // Load trop%04d.png for each trophy
for (const auto& item : set.items) {
char nameBuf[32];
snprintf(nameBuf, sizeof(nameBuf), "trop%04d.png", item.trophyId);
- fileEntries.push_back({nameBuf, kDefaultTropPng, sizeof(kDefaultTropPng)});
+ std::vector<uint8_t> tropPng;
+ std::string itemPaths[] = {
+ platform::dataDir() + "/trophies/icons/" + set.npCommId + "/" + nameBuf,
+ "/data/psbox/trophies/icons/" + set.npCommId + "/" + nameBuf
+ };
+ for (const auto& path : itemPaths) {
+ std::string raw;
+ if (platform::readFile(path, raw) && raw.size() > 100) {
+ const auto* udata = reinterpret_cast<const uint8_t*>(raw.data());
+ if (is512x512Png(udata, raw.size())) {
+ tropPng.assign(udata, udata + raw.size());
+ break;
+ } else if (convertTo512Png(udata, raw.size(), tropPng)) {
+ break;
+ }
+ }
+ }
+ addEntry(nameBuf, std::move(tropPng), kDefaultTropPng, sizeof(kDefaultTropPng));
}
- fileEntries.push_back({"tropconf.json", reinterpret_cast<const uint8_t*>(tropconfStr.data()), tropconfStr.size()});
- fileEntries.push_back({"tropmeta_en-US.json", reinterpret_cast<const uint8_t*>(tropmetaEnStr.data()), tropmetaEnStr.size()});
- fileEntries.push_back({"tropmeta_pt-BR.json", reinterpret_cast<const uint8_t*>(tropmetaPtStr.data()), tropmetaPtStr.size()});
+ addEntry("tropconf.json", {}, reinterpret_cast<const uint8_t*>(tropconfStr.data()), tropconfStr.size());
+ addEntry("tropmeta_en-US.json", {}, reinterpret_cast<const uint8_t*>(tropmetaEnStr.data()), tropmetaEnStr.size());
+ addEntry("tropmeta_pt-BR.json", {}, reinterpret_cast<const uint8_t*>(tropmetaPtStr.data()), tropmetaPtStr.size());
const uint32_t numFiles = static_cast<uint32_t>(fileEntries.size());
const uint64_t headerSize = 0x60;
@@ -493,30 +724,41 @@ bool buildTrpTitleDat(const TitleTrophySet& set, uint32_t userId, std::vector<ui
outDat.clear();
if (set.npCommId.empty()) return false;
- // Load existing unlocked trophies to preserve them 100% (append-only)
- std::map<uint32_t, ExistingTrophyRecord> existingTrophies;
+ // 1. Gather all unlocked trophies and timestamps
+ std::map<uint32_t, uint64_t> unlockedTimes;
+ for (const auto& item : set.items) {
+ if (item.unlocked) {
+ uint64_t ticks = (static_cast<uint64_t>(std::time(nullptr)) + 62135596800ULL) * 1000000ULL;
+ unlockedTimes[item.trophyId] = ticks;
+ }
+ }
+
+ // Also check existing disk file for previously unlocked trophies (append-only)
+ std::map<uint32_t, ExistingTrophyRecord> diskTrophies;
if (existingDat && !existingDat->empty()) {
- parseTrpTitleDat(existingDat->data(), existingDat->size(), existingTrophies);
+ parseTrpTitleDat(existingDat->data(), existingDat->size(), diskTrophies);
} else {
- char existingPath[256];
- snprintf(existingPath, sizeof(existingPath),
- "/user/home/%08x/trophy2/nobackup/data/%s/TRPTITLE.DAT",
+ char dataPath[256];
+ snprintf(dataPath, sizeof(dataPath), "/user/home/%08x/trophy2/nobackup/data/%s/TRPTITLE.DAT",
userId, set.npCommId.c_str());
- int eFd = ::open(existingPath, O_RDONLY);
- if (eFd >= 0) {
+ int fd = ::open(dataPath, O_RDONLY);
+ if (fd >= 0) {
struct stat st{};
- if (::fstat(eFd, &st) == 0 && st.st_size > 0) {
- std::vector<uint8_t> diskBuf(st.st_size);
- ssize_t n = ::read(eFd, diskBuf.data(), diskBuf.size());
- if (n > 0) {
- parseTrpTitleDat(diskBuf.data(), static_cast<size_t>(n), existingTrophies);
- }
+ if (::fstat(fd, &st) == 0 && st.st_size > 0) {
+ std::vector<uint8_t> dBuf(st.st_size);
+ ssize_t n = ::read(fd, dBuf.data(), dBuf.size());
+ if (n > 0) parseTrpTitleDat(dBuf.data(), static_cast<size_t>(n), diskTrophies);
}
- ::close(eFd);
+ ::close(fd);
+ }
+ }
+ for (const auto& [tid, rec] : diskTrophies) {
+ if (rec.state == 1 && rec.timestamp > 0) {
+ unlockedTimes[tid] = rec.timestamp;
}
}
- // If ucpSha1 is not provided, compute it via buildUcp
+ // 2. Compute or use UCP SHA-1
std::vector<uint8_t> computedSha1;
if (!ucpSha1) {
std::vector<uint8_t> tempUcp;
@@ -525,256 +767,181 @@ bool buildTrpTitleDat(const TitleTrophySet& set, uint32_t userId, std::vector<ui
}
}
- // Total count including Platinum (Trophy 0)
- const uint32_t N = static_cast<uint32_t>(set.items.size() + 1);
-
- const uint32_t TAG1_LEN = 0x30;
- const uint32_t TAG2_LEN = 0x60;
- const uint32_t TAG100_LEN = 0x40;
- const uint32_t TAG300_LEN = 0x480;
- const uint32_t TAG400_LEN = 0x90;
- const uint32_t TAG500_ITEM_LEN = 0xc0;
- const uint32_t TAG600_LEN = 0x1f0;
- const uint32_t TAG700_LEN = 0xb0;
- const uint32_t TAG800_ITEM_LEN = 0x50;
-
- const uint64_t tag1_rel = 0x150;
- const uint64_t tag2_rel = tag1_rel + 0x10 + TAG1_LEN; // 0x190
- const uint64_t tag100_rel = tag2_rel + 0x10 + TAG2_LEN; // 0x200
- const uint64_t tag300_rel = tag100_rel + 0x10 + TAG100_LEN; // 0x250
- const uint64_t tag400_rel = tag300_rel + 0x10 + TAG300_LEN; // 0x6e0
- const uint64_t tag500_rel = tag400_rel + 0x10 + TAG400_LEN; // 0x780
- const uint64_t tag600_rel = tag500_rel + static_cast<uint64_t>(N) * (0x10 + TAG500_ITEM_LEN); // 0x780 + N * 0xd0
- const uint64_t tag700_rel = tag600_rel + 0x10 + TAG600_LEN;
- const uint64_t tag800_rel = tag700_rel + 0x10 + TAG700_LEN;
-
- const uint64_t tag800_end = 0x60 + tag800_rel + static_cast<uint64_t>(N) * (0x10 + TAG800_ITEM_LEN);
- const uint64_t total_size = tag800_end + 0x40; // 0x20 pad + 0x20 signature
-
- outDat.assign(total_size, 0);
- uint8_t* p = outDat.data();
-
- // 1. T2PD Header
- std::memcpy(p + 0x00, "T2PD", 4);
- writeBe32(p + 0x04, 0x00010000);
- writeBe32(p + 0x08, 0);
- writeBe32(p + 0x0c, 0x0420);
- writeBe64(p + 0x20, 9);
-
- // 2. T2TD Header
- std::memcpy(p + 0x40, "T2TD", 4);
- writeBe32(p + 0x44, 0x00010000);
- writeBe32(p + 0x48, 9);
-
- // 3. Descriptors
- struct Desc {
- uint32_t tag;
- uint32_t len;
- uint32_t count;
- uint64_t rel_off;
- };
- Desc descs[9] = {
- {0x0001, TAG1_LEN, 1, tag1_rel},
- {0x0002, TAG2_LEN, 1, tag2_rel},
- {0x0100, TAG100_LEN, 1, tag100_rel},
- {0x0300, TAG300_LEN, 1, tag300_rel},
- {0x0400, TAG400_LEN, 1, tag400_rel},
- {0x0500, TAG500_ITEM_LEN, N, tag500_rel},
- {0x0600, TAG600_LEN, 1, tag600_rel},
- {0x0700, TAG700_LEN, 1, tag700_rel},
- {0x0800, TAG800_ITEM_LEN, N, tag800_rel},
- };
- for (int i = 0; i < 9; ++i) {
- uint8_t* d = p + 0x70 + (i * 32);
- writeBe32(d + 0, descs[i].tag);
- writeBe32(d + 4, descs[i].len);
- writeBe32(d + 8, 1); // unk = 1
- writeBe32(d + 12, descs[i].count);
- writeBe64(d + 16, descs[i].rel_off);
- writeBe64(d + 24, 0);
- }
-
- // 4. Tag 1 at 0x190
- writeBe32(p + 0x190, 0x0001);
- writeBe32(p + 0x194, TAG1_LEN);
- std::memcpy(p + 0x1a0, kTag1PayloadTemplate, sizeof(kTag1PayloadTemplate));
-
- // 5. Tag 2 at 0x1d0
- writeBe32(p + 0x1d0, 0x0002);
- writeBe32(p + 0x1d4, TAG2_LEN);
- std::memcpy(p + 0x1e0, kTag2PayloadTemplate, sizeof(kTag2PayloadTemplate));
- writeBe32(p + 0x1e0 + 0x28, userId);
-
- // 6. Tag 0x0100 at 0x240
- writeBe32(p + 0x240, 0x0100);
- writeBe32(p + 0x244, TAG100_LEN);
- std::memcpy(p + 0x250, kTag100PayloadTemplate, sizeof(kTag100PayloadTemplate));
- if (ucpSha1) {
- std::memcpy(p + 0x250, ucpSha1, 20);
+ // 3. Find template stream (search on-disk first, fallback to embedded)
+ std::vector<uint8_t> tStream;
+ char homeDirBuf[256];
+ snprintf(homeDirBuf, sizeof(homeDirBuf), "/user/home/%08x/trophy2/nobackup/data", userId);
+ DIR* dir = ::opendir(homeDirBuf);
+ if (dir) {
+ struct dirent* ent = nullptr;
+ while ((ent = ::readdir(dir)) != nullptr) {
+ if (std::strncmp(ent->d_name, "NPWR", 4) != 0 || set.npCommId == ent->d_name) continue;
+ char tPath[512];
+ snprintf(tPath, sizeof(tPath), "%s/%s/TRPTITLE.DAT", homeDirBuf, ent->d_name);
+ int tFd = ::open(tPath, O_RDONLY);
+ if (tFd >= 0) {
+ struct stat st{};
+ if (::fstat(tFd, &st) == 0 && st.st_size >= static_cast<off_t>(TRP_HEAD)) {
+ std::vector<uint8_t> tRaw(st.st_size);
+ ssize_t n = ::read(tFd, tRaw.data(), tRaw.size());
+ if (n > 0 && readTrophyStream(tRaw.data(), static_cast<size_t>(n), tStream)) {
+ XC_LOGI("trophy builder: using on-disk template from %s (%zu bytes)", ent->d_name, tStream.size());
+ ::close(tFd);
+ break;
+ }
+ }
+ ::close(tFd);
+ }
+ }
+ ::closedir(dir);
}
- // 7. Tag 0x0300 at 0x290
- writeBe32(p + 0x290, 0x0300);
- writeBe32(p + 0x294, TAG300_LEN);
- std::memcpy(p + 0x2a0, kTag300PayloadTemplate, sizeof(kTag300PayloadTemplate));
- std::memcpy(p + 0x2a0 + 0x000, set.npCommId.c_str(), std::min(set.npCommId.size(), size_t(16)));
- std::memcpy(p + 0x2a0 + 0x0b0, set.npCommId.c_str(), std::min(set.npCommId.size(), size_t(16)));
- writeBe32(p + 0x2a0 + 0xd8, 780785);
+ if (tStream.empty()) {
+ XC_LOGI("trophy builder: using embedded Animal Well template (%zu bytes)", sizeof(kAnimalWellTemplateStream));
+ tStream.assign(kAnimalWellTemplateStream, kAnimalWellTemplateStream + sizeof(kAnimalWellTemplateStream));
+ }
- // Bitmasks for Tag 0x0300
- uint8_t total_mask[32] = {0};
- uint8_t unlocked_mask[32] = {0};
- uint8_t bronze_mask[32] = {0};
- uint8_t silver_mask[32] = {0};
- uint8_t gold_mask[32] = {0};
+ // 4. Build trophy list for target title
+ struct TItem { uint8_t id; uint8_t grade; uint8_t hidden; };
+ std::vector<TItem> trophyItems;
+ trophyItems.push_back({0, 1, 0}); // Platinum
+ for (const auto& item : set.items) {
+ uint8_t g = 4; // default Bronze
+ if (item.grade == TrophyGrade::Platinum) g = 1;
+ else if (item.grade == TrophyGrade::Gold) g = 2;
+ else if (item.grade == TrophyGrade::Silver) g = 3;
+ else if (item.grade == TrophyGrade::Bronze) g = 4;
+ trophyItems.push_back({static_cast<uint8_t>(item.trophyId), g, 0});
+ }
- total_mask[0] |= 1; // Plat
+ const size_t N = trophyItems.size();
+ std::vector<uint8_t> ids(N), grades(N), hidden(N);
+ for (size_t i = 0; i < N; ++i) {
+ ids[i] = trophyItems[i].id;
+ grades[i] = trophyItems[i].grade;
+ hidden[i] = trophyItems[i].hidden;
+ }
- struct FinalTrophyState {
- bool unlocked = false;
- uint64_t timestamp = 0;
- };
- std::vector<FinalTrophyState> finalStates(set.items.size());
- size_t unlockedNonPlatCount = 0;
-
- for (size_t idx = 0; idx < set.items.size(); ++idx) {
- uint32_t tid = static_cast<uint32_t>(idx + 1);
- uint32_t bIdx = tid / 8;
- uint32_t bit = tid % 8;
- if (bIdx < 32) {
- total_mask[bIdx] |= (1 << bit);
- if (set.items[idx].grade == TrophyGrade::Bronze) {
- bronze_mask[bIdx] |= (1 << bit);
- } else if (set.items[idx].grade == TrophyGrade::Silver) {
- silver_mask[bIdx] |= (1 << bit);
- } else if (set.items[idx].grade == TrophyGrade::Gold) {
- gold_mask[bIdx] |= (1 << bit);
- }
+ // 5. Construct progress stream s
+ static const uint32_t kOrder[9] = {0x1, 0x2, 0x100, 0x300, 0x400, 0x500, 0x600, 0x700, 0x800};
+ uint32_t sizes[9], counts[9];
+ size_t offsets[9];
+ for (int i = 0; i < 9; ++i) {
+ if (!dirRecord(tStream.data(), tStream.size(), kOrder[i], &sizes[i], &counts[i], &offsets[i])) {
+ XC_LOGW("trophy builder: template missing tag 0x%x", kOrder[i]);
+ return false;
}
+ }
- bool isUnlocked = false;
- uint64_t trophyTs = 0x00000000ffffffffULL;
-
- auto eIt = existingTrophies.find(tid);
- if (eIt != existingTrophies.end() && eIt->second.state == 1) {
- // 100% PRESERVE existing unlocked state and original timestamp from console!
- isUnlocked = true;
- trophyTs = eIt->second.timestamp;
- } else if (set.items[idx].unlocked) {
- // Newly unlocked from Xbox Live!
- isUnlocked = true;
- uint64_t nowUs = static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(
- std::chrono::system_clock::now().time_since_epoch()).count());
- trophyTs = (nowUs > 0) ? nowUs : (1730400000000000ULL + tid * 1000000ULL);
+ size_t platRec = 0, otherRec = 0;
+ for (uint32_t k = 0; k < counts[5]; ++k) {
+ size_t r = offsets[5] + k * 0xd0;
+ if (readBe32(tStream.data() + r + 0x14) == 1) {
+ if (!platRec) platRec = r;
+ } else {
+ if (!otherRec) otherRec = r;
}
+ }
+ if (!otherRec) return false;
- finalStates[idx] = {isUnlocked, trophyTs};
- if (isUnlocked) {
- unlockedNonPlatCount++;
- if (bIdx < 32) {
- unlocked_mask[bIdx] |= (1 << bit);
- }
+ std::vector<uint8_t> s(TRP_MAX, 0);
+ std::memcpy(s.data(), tStream.data(), 0x190);
+ size_t pos = 0x190;
+
+ size_t at[9];
+ for (int i = 0; i < 9; ++i) {
+ uint32_t c = (i == 5 || i == 8) ? static_cast<uint32_t>(N) : 1;
+ uint8_t* e = s.data() + 0x70 + i * 0x20;
+ writeBe32(e, kOrder[i]);
+ writeBe32(e + 4, sizes[i]);
+ writeBe32(e + 8, 1);
+ writeBe32(e + 12, c);
+ writeBe64(e + 16, pos - 0x40);
+ at[i] = pos;
+ pos += (sizes[i] + 0x10) * c;
+ }
+
+ size_t blocks = (pos - 0x40 + TRP_CHUNK - 1) / TRP_CHUNK;
+ size_t streamSize = 0x40 + blocks * TRP_CHUNK;
+ if (streamSize > TRP_MAX) return false;
+
+ for (int i = 0; i < 5; ++i) {
+ std::memcpy(s.data() + at[i], tStream.data() + offsets[i], sizes[i] + 0x10);
+ }
+ if (ucpSha1) {
+ std::memcpy(s.data() + at[2] + 0x10, ucpSha1, 20);
+ }
+
+ uint8_t* r3 = s.data() + at[3];
+ std::memset(r3 + 0x10, 0, 16);
+ std::memcpy(r3 + 0x10, set.npCommId.c_str(), std::min(set.npCommId.size(), size_t(16)));
+ std::memset(r3 + 0xc0, 0, 16);
+ std::memcpy(r3 + 0xc0, set.npCommId.c_str(), std::min(set.npCommId.size(), size_t(16)));
+ writeBe32(r3 + 0xe8, 1);
+ putMask(r3 + 0x100, ids);
+
+ std::vector<uint8_t> secret;
+ for (size_t i = 0; i < N; ++i) if (hidden[i]) secret.push_back(ids[i]);
+ putMask(r3 + 0x180, secret);
+
+ for (int g = 1; g <= 4; ++g) {
+ std::vector<uint8_t> ofGrade;
+ for (size_t i = 0; i < N; ++i) if (grades[i] == g) ofGrade.push_back(ids[i]);
+ putMask(r3 + 0x200 + (g - 1) * 0x80, ofGrade);
+ }
+
+ putMask(s.data() + at[4] + 0x20, ids);
+
+ std::vector<uint8_t> others;
+ for (size_t i = 0; i < N; ++i) if (grades[i] != 1) others.push_back(ids[i]);
+
+ for (size_t i = 0; i < N; ++i) {
+ uint8_t* r = s.data() + at[5] + i * 0xd0;
+ size_t srcOff = (grades[i] == 1 && platRec) ? platRec : otherRec;
+ std::memcpy(r, tStream.data() + srcOff, 0xd0);
+ writeBe32(r + 0x10, ids[i]);
+ writeBe32(r + 0x14, grades[i]);
+ writeBe32(r + 0x18, hidden[i]);
+ if (grades[i] == 1) putMask(r + 0x50, others);
+ }
+
+ std::memcpy(s.data() + at[6], tStream.data() + offsets[6], 0x200);
+ std::memcpy(s.data() + at[7], tStream.data() + offsets[7], 0xc0);
+
+ uint8_t* r6 = s.data() + at[6];
+ uint8_t* r7 = s.data() + at[7];
+ std::memset(r6 + 0x80, 0, 16);
+ std::memset(r6 + 0x180, 0, 16);
+ std::memset(r7 + 0x40, 0, 16);
+ std::memset(r6 + 0x40, 0, 8);
+ std::memset(r6 + 0x70, 0, 8);
+ std::memset(r7 + 0x20, 0, 8);
+
+ for (size_t i = 0; i < N; ++i) {
+ uint8_t* r = s.data() + at[8] + i * 0x60;
+ std::memset(r, 0, 0x60);
+ writeBe32(r, 0x800);
+ writeBe32(r + 4, 0x50);
+ writeBe32(r + 0x10, ids[i]);
+ }
+
+ writeBe32(s.data() + 0x24, static_cast<uint32_t>(blocks));
+
+ // 6. Apply unlocks
+ int unlockedCount = 0;
+ for (const auto& [tid, ticks] : unlockedTimes) {
+ if (unlockInStream(s.data(), streamSize, tid, ticks)) {
+ unlockedCount++;
}
}
- // Trophy 0: Platinum
- bool platUnlocked = false;
- uint64_t platTs = 0xffffffffffffffffULL;
- auto pIt = existingTrophies.find(0);
- if (pIt != existingTrophies.end() && pIt->second.state == 1) {
- platUnlocked = true;
- platTs = pIt->second.timestamp;
- } else if (unlockedNonPlatCount == set.items.size() && set.items.size() > 0) {
- platUnlocked = true;
- platTs = static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::microseconds>(
- std::chrono::system_clock::now().time_since_epoch()).count());
- }
-
- if (platUnlocked) {
- unlocked_mask[0] |= 1;
- }
-
- std::memcpy(p + 0x2a0 + 0x0f0, total_mask, 32);
- std::memcpy(p + 0x2a0 + 0x170, unlocked_mask, 32);
- std::memcpy(p + 0x2a0 + 0x290, bronze_mask, 32);
- std::memcpy(p + 0x2a0 + 0x310, silver_mask, 32);
- std::memcpy(p + 0x2a0 + 0x390, gold_mask, 32);
-
- // 8. Tag 0x0400 at 0x740
- writeBe32(p + 0x740, 0x0400);
- writeBe32(p + 0x744, TAG400_LEN);
- std::memcpy(p + 0x750 + 0x10, total_mask, 32);
-
- // 9. Tag 0x0500 at 0x7e0 (N items * 208 bytes)
- const uint64_t base500 = 0x7e0;
- // Trophy 0: Platinum
- writeBe32(p + base500 + 0, 0x0500);
- writeBe32(p + base500 + 4, TAG500_ITEM_LEN);
- writeBe32(p + base500 + 16, 0); // tid = 0
- writeBe32(p + base500 + 20, 1); // grade = 1 (Plat)
- writeBe32(p + base500 + 24, platUnlocked ? 1 : 0);
- writeBe64(p + base500 + 32, platTs);
-
- uint8_t total_mask_no_plat[32];
- std::memcpy(total_mask_no_plat, total_mask, 32);
- total_mask_no_plat[0] &= ~1;
- std::memcpy(p + base500 + 0x50, total_mask_no_plat, 32);
-
- // Trophies 1..N-1
- for (size_t idx = 0; idx < set.items.size(); ++idx) {
- uint32_t tid = static_cast<uint32_t>(idx + 1);
- uint64_t pos = base500 + (static_cast<uint64_t>(tid) * 208);
- const auto& item = set.items[idx];
- const auto& st = finalStates[idx];
- uint32_t gVal = 4;
- if (item.grade == TrophyGrade::Platinum) gVal = 1;
- else if (item.grade == TrophyGrade::Gold) gVal = 2;
- else if (item.grade == TrophyGrade::Silver) gVal = 3;
-
- writeBe32(p + pos + 0, 0x0500);
- writeBe32(p + pos + 4, TAG500_ITEM_LEN);
- writeBe32(p + pos + 16, tid);
- writeBe32(p + pos + 20, gVal);
- writeBe32(p + pos + 24, st.unlocked ? 1 : 0);
- writeBe64(p + pos + 32, st.timestamp);
-
- // Template flags
- writeBe32(p + pos + 16 + 0x20, 6);
- writeBe32(p + pos + 16 + 0x24, 4);
- writeBe32(p + pos + 16 + 0x28, 2);
- writeBe32(p + pos + 16 + 0x2c, 0);
- writeBe32(p + pos + 16 + 0x30, 0x55000000);
- writeBe32(p + pos + 16 + 0x34, 8);
- writeBe32(p + pos + 16 + 0x38, 0);
- writeBe32(p + pos + 16 + 0x3c, 1);
- }
-
- // 10. Tag 0x0600
- uint64_t pos600 = 0x60 + tag600_rel;
- writeBe32(p + pos600 + 0, 0x0600);
- writeBe32(p + pos600 + 4, TAG600_LEN);
- std::memcpy(p + pos600 + 16, kTag600PayloadTemplate, sizeof(kTag600PayloadTemplate));
-
- // 11. Tag 0x0700
- uint64_t pos700 = 0x60 + tag700_rel;
- writeBe32(p + pos700 + 0, 0x0700);
- writeBe32(p + pos700 + 4, TAG700_LEN);
-
- // 12. Tag 0x0800
- uint64_t pos800 = 0x60 + tag800_rel;
- for (uint32_t tid = 0; tid < N; ++tid) {
- uint64_t entryPos = pos800 + (static_cast<uint64_t>(tid) * 96);
- writeBe32(p + entryPos + 0, 0x0800);
- writeBe32(p + entryPos + 4, TAG800_ITEM_LEN);
- writeBe32(p + entryPos + 16, tid);
- }
-
- // 13. Trailer signature
- std::memcpy(p + total_size - 32, kTrailerSignatureTemplate, 32);
-
- XC_LOGI("trophy builder: built TRPTITLE.DAT for %s (%s, user=0x%08x): %zu bytes, %u trophies (%zu unlocked)",
- set.titleName.c_str(), set.npCommId.c_str(), userId, outDat.size(), N,
- unlockedNonPlatCount + (platUnlocked ? 1 : 0));
+ // 7. Pack into finalized disk file with SHA-256 blocks
+ if (!writeTrophyFile(s.data(), streamSize, outDat)) {
+ return false;
+ }
+
+ XC_LOGI("trophy builder: built valid TRPTITLE.DAT for %s (%s, user=0x%08x): %zu bytes, %zu trophies (%d unlocked)",
+ set.titleName.c_str(), set.npCommId.c_str(), userId, outDat.size(), N, unlockedCount);
return true;
}
@@ -872,18 +1039,31 @@ bool deployTrophyPack(const TitleTrophySet& set, uint32_t userId) {
writeRawFile(dataDir + "/TRPTITLE.DAT", datBytes.data(), datBytes.size());
}
- // 3. Target appmeta dirs for homebrew runner
- const std::string appMetaDirs[] = {
- "/system_data/priv/appmeta/PPSA99810/trophy2",
- "/user/appmeta/PPSA99810/trophy2",
- "/user/app/PPSA99810/sce_sys/trophy2",
- "/data/homebrew/PPSA99810/sce_sys/trophy2"
- };
+ // 3. Target appmeta dirs for homebrew runner (only if verifying PSBox's own title)
+ if (set.sonyTitleId == "PPSA99810") {
+ const std::string appMetaDirs[] = {
+ "/system_data/priv/appmeta/PPSA99810/trophy2",
+ "/user/appmeta/PPSA99810/trophy2",
+ "/user/app/PPSA99810/sce_sys/trophy2",
+ "/data/homebrew/PPSA99810/sce_sys/trophy2"
+ };
+
+ for (const auto& dir : appMetaDirs) {
+ ensureDir(dir);
+ writeRawFile(dir + "/trophy00.ucp", ucpBytes.data(), ucpBytes.size());
+ writeRawFile(dir + "/npbind.dat", npBindBytes.data(), npBindBytes.size());
+ }
+
+ // Canonical bare npbind.dat for PPSA99810
+ writeRawFile("/system_data/priv/appmeta/PPSA99810/npbind.dat", npBindBytes.data(), npBindBytes.size());
+ writeRawFile("/user/appmeta/PPSA99810/npbind.dat", npBindBytes.data(), npBindBytes.size());
- for (const auto& dir : appMetaDirs) {
- ensureDir(dir);
- writeRawFile(dir + "/trophy00.ucp", ucpBytes.data(), ucpBytes.size());
- writeRawFile(dir + "/npbind.dat", npBindBytes.data(), npBindBytes.size());
+ // Cronos /system_data/game/temp dirs for PPSA99810 (PS5 10.00+ and 13.60)
+ ensureDir("/system_data/game/temp/PPSA99810");
+ ensureDir("/system_data/game/temp/PPSA99810/trophy2");
+ writeRawFile("/system_data/game/temp/PPSA99810/npbind.dat", npBindBytes.data(), npBindBytes.size());
+ writeRawFile("/system_data/game/temp/PPSA99810/trophy2/npbind.dat", npBindBytes.data(), npBindBytes.size());
+ writeRawFile("/system_data/game/temp/PPSA99810/trophy2/trophy00.ucp", ucpBytes.data(), ucpBytes.size());
}
// 4. Game Title appmeta dirs (PPSA01922 and set.sonyTitleId)
@@ -930,6 +1110,9 @@ bool deployTrophyPack(const TitleTrophySet& set, uint32_t userId) {
writeRawFile(iconPath, kDefaultIconPng, sizeof(kDefaultIconPng));
}
}
+ // Canonical bare npbind.dat (legacy path)
+ writeRawFile(d + "/npbind.dat", npBindBytes.data(), npBindBytes.size());
+
// trophy2 subdirectory: trophy00.ucp and npbind.dat
std::string t2 = d + "/trophy2";
ensureDir(t2);
@@ -942,6 +1125,13 @@ bool deployTrophyPack(const TitleTrophySet& set, uint32_t userId) {
writeRawFile(uds + "/uds00.ucp", udsBytes.data(), udsBytes.size());
writeRawFile(uds + "/npbind.dat", npBindBytes.data(), npBindBytes.size());
}
+
+ // Cronos /system_data/game/temp dirs for this title (PS5 10.00+ and 13.60)
+ ensureDir("/system_data/game/temp/" + tid);
+ ensureDir("/system_data/game/temp/" + tid + "/trophy2");
+ writeRawFile("/system_data/game/temp/" + tid + "/npbind.dat", npBindBytes.data(), npBindBytes.size());
+ writeRawFile("/system_data/game/temp/" + tid + "/trophy2/npbind.dat", npBindBytes.data(), npBindBytes.size());
+ writeRawFile("/system_data/game/temp/" + tid + "/trophy2/trophy00.ucp", ucpBytes.data(), ucpBytes.size());
}
// 5. UDS conf dir: /user/np_uds/nobackup/conf/<NPWR>/uds.ucp
diff --git a/src/trophy/trophy_builder.h b/src/trophy/trophy_builder.h
index 12e7c65..20ce376 100644
--- a/src/trophy/trophy_builder.h
+++ b/src/trophy/trophy_builder.h
@@ -20,6 +20,12 @@ struct ExistingTrophyRecord {
// Parses a TRPTITLE.DAT buffer to extract existing trophy unlock records and timestamps.
bool parseTrpTitleDat(const uint8_t* data, size_t size, std::map<uint32_t, ExistingTrophyRecord>& outTrophies);
+// Returns true if rawData contains a valid PNG signature with 512x512 dimensions.
+bool is512x512Png(const uint8_t* data, size_t size);
+
+// Center-crops and resizes raw image data (JPEG or PNG) to a 512x512 RGBA PNG buffer.
+bool convertTo512Png(const uint8_t* rawData, size_t rawSize, std::vector<uint8_t>& outPng);
+
// Builds an nptitle.dat file (160 bytes) for the given titleId.
bool buildNpTitleDat(const std::string& titleId, std::vector<uint8_t>& outNpTitle);
diff --git a/src/trophy/trophy_registry.cpp b/src/trophy/trophy_registry.cpp
index 7527494..e612e76 100644
--- a/src/trophy/trophy_registry.cpp
+++ b/src/trophy/trophy_registry.cpp
@@ -67,14 +67,89 @@ std::string generateSonyTitleId(const std::string& xboxTitleId) {
std::string normalizeTrophyName(const std::string& name) {
std::string out;
out.reserve(name.size());
- for (char c : name) {
- if (std::isalnum(static_cast<unsigned char>(c))) {
- out.push_back(static_cast<char>(std::tolower(static_cast<unsigned char>(c))));
+ for (size_t i = 0; i < name.size(); ++i) {
+ unsigned char c = static_cast<unsigned char>(name[i]);
+ if (c == 0xc3 && i + 1 < name.size()) {
+ unsigned char c2 = static_cast<unsigned char>(name[i + 1]);
+ // Latin-1 Supplement in UTF-8: fold accented vowels and c-cedilla
+ if ((c2 >= 0xa0 && c2 <= 0xa5) || (c2 >= 0x80 && c2 <= 0x85)) { out.push_back('a'); ++i; continue; }
+ if ((c2 >= 0xa8 && c2 <= 0xab) || (c2 >= 0x88 && c2 <= 0x8b)) { out.push_back('e'); ++i; continue; }
+ if ((c2 >= 0xac && c2 <= 0xaf) || (c2 >= 0x8c && c2 <= 0x8f)) { out.push_back('i'); ++i; continue; }
+ if ((c2 >= 0xb2 && c2 <= 0xb6) || (c2 >= 0x92 && c2 <= 0x96)) { out.push_back('o'); ++i; continue; }
+ if ((c2 >= 0xb9 && c2 <= 0xbc) || (c2 >= 0x99 && c2 <= 0x9c)) { out.push_back('u'); ++i; continue; }
+ if (c2 == 0xa7 || c2 == 0x87) { out.push_back('c'); ++i; continue; }
+ }
+ if (std::isalnum(c)) {
+ out.push_back(static_cast<char>(std::tolower(c)));
}
}
return out;
}
+namespace {
+
+bool isFortniteTitle(const std::string& xboxTitleId, const std::string& productId,
+ const std::string& npCommId, const std::string& titleName) {
+ if (xboxTitleId == "267695549") return true;
+ if (productId == "BT5P2X999VH2") return true;
+ if (npCommId == "NPWR20561_00") return true;
+ std::string n = normalizeTrophyName(titleName);
+ if (n.find("fortnite") != std::string::npos) return true;
+ return false;
+}
+
+TrophyGrade resolveFortniteGrade(int trophyId, const std::string& name, int gamerscore, size_t totalCount) {
+ std::string norm = normalizeTrophyName(name);
+
+ // Official Gold trophies (3)
+ // 1. All Tied Up (Twine Peaks Storm Shield Defense 6) - ID 29
+ // 2. Guardian Angel (Save 10,000 survivors in successful missions) - ID 40
+ // 3. Plays Well with Others (Complete 1,000 "Play With Others" missions) - ID 44
+ if (norm == "alltiedup" || norm == "tudoarrumado" ||
+ norm == "guardianangel" || norm == "anjodaguarda" ||
+ norm == "playswellwithothers" || norm == "jogabememconjunto" ||
+ (totalCount == 45 && (trophyId == 29 || trophyId == 40 || trophyId == 44))) {
+ return TrophyGrade::Gold;
+ }
+
+ // Official Silver trophies (10)
+ // 1. Many Planks (Plankerton main quests) - ID 23
+ // 2. Amped for Expansion (Canny Valley Storm Shield Defense 6) - ID 26
+ // 3. Uncanny! (Canny Valley main quests) - ID 27
+ // 4. Into the Night (Twine Peaks Storm Shield Defense 1) - ID 28
+ // 5. Evil Things with Crazy Teeth (Toxic Treasures - Stage 10) - ID 37
+ // 6. Talented Builder (Build 500,000 structures in successful missions) - ID 38
+ // 7. Go Gnome! (Destroy 100 Garden Gnomes in successful missions) - ID 39
+ // 8. Loot Legend (Loot 300 Treasure Chests in successful missions) - ID 41
+ // 9. World Explorer (Fully explore 1,500 zones in successful missions) - ID 42
+ // 10. Unspeakable Horrors (Kill 20,000 Mist Monsters in successful missions) - ID 43
+ if (norm == "manyplanks" || norm == "plankertonlivre" ||
+ norm == "ampedforexpansion" || norm == "preparadoparaexpandir" ||
+ norm == "uncanny" || norm == "desencana" ||
+ norm == "intothenight" || norm == "pelanoite" ||
+ norm == "evilthingswithcrazyteeth" || norm == "coisasmalvadascomunsdentoes" || norm == "coisasmalvadascomunsdentes" ||
+ norm == "talentedbuilder" || norm == "construtortalentoso" ||
+ norm == "gognome" || norm == "vaignomo" ||
+ norm == "lootlegend" || norm == "lendadosaque" ||
+ norm == "worldexplorer" || norm == "exploradormundial" ||
+ norm == "unspeakablehorrors" || norm == "horroresinenarraveis" || norm == "horroresinenarrveis" ||
+ (totalCount == 45 && (trophyId == 23 || trophyId == 26 || trophyId == 27 || trophyId == 28 ||
+ trophyId == 37 || trophyId == 38 || trophyId == 39 || trophyId == 41 ||
+ trophyId == 42 || trophyId == 43))) {
+ return TrophyGrade::Silver;
+ }
+
+ // When the canonical 45 Fortnite Save the World achievements are present
+ if (totalCount == 45 && trophyId >= 1 && trophyId <= 45) {
+ return TrophyGrade::Bronze;
+ }
+
+ // Fallback to scoreToGrade for synthetic tests or custom inputs
+ return scoreToGrade(gamerscore);
+}
+
+} // namespace
+
TitleTrophySet resolveTitleSet(const std::string& xboxTitleId, const std::string& productId,
const std::string& titleName, const std::vector<xcloud::Achievement>& achievements) {
TitleTrophySet set;
@@ -93,6 +168,8 @@ TitleTrophySet resolveTitleSet(const std::string& xboxTitleId, const std::string
set.sonyTitleId = generateSonyTitleId(seed);
}
+ bool isFortnite = isFortniteTitle(xboxTitleId, productId, set.npCommId, set.titleName);
+
set.items.reserve(achievements.size());
for (size_t i = 0; i < achievements.size(); ++i) {
const auto& ach = achievements[i];
@@ -102,7 +179,11 @@ TitleTrophySet resolveTitleSet(const std::string& xboxTitleId, const std::string
def.description = ach.description.empty() ? ach.lockedDescription : ach.description;
def.iconUrl = ach.iconUrl;
def.gamerscore = ach.gamerscore;
- def.grade = scoreToGrade(ach.gamerscore);
+ if (isFortnite) {
+ def.grade = resolveFortniteGrade(def.trophyId, def.name, ach.gamerscore, achievements.size());
+ } else {
+ def.grade = scoreToGrade(ach.gamerscore);
+ }
def.unlocked = ach.unlocked;
def.timeUnlocked = ach.timeUnlocked;
diff --git a/src/trophy/trophy_sync.cpp b/src/trophy/trophy_sync.cpp
index b4f9d60..44ecfe0 100644
--- a/src/trophy/trophy_sync.cpp
+++ b/src/trophy/trophy_sync.cpp
@@ -1,8 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 RafaelNGP
#include "trophy/trophy_sync.h"
+#include "trophy/trophy_builder.h"
#include "trophy/trophy_registry.h"
#include "trophy/trophy_rules.h"
+#include "net/http.h"
#include "platform/platform.h"
#include "ui/strings.h"
#include "util/json.h"
@@ -88,6 +90,86 @@ bool TrophySyncEngine::syncTitleAchievements(const std::string& xblAuth, const s
// 2. Resolve trophy set mapping
TitleTrophySet titleSet = resolveTitleSet(xboxTitleId, "", titleName, ach.items);
+ // 2b. Cache trophy and game icons on disk
+ std::string iconsBase = trophyCacheDir() + "/icons";
+ ::mkdir(iconsBase.c_str(), 0777);
+ std::string iconsDir = iconsBase + "/" + titleSet.npCommId;
+ ::mkdir(iconsDir.c_str(), 0777);
+
+ std::string icon0File = iconsDir + "/icon0.png";
+ struct stat st0{};
+ if (::stat(icon0File.c_str(), &st0) != 0 || st0.st_size == 0) {
+ std::string candidatePaths[] = {
+ "/system_data/priv/appmeta/" + titleSet.sonyTitleId + "/icon0.png",
+ "/user/appmeta/" + titleSet.sonyTitleId + "/icon0.png",
+ "/user/app/" + titleSet.sonyTitleId + "/sce_sys/icon0.png"
+ };
+ for (const auto& cp : candidatePaths) {
+ std::string raw;
+ if (platform::readFile(cp, raw) && raw.size() > 100) {
+ std::vector<uint8_t> png512;
+ const auto* udata = reinterpret_cast<const uint8_t*>(raw.data());
+ if (is512x512Png(udata, raw.size())) {
+ platform::writeFileAtomic(icon0File, raw);
+ break;
+ } else if (convertTo512Png(udata, raw.size(), png512)) {
+ platform::writeFileAtomic(icon0File, std::string(reinterpret_cast<const char*>(png512.data()), png512.size()));
+ break;
+ }
+ }
+ }
+ }
+
+ // Platinum icon (trop0000.png) for titles with dedicated Platinum like Fortnite
+ std::string platFile = iconsDir + "/trop0000.png";
+ struct stat stPlat{};
+ if (::stat(platFile.c_str(), &stPlat) != 0 || stPlat.st_size == 0 || (st0.st_size > 0 && stPlat.st_size == st0.st_size)) {
+ if (titleSet.npCommId == "NPWR20561_00") {
+ net::Request req;
+ req.method = "GET";
+ req.url = "https://m.exophase.com/psn/awards/l/d41b74.png";
+ auto r = net::perform(req);
+ if (r.ok() && !r.body.empty()) {
+ std::vector<uint8_t> png512;
+ const auto* udata = reinterpret_cast<const uint8_t*>(r.body.data());
+ if (convertTo512Png(udata, r.body.size(), png512)) {
+ platform::writeFileAtomic(platFile, std::string(reinterpret_cast<const char*>(png512.data()), png512.size()));
+ XC_LOGI("trophy sync: cached genuine Platinum icon for %s (%zu bytes)", titleSet.npCommId.c_str(), png512.size());
+ }
+ }
+ }
+ }
+
+ for (size_t i = 0; i < ach.items.size() && i < titleSet.items.size(); ++i) {
+ const auto& a = ach.items[i];
+ const auto& def = titleSet.items[i];
+ if (a.iconUrl.empty()) continue;
+ char nameBuf[32];
+ snprintf(nameBuf, sizeof(nameBuf), "trop%04d.png", def.trophyId);
+ std::string iconFile = iconsDir + "/" + nameBuf;
+ struct stat st{};
+ // Skip only if existing file is valid and not an accidental duplicate of cover art
+ if (::stat(iconFile.c_str(), &st) == 0 && st.st_size > 0 && (st0.st_size == 0 || st.st_size != st0.st_size)) continue;
+
+ std::string fetchUrl = a.iconUrl;
+ if (fetchUrl.find("images-eds-ssl.xboxlive.com") != std::string::npos &&
+ fetchUrl.find("format=") == std::string::npos) {
+ fetchUrl += (fetchUrl.find('?') == std::string::npos) ? "?format=jpg" : "&format=jpg";
+ }
+ net::Request req;
+ req.method = "GET";
+ req.url = fetchUrl;
+ auto r = net::perform(req);
+ if (r.ok() && !r.body.empty()) {
+ std::vector<uint8_t> png512;
+ const auto* udata = reinterpret_cast<const uint8_t*>(r.body.data());
+ if (convertTo512Png(udata, r.body.size(), png512)) {
+ platform::writeFileAtomic(iconFile, std::string(reinterpret_cast<const char*>(png512.data()), png512.size()));
+ XC_LOGI("trophy sync: cached icon %s (%zu bytes)", nameBuf, png512.size());
+ }
+ }
+ }
+
// 3. Load local cache snapshot
std::set<std::string> prevUnlocked;
std::string cacheFile = trophyCachePath(xboxTitleId);
@@ -220,6 +302,10 @@ bool TrophySyncEngine::syncAllAccountTrophies(const std::string& xblAuth, const
std::unordered_set<std::string> seenXboxTitles;
std::vector<std::pair<std::string, std::string>> titlesToSync; // pair<xboxTitleId, titleName>
+ // Always prioritize Fortnite first for focused verification (AGENTS.md §8.1)
+ seenXboxTitles.insert("267695549");
+ titlesToSync.emplace_back("267695549", "Fortnite");
+
// Add titles from owned library, resolving known titles if xboxTitleId is missing
for (const auto& game : ownedGames) {
std::string xid = game.xboxTitleId;
@@ -233,11 +319,6 @@ bool TrophySyncEngine::syncAllAccountTrophies(const std::string& xblAuth, const
}
}
- // Always include Fortnite if not already added
- if (seenXboxTitles.insert("267695549").second) {
- titlesToSync.emplace_back("267695549", "Fortnite");
- }
-
XC_LOGI("trophy back-sync: starting synchronization for %d titles", static_cast<int>(titlesToSync.size()));
for (size_t i = 0; i < titlesToSync.size(); ++i) {
if (cancelCheck && cancelCheck()) {
diff --git a/src/trophy/trptitle_template.inc b/src/trophy/trptitle_template.inc
index 91f9ef1..ea19134 100644
--- a/src/trophy/trptitle_template.inc
+++ b/src/trophy/trptitle_template.inc
@@ -1,27 +1,48 @@
-// Auto-generated Animal Well TRPTITLE.DAT templates
-const uint8_t kTag1PayloadTemplate[48] = {
+// Animal Well (NPWR36759_00) unhashed template stream (9280 bytes)
+// Used when creating a new TRPTITLE.DAT for a game without an existing on-disk template
+const uint8_t kAnimalWellTemplateStream[9280] = {
+ 0x54, 0x32, 0x50, 0x44, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x20,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x54, 0x32, 0x54, 0x44, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x15,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x15,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const uint8_t kTag2PayloadTemplate[96] = {
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x1f, 0x22, 0xc0, 0x29, 0x0f, 0xa9,
0x00, 0xe3, 0x1f, 0x24, 0xd4, 0x18, 0xd5, 0xc0, 0x00, 0xe3, 0x1f, 0x24, 0xb6, 0xc3, 0x2c, 0xca,
0x39, 0x55, 0xb5, 0x60, 0x12, 0xbc, 0x18, 0xbc, 0x1e, 0xa2, 0xf4, 0xda, 0x00, 0x00, 0x00, 0x00,
0xe2, 0x11, 0x80, 0xcb, 0xb5, 0x2a, 0x33, 0xc3, 0xa3, 0xb0, 0x92, 0xc6, 0xd7, 0x9e, 0x30, 0x5f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const uint8_t kTag100PayloadTemplate[64] = {
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0xde, 0xfa, 0x70, 0x18, 0x02, 0x80, 0xd4, 0xc3, 0x09, 0x60, 0xe1, 0x42, 0xad, 0xf4, 0x06,
0xd4, 0xbb, 0x43, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const uint8_t kTag300PayloadTemplate[1152] = {
+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4e, 0x50, 0x57, 0x52, 0x33, 0x36, 0x37, 0x35, 0x39, 0x5f, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
0xb9, 0xdd, 0xe1, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0a, 0x93, 0x9e,
0xca, 0x4f, 0xe6, 0x12, 0x95, 0xc6, 0xff, 0x69, 0xe4, 0xc3, 0x9a, 0x7b, 0xcf, 0xd4, 0x44, 0x97,
@@ -48,8 +69,6 @@ const uint8_t kTag300PayloadTemplate[1152] = {
0xfc, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x2f, 0x0c, 0xda, 0xb8, 0xf2, 0x32, 0x41, 0x4a, 0x54, 0x41, 0xda, 0x69, 0x7a, 0x16, 0x77, 0xf4,
- 0xae, 0xa2, 0xed, 0x19, 0x2a, 0x43, 0xff, 0x1a, 0x34, 0x6c, 0x64, 0x10, 0x97, 0x56, 0xbb, 0xf2,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -94,15 +113,472 @@ const uint8_t kTag300PayloadTemplate[1152] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const uint8_t kTag600PayloadTemplate[48] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xfe, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe3, 0x1f, 0x22, 0xc0, 0x29, 0x0f, 0x3a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe3, 0x1f, 0x22, 0xdd, 0x73, 0x77, 0x80, 0x00, 0xe3, 0x1f, 0x22, 0xc0, 0x29, 0x0e, 0xeb,
0x00, 0xe3, 0x1f, 0x24, 0xd4, 0x18, 0xd5, 0xc0, 0x00, 0xe3, 0x1f, 0x24, 0xb6, 0xc3, 0x24, 0xd3,
-};
-
-const uint8_t kTrailerSignatureTemplate[32] = {
- 0xdf, 0x73, 0xfa, 0x0c, 0x57, 0xe5, 0x46, 0x5c, 0x61, 0xa9, 0xef, 0xf7, 0x0e, 0x34, 0xdd, 0x13,
- 0x71, 0x04, 0x84, 0x3a, 0x74, 0xaf, 0x69, 0xbf, 0x65, 0x55, 0x4a, 0x4f, 0x93, 0xf4, 0xfc, 0xdc,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index f7958f5..65655f4 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -6898,6 +6898,78 @@ static void testTrophySystem() {
std::string genericParam = buildParamJson("PPSA12345", "Custom Game");
CHECK(genericParam.find("\"titleId\": \"PPSA12345\"") != std::string::npos);
+
+ // 4d. Full official Fortnite Save the World 45-achievement set mapping
+ std::vector<xcloud::Achievement> fnAchs;
+ for (int i = 1; i <= 45; ++i) {
+ xcloud::Achievement ach;
+ ach.id = std::to_string(i);
+ ach.name = "Fortnite Achievement " + std::to_string(i);
+ ach.gamerscore = (i == 29 || i == 40 || i == 44) ? 50 : 20;
+ fnAchs.push_back(ach);
+ }
+ fnAchs[28].name = "All Tied Up"; // ID 29 (0-indexed 28)
+ fnAchs[39].name = "Anjo da Guarda"; // ID 40 (0-indexed 39)
+ fnAchs[43].name = "Plays Well with Others"; // ID 44 (0-indexed 43)
+ fnAchs[22].name = "Plankerton livre"; // ID 23
+ fnAchs[25].name = "Amped for Expansion"; // ID 26
+ fnAchs[26].name = "Desencana!"; // ID 27
+ fnAchs[27].name = "Into the Night"; // ID 28
+ fnAchs[36].name = "Coisas malvadas com uns dentões"; // ID 37
+ fnAchs[37].name = "Talented Builder"; // ID 38
+ fnAchs[38].name = "Vai Gnomo!"; // ID 39
+ fnAchs[40].name = "Loot Legend"; // ID 41
+ fnAchs[41].name = "World Explorer"; // ID 42
+ fnAchs[42].name = "Horrores Inenarráveis"; // ID 43
+
+ TitleTrophySet fnSet = resolveTitleSet("267695549", "BT5P2X999VH2", "Fortnite", fnAchs);
+ CHECK(fnSet.npCommId == "NPWR20561_00");
+ CHECK(fnSet.totalCount == 45);
+ int goldCount = 0, silverCount = 0, bronzeCount = 0;
+ for (const auto& item : fnSet.items) {
+ if (item.grade == TrophyGrade::Gold) goldCount++;
+ else if (item.grade == TrophyGrade::Silver) silverCount++;
+ else if (item.grade == TrophyGrade::Bronze) bronzeCount++;
+ }
+ CHECK(goldCount == 3);
+ CHECK(silverCount == 10);
+ CHECK(bronzeCount == 32);
+
+ // Test UTF-8 Portuguese accent folding in normalizeTrophyName
+ CHECK(normalizeTrophyName("Coisas malvadas com uns dent\u00f5es") == "coisasmalvadascomunsdentoes");
+ CHECK(normalizeTrophyName("Horrores Inenarr\u00e1veis") == "horroresinenarraveis");
+ CHECK(normalizeTrophyName("Vai, Gnomo!") == "vaignomo");
+
+ // Test single-item Fortnite grade resolution by ID and by name (regardless of totalCount)
+ std::vector<xcloud::Achievement> singleAch;
+ xcloud::Achievement ach29;
+ ach29.id = "29";
+ ach29.name = "Coisas malvadas com uns dent\u00f5es"; // Silver
+ ach29.gamerscore = 20;
+ singleAch.push_back(ach29);
+ TitleTrophySet singleSet = resolveTitleSet("267695549", "BT5P2X999VH2", "Fortnite", singleAch);
+ CHECK(singleSet.items.size() == 1);
+ CHECK(singleSet.items[0].grade == TrophyGrade::Silver);
+
+ // Verify UCP builds with Platinum metadata
+ std::vector<uint8_t> fnUcp;
+ CHECK(buildUcp(fnSet, fnUcp));
+ std::string ucpStr(reinterpret_cast<const char*>(fnUcp.data()), fnUcp.size());
+ CHECK(ucpStr.find("Hero of the Storm") != std::string::npos);
+ CHECK(ucpStr.find("Her\u00f3i da Tempestade") != std::string::npos);
+
+ // Test convertTo512Png helper with a minimal valid 1x1 PNG
+ static const uint8_t kTinyPng[67] = {
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x15, 0xc4,
+ 0x89, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x00, 0x01, 0x00, 0x00,
+ 0x05, 0x00, 0x01, 0x0d, 0x0a, 0x2d, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
+ 0x42, 0x60, 0x82
+ };
+ CHECK(!is512x512Png(kTinyPng, sizeof(kTinyPng)));
+ std::vector<uint8_t> dummyPng;
+ CHECK(convertTo512Png(kTinyPng, sizeof(kTinyPng), dummyPng));
+ CHECK(is512x512Png(dummyPng.data(), dummyPng.size()));
CHECK(genericParam.find("\"contentId\": \"UP0001-PPSA12345_00-0000000000000000\"") != std::string::npos);
CHECK(genericParam.find("\"titleName\": \"Custom Game\"") != std::string::npos);
diff --git a/tools/ps5/payload_patch_test/main.c b/tools/ps5/payload_patch_test/main.c
index 1b1e43c..4ae196a 100644
--- a/tools/ps5/payload_patch_test/main.c
+++ b/tools/ps5/payload_patch_test/main.c
@@ -98,7 +98,116 @@ static void apply_patch(pid_t pid, intptr_t addr, const unsigned char *patch, co
name, addr, verify[0], verify[1], verify[2], verify[3], verify[4], verify[5]);
}
+static void patch_client_trophy_module(pid_t pid) {
+ if (pid <= 0) return;
+ intptr_t trophy_base = 0;
+ uint32_t handle = 0;
+ if (kernel_dynlib_handle(pid, "libSceNpTrophy2.sprx", &handle) == 0 && handle > 0) {
+ trophy_base = kernel_dynlib_mapbase_addr(pid, handle);
+ klog_printf("[TROPHY_PATCH] kernel_dynlib_handle found libSceNpTrophy2.sprx handle=%u base=0x%lx\n", handle, trophy_base);
+ }
+ if (trophy_base == 0) {
+ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, pid};
+ size_t size = 0;
+ if (sysctl(mib, 4, NULL, &size, NULL, 0) == 0 && size > 0) {
+ char *buf = malloc(size);
+ if (buf && sysctl(mib, 4, buf, &size, NULL, 0) == 0) {
+ for (char *p = buf; p < buf + size; ) {
+ struct kinfo_vmentry *kve = (struct kinfo_vmentry*)p;
+ if (kve->kve_structsize <= 0) break;
+ p += kve->kve_structsize;
+ if (kve->kve_protection & 4) {
+ if (strstr(kve->kve_path, "libSceNpTrophy2") != NULL) {
+ trophy_base = kve->kve_start;
+ break;
+ }
+ // Signature fallback check (0x6d90 in libSceNpTrophy2 text segment)
+ unsigned char sig[8] = {0};
+ if (kernel_proc_copyout(pid, kve->kve_start + 0x6d90, sig, sizeof(sig)) == 0) {
+ const unsigned char expected_sig[8] = {0x83, 0x7f, 0x30, 0x00, 0x0f, 0x94, 0xc0, 0xc3};
+ const unsigned char patched_sig[8] = {0xb0, 0x01, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90};
+ if (memcmp(sig, expected_sig, 8) == 0 || memcmp(sig, patched_sig, 8) == 0) {
+ trophy_base = kve->kve_start;
+ break;
+ }
+ }
+ }
+ }
+ }
+ free(buf);
+ }
+ }
+ if (trophy_base == 0) {
+ klog_printf("[TROPHY_PATCH] libSceNpTrophy2.sprx not found in PID %d vmmap yet\n", pid);
+ return;
+ }
+ klog_printf("[TROPHY_PATCH] Found libSceNpTrophy2.sprx in PID %d at 0x%lx\n", pid, trophy_base);
+
+ // Patch 0x6d90: 83 7f 30 00 0f 94 c0 c3 -> b0 01 c3 90 90 90 90 90 (mov al, 1; ret; 5x NOP)
+ const unsigned char orig_6d90[8] = {0x83, 0x7f, 0x30, 0x00, 0x0f, 0x94, 0xc0, 0xc3};
+ const unsigned char patch_al_one[8] = {0xb0, 0x01, 0xc3, 0x90, 0x90, 0x90, 0x90, 0x90};
+ apply_patch(pid, trophy_base + 0x6d90, patch_al_one, orig_6d90, sizeof(patch_al_one), "Client NpTrophy2 0x6d90 bypass");
+
+ // Patch 0x6da0: 83 7f 30 01 0f 94 c0 c3 -> b0 01 c3 90 90 90 90 90 (mov al, 1; ret; 5x NOP)
+ const unsigned char orig_6da0[8] = {0x83, 0x7f, 0x30, 0x01, 0x0f, 0x94, 0xc0, 0xc3};
+ apply_patch(pid, trophy_base + 0x6da0, patch_al_one, orig_6da0, sizeof(patch_al_one), "Client NpTrophy2 0x6da0 bypass");
+
+ // [B2] Inject NpAsmClient cache in libSceNpManager.sprx (FW 13.60 DAT_01063178)
+ uint32_t npmgr_handle = 0;
+ intptr_t npmgr_base = 0;
+ if (kernel_dynlib_handle(pid, "libSceNpManager.sprx", &npmgr_handle) == 0 && npmgr_handle > 0) {
+ npmgr_base = kernel_dynlib_mapbase_addr(pid, npmgr_handle);
+ }
+ if (npmgr_base > 0) {
+ uint64_t struct_va = 0;
+ kernel_proc_copyout(pid, npmgr_base + 0x63178, &struct_va, sizeof(struct_va));
+ klog_printf("[TROPHY_PATCH] B2 libSceNpManager base=0x%lx struct_va=0x%lx\n", npmgr_base, struct_va);
+ if (struct_va > 0) {
+ char fake_title_id[16] = "PPSA01922_00";
+ uint8_t fake_secret[128];
+ memset(fake_secret, 0x5a, sizeof(fake_secret));
+ uint8_t b1_flag = 1;
+
+ kernel_proc_copyin(pid, fake_title_id, struct_va + 0x14, 16);
+ kernel_proc_copyin(pid, fake_secret, struct_va + 0x24, 128);
+ kernel_proc_copyin(pid, &b1_flag, struct_va + 0xa4, 1);
+ kernel_proc_copyin(pid, &b1_flag, struct_va + 0xa5, 1);
+ kernel_proc_copyin(pid, &b1_flag, struct_va + 0xa6, 1);
+ klog_printf("[TROPHY_PATCH] B2 NpAsmClient injected for PPSA01922_00 (struct_va=0x%lx)\n", struct_va);
+ }
+ }
+}
+
int main(void) {
+ // 1. Immediately unjail eboot.bin from pidfile or process scan
+ FILE* f = fopen("/data/psbox/eboot_pid.txt", "r");
+ if (f) {
+ pid_t eboot_pid = 0;
+ if (fscanf(f, "%d", &eboot_pid) == 1 && eboot_pid > 0) {
+ unjail_pid(eboot_pid);
+ patch_client_trophy_module(eboot_pid);
+ }
+ fclose(f);
+ }
+ pid_t scan_pid = find_process_by_name("eboot.bin");
+ if (scan_pid > 0) {
+ unjail_pid(scan_pid);
+ patch_client_trophy_module(scan_pid);
+ }
+
+ // 2. Trophy directory permissions
+ chmod("/user/trophy2", 0777);
+ chmod("/user/trophy2/nobackup", 0777);
+ chmod("/user/trophy2/nobackup/conf", 0777);
+ chmod("/user/trophy2/nobackup/conf/NPWR20561_00", 0777);
+ chmod("/user/trophy2/nobackup/conf/NPWR20561_00/TROPHY.UCP", 0666);
+
+ chmod("/user/home/1ea2f4da/trophy2", 0777);
+ chmod("/user/home/1ea2f4da/trophy2/nobackup", 0777);
+ chmod("/user/home/1ea2f4da/trophy2/nobackup/data", 0777);
+ chmod("/user/home/1ea2f4da/trophy2/nobackup/data/NPWR20561_00", 0777);
+ chmod("/user/home/1ea2f4da/trophy2/nobackup/data/NPWR20561_00/TRPTITLE.DAT", 0666);
+
pid_t pid = find_process_by_name("SceShellCore");
intptr_t mapbase = get_process_mapbase(pid);
klog_printf("[TROPHY_PATCH] SceShellCore dynamic pid=%d, mapbase=0x%lx\n", pid, mapbase);
@@ -109,82 +218,130 @@ int main(void) {
}
// =====================================================================
- // SceShellCore trophy patches — CLEANED 2026-11-03.
- // From disassembling the live SceShellCore .text (RE workflows): the
- // collection/surfacing path is handler 0xe232e0 -> 0xe1a4c0 -> cache
- // ingest [cache_vtable+0x30]=0xe39310 -> fan-out 0xe34e70 (ShellUI). The
- // unlock subsystem (~0xe65xxx) is separate. REMOVED 7 past-agent patches
- // that targeted off-path / non-trophy / inert / counterproductive code:
- // old #1 0xc3ca78 account/NP gate (errors 0x8055001x), not trophy
- // old #3 0xe32600 wrong ctx-state predicate (==1; ingest uses ==0/==2)
- // old #7 0xe2175b inert null/validity guard (non-null args pass anyway)
- // old #12 0xe17a60 inert serviceLabel validator (we use label 1)
- // old #13 0xbcd5b8 generic app-manager find-by-id, not the trophy service
- // old #14 0xe17b80 inert context-param validator (valid params pass)
- // old #15 0xe4c980 serviceLabel==0 validator; bypass re-allowed label 0
- // (counterproductive vs AGENTS.md 8.3)
- // What remains below is trophy-mechanism only; final trim pends the chosen
- // surfacing approach (in-process funnel vs external service).
+ // SceShellCore trophy patches — VERIFIED 2026-11-04 FW 13.60.
+ // Every single offset below is byte-verified against decrypted FW 13.60
+ // SceShellCore memory dump (sc_text.bin, sc_rodata.bin, sc_data.bin).
// =====================================================================
- // [K1] Trophy config load/init guard (old #2):
- // Address: mapbase + 0xe6b1ff (file offset 0xe6f1ff)
+ // [B1] SceShellCore "AAAA00000" string patches -> "ZZZZZZZZZ" for arbitrary commId acceptance (FW 13.60)
+ const unsigned char aaaa_orig[10] = "AAAA00000";
+ const unsigned char aaaa_patch[10] = "ZZZZZZZZZ";
+ const intptr_t b1_offsets[] = {
+ 0x2070788, 0x2070794, 0x2070ee8, 0x2070ef4, 0x1f32868
+ };
+ for (size_t i = 0; i < sizeof(b1_offsets)/sizeof(b1_offsets[0]); i++) {
+ char name[64];
+ snprintf(name, sizeof(name), "B1 commId slot %zu (0x%lx)", i, b1_offsets[i]);
+ apply_patch(pid, mapbase + b1_offsets[i], aaaa_patch, aaaa_orig, sizeof(aaaa_patch), name);
+ }
+
+ // [B5_LNC] Scan for LncManager::getSceSysDirPath attr gate and patch JZ -> NOP
+ intptr_t b5_lnc_addr = 0;
+ unsigned char scan_buf[4096];
+ for (intptr_t off = 0x1500000; off < 0x1800000; off += 3800) {
+ if (kernel_proc_copyout(pid, mapbase + off, scan_buf, sizeof(scan_buf)) != 0) continue;
+ for (size_t i = 0; i < sizeof(scan_buf) - 16; i++) {
+ if (scan_buf[i] == 0xf6 && scan_buf[i+1] == 0x86 &&
+ ((scan_buf[i+2] == 0xd4 && scan_buf[i+3] == 0x00 && scan_buf[i+4] == 0x00 && scan_buf[i+5] == 0x00 && scan_buf[i+6] == 0x06) ||
+ (scan_buf[i+2] == 0x04 && scan_buf[i+3] == 0x01 && scan_buf[i+4] == 0x00 && scan_buf[i+5] == 0x00 && scan_buf[i+6] == 0x06))) {
+ intptr_t jz_addr = mapbase + off + i + 7;
+ klog_printf("[TROPHY_PATCH] B5_LNC candidate found at mapbase + 0x%lx (jz at 0x%lx): %02x %02x %02x %02x %02x %02x\n",
+ off + i, jz_addr, scan_buf[i+7], scan_buf[i+8], scan_buf[i+9], scan_buf[i+10], scan_buf[i+11], scan_buf[i+12]);
+ b5_lnc_addr = jz_addr;
+ break;
+ }
+ }
+ if (b5_lnc_addr != 0) break;
+ }
+ if (b5_lnc_addr != 0) {
+ unsigned char jz_bytes[6] = {0};
+ kernel_proc_copyout(pid, b5_lnc_addr, jz_bytes, 6);
+ if (jz_bytes[0] == 0x74) {
+ const unsigned char orig_2b[2] = { jz_bytes[0], jz_bytes[1] };
+ const unsigned char p_2nop[2] = { 0x90, 0x90 };
+ apply_patch(pid, b5_lnc_addr, p_2nop, orig_2b, 2, "B5_LNC short JZ bypass");
+ } else if (jz_bytes[0] == 0x0f && jz_bytes[1] == 0x84) {
+ const unsigned char p_6nop[6] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
+ apply_patch(pid, b5_lnc_addr, p_6nop, jz_bytes, 6, "B5_LNC long JZ bypass");
+ }
+ } else {
+ klog_printf("[TROPHY_PATCH] B5_LNC scan completed (not found in 0x1500000..0x1800000)\n");
+ }
+
+ // [B4] SceShellCore app category gate in RegisterContextIpcJob (0xe19d74 on FW 13.60)
+ // Forces calling process category to 2 (Installed Game) and returns 0 (success)
+ const unsigned char b4_orig[28] = {
+ 0x85, 0xc0, 0x0f, 0x88, 0x66, 0x01, 0x00, 0x00,
+ 0x8b, 0x85, 0x1c, 0xfb, 0xff, 0xff,
+ 0x31, 0xdb,
+ 0x83, 0xc0, 0xfc,
+ 0x83, 0xf8, 0xfe,
+ 0x0f, 0x82, 0x54, 0x01, 0x00, 0x00
+ };
+ const unsigned char b4_patch[28] = {
+ 0xc7, 0x85, 0x1c, 0xfb, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, // mov dword ptr [rbp - 0x4e4], 2
+ 0x31, 0xc0, // xor eax, eax
+ 0x31, 0xdb, // xor ebx, ebx
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
+ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 // 14x NOP
+ };
+ apply_patch(pid, mapbase + 0xe19d74, b4_patch, b4_orig, sizeof(b4_patch), "B4 App Category Bypass (0xe19d74)");
+
+ // [K1] Trophy config load/init guard:
+ // Address: mapbase + 0xe6b1ff
// 78 45 (js +0x45) -> 2x NOP
const unsigned char orig_comm_info[] = {0x78, 0x45};
const unsigned char patch_comm_info[] = {0x90, 0x90};
apply_patch(pid, mapbase + 0xe6b1ff, patch_comm_info, orig_comm_info, sizeof(patch_comm_info), "Trophy config load guard (0xe6b1ff)");
- // [K2] Debug-unlock IPC gate (old #4):
- // Address: mapbase + 0xeb4716 (file offset 0xeb8716)
+ // [K2] Debug-unlock IPC gate:
+ // Address: mapbase + 0xeb4716
// 75 36 (jne +0x36) -> 2x NOP
const unsigned char orig_ipc_debug[] = {0x75, 0x36};
const unsigned char patch_ipc_debug[] = {0x90, 0x90};
apply_patch(pid, mapbase + 0xeb4716, patch_ipc_debug, orig_ipc_debug, sizeof(patch_ipc_debug), "Trophy debug IPC gate (0xeb4716)");
- // [K3] Debug/dev status gate a trophy handler checks; keep until the chosen path proves it unneeded.
+ // [K3] Debug/dev status gate:
+ // Address: mapbase + 0xb20050
+ // 55 48 89 e5 53 48 -> mov eax, 1; ret
const unsigned char orig_debug_fn[] = {0x55, 0x48, 0x89, 0xe5, 0x53, 0x48};
const unsigned char patch_debug_fn[] = {0xb8, 0x01, 0x00, 0x00, 0x00, 0xc3};
apply_patch(pid, mapbase + 0xb20050, patch_debug_fn, orig_debug_fn, sizeof(patch_debug_fn), "Trophy debug/dev status gate (0xb20050)");
- // [K4] Unlock reader already-unlocked bitmap test (old #6):
- // Address: mapbase + 0xe5c1b4 (file offset 0xe601b4)
+ // [K4] Unlock reader already-unlocked bitmap test:
+ // Address: mapbase + 0xe5c1b4
// 0f 83 b8 00 00 00 (jae +0xb8) -> 6x NOP
const unsigned char orig_bitmask_check[] = {0x0f, 0x83, 0xb8, 0x00, 0x00, 0x00};
- const unsigned char patch_bitmask_check[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
- apply_patch(pid, mapbase + 0xe5c1b4, patch_bitmask_check, orig_bitmask_check, sizeof(patch_bitmask_check), "Unlock already-unlocked bitmap (0xe5c1b4)");
+ const unsigned char patch_6nop[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
+ const unsigned char patch_2nop[] = {0x90, 0x90};
+ apply_patch(pid, mapbase + 0xe5c1b4, patch_6nop, orig_bitmask_check, sizeof(patch_6nop), "Unlock already-unlocked bitmap (0xe5c1b4)");
- // [K5] Unlock worker group bounds (old #8):
- // Address: mapbase + 0xe65c85 (file offset 0xe69c85)
+ // [K5] Unlock worker group bounds:
+ // Address: mapbase + 0xe65c85
// 0f 83 02 01 00 00 (jae +0x102) -> 6x NOP
const unsigned char orig_bounds1[] = {0x0f, 0x83, 0x02, 0x01, 0x00, 0x00};
- const unsigned char patch_6nop[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
- apply_patch(pid, mapbase + 0xe65c85, patch_6nop, orig_bounds1, sizeof(patch_6nop), "Trophy Pack Group Check Bypass (0xe69c85)");
+ apply_patch(pid, mapbase + 0xe65c85, patch_6nop, orig_bounds1, sizeof(patch_6nop), "Trophy Pack Group Check Bypass (0xe65c85)");
- // 9. Patch Trophy TrophyId Bounds Check (bypasses 0x80553904 check in 0xe69c9d):
- // Address: mapbase + 0xe65c9d (file offset 0xe69c9d)
+ // [K6] Trophy TrophyId Bounds Check:
+ // Address: mapbase + 0xe65c9d
// 0f 83 ea 00 00 00 (jae +0xea) -> 6x NOP
const unsigned char orig_bounds2[] = {0x0f, 0x83, 0xea, 0x00, 0x00, 0x00};
- apply_patch(pid, mapbase + 0xe65c9d, patch_6nop, orig_bounds2, sizeof(patch_6nop), "Trophy Pack TrophyId Check Bypass (0xe69c9d)");
+ apply_patch(pid, mapbase + 0xe65c9d, patch_6nop, orig_bounds2, sizeof(patch_6nop), "Trophy Pack TrophyId Check Bypass (0xe65c9d)");
- // 10. Patch Trophy Group ID Match Check (bypasses 0x80553999 check in 0xe69d35):
- // Address: mapbase + 0xe65d35 (file offset 0xe69d35)
+ // [K7] Trophy Group ID Match Check:
+ // Address: mapbase + 0xe65d35
// 75 56 (jne +0x56) -> 2x NOP
const unsigned char orig_group_match[] = {0x75, 0x56};
- const unsigned char patch_2nop[] = {0x90, 0x90};
- apply_patch(pid, mapbase + 0xe65d35, patch_2nop, orig_group_match, sizeof(patch_2nop), "Trophy Group ID Match Bypass (0xe69d35)");
+ apply_patch(pid, mapbase + 0xe65d35, patch_2nop, orig_group_match, sizeof(patch_2nop), "Trophy Group ID Match Bypass (0xe65d35)");
- // 11. Patch Trophy Entry Size Match Check (bypasses 0x80553999 check in 0xe69d3f):
- // Address: mapbase + 0xe65d3f (file offset 0xe69d3f)
+ // [K8] Trophy Entry Size Match Check:
+ // Address: mapbase + 0xe65d3f
// 75 4c (jne +0x4c) -> 2x NOP
const unsigned char orig_size_match[] = {0x75, 0x4c};
- apply_patch(pid, mapbase + 0xe65d3f, patch_2nop, orig_size_match, sizeof(patch_2nop), "Trophy Entry Size Match Bypass (0xe69d3f)");
-
- // (removed old #12-#15: inert serviceLabel/param validators + the
- // counterproductive serviceLabel==0 bypass — see cleanup header above)
+ apply_patch(pid, mapbase + 0xe65d3f, patch_2nop, orig_size_match, sizeof(patch_2nop), "Trophy Entry Size Match Bypass (0xe65d3f)");
- // [K9] Pack-register precondition 1 (old #16):
- // Address: mapbase + 0xbf5a62 (file offset 0xbf9a62)
- // 80 7d 97 01 b8 5b b7 55 80 0f 85 cd 00 00 00 80 7d 96 00 0f 85 c3 00 00 00 -> jmp +0x17 (eb 17); 23x NOP
+ // [K9] Pack-register precondition 1:
+ // Address: mapbase + 0xbf5a62
const unsigned char orig_pack_check1[] = {
0x80, 0x7d, 0x97, 0x01, 0xb8, 0x5b, 0xb7, 0x55, 0x80, 0x0f, 0x85, 0xcd, 0x00, 0x00, 0x00,
0x80, 0x7d, 0x96, 0x00, 0x0f, 0x85, 0xc3, 0x00, 0x00, 0x00
@@ -193,110 +350,37 @@ int main(void) {
0xeb, 0x17, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90
};
- apply_patch(pid, mapbase + 0xbf5a62, patch_pack_check1, orig_pack_check1, sizeof(patch_pack_check1), "Trophy Pack Check 1 Bypass (0xbf9a62)");
+ apply_patch(pid, mapbase + 0xbf5a62, patch_pack_check1, orig_pack_check1, sizeof(patch_pack_check1), "Trophy Pack Check 1 Bypass (0xbf5a62)");
- // 17. Patch Trophy Context Register Pack Check 2 (bypasses 0x8055b75b in 0xbeb9a5):
- // Address: mapbase + 0xbe79a5 (file offset 0xbeb9a5)
- // 80 7d cf 01 b8 5b b7 55 80 75 56 80 7d ce 00 75 50 -> jmp +0x0f (eb 0f); 15x NOP
+ // [K10] Pack-register precondition 2:
+ // Address: mapbase + 0xbe79a5
const unsigned char orig_pack_check2[] = {
0x80, 0x7d, 0xcf, 0x01, 0xb8, 0x5b, 0xb7, 0x55, 0x80, 0x75, 0x56, 0x80, 0x7d, 0xce, 0x00, 0x75, 0x50
};
const unsigned char patch_pack_check2[] = {
0xeb, 0x0f, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90
};
- apply_patch(pid, mapbase + 0xbe79a5, patch_pack_check2, orig_pack_check2, sizeof(patch_pack_check2), "Trophy Pack Check 2 Bypass (0xbeb9a5)");
+ apply_patch(pid, mapbase + 0xbe79a5, patch_pack_check2, orig_pack_check2, sizeof(patch_pack_check2), "Trophy Pack Check 2 Bypass (0xbe79a5)");
- // [K11] RESTORE the collection ingest/commit function (old #18) @0xe1a4c0.
+ // [K11] RESTORE the collection ingest/commit function prologue @0xe1a4c0.
// This fn IS the surfacing path (0xe232e0 -> here -> cache ingest 0xe39310
- // -> fan-out 0xe34e70 -> ShellUI). A past agent had stubbed it to
- // `xor eax,eax; ret`, disabling the only real surfacing function while
- // doing nothing for the debug-unlock path (which never reaches it). Write
- // the ORIGINAL prologue back so it stays intact. Idempotent: restores when
- // the old stub is present, and reports "already patched" once original.
+ // -> fan-out 0xe34e70 -> ShellUI). Write the ORIGINAL prologue back!
const unsigned char uds_orig[] = {0x55, 0x48, 0x89, 0xe5, 0x41, 0x57}; // real prologue
- const unsigned char uds_stub[] = {0x31, 0xc0, 0xc3, 0x90, 0x90, 0x90}; // the former no-op stub
+ const unsigned char uds_stub[] = {0x31, 0xc0, 0xc3, 0x90, 0x90, 0x90}; // former no-op stub
apply_patch(pid, mapbase + 0xe1a4c0, uds_orig, uds_stub, sizeof(uds_orig), "RESTORE collection-ingest fn (0xe1a4c0)");
- // 19. Patch Trophy Cache Auto-Enumerate Titles Check (bypasses suppression in 0xe2acea):
- // Address: mapbase + 0xe2acef (file offset 0xe2ecef)
+ // [K12] Auto-Enumerate Titles Check:
+ // Address: mapbase + 0xe2acef
// 75 09 (jne +0x09) -> 2x NOP
const unsigned char orig_enum_check[] = {0x75, 0x09};
apply_patch(pid, mapbase + 0xe2acef, patch_2nop, orig_enum_check, sizeof(patch_2nop), "Trophy Auto-Enumerate Titles Bypass (0xe2acef)");
- // Cache Diagnostic: Inspect NpTrophy2CSCache live state
- intptr_t svc_ptr = 0;
- kernel_proc_copyout(pid, mapbase + 0x22269a0, &svc_ptr, sizeof(svc_ptr));
- klog_printf("[TROPHY_DIAG] SceShellCore NpTrophy2Service* at 0x%lx = 0x%lx\n", mapbase + 0x22269a0, svc_ptr);
- if (svc_ptr > 0) {
- intptr_t cache_ptr = 0;
- kernel_proc_copyout(pid, svc_ptr + 0x80, &cache_ptr, sizeof(cache_ptr));
- klog_printf("[TROPHY_DIAG] NpTrophy2CSCache* at 0x%lx+0x80 = 0x%lx\n", svc_ptr, cache_ptr);
- if (cache_ptr > 0) {
- uint32_t state = 0;
- kernel_proc_copyout(pid, cache_ptr + 0x30, &state, sizeof(state));
- uint8_t flags[16] = {0};
- kernel_proc_copyout(pid, cache_ptr + 0x08, flags, sizeof(flags));
- klog_printf("[TROPHY_DIAG] Cache flags: 0xc=%d, 0xd=%d, 0xe=%d, 0x14=%d, state=0x%x\n",
- flags[0x0c - 8], flags[0x0d - 8], flags[0x0e - 8], flags[0x14 - 8], state);
-
- unsigned char cbytes[128] = {0};
- kernel_proc_copyout(pid, cache_ptr, cbytes, sizeof(cbytes));
- klog_printf("[TROPHY_DIAG] Cache raw 00..1f: %016lx %016lx %016lx %016lx\n",
- *(uint64_t*)(cbytes+0), *(uint64_t*)(cbytes+8), *(uint64_t*)(cbytes+16), *(uint64_t*)(cbytes+24));
- klog_printf("[TROPHY_DIAG] Cache raw 20..3f: %016lx %016lx %016lx %016lx\n",
- *(uint64_t*)(cbytes+32), *(uint64_t*)(cbytes+40), *(uint64_t*)(cbytes+48), *(uint64_t*)(cbytes+56));
- klog_printf("[TROPHY_DIAG] Cache raw 40..5f: %016lx %016lx %016lx %016lx\n",
- *(uint64_t*)(cbytes+64), *(uint64_t*)(cbytes+72), *(uint64_t*)(cbytes+80), *(uint64_t*)(cbytes+88));
- klog_printf("[TROPHY_DIAG] Cache raw 60..7f: %016lx %016lx %016lx %016lx\n",
- *(uint64_t*)(cbytes+96), *(uint64_t*)(cbytes+104), *(uint64_t*)(cbytes+112), *(uint64_t*)(cbytes+120));
- }
- }
-
- // Scan SceShellCore heap to verify title presence
- {
- int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, pid};
- size_t size = 0;
- if (sysctl(mib, 4, NULL, &size, NULL, 0) == 0 && size > 0) {
- char *vmbuf = malloc(size);
- if (vmbuf && sysctl(mib, 4, vmbuf, &size, NULL, 0) == 0) {
- int found_aw = 0, found_fn = 0;
- for (char *p = vmbuf; p < vmbuf + size; ) {
- struct kinfo_vmentry *kve = (struct kinfo_vmentry*)p;
- if (kve->kve_structsize <= 0) break;
- p += kve->kve_structsize;
- if ((kve->kve_protection & 3) == 3 && kve->kve_start >= 0x800000000ULL && (kve->kve_end - kve->kve_start) <= 32*1024*1024) {
- size_t seg_sz = kve->kve_end - kve->kve_start;
- char *chunk = malloc(seg_sz);
- if (chunk) {
- if (kernel_proc_copyout(pid, kve->kve_start, chunk, seg_sz) == 0) {
- for (size_t i = 0; i + 12 <= seg_sz; i += 4) {
- if (!found_aw && memcmp(chunk + i, "NPWR36759_00", 12) == 0) {
- found_aw = 1;
- klog_printf("[TROPHY_DIAG] Animal Well (NPWR36759_00) found in SceShellCore heap at 0x%lx\n", kve->kve_start + i);
- }
- if (!found_fn && memcmp(chunk + i, "NPWR20561_00", 12) == 0) {
- found_fn = 1;
- klog_printf("[TROPHY_DIAG] Fortnite (NPWR20561_00) found in SceShellCore heap at 0x%lx\n", kve->kve_start + i);
- unsigned char node[128] = {0};
- kernel_proc_copyout(pid, kve->kve_start + i - 32, node, sizeof(node));
- klog_printf("[TROPHY_DIAG] Node -32..+0: %016lx %016lx %016lx %016lx\n",
- *(uint64_t*)(node+0), *(uint64_t*)(node+8), *(uint64_t*)(node+16), *(uint64_t*)(node+24));
- klog_printf("[TROPHY_DIAG] Node +0..+32: %016lx %016lx %016lx %016lx\n",
- *(uint64_t*)(node+32), *(uint64_t*)(node+40), *(uint64_t*)(node+48), *(uint64_t*)(node+56));
- klog_printf("[TROPHY_DIAG] Node +32..+64: %016lx %016lx %016lx %016lx\n",
- *(uint64_t*)(node+64), *(uint64_t*)(node+72), *(uint64_t*)(node+80), *(uint64_t*)(node+88));
- }
- }
- }
- free(chunk);
- }
- }
- }
- klog_printf("[TROPHY_DIAG] SceShellCore heap scan result: AnimalWell=%d, Fortnite=%d\n", found_aw, found_fn);
- }
- if (vmbuf) free(vmbuf);
- }
- }
+ // [B12] Bypass commId NULL check JZ -> NOP NOP in LoadNpBindDat callers (0xe6a4fa and 0xe6a9ea on FW 13.60)
+ // Fixes RegisterContext error 0x8055391a
+ const unsigned char orig_b12[] = {0x74, 0x6a};
+ const unsigned char patch_b12[] = {0x90, 0x90};
+ apply_patch(pid, mapbase + 0xe6a4fa, patch_b12, orig_b12, sizeof(patch_b12), "B12 commId check bypass (0xe6a4fa)");
+ apply_patch(pid, mapbase + 0xe6a9ea, patch_b12, orig_b12, sizeof(patch_b12), "B12 commId check bypass (0xe6a9ea)");
// Permissions for homebrew trophy dirs
chmod("/user/app", 0777);
@@ -334,21 +418,20 @@ int main(void) {
chmod("/system_data/priv/appmeta/PPSA01922/trophy2/npbind.dat", 0666);
chmod("/system_data/priv/appmeta/PPSA01922/trophy2/trophy00.ucp", 0666);
- // Unjail eboot.bin from pidfile
- FILE* f = fopen("/data/psbox/eboot_pid.txt", "r");
- if (f) {
- pid_t eboot_pid = 0;
- if (fscanf(f, "%d", &eboot_pid) == 1 && eboot_pid > 0) {
- unjail_pid(eboot_pid);
- }
- fclose(f);
- }
-
- // Also search for running eboot.bin if any
- pid_t scan_pid = find_process_by_name("eboot.bin");
- if (scan_pid > 0) {
- unjail_pid(scan_pid);
- }
+ // Cronos /system_data/game/temp dirs (PS5 FW 10.00+ and 13.60)
+ chmod("/system_data/game", 0777);
+ chmod("/system_data/game/temp", 0777);
+ chmod("/system_data/game/temp/PPSA99810", 0777);
+ chmod("/system_data/game/temp/PPSA99810/trophy2", 0777);
+ chmod("/system_data/game/temp/PPSA99810/npbind.dat", 0666);
+ chmod("/system_data/game/temp/PPSA99810/trophy2/npbind.dat", 0666);
+ chmod("/system_data/game/temp/PPSA99810/trophy2/trophy00.ucp", 0666);
+
+ chmod("/system_data/game/temp/PPSA01922", 0777);
+ chmod("/system_data/game/temp/PPSA01922/trophy2", 0777);
+ chmod("/system_data/game/temp/PPSA01922/npbind.dat", 0666);
+ chmod("/system_data/game/temp/PPSA01922/trophy2/npbind.dat", 0666);
+ chmod("/system_data/game/temp/PPSA01922/trophy2/trophy00.ucp", 0666);
return 0;
}
diff --git a/tools/ps5/payload_patch_test/patch_test.elf b/tools/ps5/payload_patch_test/patch_test.elf
index e8456a2..a00bbf9 100755
Binary files a/tools/ps5/payload_patch_test/patch_test.elf and b/tools/ps5/payload_patch_test/patch_test.elf differ
diff --git a/tools/ps5/register_title_db.py b/tools/ps5/register_title_db.py
index 9a5aa74..beace8a 100644
--- a/tools/ps5/register_title_db.py
+++ b/tools/ps5/register_title_db.py
@@ -82,6 +82,7 @@ def register_title_app_db(local_db_path, model_title_id="PPSA22520",
new_row["icon0Info"] = f"/user/app/{target_title_id}/sce_sys/icon0.png"
new_row["pic0Info"] = f"/user/app/{target_title_id}/sce_sys/pic0.png"
new_row["appType"] = 1 # 1 = Game
+ new_row["dispLocation"] = 0 # Keep hidden from Game Library
if new_row.get("AppInfoJson"):
try:
@@ -92,6 +93,7 @@ def register_title_app_db(local_db_path, model_title_id="PPSA22520",
info["CONCEPT_ID"] = target_concept_id
info["APP_TYPE"] = 1
info["ATTRIBUTE3"] = 1835012
+ info["DISPLAYLOCATION"] = 0
info["DEEPLINK_URI"] = f"psgm:play?id={target_title_id}"
info["HUBAPP_URI"] = f"pshome:gamehub?titleId={target_title_id}"
info["_metadata_path"] = f"/system_data/priv/appmeta/{target_title_id}"
@@ -123,6 +125,7 @@ def register_title_app_db(local_db_path, model_title_id="PPSA22520",
info["CONCEPT_ID"] = target_concept_id
info["APP_TYPE"] = 1
info["ATTRIBUTE3"] = 1835012
+ info["DISPLAYLOCATION"] = 0
for k in list(info.keys()):
if k.startswith("TITLE_") and k != "TITLE_ID":
info[k] = target_title_name
@@ -130,10 +133,10 @@ def register_title_app_db(local_db_path, model_title_id="PPSA22520",
except Exception:
pass
if app_json_str:
- c.execute("UPDATE tbl_contentinfo SET appType = 1, titleName = ?, contentId = ?, conceptId = ?, AppInfoJson = ? WHERE titleId = ?",
+ c.execute("UPDATE tbl_contentinfo SET appType = 1, dispLocation = 0, titleName = ?, contentId = ?, conceptId = ?, AppInfoJson = ? WHERE titleId = ?",
(target_title_name, target_content_id, target_concept_id, app_json_str, target_title_id))
else:
- c.execute("UPDATE tbl_contentinfo SET appType = 1, titleName = ?, contentId = ?, conceptId = ? WHERE titleId = ?",
+ c.execute("UPDATE tbl_contentinfo SET appType = 1, dispLocation = 0, titleName = ?, contentId = ?, conceptId = ? WHERE titleId = ?",
(target_title_name, target_content_id, target_concept_id, target_title_id))
# 2. All tbl_iconinfo_* tables
@@ -151,7 +154,7 @@ def register_title_app_db(local_db_path, model_title_id="PPSA22520",
new_row["contentId"] = target_content_id
new_row["conceptId"] = target_concept_id
new_row["localConceptId"] = target_local_concept_id
- new_row["visible"] = 1
+ new_row["visible"] = 0
new_row["installStatus"] = 2
new_row["appDrmType"] = 5
new_row["deeplinkUri"] = f"psgm:play?id={target_title_id}"
@@ -164,7 +167,7 @@ def register_title_app_db(local_db_path, model_title_id="PPSA22520",
print(f"Inserted {target_title_id} into {tbl}")
else:
print(f"{target_title_id} already exists in {tbl}, updating...")
- c.execute(f"UPDATE {tbl} SET conceptId = ?, localConceptId = ?, contentId = ?, titleName = ?, visible = 1, installStatus = 2, appDrmType = 5 WHERE titleId = ?",
+ c.execute(f"UPDATE {tbl} SET conceptId = ?, localConceptId = ?, contentId = ?, titleName = ?, visible = 0, installStatus = 2, appDrmType = 5 WHERE titleId = ?",
(target_concept_id, target_local_concept_id, target_content_id, target_title_name, target_title_id))
# 3. All tbl_concepticoninfo_* tables
@@ -255,6 +258,8 @@ def register_title_appinfo_db(local_db_path, model_title_id="PPSA22520",
(1835012, target_title_id))
c.execute("UPDATE tbl_appinfo SET val = ? WHERE titleId = ? AND key = '_local_concept_id'",
(target_local_concept_id, target_title_id))
+ c.execute("UPDATE tbl_appinfo SET val = 0 WHERE titleId = ? AND key = 'DISPLAYLOCATION'",
+ (target_title_id,))
conn.commit()