mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-03-15 10:19:40 +01:00
vmu icon wip
This commit is contained in:
parent
d6e5be5a5d
commit
6d73e6e79d
@ -165,6 +165,10 @@ $(REPACK_GTA_DIR)/GTA3SF8.b: GTA3SF8.b
|
||||
mkdir -p $(@D)
|
||||
cp $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/%.ico: %.ico
|
||||
mkdir -p $(@D)
|
||||
cp $< $@
|
||||
|
||||
1ST_READ.BIN: $(TARGET)
|
||||
rm -f $(TARGET).bin
|
||||
rm -f 1ST_READ.BIN
|
||||
@ -180,20 +184,20 @@ IP.BIN:
|
||||
rm -f IP.BIN
|
||||
$(KOS_BASE)/utils/makeip/makeip ip.txt IP.BIN
|
||||
|
||||
$(PROJECT_NAME).iso: IP.BIN 1ST_READ.BIN $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b
|
||||
$(PROJECT_NAME).iso: IP.BIN 1ST_READ.BIN $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b $(REPACK_GTA_DIR)/settings.ico $(REPACK_GTA_DIR)/save.ico
|
||||
rm -f $(PROJECT_NAME).iso
|
||||
rm -f $(REPACK_GTA_DIR)/1ST_READ.BIN
|
||||
cp 1ST_READ.BIN $(REPACK_GTA_DIR)
|
||||
mkisofs -C 0,11702 -V $(PROJECT_NAME) -G IP.BIN -r -J -l -o $(PROJECT_NAME).iso $(REPACK_GTA_DIR)
|
||||
|
||||
$(PROJECT_NAME)-no-repack.iso: IP.BIN 1ST_READ.BIN $(REPACK_GTA_DIR)/GTA3SF8.b
|
||||
$(PROJECT_NAME)-no-repack.iso: IP.BIN 1ST_READ.BIN $(REPACK_GTA_DIR)/GTA3SF8.b $(REPACK_GTA_DIR)/settings.ico $(REPACK_GTA_DIR)/save.ico
|
||||
rm -f $(PROJECT_NAME)-no-repack.iso
|
||||
rm -f $(REPACK_GTA_DIR)/1ST_READ.BIN
|
||||
cp 1ST_READ.BIN $(REPACK_GTA_DIR)
|
||||
mkisofs -C 0,11702 -V $(PROJECT_NAME) -G IP.BIN -r -J -l -o $(PROJECT_NAME)-no-repack.iso $(REPACK_GTA_DIR)
|
||||
|
||||
|
||||
$(PROJECT_NAME).ds.iso: IP.BIN 1ST_READ.BIN $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b
|
||||
$(PROJECT_NAME).ds.iso: IP.BIN 1ST_READ.BIN $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b $(REPACK_GTA_DIR)/settings.ico $(REPACK_GTA_DIR)/save.ico
|
||||
rm -f $(PROJECT_NAME).ds.iso
|
||||
rm -f $(REPACK_GTA_DIR)/1ST_READ.BIN
|
||||
cp $(TARGET).bin $(REPACK_GTA_DIR)/1ST_READ.BIN
|
||||
@ -204,7 +208,7 @@ $(PROJECT_NAME).ds.iso: IP.BIN 1ST_READ.BIN $(REPACK_DIR)/repacked $(REPACK_GTA_
|
||||
$(KOS_BASE)/utils/scramble/scramble $(TARGET)-prebuilt.bin 1ST_READ_PREBUILT.BIN
|
||||
mkdir -p $(REPACK_GTA_DIR)
|
||||
|
||||
$(PROJECT_NAME)-prebuilt.iso: IP.BIN 1ST_READ_PREBUILT.BIN $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b
|
||||
$(PROJECT_NAME)-prebuilt.iso: IP.BIN 1ST_READ_PREBUILT.BIN $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b $(REPACK_GTA_DIR)/settings.ico $(REPACK_GTA_DIR)/save.ico
|
||||
rm -f $(REPACK_GTA_DIR)/1ST_READ.BIN
|
||||
cp 1ST_READ_PREBUILT.BIN $(REPACK_GTA_DIR)/1ST_READ.BIN
|
||||
mkisofs -C 0,11702 -V $(PROJECT_NAME) -G IP.BIN -r -J -l -o $(PROJECT_NAME).iso $(REPACK_GTA_DIR)
|
||||
@ -223,15 +227,15 @@ $(PROJECT_NAME)-prebuilt.cdi: $(PROJECT_NAME)-prebuilt.iso
|
||||
rm 1ST_READ_PREBUILT.BIN
|
||||
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
|
||||
else
|
||||
$(PROJECT_NAME).cdi: $(TARGET) $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b
|
||||
$(PROJECT_NAME).cdi: $(TARGET) $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b $(REPACK_GTA_DIR)/settings.ico $(REPACK_GTA_DIR)/save.ico
|
||||
mkdcdisc -e $(TARGET) -o $(PROJECT_NAME).cdi -d $(REPACK_GTA_DIR)/ $(MKDCDISC_PAD_OPTION) -n DCA3 -a "the gang"
|
||||
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
|
||||
|
||||
$(PROJECT_NAME)-no-repack.cdi: $(TARGET) $(REPACK_GTA_DIR)/GTA3SF8.b
|
||||
$(PROJECT_NAME)-no-repack.cdi: $(TARGET) $(REPACK_GTA_DIR)/GTA3SF8.b $(REPACK_GTA_DIR)/settings.ico $(REPACK_GTA_DIR)/save.ico
|
||||
mkdcdisc -e $(TARGET) -o $(PROJECT_NAME)-no-repack.cdi -d $(REPACK_GTA_DIR)/ $(MKDCDISC_PAD_OPTION) -n DCA3 -a "the gang"
|
||||
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
|
||||
|
||||
$(PROJECT_NAME)-prebuilt.cdi: $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b
|
||||
$(PROJECT_NAME)-prebuilt.cdi: $(REPACK_DIR)/repacked $(REPACK_GTA_DIR)/GTA3SF8.b $(REPACK_GTA_DIR)/settings.ico $(REPACK_GTA_DIR)/save.ico
|
||||
mkdcdisc -e $(TARGET) -o $(PROJECT_NAME).cdi -d $(REPACK_GTA_DIR)/ $(MKDCDISC_PAD_OPTION) -n DCA3 -a "the gang"
|
||||
@echo && echo && echo "*** CDI Baked Successfully ***" && echo && echo
|
||||
endif
|
||||
|
BIN
dreamcast/save.ico
Normal file
BIN
dreamcast/save.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
dreamcast/settings.ico
Normal file
BIN
dreamcast/settings.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
@ -94,6 +94,10 @@
|
||||
#include <sys/stat.h>
|
||||
#include <cctype>
|
||||
|
||||
#ifdef RW_DC
|
||||
#include <dc/vmu_pkg.h>
|
||||
#endif
|
||||
|
||||
namespace mINI
|
||||
{
|
||||
namespace INIStringUtil
|
||||
@ -335,6 +339,7 @@ namespace mINI
|
||||
private:
|
||||
std::ifstream fileReadStream;
|
||||
T_LineDataPtr lineData;
|
||||
std::size_t start_offt;
|
||||
|
||||
T_LineData readFile()
|
||||
{
|
||||
@ -352,7 +357,17 @@ namespace mINI
|
||||
}
|
||||
std::string buffer;
|
||||
buffer.reserve(50);
|
||||
for (std::size_t i = 0; i < fileSize; ++i)
|
||||
|
||||
#ifdef RW_DC
|
||||
{
|
||||
vmu_pkg_t vmu_pkg;
|
||||
vmu_pkg_parse(reinterpret_cast<uint8*>(const_cast<int8*>(fileContents.c_str())), &vmu_pkg);
|
||||
start_offt = reinterpret_cast<unsigned int>(vmu_pkg.data)
|
||||
- reinterpret_cast<unsigned int>(fileContents.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
for (std::size_t i = start_offt; i < fileSize; ++i)
|
||||
{
|
||||
char& c = fileContents[i];
|
||||
if (c == '\n')
|
||||
@ -378,6 +393,8 @@ namespace mINI
|
||||
{
|
||||
lineData = std::make_shared<T_LineData>();
|
||||
}
|
||||
|
||||
start_offt = 0;
|
||||
}
|
||||
~INIReader() { }
|
||||
|
||||
@ -426,22 +443,54 @@ namespace mINI
|
||||
{
|
||||
private:
|
||||
std::ofstream fileWriteStream;
|
||||
std::stringstream memStream;
|
||||
|
||||
public:
|
||||
bool prettyPrint = false;
|
||||
|
||||
INIGenerator(std::string const& filename)
|
||||
: fileWriteStream(filename, std::ios::out | std::ios::binary),
|
||||
memStream(std::ios::out | std::ios::binary)
|
||||
{
|
||||
fileWriteStream.open(filename, std::ios::out | std::ios::binary);
|
||||
}
|
||||
~INIGenerator() { }
|
||||
|
||||
~INIGenerator()
|
||||
{
|
||||
const char *buf = memStream.str().c_str();
|
||||
int buf_size = static_cast<int>(memStream.tellg());
|
||||
|
||||
#ifdef RW_DC
|
||||
uint8_t *data;
|
||||
uint8_t icon_buf[512 * 3];
|
||||
vmu_pkg_t vmu_pkg = {
|
||||
.desc_short = "DCA3 Settings",
|
||||
.desc_long = "DCA3 Settings",
|
||||
.app_id = "DCA3",
|
||||
.icon_cnt = 3,
|
||||
.icon_anim_speed = 8,
|
||||
.data_len = buf_size,
|
||||
.icon_data = icon_buf,
|
||||
.data = reinterpret_cast<const uint8_t*>(buf),
|
||||
};
|
||||
|
||||
if (vmu_pkg_load_icon(&vmu_pkg, "settings.ico") < 0)
|
||||
vmu_pkg.icon_cnt = 0;
|
||||
|
||||
vmu_pkg_build(const_cast<vmu_pkg_t *>(&vmu_pkg), &data, &buf_size);
|
||||
buf = reinterpret_cast<char*>(data);
|
||||
#endif
|
||||
|
||||
fileWriteStream.write(buf, buf_size);
|
||||
}
|
||||
|
||||
bool operator<<(const std::string& str)
|
||||
{
|
||||
memStream << str;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator<<(INIStructure const& data)
|
||||
{
|
||||
if (!fileWriteStream.is_open())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!data.size())
|
||||
{
|
||||
return true;
|
||||
@ -451,13 +500,13 @@ namespace mINI
|
||||
{
|
||||
auto const& section = it->first;
|
||||
auto const& collection = it->second;
|
||||
fileWriteStream
|
||||
memStream
|
||||
<< "["
|
||||
<< section
|
||||
<< "]";
|
||||
if (collection.size())
|
||||
{
|
||||
fileWriteStream << INIStringUtil::endl;
|
||||
memStream << INIStringUtil::endl;
|
||||
auto it2 = collection.begin();
|
||||
for (;;)
|
||||
{
|
||||
@ -465,7 +514,7 @@ namespace mINI
|
||||
INIStringUtil::replace(key, "=", "\\=");
|
||||
auto value = it2->second;
|
||||
INIStringUtil::trim(value);
|
||||
fileWriteStream
|
||||
memStream
|
||||
<< key
|
||||
<< ((prettyPrint) ? " = " : "=")
|
||||
<< value;
|
||||
@ -473,21 +522,26 @@ namespace mINI
|
||||
{
|
||||
break;
|
||||
}
|
||||
fileWriteStream << INIStringUtil::endl;
|
||||
memStream << INIStringUtil::endl;
|
||||
}
|
||||
}
|
||||
if (++it == data.end())
|
||||
{
|
||||
break;
|
||||
}
|
||||
fileWriteStream << INIStringUtil::endl;
|
||||
memStream << INIStringUtil::endl;
|
||||
if (prettyPrint)
|
||||
{
|
||||
fileWriteStream << INIStringUtil::endl;
|
||||
memStream << INIStringUtil::endl;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return fileWriteStream.is_open();
|
||||
}
|
||||
};
|
||||
|
||||
class INIWriter
|
||||
@ -667,12 +721,15 @@ namespace mINI
|
||||
{
|
||||
struct stat buf;
|
||||
bool fileExists = (stat(filename.c_str(), &buf) == 0);
|
||||
|
||||
INIGenerator generator(filename);
|
||||
generator.prettyPrint = prettyPrint;
|
||||
|
||||
if (!fileExists)
|
||||
{
|
||||
INIGenerator generator(filename);
|
||||
generator.prettyPrint = prettyPrint;
|
||||
return generator << data;
|
||||
}
|
||||
|
||||
INIStructure originalData;
|
||||
T_LineDataPtr lineData;
|
||||
bool readSuccess = false;
|
||||
@ -688,20 +745,19 @@ namespace mINI
|
||||
return false;
|
||||
}
|
||||
T_LineData output = getLazyOutput(lineData, data, originalData);
|
||||
std::ofstream fileWriteStream(filename, std::ios::out | std::ios::binary);
|
||||
if (fileWriteStream.is_open())
|
||||
if (generator)
|
||||
{
|
||||
if (output.size())
|
||||
{
|
||||
auto line = output.begin();
|
||||
for (;;)
|
||||
{
|
||||
fileWriteStream << *line;
|
||||
generator << *line;
|
||||
if (++line == output.end())
|
||||
{
|
||||
break;
|
||||
}
|
||||
fileWriteStream << INIStringUtil::endl;
|
||||
generator << INIStringUtil::endl;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user