Commit graph

32 commits

Author SHA1 Message Date
King_DuckZ
0b94626549 Store individual multiblock saves into a separate in-mem db by value 2025-02-15 11:24:13 +00:00
King_DuckZ
8042481764 Update copyright notice to 2025 2025-02-15 11:24:13 +00:00
King_DuckZ
23f5225cc0 Build fix 2025-02-05 00:37:00 +00:00
0d287a60f1 Draw blank squares for empty blocks in the grid.
Import vectorwrapper, it's just too convenient. It's only used
in one place for now but I will probably use it more from now on.
2020-03-28 21:33:46 +01:00
5688775e6c Finish implementation of block_group().
This forced me to think about treating block 0 specially. The
problem was with block.index() returning [1-15], while the valid
range for MemoryCard::operator[] is [0-14]. This discrepancy was
very confusing. A simple solution would've been to just rename
Block::index() to eg Block::id(), and then know that one has to
do -1 on the id to obtain the index. I tried but discarded this
option. I don't think it's intuitive either (what's id? is it
guaranteed to be index+1? is it a random number, rather? I
know I will forget in 6 months).

Treating block 0 normally would, on the other hand, break range
iteration, as the first iteration would always be on the TOC
block, and all for loops would become 1-based. Also implementing
size() correctly becomes tricky (size could never be 0?)
I don't like the current implementation either but I did
it anyways for now, so operator[] works as before, you can get
block 0 by calling toc_block(), and Block::index() returns some
silly value for block 0. This should work in the future too
when there will be the possibility to forge a new block from
scratch. You don't really want to forge a block 0 as that's
calculated from adding the normal savegame blocks, and for the
latter MemoryCard can just do the +1 internally when receiving
a new Block. Besides Block::link_order() seems to like indices
this way, with 0 being the first savegame and not the TOC. So
it seems to be special in the original PSX API, then let's
treat it specially.
2020-03-21 23:35:43 +01:00
2352bfddc1 Fix size(), now linked blocks also count toward the total count. 2020-03-21 23:20:05 +01:00
bf6814df20 Show the correct number of blocks for multiblock savegames 2020-03-21 21:12:26 +01:00
a98539aa06 Implement use_byte() as per the spec. 2020-03-21 21:05:23 +01:00
05b34b4818 Support non-const to const conversions. 2020-03-21 16:49:34 +01:00
f86032d2b4 Attach GPL3 licence. 2020-03-20 19:22:16 +01:00
e40d092b7d Add methods to get the TOC checksum as per the specs. 2020-03-20 18:58:06 +01:00
c89a27f427 Print the savegame identifier.
Returned string is always 8 chars long, even though when
printed it may be shorter. It's therefore always safe to
memcopy 8 from it.
2020-03-20 18:34:09 +01:00
747209f744 Add new methods to BasicBlock. 2020-03-20 18:24:54 +01:00
30ef4cd49d Remove code duplication, leverage ContentInfo. 2020-03-20 16:48:54 +01:00
a190a76b5d Allow iterating over a block's frames.
Yeah, the PartIterator thing seems to have worked.
2020-03-20 16:44:48 +01:00
db70dead33 Add new BasicFrame class. 2020-03-20 16:21:17 +01:00
4eaa2fc734 Generalise BlockIterator and rename to PartIterator.
I'm going to need a FrameIterator class too so let's see if
I can reuse BlockIterator.
2020-03-20 15:33:16 +01:00
1bca8f0201 Rename palette() to icon_palette(). 2020-03-20 14:59:27 +01:00
c5987d882d Block should be lightweight so don't store palette. 2020-03-20 14:58:36 +01:00
905e6be0c4 Add proper typedefs and restore block number printing in CLI. 2020-03-20 14:54:05 +01:00
dfc466fc87 Refactoring, allow iterating over blocks. 2020-03-20 14:33:42 +01:00
ee163a213a Refactor MemoryCard istream ctor out.
Also move everything into a psx namespace, though I'm not
too sure about this yet.
2020-03-20 13:51:09 +01:00
ef348fe1ca Use the new frame() method. 2020-03-20 01:53:57 +01:00
965dafa240 Make FrameSize a static constant. 2020-03-20 01:46:42 +01:00
d475003215 Add frame() method. 2020-03-20 01:43:50 +01:00
55427a71d6 Print blocks to stdout. 2020-03-20 00:08:01 +01:00
b2b87c7459 Add a CLI program to access the memoserv lib. 2020-03-19 22:13:55 +01:00
4c655850de Committing old changes.
I'm not sure what this is, I think it's just adding a new
MemoryCard::content_info() method. There might be unwanted
debug stuff included in this commit too.
2020-03-19 19:48:28 +01:00
5102dae552 Add BasicBlock::block_count() method. 2019-08-20 01:40:19 +01:00
cb37f21502 Add BasicBlock::title() method.
Latin letters and spaces get converted to halfwidth utf-8
characters. Not ideal as this will break visualisation for
Japanese users.
Leading and trailing spaces are trimmed and repeated spaces
in the names are replaced with a single space.
2019-08-20 01:39:51 +01:00
15e7edbc72 Move memcard code to the mc namespace. 2019-08-19 22:27:55 +01:00
d7d1ca4a24 Move memory card stuff to a separate lib. 2019-08-19 22:22:21 +01:00