mirror of
https://github.com/open-goal/jak-project
synced 2026-06-06 03:39:01 -04:00
Add the STR RPC to overlord and game code (#134)
* work in progress streaming rpc, simple test is working * actually add the test * debug windows failure * windows fix maybe * windows 2 * use str-load-status * update types
This commit is contained in:
@@ -10311,39 +10311,43 @@
|
||||
; )
|
||||
; )
|
||||
|
||||
; ;; rpc-h
|
||||
; (deftype rpc-buffer (basic)
|
||||
; ((elt-size uint32 :offset-assert 4)
|
||||
; (elt-count uint32 :offset-assert 8)
|
||||
; (elt-used uint32 :offset-assert 12)
|
||||
; (busy basic :offset-assert 16)
|
||||
; (base uint32 :offset-assert 20)
|
||||
; (data UNKNOWN :dynamic :offset-assert 32)
|
||||
; )
|
||||
; :method-count-assert 9
|
||||
; :size-assert #x20
|
||||
; :flag-assert #x900000020
|
||||
; )
|
||||
;; rpc-h
|
||||
(deftype rpc-buffer (basic)
|
||||
((elt-size uint32 :offset-assert 4)
|
||||
(elt-count uint32 :offset-assert 8)
|
||||
(elt-used uint32 :offset-assert 12)
|
||||
(busy basic :offset-assert 16)
|
||||
(base pointer :offset-assert 20)
|
||||
(data uint8 :dynamic :offset 32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
:flag-assert #x900000020
|
||||
(:methods
|
||||
(new (symbol type uint uint) rpc-buffer 0)
|
||||
)
|
||||
)
|
||||
|
||||
; ;; rpc-h
|
||||
; (deftype rpc-buffer-pair (basic)
|
||||
; ((buffer UNKNOWN 2 :offset-assert 4)
|
||||
; (current basic :offset-assert 12)
|
||||
; (last-recv-buffer uint32 :offset-assert 16)
|
||||
; (rpc-port int32 :offset-assert 20)
|
||||
; )
|
||||
; :method-count-assert 15
|
||||
; :size-assert #x18
|
||||
; :flag-assert #xf00000018
|
||||
; (:methods
|
||||
; (dummy-9 () none 9)
|
||||
; (dummy-10 () none 10)
|
||||
; (dummy-11 () none 11)
|
||||
; (dummy-12 () none 12)
|
||||
; (dummy-13 () none 13)
|
||||
; (dummy-14 () none 14)
|
||||
; )
|
||||
; )
|
||||
;; rpc-h
|
||||
(deftype rpc-buffer-pair (basic)
|
||||
((buffer rpc-buffer 2 :offset-assert 4)
|
||||
(current rpc-buffer :offset-assert 12)
|
||||
(last-recv-buffer pointer :offset-assert 16)
|
||||
(rpc-port int32 :offset-assert 20)
|
||||
)
|
||||
:method-count-assert 15
|
||||
:size-assert #x18
|
||||
:flag-assert #xf00000018
|
||||
(:methods
|
||||
(new (symbol type uint uint int) rpc-buffer-pair 0)
|
||||
(call (rpc-buffer-pair uint pointer uint) int 9)
|
||||
(add-element (rpc-buffer-pair) pointer 10)
|
||||
(decrement-elt-used (rpc-buffer-pair) int 11)
|
||||
(sync (rpc-buffer-pair symbol) int 12)
|
||||
(check-busy (rpc-buffer-pair) symbol 13)
|
||||
(pop-last-received (rpc-buffer-pair) pointer 14)
|
||||
)
|
||||
)
|
||||
|
||||
; ;; path-h
|
||||
; (deftype path-control (basic)
|
||||
@@ -10659,7 +10663,8 @@
|
||||
(b1 uint32 :offset-assert 4)
|
||||
(b2 uint32 :offset-assert 8)
|
||||
(bt uint32 :offset-assert 12)
|
||||
(name uint128 :offset-assert 16)
|
||||
;(name uint128 :offset-assert 16)
|
||||
(name uint8 16 :offset-assert 16)
|
||||
(address uint32 :offset 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
@@ -10667,30 +10672,30 @@
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
; ;; load-dgo
|
||||
; (deftype load-chunk-msg (structure)
|
||||
; ((rsvd uint16 :offset-assert 0)
|
||||
; (result uint16 :offset-assert 2)
|
||||
; (address uint32 :offset-assert 4)
|
||||
; (section uint32 :offset-assert 8)
|
||||
; (maxlen uint32 :offset-assert 12)
|
||||
; (id uint32 :offset-assert 4)
|
||||
; (basename UNKNOWN 48 :offset-assert 16)
|
||||
; )
|
||||
; :method-count-assert 9
|
||||
; :size-assert #x40
|
||||
; :flag-assert #x900000040
|
||||
; )
|
||||
;; load-dgo
|
||||
(deftype load-chunk-msg (structure)
|
||||
((rsvd uint16 :offset-assert 0)
|
||||
(result uint16 :offset-assert 2)
|
||||
(address uint32 :offset-assert 4)
|
||||
(section uint32 :offset-assert 8)
|
||||
(maxlen uint32 :offset-assert 12)
|
||||
(id uint32 :offset 4)
|
||||
(basename uint8 48 :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
)
|
||||
|
||||
; ;; load-dgo
|
||||
; (deftype dgo-header (structure)
|
||||
; ((length uint32 :offset-assert 0)
|
||||
; (rootname UNKNOWN 60 :offset-assert 4)
|
||||
; )
|
||||
; :method-count-assert 9
|
||||
; :size-assert #x40
|
||||
; :flag-assert #x900000040
|
||||
; )
|
||||
;; load-dgo
|
||||
(deftype dgo-header (structure)
|
||||
((length uint32 :offset-assert 0)
|
||||
(rootname uint8 60 :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
)
|
||||
|
||||
; ;; ramdisk
|
||||
; (deftype ramdisk-rpc-fill (structure)
|
||||
@@ -31160,7 +31165,7 @@
|
||||
(define-extern string-strip-whitespace! function)
|
||||
(define-extern string<? function)
|
||||
(define-extern string-get-flag!! function)
|
||||
(define-extern charp<-string function)
|
||||
(define-extern charp<-string (function (pointer uint8) string int))
|
||||
(define-extern string>=? function)
|
||||
(define-extern string-charp= function)
|
||||
(define-extern string->float function)
|
||||
@@ -32848,13 +32853,13 @@
|
||||
(define-extern dgo-load-begin function)
|
||||
(define-extern dgo-load-continue function)
|
||||
(define-extern destroy-mem function)
|
||||
(define-extern str-load function)
|
||||
(define-extern str-load (function string int pointer int symbol))
|
||||
;;(define-extern *load-str-rpc* object) ;; unknown type
|
||||
;;(define-extern load-chunk-msg object) ;; unknown type
|
||||
;;(define-extern *dgo-name* object) ;; unknown type
|
||||
(define-extern str-ambient-play function)
|
||||
;;(define-extern *load-str-lock* object) ;; unknown type
|
||||
(define-extern str-load-status function)
|
||||
(define-extern str-load-status (function (pointer int32) symbol))
|
||||
(define-extern str-load-cancel function)
|
||||
(define-extern str-play-queue function)
|
||||
(define-extern str-ambient-stop function)
|
||||
|
||||
@@ -6,27 +6,17 @@
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include "common/util/FileUtil.h"
|
||||
#include "game/overlord/isocommon.h"
|
||||
#include "game/common/overlord_common.h"
|
||||
#include "game/common/str_rpc_types.h"
|
||||
#include "StrFileReader.h"
|
||||
|
||||
// up to 64 chunks per STR file.
|
||||
constexpr int SECTOR_TABLE_SIZE = 64;
|
||||
|
||||
// there is a 1 sector long header
|
||||
struct StrFileHeader {
|
||||
u32 sectors[SECTOR_TABLE_SIZE]; // start of chunk, in sectors. including this sector.
|
||||
u32 sizes[SECTOR_TABLE_SIZE]; // size of chunk, in bytes. always an integer number of sectors.
|
||||
u32 pad[512 - 128]; // all zero
|
||||
};
|
||||
static_assert(sizeof(StrFileHeader) == SECTOR_SIZE, "Sector header size");
|
||||
|
||||
StrFileReader::StrFileReader(const std::string& file_path) {
|
||||
auto data = file_util::read_binary_file(file_path);
|
||||
assert(data.size() >= SECTOR_SIZE); // must have at least the header sector
|
||||
assert(data.size() % SECTOR_SIZE == 0); // should be multiple of the sector size.
|
||||
int end_sector = int(data.size()) / SECTOR_SIZE;
|
||||
|
||||
auto* header = (StrFileHeader*)data.data();
|
||||
auto* header = (StrFileHeaderSector*)data.data();
|
||||
|
||||
bool got_zero = false;
|
||||
for (int i = 0; i < SECTOR_TABLE_SIZE; i++) {
|
||||
|
||||
Reference in New Issue
Block a user