mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
332bd81524 | ||
|
|
c986594aa9 | ||
|
|
72c8b8426d |
No files matched your search
@@ -2844,9 +2844,10 @@ static void render_scene(void) {
|
||||
else if (rendered && how == 2) droiddeck_color_frame_shown(hs.color, DROIDDECK_HDR_TONEMAPPED, 0);
|
||||
else if (rendered) hdr_copy = "the HDR composition pass is unavailable on this driver";
|
||||
}
|
||||
if (hdr_route == 0 && vkp_quest_layer_presentation() && !framegen && !cardboard && !cursor_on &&
|
||||
if (hdr_route == 0 && vkp_quest_layer_presentation() && !cardboard && !cursor_on &&
|
||||
!ahb_only) {
|
||||
settle_unwaited();
|
||||
g_framegen_layer = framegen;
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
} else if (hdr_route == 0 || hdr_route == 3) {
|
||||
const int pass_on = fx_on || framegen;
|
||||
|
||||
@@ -3013,15 +3013,24 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
||||
}
|
||||
|
||||
int vkp_render(int scene_w, int scene_h, const struct vkp_draw *draws, int n) {
|
||||
if (vkp_quest_layer_presentation() && !vkp_framegen_active() && !vkp_cardboard_active()) {
|
||||
if (vkp_quest_layer_presentation() && !vkp_cardboard_active()) {
|
||||
vkp_apply_window_request();
|
||||
sc_layer_hide_overlay();
|
||||
if (n > 0) {
|
||||
if (sc_layer_present_pass(draws, n, scene_w, scene_h) != 0) {
|
||||
const int fg = vkp_framegen_active();
|
||||
const int generated = fg
|
||||
? sc_layer_present_generated(draws, n, NULL, scene_w, scene_h, 1, NULL) : 0;
|
||||
const int r = fg ? (generated >= 0 ? 0 : -1)
|
||||
: sc_layer_present_pass(draws, n, scene_w, scene_h);
|
||||
if (r != 0) {
|
||||
static int said;
|
||||
if (!said) { said = 1; droiddeck_log("error", "Quest scene layer unavailable; retaining the previous frame rather than using the corrupt Android swapchain"); }
|
||||
return -1;
|
||||
}
|
||||
if (fg && generated > 0) {
|
||||
static int said;
|
||||
if (!said) { said = 1; droiddeck_log("framegen", "generated frames go on the Quest display layer"); }
|
||||
}
|
||||
} else {
|
||||
sc_layer_hide();
|
||||
}
|
||||
|
||||
@@ -212,7 +212,6 @@ object BattleNetInstall {
|
||||
reason == null -> "exit $code"
|
||||
reason == "client" -> return context.getString(R.string.bnet_dl_client_first)
|
||||
reason == STALLED -> return context.getString(R.string.bnet_dl_stalled)
|
||||
reason == "agent 703" || reason?.contains("(error 703)") == true -> return context.getString(R.string.bnet_dl_folder_access)
|
||||
reason.startsWith("agent ") -> context.getString(R.string.bnet_dl_agent_error, reason.removePrefix("agent "))
|
||||
else -> reason.removePrefix("stopped ")
|
||||
}
|
||||
|
||||
@@ -2658,7 +2658,6 @@
|
||||
<string name="bnet_dl_failed">توقفت أداة التنزيل من Blizzard: %1$s</string>
|
||||
<string name="bnet_dl_stalled">توقفت أداة التنزيل من Blizzard عن التقدم.</string>
|
||||
<string name="bnet_dl_agent_error">خطأ Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">تعذر على Blizzard الوصول إلى مجلد اللعبة (خطأ 703). تحقّق من أذوناته أو اختر مجلدًا مختلفًا.</string>
|
||||
<string name="bnet_update">تحديث</string>
|
||||
<string name="bnet_store">ألعاب Blizzard</string>
|
||||
<string name="stores_resume_install">استئناف التثبيت</string>
|
||||
|
||||
@@ -2650,7 +2650,6 @@
|
||||
<string name="bnet_dl_failed">El descargador de Blizzard se detuvo: %1$s</string>
|
||||
<string name="bnet_dl_stalled">El descargador de Blizzard dejó de avanzar.</string>
|
||||
<string name="bnet_dl_agent_error">Error de Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard no pudo acceder a la carpeta del juego (error 703). Verifica sus permisos o elige otra carpeta.</string>
|
||||
<string name="bnet_update">Actualizar</string>
|
||||
<string name="bnet_store">Juegos de Blizzard</string>
|
||||
<string name="stores_resume_install">Reanudar instalación</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">Програмата за изтегляне на Blizzard спря: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Програмата за изтегляне на Blizzard спря да напредва.</string>
|
||||
<string name="bnet_dl_agent_error">Грешка на Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не успя да получи достъп до папката на играта (грешка 703). Проверете разрешенията ѝ или изберете друга папка.</string>
|
||||
<string name="bnet_update">Актуализиране</string>
|
||||
<string name="bnet_store">Игри на Blizzard</string>
|
||||
<string name="stores_resume_install">Продължи инсталацията</string>
|
||||
|
||||
@@ -2606,7 +2606,6 @@
|
||||
<string name="bnet_dl_failed">Stahovač Blizzardu se zastavil: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Stahovač Blizzardu přestal postupovat.</string>
|
||||
<string name="bnet_dl_agent_error">Chyba Blizzardu %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nemohl získat přístup ke složce hry (chyba 703). Zkontrolujte její oprávnění nebo vyberte jinou složku.</string>
|
||||
<string name="bnet_update">Aktualizovat</string>
|
||||
<string name="bnet_store">Hry od Blizzardu</string>
|
||||
<string name="stores_resume_install">Pokračovat v instalaci</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">Blizzards downloader stoppede: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards downloader holdt op med at gøre fremskridt.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fejl %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kunne ikke få adgang til spilmappen (fejl 703). Kontrollér dens tilladelser, eller vælg en anden mappe.</string>
|
||||
<string name="bnet_update">Opdater</string>
|
||||
<string name="bnet_store">Blizzard-spil</string>
|
||||
<string name="stores_resume_install">Genoptag installation</string>
|
||||
|
||||
@@ -2546,7 +2546,6 @@
|
||||
<string name="bnet_dl_failed">Blizzards Downloader wurde beendet: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards Downloader kommt nicht mehr voran.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-Fehler %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard konnte nicht auf den Spielordner zugreifen (Fehler 703). Prüfe die Berechtigungen oder wähle einen anderen Ordner.</string>
|
||||
<string name="bnet_update">Aktualisieren</string>
|
||||
<string name="bnet_store">Blizzard-Spiele</string>
|
||||
<string name="stores_resume_install">Installation fortsetzen</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">Το πρόγραμμα λήψης της Blizzard σταμάτησε: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Το πρόγραμμα λήψης της Blizzard σταμάτησε να προχωρά.</string>
|
||||
<string name="bnet_dl_agent_error">Σφάλμα Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Το Blizzard δεν μπόρεσε να αποκτήσει πρόσβαση στον φάκελο του παιχνιδιού (σφάλμα 703). Ελέγξτε τα δικαιώματά του ή επιλέξτε διαφορετικό φάκελο.</string>
|
||||
<string name="bnet_update">Ενημέρωση</string>
|
||||
<string name="bnet_store">Παιχνίδια της Blizzard</string>
|
||||
<string name="stores_resume_install">Συνέχιση εγκατάστασης</string>
|
||||
|
||||
@@ -2580,7 +2580,6 @@
|
||||
<string name="bnet_dl_failed">El descargador de Blizzard se ha detenido: %1$s</string>
|
||||
<string name="bnet_dl_stalled">El descargador de Blizzard ha dejado de avanzar.</string>
|
||||
<string name="bnet_dl_agent_error">Error de Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard no pudo acceder a la carpeta del juego (error 703). Comprueba sus permisos o elige otra carpeta.</string>
|
||||
<string name="bnet_update">Actualizar</string>
|
||||
<string name="bnet_store">Juegos de Blizzard</string>
|
||||
<string name="stores_resume_install">Reanudar instalación</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">Blizzardin latausohjelma pysähtyi: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzardin latausohjelma lakkasi etenemästä.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-virhe %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard ei voinut käyttää pelikansiota (virhe 703). Tarkista sen käyttöoikeudet tai valitse toinen kansio.</string>
|
||||
<string name="bnet_update">Päivitä</string>
|
||||
<string name="bnet_store">Blizzardin pelit</string>
|
||||
<string name="stores_resume_install">Jatka asennusta</string>
|
||||
|
||||
@@ -2579,7 +2579,6 @@
|
||||
<string name="bnet_dl_failed">Le téléchargeur de Blizzard s\'est arrêté : %1$s</string>
|
||||
<string name="bnet_dl_stalled">Le téléchargeur de Blizzard n\'avance plus.</string>
|
||||
<string name="bnet_dl_agent_error">Erreur Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard n’a pas pu accéder au dossier du jeu (erreur 703). Vérifiez ses autorisations ou choisissez un autre dossier.</string>
|
||||
<string name="bnet_update">Mettre à jour</string>
|
||||
<string name="bnet_store">Jeux Blizzard</string>
|
||||
<string name="stores_resume_install">Reprendre l\'installation</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">Blizzard का डाउनलोडर रुक गया: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard का डाउनलोडर आगे नहीं बढ़ रहा।</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard त्रुटि %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard गेम फ़ोल्डर तक नहीं पहुँच सका (त्रुटि 703)। इसकी अनुमतियाँ जाँचें या कोई दूसरा फ़ोल्डर चुनें।</string>
|
||||
<string name="bnet_update">अपडेट करें</string>
|
||||
<string name="bnet_store">Blizzard के गेम</string>
|
||||
<string name="stores_resume_install">इंस्टॉल फिर से शुरू करें</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">A Blizzard letöltője leállt: %1$s</string>
|
||||
<string name="bnet_dl_stalled">A Blizzard letöltője nem halad tovább.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-hiba: %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard nem tudott hozzáférni a játékmappához (703-as hiba). Ellenőrizd a jogosultságait, vagy válassz másik mappát.</string>
|
||||
<string name="bnet_update">Frissítés</string>
|
||||
<string name="bnet_store">Blizzard-játékok</string>
|
||||
<string name="stores_resume_install">Telepítés folytatása</string>
|
||||
|
||||
@@ -2529,7 +2529,6 @@
|
||||
<string name="bnet_dl_failed">Pengunduh Blizzard berhenti: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Pengunduh Blizzard berhenti berjalan.</string>
|
||||
<string name="bnet_dl_agent_error">Kesalahan Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard tidak dapat mengakses folder game (kesalahan 703). Periksa izinnya atau pilih folder lain.</string>
|
||||
<string name="bnet_update">Perbarui</string>
|
||||
<string name="bnet_store">Game Blizzard</string>
|
||||
<string name="stores_resume_install">Lanjutkan instalasi</string>
|
||||
|
||||
@@ -2571,7 +2571,6 @@
|
||||
<string name="bnet_dl_failed">Il downloader di Blizzard si è fermato: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Il downloader di Blizzard ha smesso di avanzare.</string>
|
||||
<string name="bnet_dl_agent_error">Errore Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard non è riuscito ad accedere alla cartella del gioco (errore 703). Controlla i permessi o scegli un\'altra cartella.</string>
|
||||
<string name="bnet_update">Aggiorna</string>
|
||||
<string name="bnet_store">Giochi Blizzard</string>
|
||||
<string name="stores_resume_install">Riprendi installazione</string>
|
||||
|
||||
@@ -2529,7 +2529,6 @@
|
||||
<string name="bnet_dl_failed">Blizzard のダウンローダーが停止しました: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard のダウンローダーが進まなくなりました。</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard エラー %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard はゲームフォルダーにアクセスできませんでした(エラー 703)。権限を確認するか、別のフォルダーを選択してください。</string>
|
||||
<string name="bnet_update">アップデート</string>
|
||||
<string name="bnet_store">Blizzard のゲーム</string>
|
||||
<string name="stores_resume_install">インストールを再開</string>
|
||||
|
||||
@@ -2529,7 +2529,6 @@
|
||||
<string name="bnet_dl_failed">Blizzard 다운로더가 중지됨: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard 다운로더가 더 이상 진행되지 않습니다.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard 오류 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard가 게임 폴더에 액세스할 수 없습니다(오류 703). 권한을 확인하거나 다른 폴더를 선택하세요.</string>
|
||||
<string name="bnet_update">업데이트</string>
|
||||
<string name="bnet_store">Blizzard 게임</string>
|
||||
<string name="stores_resume_install">설치 재개</string>
|
||||
|
||||
@@ -2529,7 +2529,6 @@
|
||||
<string name="bnet_dl_failed">Pemuat turun Blizzard berhenti: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Pemuat turun Blizzard berhenti bergerak.</string>
|
||||
<string name="bnet_dl_agent_error">Ralat Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard tidak dapat mengakses folder permainan (ralat 703). Semak kebenarannya atau pilih folder lain.</string>
|
||||
<string name="bnet_update">Kemas kini</string>
|
||||
<string name="bnet_store">Permainan Blizzard</string>
|
||||
<string name="stores_resume_install">Sambung pemasangan</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">Blizzards nedlaster stoppet: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards nedlaster sluttet å gjøre fremgang.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-feil %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard fikk ikke tilgang til spillmappen (feil 703). Sjekk tillatelsene eller velg en annen mappe.</string>
|
||||
<string name="bnet_update">Oppdater</string>
|
||||
<string name="bnet_store">Blizzard-spill</string>
|
||||
<string name="stores_resume_install">Gjenoppta installasjon</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">Blizzards downloader is gestopt: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards downloader maakt geen voortgang meer.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fout %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kon geen toegang krijgen tot de gamemap (fout 703). Controleer de machtigingen of kies een andere map.</string>
|
||||
<string name="bnet_update">Bijwerken</string>
|
||||
<string name="bnet_store">Blizzard-games</string>
|
||||
<string name="stores_resume_install">Installatie hervatten</string>
|
||||
|
||||
@@ -2606,7 +2606,6 @@
|
||||
<string name="bnet_dl_failed">Program pobierający Blizzarda zatrzymał się: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Program pobierający Blizzarda przestał robić postępy.</string>
|
||||
<string name="bnet_dl_agent_error">Błąd Blizzarda %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nie mógł uzyskać dostępu do folderu gry (błąd 703). Sprawdź jego uprawnienia lub wybierz inny folder.</string>
|
||||
<string name="bnet_update">Aktualizuj</string>
|
||||
<string name="bnet_store">Gry Blizzarda</string>
|
||||
<string name="stores_resume_install">Wznów instalację</string>
|
||||
|
||||
@@ -2586,7 +2586,6 @@
|
||||
<string name="bnet_dl_failed">O programa de transferência da Blizzard parou: %1$s</string>
|
||||
<string name="bnet_dl_stalled">O programa de transferência da Blizzard deixou de avançar.</string>
|
||||
<string name="bnet_dl_agent_error">Erro da Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard não conseguiu aceder à pasta do jogo (erro 703). Verifica as permissões ou escolhe outra pasta.</string>
|
||||
<string name="bnet_update">Atualizar</string>
|
||||
<string name="bnet_store">Jogos da Blizzard</string>
|
||||
<string name="stores_resume_install">Retomar instalação</string>
|
||||
|
||||
@@ -2596,7 +2596,6 @@
|
||||
<string name="bnet_dl_failed">O downloader da Blizzard parou: %1$s</string>
|
||||
<string name="bnet_dl_stalled">O downloader da Blizzard parou de avançar.</string>
|
||||
<string name="bnet_dl_agent_error">Erro da Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">A Blizzard não conseguiu acessar a pasta do jogo (erro 703). Verifique as permissões ou escolha outra pasta.</string>
|
||||
<string name="bnet_update">Atualizar</string>
|
||||
<string name="bnet_store">Jogos da Blizzard</string>
|
||||
<string name="stores_resume_install">Retomar instalação</string>
|
||||
|
||||
@@ -2580,7 +2580,6 @@
|
||||
<string name="bnet_dl_failed">Programul de descărcare Blizzard s-a oprit: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Programul de descărcare Blizzard nu mai avansează.</string>
|
||||
<string name="bnet_dl_agent_error">Eroare Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard nu a putut accesa folderul jocului (eroare 703). Verifică permisiunile acestuia sau alege un alt folder.</string>
|
||||
<string name="bnet_update">Actualizează</string>
|
||||
<string name="bnet_store">Jocuri Blizzard</string>
|
||||
<string name="stores_resume_install">Reia instalarea</string>
|
||||
|
||||
@@ -2607,7 +2607,6 @@
|
||||
<string name="bnet_dl_failed">Загрузчик Blizzard остановился: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Загрузчик Blizzard перестал продвигаться.</string>
|
||||
<string name="bnet_dl_agent_error">Ошибка Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не удалось получить доступ к папке игры (ошибка 703). Проверьте права доступа или выберите другую папку.</string>
|
||||
<string name="bnet_update">Обновить</string>
|
||||
<string name="bnet_store">Игры Blizzard</string>
|
||||
<string name="stores_resume_install">Продолжить установку</string>
|
||||
|
||||
@@ -2554,7 +2554,6 @@
|
||||
<string name="bnet_dl_failed">Blizzards nedladdare stoppades: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzards nedladdare slutade göra framsteg.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard-fel %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard kunde inte komma åt spelmappen (fel 703). Kontrollera behörigheterna eller välj en annan mapp.</string>
|
||||
<string name="bnet_update">Uppdatera</string>
|
||||
<string name="bnet_store">Blizzard-spel</string>
|
||||
<string name="stores_resume_install">Återuppta installation</string>
|
||||
|
||||
@@ -2529,7 +2529,6 @@
|
||||
<string name="bnet_dl_failed">ตัวดาวน์โหลดของ Blizzard หยุดทำงาน: %1$s</string>
|
||||
<string name="bnet_dl_stalled">ตัวดาวน์โหลดของ Blizzard ไม่คืบหน้า</string>
|
||||
<string name="bnet_dl_agent_error">ข้อผิดพลาดของ Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard ไม่สามารถเข้าถึงโฟลเดอร์เกมได้ (ข้อผิดพลาด 703) ตรวจสอบสิทธิ์หรือเลือกโฟลเดอร์อื่น</string>
|
||||
<string name="bnet_update">อัปเดต</string>
|
||||
<string name="bnet_store">เกมของ Blizzard</string>
|
||||
<string name="stores_resume_install">ดำเนินการติดตั้งต่อ</string>
|
||||
|
||||
@@ -2546,7 +2546,6 @@
|
||||
<string name="bnet_dl_failed">Blizzard indiricisi durdu: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard indiricisi ilerlemeyi durdurdu.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard hatası %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard oyun klasörüne erişemedi (hata 703). İzinlerini kontrol edin veya farklı bir klasör seçin.</string>
|
||||
<string name="bnet_update">Güncelle</string>
|
||||
<string name="bnet_store">Blizzard oyunları</string>
|
||||
<string name="stores_resume_install">Yüklemeyi sürdür</string>
|
||||
|
||||
@@ -2606,7 +2606,6 @@
|
||||
<string name="bnet_dl_failed">Завантажувач Blizzard зупинився: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Завантажувач Blizzard перестав просуватися.</string>
|
||||
<string name="bnet_dl_agent_error">Помилка Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard не вдалося отримати доступ до папки гри (помилка 703). Перевірте дозволи або виберіть іншу папку.</string>
|
||||
<string name="bnet_update">Оновити</string>
|
||||
<string name="bnet_store">Ігри Blizzard</string>
|
||||
<string name="stores_resume_install">Продовжити встановлення</string>
|
||||
|
||||
@@ -2529,7 +2529,6 @@
|
||||
<string name="bnet_dl_failed">Trình tải xuống của Blizzard đã dừng: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Trình tải xuống của Blizzard không còn tiến triển.</string>
|
||||
<string name="bnet_dl_agent_error">Lỗi Blizzard %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard không thể truy cập thư mục trò chơi (lỗi 703). Hãy kiểm tra quyền hoặc chọn một thư mục khác.</string>
|
||||
<string name="bnet_update">Cập nhật</string>
|
||||
<string name="bnet_store">Trò chơi Blizzard</string>
|
||||
<string name="stores_resume_install">Tiếp tục cài</string>
|
||||
|
||||
@@ -2606,7 +2606,6 @@
|
||||
<string name="bnet_dl_failed">暴雪下载器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下载器已停止进展。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪错误 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪无法访问游戏文件夹(错误 703)。请检查其权限或选择其他文件夹。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">暴雪游戏</string>
|
||||
<string name="stores_resume_install">继续安装</string>
|
||||
|
||||
@@ -2526,7 +2526,6 @@
|
||||
<string name="bnet_dl_failed">暴雪下載器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下載器已停止進展。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪錯誤 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪無法存取遊戲資料夾(錯誤 703)。請檢查其權限或選擇其他資料夾。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">Blizzard 遊戲</string>
|
||||
<string name="stores_resume_install">繼續安裝</string>
|
||||
|
||||
@@ -2526,7 +2526,6 @@
|
||||
<string name="bnet_dl_failed">暴雪下載器已停止:%1$s</string>
|
||||
<string name="bnet_dl_stalled">暴雪下載器已停止進度。</string>
|
||||
<string name="bnet_dl_agent_error">暴雪錯誤 %1$s</string>
|
||||
<string name="bnet_dl_folder_access">暴雪無法存取遊戲資料夾(錯誤 703)。請檢查其權限或選擇其他資料夾。</string>
|
||||
<string name="bnet_update">更新</string>
|
||||
<string name="bnet_store">Blizzard 遊戲</string>
|
||||
<string name="stores_resume_install">繼續安裝</string>
|
||||
|
||||
@@ -2863,7 +2863,6 @@
|
||||
<string name="bnet_dl_failed">Blizzard\'s downloader stopped: %1$s</string>
|
||||
<string name="bnet_dl_stalled">Blizzard\'s downloader stopped making progress.</string>
|
||||
<string name="bnet_dl_agent_error">Blizzard error %1$s</string>
|
||||
<string name="bnet_dl_folder_access">Blizzard could not access the game folder (error 703). Check its permissions or choose a different folder.</string>
|
||||
<string name="bnet_update">Update</string>
|
||||
<string name="bnet_store">Blizzard games</string>
|
||||
<string name="stores_resume_install">Resume install</string>
|
||||
|
||||
@@ -4,12 +4,10 @@ import http.client
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import runpy
|
||||
import shutil
|
||||
import signal
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
@@ -158,13 +156,7 @@ function watch(path) {
|
||||
save(".json", s);
|
||||
if (/"form"\s*:\s*\{/.test(s)) {
|
||||
var refused = /"error"\s*:\s*(\d+)/.exec(object(s, "game_dir"));
|
||||
if (refused && +refused[1] != 0) {
|
||||
var code = +refused[1];
|
||||
var reason = "Battle.net refused the game folder (error " + code + ")";
|
||||
if (code == 703) reason = "Battle.net could not access the game folder (error 703)";
|
||||
if (code == 800) reason = "the game folder already holds a game";
|
||||
throw new Error(reason);
|
||||
}
|
||||
if (refused && +refused[1] != 0) throw new Error(+refused[1] == 800 ? "the game folder already holds a game" : "Battle.net refused the game folder (error " + refused[1] + ")");
|
||||
} else if (/"error"\s*:\s*[1-9]/.test(s)) break;
|
||||
var state = /"state"\s*:\s*(\d+)/.exec(s.replace(/"extended_status"\s*:\s*\{[^}]*\}/, "")), complete = /"download_complete"\s*:\s*true/.test(s);
|
||||
state = state ? +state[1] : 0;
|
||||
@@ -349,58 +341,6 @@ def install_path(root, library):
|
||||
return letter.upper() + ":\\" + path[len(target):].strip("/").replace("/", "\\")
|
||||
|
||||
|
||||
def _heal_install_permissions(folder):
|
||||
root = Path(folder)
|
||||
if any(path.is_symlink() for path in (root, *root.parents)) or not root.exists():
|
||||
return
|
||||
pending = [root]
|
||||
while pending:
|
||||
path = pending.pop()
|
||||
try:
|
||||
st = path.lstat()
|
||||
except OSError:
|
||||
continue
|
||||
if stat.S_ISLNK(st.st_mode):
|
||||
continue
|
||||
mode = stat.S_IMODE(st.st_mode)
|
||||
wanted = mode | stat.S_IRUSR | stat.S_IWUSR
|
||||
if stat.S_ISDIR(st.st_mode):
|
||||
wanted |= stat.S_IXUSR
|
||||
if wanted != mode:
|
||||
try:
|
||||
os.chmod(path, wanted, follow_symlinks=False)
|
||||
except OSError:
|
||||
continue
|
||||
if stat.S_ISDIR(st.st_mode):
|
||||
try:
|
||||
with os.scandir(path) as entries:
|
||||
for entry in entries:
|
||||
try:
|
||||
if not entry.is_symlink():
|
||||
pending.append(Path(entry.path))
|
||||
except OSError:
|
||||
continue
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
|
||||
def heal_install_folder(folder):
|
||||
folder = Path(folder).absolute()
|
||||
try:
|
||||
if any(path.is_symlink() for path in (folder, *folder.parents)):
|
||||
return
|
||||
_heal_install_permissions(folder)
|
||||
except (OSError, RuntimeError, ValueError):
|
||||
return
|
||||
try:
|
||||
game_env = runpy.run_path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "droiddeck-game-env"))
|
||||
unlocked, cleared = game_env["heal_shared_data_locked"](folder)
|
||||
except (OSError, KeyError, TypeError, ValueError):
|
||||
unlocked, cleared = [], []
|
||||
if cleared:
|
||||
say("cleared %d stale Windows owners in the game folder; unlocked: %s" % (len(cleared), ", ".join(unlocked) or "none"))
|
||||
|
||||
|
||||
def keeps_open(root):
|
||||
try:
|
||||
with open(os.path.join(drive_c(root), *CONFIG), encoding="utf-8-sig") as f:
|
||||
@@ -1610,7 +1550,6 @@ def agent_job(root, action, uid, product="", folder="", locale="enUS", country="
|
||||
stop_leftovers(pfx)
|
||||
if action == "install":
|
||||
windows = install_path(root, folder)
|
||||
heal_install_folder(folder)
|
||||
emit("STATE", "starting")
|
||||
base = os.path.join(CACHE, "agent-%s" % uid)
|
||||
os.makedirs(CACHE, exist_ok=True)
|
||||
@@ -1674,8 +1613,6 @@ def agent_job(root, action, uid, product="", folder="", locale="enUS", country="
|
||||
except OSError:
|
||||
reason = None
|
||||
code = status.get("error")
|
||||
if reason is None and code == 703:
|
||||
reason = "Battle.net could not access the game folder (error 703)"
|
||||
if reason is None and isinstance(code, int) and code > 0:
|
||||
emit("ERROR", "agent %d" % code)
|
||||
say("the %s of %s stopped: Agent error %d" % (action, uid, code))
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <link.h>
|
||||
#include <linux/input.h>
|
||||
#include <pthread.h>
|
||||
#include <stdatomic.h>
|
||||
@@ -15,6 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
@@ -34,7 +36,8 @@
|
||||
"NAME=\"Xbox 360 Controller (%d)\"\n" \
|
||||
"PHYS=\"usb-fakeinput/input%d\"\n"
|
||||
|
||||
#define RING_SDL_ID 0x045e028eu
|
||||
#define STEAM_VIRTUAL_VENDOR 0x28de
|
||||
#define STEAM_VIRTUAL_PRODUCT 0x11ff
|
||||
|
||||
#define PARENT_NAME "droiddeck-input"
|
||||
#define PARENT_SYSPATH_FORMAT "/sys/devices/droiddeck%d/" PARENT_NAME "%d"
|
||||
@@ -141,66 +144,8 @@ static int any_virtual_pad(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *sdl_id_list_text(const char *list) {
|
||||
char *text = NULL;
|
||||
char *grown;
|
||||
size_t length = 0;
|
||||
size_t got;
|
||||
FILE *file;
|
||||
|
||||
if (list[0] != '@') return strdup(list);
|
||||
file = fopen(list + 1, "re");
|
||||
if (file == NULL) return NULL;
|
||||
do {
|
||||
grown = realloc(text, length + 4097);
|
||||
if (grown == NULL) {
|
||||
free(text);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
text = grown;
|
||||
got = fread(text + length, 1, 4096, file);
|
||||
length += got;
|
||||
} while (got > 0);
|
||||
fclose(file);
|
||||
text[length] = '\0';
|
||||
return text;
|
||||
}
|
||||
|
||||
static int sdl_id_list_entries(const char *list, int *has_ring) {
|
||||
char *text = sdl_id_list_text(list);
|
||||
char *spot = text;
|
||||
uint32_t entry;
|
||||
int entries = 0;
|
||||
|
||||
*has_ring = 0;
|
||||
if (text == NULL) return 0;
|
||||
while ((spot = strstr(spot, "0x")) != NULL) {
|
||||
entry = (uint32_t)(uint16_t)strtol(spot, &spot, 0) << 16;
|
||||
spot = strstr(spot, "0x");
|
||||
if (spot == NULL) break;
|
||||
entry |= (uint16_t)strtol(spot, &spot, 0);
|
||||
entries++;
|
||||
if (entry == RING_SDL_ID) *has_ring = 1;
|
||||
}
|
||||
free(text);
|
||||
return entries;
|
||||
}
|
||||
|
||||
static int sdl_bus_skips_ring_pad(void) {
|
||||
const char *steam_virtual = getenv("FAKE_EVDEV_STEAM_VIRTUAL");
|
||||
const char *except = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT");
|
||||
const char *ignore = getenv("SDL_GAMECONTROLLER_IGNORE_DEVICES");
|
||||
int has_ring;
|
||||
|
||||
if (steam_virtual != NULL && atoi(steam_virtual) != 0) return 1;
|
||||
if (except != NULL && sdl_id_list_entries(except, &has_ring) > 0) return !has_ring;
|
||||
return ignore != NULL && sdl_id_list_entries(ignore, &has_ring) > 0 && has_ring;
|
||||
}
|
||||
|
||||
static const char *ring_uevent_format(void) {
|
||||
if (uinput_enabled() && any_virtual_pad()) return PAD_PHYSICAL_UEVENT_FORMAT;
|
||||
return sdl_bus_skips_ring_pad() ? PAD_UEVENT_FORMAT : PAD_PHYSICAL_UEVENT_FORMAT;
|
||||
return uinput_enabled() && any_virtual_pad() ? PAD_PHYSICAL_UEVENT_FORMAT : PAD_UEVENT_FORMAT;
|
||||
}
|
||||
|
||||
static void refresh_locked(int node) {
|
||||
@@ -514,6 +459,60 @@ static int caller_in_library(void *caller, const char *library) {
|
||||
|
||||
static int caller_is_winebus(void *caller) { return caller_in_library(caller, "winebus.so"); }
|
||||
|
||||
static int note_winebus(struct dl_phdr_info *info, size_t size, void *data) {
|
||||
(void)size;
|
||||
if (info->dlpi_name == NULL || strstr(info->dlpi_name, "winebus.so") == NULL) return 0;
|
||||
*(int *)data = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int winebus_reads_udev(void) {
|
||||
const char *x360 = getenv("FAKE_EVDEV_STEAM_PAD_AS_X360");
|
||||
int loaded = 0;
|
||||
|
||||
if (x360 != NULL && atoi(x360) != 0) return 0;
|
||||
dl_iterate_phdr(note_winebus, &loaded);
|
||||
return loaded;
|
||||
}
|
||||
|
||||
static int ring_pad_fd(int fd) {
|
||||
const char *spec = getenv("FAKE_EVDEV_MEMFD_PATHS");
|
||||
const char *entry;
|
||||
struct stat opened;
|
||||
struct stat ring;
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (spec == NULL || fstat(fd, &opened) != 0) return 0;
|
||||
for (entry = spec; *entry != '\0';) {
|
||||
char *end;
|
||||
long slot = strtol(entry, &end, 10);
|
||||
const char *next = strchr(entry, ';');
|
||||
size_t length;
|
||||
|
||||
if (end != entry && *end == '=' && slot >= 0 && slot < RING_MAX) {
|
||||
length = next != NULL ? (size_t)(next - end - 1) : strlen(end + 1);
|
||||
if (length < sizeof(path)) {
|
||||
memcpy(path, end + 1, length);
|
||||
path[length] = '\0';
|
||||
if (stat(path, &ring) == 0 && ring.st_dev == opened.st_dev && ring.st_ino == opened.st_ino) return 1;
|
||||
}
|
||||
}
|
||||
if (next == NULL) break;
|
||||
entry = next + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) void dd_ring_pad_sdl_id(int fd, unsigned long request, void *arg,
|
||||
void *caller, int rc) {
|
||||
struct input_id *id = arg;
|
||||
|
||||
if (rc != 0 || request != EVIOCGID || id == NULL) return;
|
||||
if (!caller_in_library(caller, "libSDL") || !winebus_reads_udev() || !ring_pad_fd(fd)) return;
|
||||
id->vendor = STEAM_VIRTUAL_VENDOR;
|
||||
id->product = STEAM_VIRTUAL_PRODUCT;
|
||||
}
|
||||
|
||||
typedef int (*sdl_rumble_fn)(void *, uint16_t, uint16_t, uint32_t);
|
||||
static _Atomic(sdl_rumble_fn) real_sdl_rumble;
|
||||
static __thread int winebus_sdl_call;
|
||||
|
||||
@@ -424,6 +424,8 @@ int dd_venc_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute
|
||||
int dd_vdec_ioctl(int fd, unsigned long request, void *arg, int *rc) __attribute__((visibility("hidden")));
|
||||
int dd_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request,
|
||||
void *arg, void *caller, int *rc) __attribute__((visibility("hidden")));
|
||||
void dd_ring_pad_sdl_id(int fd, unsigned long request, void *arg, void *caller, int rc)
|
||||
__attribute__((visibility("hidden")));
|
||||
int dd_writewatch_ioctl(int (*real)(int, unsigned long, void *), int fd, unsigned long request, void *arg,
|
||||
int *rc) __attribute__((visibility("hidden")));
|
||||
|
||||
@@ -444,6 +446,7 @@ int ioctl(int fd, unsigned long request, ...) {
|
||||
if (dd_winebus_rumble_ioctl(real, fd, request, arg, __builtin_return_address(0), &rc)) return rc;
|
||||
if (dd_writewatch_ioctl(real, fd, request, arg, &rc)) return rc;
|
||||
if (!dd_kgsl_poll(real, fd, request, arg, &rc)) rc = quest_kgsl_ioctl(real, fd, request, arg);
|
||||
dd_ring_pad_sdl_id(fd, request, arg, __builtin_return_address(0), rc);
|
||||
dd_kgsl_track(real, fd, request, arg, &rc);
|
||||
dd_kgsl_chip_id_fixup(request, arg, rc);
|
||||
if (arg == NULL || !is_link_query(request)) return rc;
|
||||
|
||||
+101
-11
@@ -3,8 +3,12 @@
|
||||
#include <stdio.h>
|
||||
|
||||
struct vkp_draw { int unused; };
|
||||
static int quest, framegen, cardboard, pass_result, base_result, pass_shown;
|
||||
static int first_frames, pass_calls, base_calls, fallback_calls;
|
||||
struct vkp_hdr_frame;
|
||||
struct droiddeck_color;
|
||||
static int quest, framegen, cardboard, pass_result, gen_result, base_result, pass_shown, gen_shown;
|
||||
static int first_frames, pass_calls, gen_calls, base_calls, fallback_calls;
|
||||
static int settled, g_framegen_layer;
|
||||
static void settle_unwaited(void) { settled++; }
|
||||
static int vkp_quest_layer_presentation(void) { return quest; }
|
||||
static int vkp_framegen_active(void) { return framegen; }
|
||||
static int vkp_cardboard_active(void) { return cardboard; }
|
||||
@@ -19,26 +23,46 @@ static int sc_layer_present_pass(const struct vkp_draw *draws, int n, int w, int
|
||||
if (pass_result == 0 && pass_shown) vkp_signal_first_frame();
|
||||
return pass_result;
|
||||
}
|
||||
static int sc_layer_present_generated(const struct vkp_draw *draws, int n_draws,
|
||||
const struct vkp_hdr_frame *hf, int w, int h,
|
||||
int composed, const struct droiddeck_color *color) {
|
||||
(void)w; (void)h;
|
||||
assert(composed == 1 && hf == NULL && color == NULL);
|
||||
gen_calls++;
|
||||
if (gen_result >= 0 && gen_shown) vkp_signal_first_frame();
|
||||
return gen_result;
|
||||
}
|
||||
static int render_impl(int w, int h, const struct vkp_draw *draws, int n,
|
||||
const void *hdr, int *how) { fallback_calls++; return 17; }
|
||||
|
||||
#include "vkp_render_under_test.inc"
|
||||
|
||||
static int compositor_route(int hdr_route, int cursor_on, int ahb_only,
|
||||
const struct vkp_draw *draws) {
|
||||
const int w = 1280, h = 720;
|
||||
const struct { const struct vkp_draw *d; int n; } dl = {draws, 1};
|
||||
int rendered = -2;
|
||||
#include "quest_route_under_test.inc"
|
||||
return rendered;
|
||||
}
|
||||
|
||||
static void reset(void) {
|
||||
quest = 1;
|
||||
framegen = cardboard = pass_result = base_result = pass_shown = 0;
|
||||
first_frames = pass_calls = base_calls = fallback_calls = 0;
|
||||
settled = 0;
|
||||
g_framegen_layer = -1;
|
||||
framegen = cardboard = pass_result = gen_result = base_result = pass_shown = gen_shown = 0;
|
||||
first_frames = pass_calls = gen_calls = base_calls = fallback_calls = 0;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
const struct vkp_draw draw = {0};
|
||||
reset();
|
||||
for (int i = 0; i < 3; i++) assert(vkp_render(1280, 720, NULL, 0) == 0);
|
||||
assert(base_calls == 3 && pass_calls == 0 && first_frames == 0);
|
||||
assert(base_calls == 3 && pass_calls == 0 && gen_calls == 0 && first_frames == 0);
|
||||
|
||||
reset();
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
assert(pass_calls == 1 && base_calls == 1 && first_frames == 0);
|
||||
assert(pass_calls == 1 && gen_calls == 0 && base_calls == 1 && first_frames == 0);
|
||||
|
||||
reset(); pass_shown = 1;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
@@ -53,15 +77,81 @@ int main(void) {
|
||||
assert(vkp_render(1280, 720, NULL, 0) == -1);
|
||||
assert(first_frames == 0);
|
||||
|
||||
for (int mode = 0; mode < 3; mode++) {
|
||||
for (int mode = 0; mode < 4; mode++) {
|
||||
reset();
|
||||
if (mode == 0) quest = 0;
|
||||
if (mode == 1) framegen = 1;
|
||||
if (mode == 2) cardboard = 1;
|
||||
if (mode == 1) cardboard = 1;
|
||||
if (mode == 2) { quest = 0; framegen = 1; }
|
||||
if (mode == 3) { framegen = 1; cardboard = 1; }
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 17);
|
||||
assert(fallback_calls == 1 && pass_calls == 0 && base_calls == 0);
|
||||
assert(fallback_calls == 1 && pass_calls == 0 && gen_calls == 0 && base_calls == 0);
|
||||
assert(first_frames == 0);
|
||||
}
|
||||
puts("PASS: Quest first-frame notification waits for client content");
|
||||
|
||||
reset(); framegen = 1;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
assert(gen_calls == 1 && pass_calls == 0 && fallback_calls == 0 && base_calls == 1);
|
||||
|
||||
reset(); framegen = 1; gen_result = -1;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == -1);
|
||||
assert(gen_calls == 1 && fallback_calls == 0 && base_calls == 0 && first_frames == 0);
|
||||
|
||||
reset(); framegen = 1; gen_shown = 1;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
assert(first_frames == 1);
|
||||
assert(vkp_render(1280, 720, NULL, 0) == 0);
|
||||
assert(first_frames == 1);
|
||||
|
||||
reset(); framegen = 1;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
framegen = 0;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
assert(gen_calls == 1 && pass_calls == 1 && fallback_calls == 0 && first_frames == 0);
|
||||
for (int count = 1; count <= 2; count++) {
|
||||
for (int shown = 0; shown <= 1; shown++) {
|
||||
reset(); framegen = 1; gen_result = count; gen_shown = shown;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
assert(gen_calls == 1 && pass_calls == 0 && fallback_calls == 0);
|
||||
assert(base_calls == 1 && first_frames == shown);
|
||||
assert(vkp_render(1280, 720, NULL, 0) == 0);
|
||||
assert(gen_calls == 1 && base_calls == 2 && first_frames == shown);
|
||||
}
|
||||
reset(); framegen = 1; gen_result = count; gen_shown = 1; base_result = -1;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == -1);
|
||||
assert(gen_calls == 1 && base_calls == 1 && first_frames == 1);
|
||||
assert(pass_calls == 0 && fallback_calls == 0);
|
||||
}
|
||||
|
||||
for (int route = 0; route <= 3; route++) {
|
||||
for (int flags = 0; flags < 32; flags++) {
|
||||
reset();
|
||||
quest = flags & 1;
|
||||
framegen = (flags >> 1) & 1;
|
||||
cardboard = (flags >> 2) & 1;
|
||||
const int cursor = (flags >> 3) & 1;
|
||||
const int ahb = (flags >> 4) & 1;
|
||||
const int selected = route == 0 && quest && !cardboard && !cursor && !ahb;
|
||||
gen_result = 2; gen_shown = pass_shown = 1;
|
||||
assert(compositor_route(route, cursor, ahb, &draw) == (selected ? 1 : -2));
|
||||
assert(settled == selected && base_calls == selected);
|
||||
assert(gen_calls == (selected && framegen));
|
||||
assert(pass_calls == (selected && !framegen));
|
||||
assert(first_frames == selected && fallback_calls == 0);
|
||||
assert(g_framegen_layer == (selected ? framegen : -1));
|
||||
assert(quest == (flags & 1));
|
||||
assert(framegen == ((flags >> 1) & 1));
|
||||
assert(cardboard == ((flags >> 2) & 1));
|
||||
}
|
||||
}
|
||||
reset(); framegen = 1; gen_result = 2;
|
||||
assert(compositor_route(0, 0, 0, &draw) == 1);
|
||||
assert(g_framegen_layer == 1);
|
||||
framegen = 0;
|
||||
assert(compositor_route(0, 0, 0, &draw) == 1);
|
||||
assert(g_framegen_layer == 0 && gen_calls == 1 && pass_calls == 1 && base_calls == 2);
|
||||
reset(); framegen = 1; gen_result = -1;
|
||||
assert(compositor_route(0, 0, 0, &draw) == 0);
|
||||
assert(settled == 1 && gen_calls == 1 && base_calls == 0 && fallback_calls == 0);
|
||||
puts("PASS: Quest first-frame notification and display-layer frame generation");
|
||||
return 0;
|
||||
}
|
||||
@@ -5,8 +5,6 @@ from pathlib import Path
|
||||
import re
|
||||
import runpy
|
||||
import shutil
|
||||
import stat
|
||||
import struct
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
@@ -1495,103 +1493,6 @@ class AgentTest(Temp):
|
||||
self.assertIn('var patch = zone == "cn" ? "cn.patch.battlenet.com.cn" : zone + ".patch.battle.net";', script)
|
||||
self.assertIn("+ patch + ':1119/'", script)
|
||||
|
||||
def test_the_driver_maps_game_dir_errors_to_readable_reasons(self):
|
||||
script = BNET["AGENT_SCRIPT"]
|
||||
self.assertIn('if (code == 703) reason = "Battle.net could not access the game folder (error 703)";', script)
|
||||
self.assertIn('if (code == 800) reason = "the game folder already holds a game";', script)
|
||||
|
||||
|
||||
class InstallFolderHealTest(Temp):
|
||||
def test_stale_owners_in_the_install_folder_are_cleared(self):
|
||||
roots, notes = [], []
|
||||
|
||||
def heal(root):
|
||||
roots.append(root)
|
||||
return ["Data"], [".", "Data"]
|
||||
|
||||
with mock.patch.object(BNET["runpy"], "run_path", return_value={"heal_shared_data_locked": heal}), \
|
||||
mock.patch.dict(BNET, {"say": notes.append}):
|
||||
BNET["heal_install_folder"](str(self.tmp / "install"))
|
||||
self.assertEqual(roots, [self.tmp / "install"])
|
||||
self.assertEqual(notes, ["cleared 2 stale Windows owners in the game folder; unlocked: Data"])
|
||||
|
||||
def test_a_folder_that_cannot_be_checked_does_not_stop_the_install(self):
|
||||
for error in (OSError("xattrs"), KeyError("heal_shared_data_locked")):
|
||||
with self.subTest(error=error), mock.patch.object(BNET["runpy"], "run_path", side_effect=error):
|
||||
self.assertIsNone(BNET["heal_install_folder"](str(self.tmp / "install")))
|
||||
|
||||
def test_unreadable_install_folder_entries_are_made_writable(self):
|
||||
folder = self.tmp / "install"
|
||||
data = folder / "Data"
|
||||
data.mkdir(parents=True)
|
||||
blocked = data / "data"
|
||||
blocked.write_bytes(b"x")
|
||||
blocked.chmod(0o400)
|
||||
data.chmod(0o500)
|
||||
folder.chmod(0o500)
|
||||
try:
|
||||
with mock.patch.object(BNET["runpy"], "run_path", return_value={"heal_shared_data_locked": lambda root: ([], [])}):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
self.assertEqual(stat.S_IMODE(folder.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(data.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(blocked.stat().st_mode), 0o600)
|
||||
finally:
|
||||
folder.chmod(0o700)
|
||||
data.chmod(0o700)
|
||||
blocked.chmod(0o600)
|
||||
|
||||
def test_unreadable_descendants_are_repaired_before_windows_cleanup(self):
|
||||
folder = self.tmp / "install"
|
||||
data = folder / "Data"
|
||||
data.mkdir(parents=True)
|
||||
blocked = data / "payload"
|
||||
blocked.write_bytes(b"x")
|
||||
sibling = self.write("other/payload", "keep", 0o440)
|
||||
linked = self.write("external/payload", "keep", 0o440)
|
||||
(folder / "link").symlink_to(linked.parent, target_is_directory=True)
|
||||
subs = (21, 0x0badf00d, 0x0ddba11, 10122, 1000)
|
||||
sid = bytes([1, len(subs)]) + (5).to_bytes(6, "big") + struct.pack("<5I", *subs)
|
||||
descriptor = b"\x01\x00" + struct.pack("<BBHIIII", 1, 0, 0x8004, len(sid), 0, 0, 0) + sid
|
||||
try:
|
||||
os.setxattr(blocked, "user.wine.sd", descriptor)
|
||||
except OSError:
|
||||
self.skipTest("needs user xattrs")
|
||||
blocked.chmod(0)
|
||||
data.chmod(0o300)
|
||||
folder.chmod(0o2510)
|
||||
scan = os.scandir
|
||||
|
||||
def checked_scan(path):
|
||||
self.assertEqual(stat.S_IMODE(os.stat(path).st_mode) & 0o700, 0o700)
|
||||
return scan(path)
|
||||
|
||||
try:
|
||||
with mock.patch.object(BNET["os"], "scandir", side_effect=checked_scan):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
self.assertEqual(stat.S_IMODE(folder.stat().st_mode), 0o2710)
|
||||
self.assertEqual(stat.S_IMODE(data.stat().st_mode), 0o700)
|
||||
self.assertEqual(stat.S_IMODE(blocked.stat().st_mode), 0o600)
|
||||
self.assertNotIn("user.wine.sd", os.listxattr(blocked))
|
||||
self.assertEqual(stat.S_IMODE(sibling.stat().st_mode), 0o440)
|
||||
self.assertEqual(stat.S_IMODE(linked.stat().st_mode), 0o440)
|
||||
finally:
|
||||
folder.chmod(0o700)
|
||||
data.chmod(0o700)
|
||||
blocked.chmod(0o600)
|
||||
|
||||
def test_symlinked_roots_and_ancestors_are_not_repaired(self):
|
||||
target = self.tmp / "external"
|
||||
target.mkdir()
|
||||
payload = self.write("external/install/payload", "keep", 0o400)
|
||||
link = self.tmp / "link"
|
||||
link.symlink_to(target, target_is_directory=True)
|
||||
with mock.patch.object(BNET["runpy"], "run_path") as cleanup:
|
||||
for folder in (link, link / "install"):
|
||||
BNET["heal_install_folder"](str(folder))
|
||||
BNET["_heal_install_permissions"](str(folder))
|
||||
cleanup.assert_not_called()
|
||||
self.assertEqual(stat.S_IMODE(payload.stat().st_mode), 0o400)
|
||||
|
||||
|
||||
class AgentJobTest(Harness):
|
||||
def setUp(self):
|
||||
@@ -1619,7 +1520,6 @@ class AgentJobTest(Harness):
|
||||
"stop_leftovers": lambda pfx: True, "CACHE": str(self.tmp / "cache")})
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
self.child = Child
|
||||
popen = mock.patch.object(BNET["subprocess"], "Popen", Child)
|
||||
popen.start()
|
||||
self.addCleanup(popen.stop)
|
||||
@@ -1647,25 +1547,6 @@ class AgentJobTest(Harness):
|
||||
self.assertEqual([kind for kind, _ in self.lines], ["STATE", "PROGRESS", "DONE"])
|
||||
self.assertEqual(json.loads(self.lines[-1][1]), {"install_dir": "Z:" + folder, "exe": "WarcraftRumble.exe", "version": "16.1.2.119725"})
|
||||
|
||||
def test_an_install_heals_stale_owners_before_it_starts_the_agent(self):
|
||||
self.install()
|
||||
folder = str(self.tmp / "Games/Battle.net/World of Warcraft")
|
||||
self.files = {".json": json.dumps({"state": 1004, "download_complete": True}),
|
||||
".game": json.dumps({"installed": True, "playable": True, "install_dir": "Z:" + folder,
|
||||
"local_version": "1"})}
|
||||
events = []
|
||||
|
||||
class Recording(self.child):
|
||||
def __init__(self, cmd, **kwargs):
|
||||
events.append("popen")
|
||||
super().__init__(cmd, **kwargs)
|
||||
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": lambda path: events.append(("heal", path))}), \
|
||||
mock.patch.object(BNET["subprocess"], "Popen", Recording):
|
||||
code = BNET["agent_job"](self.root, "install", "wow", "wow", folder, "enUS", "USA", "US", poll=0)
|
||||
self.assertEqual(code, 0)
|
||||
self.assertEqual(events, [("heal", folder), "popen"])
|
||||
|
||||
def test_an_install_on_another_volume_is_handed_over_by_its_drive_once_the_prefix_is_stopped(self):
|
||||
self.install()
|
||||
card = self.tmp / "card"
|
||||
@@ -1716,9 +1597,7 @@ class AgentJobTest(Harness):
|
||||
self.install()
|
||||
self.files = {".json": json.dumps({"progress": 1.0}),
|
||||
".game": json.dumps({"installed": True, "playable": True, "install_dir": "Z:/g", "local_version": "2"})}
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "update", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(BNET["agent_job"](self.root, "update", "gryphon", poll=0), 0)
|
||||
self.assertIn("agent-serve", self.started[0])
|
||||
self.assertEqual(json.loads(self.lines[-1][1])["version"], "2")
|
||||
|
||||
@@ -1869,9 +1748,7 @@ class AgentJobTest(Harness):
|
||||
def test_an_uninstall_is_done_once_the_agent_no_longer_lists_it(self):
|
||||
self.install()
|
||||
self.files = {".json": json.dumps({}), ".game": json.dumps({"installed": False})}
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
self.assertEqual(self.lines[-1], ("DONE", json.dumps({"uninstalled": "gryphon"})))
|
||||
|
||||
def test_a_gamescope_that_cannot_start_is_reported(self):
|
||||
@@ -1907,9 +1784,7 @@ class AgentJobTest(Harness):
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 1)
|
||||
self.assertEqual(self.lines[-1][0], "ERROR")
|
||||
self.files = {".game": json.dumps({})}
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
self.assertEqual(self.lines[-1], ("DONE", json.dumps({"uninstalled": "gryphon"})))
|
||||
|
||||
def test_without_battle_net_nothing_starts(self):
|
||||
@@ -1921,9 +1796,7 @@ class AgentJobTest(Harness):
|
||||
self.install()
|
||||
self.states = [self.clients() + [(40, self.GAME)], [(40, self.GAME)], []]
|
||||
self.files = {".game": json.dumps({"installed": False})}
|
||||
with mock.patch.dict(BNET, {"heal_install_folder": mock.Mock()}) as values:
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
values["heal_install_folder"].assert_not_called()
|
||||
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
|
||||
self.assertEqual(self.lines[0], ("STATE", "waiting"))
|
||||
self.assertEqual(self.lines[1], ("STATE", "starting"))
|
||||
|
||||
|
||||
@@ -707,36 +707,15 @@ class InputUdevPreloadTest(unittest.TestCase):
|
||||
def identity(self, pads=None, **extra):
|
||||
return self.run_program("identity", pads=pads, extra=extra)
|
||||
|
||||
@classmethod
|
||||
def id_list(cls, name, text):
|
||||
path = cls.dir / name
|
||||
path.write_text(text)
|
||||
return "@" + str(path)
|
||||
|
||||
def test_a_pad_wine_also_reads_through_sdl_is_described_as_the_pad_sdl_sees(self):
|
||||
xbox = ["pad PRODUCT=3/45e/28e/110", "parent PRODUCT=3/45e/28e/110"]
|
||||
for extra in ({}, {"FAKE_EVDEV_UINPUT": "1"}, {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x045e/0x028e"}, {"FAKE_EVDEV_STEAM_VIRTUAL": "0"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-other.txt", "0x28de/0x1142\n")},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES": "@" + str(self.dir / "missing.txt")},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": self.id_list("except-ring.txt", "0x045E/0x028E\n")},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x45e/0x28e"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": ""},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028f"}):
|
||||
with self.subTest(**extra):
|
||||
self.assertEqual(self.identity(**extra), xbox)
|
||||
|
||||
def test_a_pad_sdl_skips_keeps_the_steam_input_identity(self):
|
||||
def test_a_ring_pad_keeps_the_steam_input_identity_whatever_sdl_is_told(self):
|
||||
steam = ["pad PRODUCT=6/28de/11ff/110", "parent PRODUCT=6/28de/11ff/110"]
|
||||
for extra in ({"FAKE_EVDEV_STEAM_VIRTUAL": "1"}, {"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142,0x045E/0x028E"},
|
||||
for extra in ({}, {"FAKE_EVDEV_UINPUT": "1"}, {"FAKE_EVDEV_STEAM_VIRTUAL": "0"}, {"FAKE_EVDEV_STEAM_VIRTUAL": "1"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x28de/0x1142,0x045E/0x028E"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x045e/0x028e"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "0x28de/0x11ff"},
|
||||
{"FAKE_EVDEV_UINPUT": "1", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028e"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-ring.txt", "0x28de/0x1142\n0x045e/0x028e\n")},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": self.id_list("except-other.txt", "0x28de/0x11ff\n")},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES": self.id_list("ignore-long.txt", "0x28de/0x1142\n" * 400 + "0x045e/0x028e\n")},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x45e/0x28e"},
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": "", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028e"}):
|
||||
{"SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT": ""},
|
||||
{"FAKE_EVDEV_UINPUT": "1", "SDL_GAMECONTROLLER_IGNORE_DEVICES": "0x045e/0x028e"}):
|
||||
with self.subTest(**extra):
|
||||
self.assertEqual(self.identity(**extra), steam)
|
||||
|
||||
|
||||
@@ -16,6 +16,11 @@ class QuestBackdropTest(unittest.TestCase):
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
work = Path(folder)
|
||||
(work / 'vkp_render_under_test.inc').write_text(source[start:end])
|
||||
compositor = (ROOT / 'app/src/main/cpp/waylandcomp/src/compositor.c').read_text()
|
||||
route_start = compositor.index(' if (hdr_route == 0 && vkp_quest_layer_presentation()')
|
||||
route_end = compositor.index(' } else if (hdr_route == 0 || hdr_route == 3)', route_start)
|
||||
(work / 'quest_route_under_test.inc').write_text(
|
||||
compositor[route_start:route_end] + ' }\n')
|
||||
binary = work / 'test-first-frame'
|
||||
subprocess.run(['cc', '-std=c11', '-Wall', '-Wextra',
|
||||
'-Wno-unused-parameter', '-Wno-unused-function', f'-I{work}',
|
||||
@@ -55,6 +60,20 @@ void AHardwareBuffer_describe(const AHardwareBuffer *, AHardwareBuffer_Desc *);
|
||||
int AHardwareBuffer_lock(AHardwareBuffer *, uint64_t, int32_t, const ARect *, void **);
|
||||
int AHardwareBuffer_unlock(AHardwareBuffer *, int32_t *);
|
||||
void AHardwareBuffer_release(AHardwareBuffer *);
|
||||
''')
|
||||
vulkan = work / 'vulkan'
|
||||
vulkan.mkdir()
|
||||
(vulkan / 'vulkan.h').write_text('''#pragma once
|
||||
#include <stdint.h>
|
||||
typedef void *VkInstance;
|
||||
typedef void *VkPhysicalDevice;
|
||||
typedef void *VkDevice;
|
||||
typedef void *VkQueue;
|
||||
typedef void *VkCommandBuffer;
|
||||
typedef void *VkImage;
|
||||
typedef void *VkImageView;
|
||||
typedef int VkFormat;
|
||||
typedef void (*PFN_vkGetInstanceProcAddr)(void);
|
||||
''')
|
||||
binary = work / 'test-presentation'
|
||||
subprocess.run(['cc', '-std=c11', '-O1', '-g', '-Wall', '-Wextra',
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
from pathlib import Path
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
PRELOAD = Path(__file__).resolve().parents[1] / "linuxfs/preload"
|
||||
|
||||
SHIM = r"""
|
||||
#include <linux/input.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
int ioctl(int fd, unsigned long request, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, request);
|
||||
struct input_id *id = va_arg(ap, struct input_id *);
|
||||
va_end(ap);
|
||||
(void)fd;
|
||||
if (request != EVIOCGID) return -1;
|
||||
memset(id, 0, sizeof(*id));
|
||||
id->bustype = 3;
|
||||
id->vendor = 0x045e;
|
||||
id->product = 0x028e;
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
QUERY = r"""
|
||||
#include <fcntl.h>
|
||||
#include <linux/input.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void query(const char *path) {
|
||||
struct input_id id;
|
||||
int fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||
int rc = ioctl(fd, EVIOCGID, &id);
|
||||
printf("%d %04x:%04x\n", rc, id.vendor, id.product);
|
||||
close(fd);
|
||||
}
|
||||
"""
|
||||
|
||||
PROGRAM = r"""
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void query(const char *path);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
(void)argc;
|
||||
if (strcmp(argv[1], "-") != 0) dlopen(argv[1], RTLD_NOW);
|
||||
if (strcmp(argv[2], "program") == 0) {
|
||||
query(argv[3]);
|
||||
} else {
|
||||
void *sdl = dlopen(argv[2], RTLD_NOW | RTLD_LOCAL);
|
||||
void (*sdl_query)(const char *) = (void (*)(const char *))dlsym(sdl, "query");
|
||||
sdl_query(argv[3]);
|
||||
}
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@unittest.skipUnless(sys.platform == "linux" and shutil.which("cc"), "needs Linux and cc")
|
||||
class RingPadSdlIdentityTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.dir = Path(tempfile.mkdtemp())
|
||||
build = cls.dir / "build"
|
||||
build.mkdir()
|
||||
for name, text in (("shim.c", SHIM), ("query.c", QUERY), ("program.c", PROGRAM), ("empty.c", "int bus;\n")):
|
||||
(build / name).write_text(text)
|
||||
cls.lib = cls.dir / "libddsession.so"
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-Wall", "-pthread", "-o", str(cls.lib),
|
||||
*map(str, sorted(PRELOAD.glob("*.c"))), "-ldl"], check=True)
|
||||
cls.shim = cls.dir / "libshim.so"
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.shim), str(build / "shim.c")], check=True)
|
||||
cls.winebus = cls.dir / "winebus.so"
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.winebus), str(build / "empty.c")], check=True)
|
||||
cls.sdl_library = cls.dir / "libSDL2-2.0.so.0"
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-O2", "-o", str(cls.sdl_library), str(build / "query.c")], check=True)
|
||||
cls.program = cls.dir / "program"
|
||||
subprocess.run(["cc", "-O2", "-o", str(cls.program), str(build / "program.c"), str(build / "query.c"), "-ldl"],
|
||||
check=True)
|
||||
cls.ring = cls.dir / "ring0"
|
||||
cls.ring.write_text("")
|
||||
cls.virtual = cls.dir / "ring16"
|
||||
cls.virtual.write_text("")
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.dir, True)
|
||||
|
||||
def query(self, winebus=True, caller="sdl", path=None, **extra):
|
||||
env = dict(os.environ, LD_PRELOAD="%s:%s" % (self.lib, self.shim),
|
||||
FAKE_EVDEV_MEMFD_PATHS="0=%s;16=%s" % (self.ring, self.virtual))
|
||||
env.pop("FAKE_EVDEV_STEAM_PAD_AS_X360", None)
|
||||
env.update(extra)
|
||||
result = subprocess.run([str(self.program), str(self.winebus) if winebus else "-",
|
||||
str(self.sdl_library) if caller == "sdl" else "program", str(path or self.ring)],
|
||||
env=env, capture_output=True, text=True, timeout=10, check=True)
|
||||
return result.stdout.strip()
|
||||
|
||||
def test_sdl_in_a_winebus_process_sees_a_ring_pad_as_the_steam_input_pad(self):
|
||||
self.assertEqual(self.query(), "0 28de:11ff")
|
||||
|
||||
def test_sdl_outside_winebus_keeps_the_pad_identity(self):
|
||||
self.assertEqual(self.query(winebus=False), "0 045e:028e")
|
||||
|
||||
def test_other_callers_and_devices_keep_their_identity(self):
|
||||
self.assertEqual(self.query(caller="program"), "0 045e:028e")
|
||||
self.assertEqual(self.query(path=self.virtual), "0 045e:028e")
|
||||
|
||||
def test_a_winebus_without_a_udev_bus_keeps_the_pad_for_sdl(self):
|
||||
self.assertEqual(self.query(FAKE_EVDEV_STEAM_PAD_AS_X360="1"), "0 045e:028e")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user