Files
SpartanPort/tests/test_page_state.cpp
Felipe Prado 226fb0e969 Refactor(Branding): renamed the project to SpartanPort (#755)
EN-US

- Renamed code, binaries, packaging, CI and docs to SpartanPort, with the SP monogram and the SpartanPort logo
- Renamed only the names in the shadPS4 core and the FSR patch, keeping authors, dates and licenses
- Added scripts/legacy.py, the only place with the former name, kept for three releases
- Added a one-time copy of the game settings, the launcher settings and the Linux data folder from their former names, without overwriting or deleting anything
- Updated the Linux data move to leave the GPU caches (user/cache) and the run views (out/) in the former folder
- Added forwarding of the former GOW3_ variables to SPARTAN_
- Added the launcher under its former names, so the 2.5.0 updater and existing shortcuts keep working
- Added a note to the READMEs that the project was gow3_pc and that 2.5.0 players keep their saves and settings
- Passed the full Python suite (531 tests, 0 failures) and the Windows zip and Linux AppImage CI builds

---

PT-BR

- Renomeados código, executáveis, empacotamento, CI e docs para SpartanPort, com o monograma SP e o logotipo SpartanPort
- Renomeados só os nomes no núcleo do shadPS4 e no patch do FSR, mantendo autores, datas e licenças
- Adicionado o scripts/legacy.py, único lugar com o nome antigo, mantido por três releases
- Adicionada a cópia única das configurações do jogo, das configurações do launcher e da pasta de dados do Linux a partir dos nomes antigos, sem sobrescrever nem apagar nada
- Atualizada a migração da pasta de dados do Linux para deixar os caches da GPU (user/cache) e as pastas de execução (out/) na pasta antiga
- Adicionado o repasse das variáveis GOW3_ antigas para SPARTAN_
- Adicionado o launcher com os nomes antigos, para que o atualizador da 2.5.0 e os atalhos existentes continuem funcionando
- Adicionada aos READMEs a nota de que o projeto era o gow3_pc e de que jogadores da 2.5.0 mantêm saves e configurações
- Aprovadas a suíte Python completa (531 testes, 0 falhas) e as builds de CI do zip do Windows e da AppImage do Linux
2026-10-19 18:18:13 -03:00

33 lines
1.2 KiB
C++

// Regression: a pending readback (read watcher) must deny every access. Read denied with write
// allowed is an invalid protection on Windows and would let the CPU write before the readback.
#include <cassert>
#include "video_core/page_state.h"
using Core::MemoryPermission;
using VideoCore::PageState;
int main() {
PageState state{};
assert(state.Perms() == MemoryPermission::ReadWrite);
state.AddDelta<1, true>();
assert(state.Perms() == MemoryPermission::None);
state.AddDelta<-1, true>();
assert(state.Perms() == MemoryPermission::ReadWrite);
// SPARTAN_STALE_READBACK: a pending copy is a write watcher, so CPU reads stay allowed.
state.AddDelta<1, false>();
assert(state.Perms() == MemoryPermission::Read);
for (int i = 1; i <= 65; ++i) {
assert((state.AddDelta<1, true>() == i));
assert(state.Perms() == MemoryPermission::None);
}
for (int i = 64; i >= 0; --i) {
assert((state.AddDelta<-1, true>() == i));
assert(i == 0 || state.Perms() == MemoryPermission::None);
}
assert(state.Perms() == MemoryPermission::Read);
state.AddDelta<-1, false>();
assert(state.Perms() == MemoryPermission::ReadWrite);
}