1 #include "save/save-util.h"
3 FILE *saving_savefile; /* Current save "file" */
4 byte save_xor_byte; /* Simple encryption */
5 uint32_t v_stamp = 0L; /* A simple "checksum" on the actual values */
6 uint32_t x_stamp = 0L; /* A simple "checksum" on the encoded bytes */
9 * @brief 1バイトをファイルに書き込む / These functions place information into a savefile a byte at a time
12 static void sf_put(byte v)
14 /* Encode the value, write a character */
16 (void)putc((int)save_xor_byte, saving_savefile);
18 /* Maintain the checksum info */
20 x_stamp += save_xor_byte;
24 * @brief bool値をファイルに書き込む(wr_byte()の糖衣)
33 * @brief 1バイトをファイルに書き込む(sf_put()の糖衣)
42 * @brief 符号なし16ビットをファイルに書き込む
43 * @param v 書き込む符号なし16bit値
45 void wr_u16b(uint16_t v)
47 wr_byte((byte)(v & 0xFF));
48 wr_byte((byte)((v >> 8) & 0xFF));
52 * @brief 符号あり16ビットをファイルに書き込む
53 * @param v 書き込む符号あり16bit値
55 void wr_s16b(int16_t v)
61 * @brief 符号なし32ビットをファイルに書き込む
62 * @param v 書き込む符号なし32bit値
64 void wr_u32b(uint32_t v)
66 wr_byte((byte)(v & 0xFF));
67 wr_byte((byte)((v >> 8) & 0xFF));
68 wr_byte((byte)((v >> 16) & 0xFF));
69 wr_byte((byte)((v >> 24) & 0xFF));
73 * @brief 符号あり32ビットをファイルに書き込む
74 * @param v 書き込む符号あり32bit値
76 void wr_s32b(int32_t v)
82 * @brief 文字列をファイルに書き込む
85 void wr_string(std::string_view sv)