// DR. ROBOTNIK'S RING RACERS //----------------------------------------------------------------------------- // Copyright (C) 2016 by James Haley, David Hill, et al. (Team Eternity) // Copyright (C) 2025 by Sally "TehRealSalt" Cochenour // Copyright (C) 2025 by Kart Krew // // This program is free software distributed under the // terms of the GNU General Public License, version 2. // See the 'LICENSE' file for more details. //----------------------------------------------------------------------------- /// \file stream.cpp /// \brief Action Code Script: Dummy stream buffer to /// interact with P_Save/LoadNetGame // TODO? Maybe untie this file from ACS? #include #include #include #include "../doomtype.h" #include "../doomdef.h" #include "../doomstat.h" #include "../p_saveg.h" #include "stream.hpp" #include "../cxxutil.hpp" using namespace srb2::acs; SaveBuffer::SaveBuffer(savebuffer_t *save_) : save{save_} { } SaveBuffer::int_type SaveBuffer::overflow(SaveBuffer::int_type ch) { if (save->p == save->end) { return traits_type::eof(); } *save->p = static_cast(ch); save->p++; return ch; } SaveBuffer::int_type SaveBuffer::underflow() { if (save->p == save->end) { return traits_type::eof(); } UINT8 ret = *save->p; save->p++; // Allow the streambuf internal funcs to work buf[0] = ret; setg( reinterpret_cast(buf), reinterpret_cast(buf), reinterpret_cast(buf + 1) ); return static_cast(ret); }