naomi: allow printing for f355/1 screen. Fix print template

f355 vanilla can print even when running with a single screen.
Fix print template by Ciopy Burns
Repeat print template vertically as needed for longer prints
No networking for f355 vanilla
This commit is contained in:
Flyinghead 2023-11-14 15:42:20 +01:00
parent 6de5879cb4
commit a0014bc810
4 changed files with 23 additions and 6 deletions

View file

@ -681,7 +681,7 @@ void naomi_cart_LoadRom(const std::string& path, const std::string& fileName, Lo
} }
if (gameId == " TOUCH DE UNOH -------------" if (gameId == " TOUCH DE UNOH -------------"
|| gameId == " TOUCH DE UNOH 2 -----------" || gameId == " TOUCH DE UNOH 2 -----------"
|| (gameId == "F355 CHALLENGE JAPAN" && config::MultiboardSlaves == 2)) || (gameId == "F355 CHALLENGE JAPAN" && (config::MultiboardSlaves == 2 || romName == "f355")))
{ {
printer::init(); printer::init();
} }

View file

@ -30,7 +30,9 @@
#undef INFO_LOG #undef INFO_LOG
#define INFO_LOG(t, s, ...) printf(s "\n", __VA_ARGS__) #define INFO_LOG(t, s, ...) printf(s "\n", __VA_ARGS__)
#undef NOTICE_LOG #undef NOTICE_LOG
#define NOTICE_LOG(t, s, ...) printf(s "\n", __VA_ARGS__) #define NOTICE_LOG INFO_LOG
#undef ERROR_LOG
#define ERROR_LOG INFO_LOG
#else #else
#include <cmrc/cmrc.hpp> #include <cmrc/cmrc.hpp>
CMRC_DECLARE(flycast); CMRC_DECLARE(flycast);
@ -329,7 +331,7 @@ public:
ERROR_LOG(NAOMI, "Failed to load the printer template: %s", e.what()); ERROR_LOG(NAOMI, "Failed to load the printer template: %s", e.what());
} }
#else #else
FILE *f = fopen("../resources/picture/f355_print_template.png", "rb"); FILE *f = fopen("f355_print_template.png", "rb");
if (f != nullptr) if (f != nullptr)
{ {
data = stbi_load_from_file(f, &x, &y, &comp, STBI_rgb_alpha); data = stbi_load_from_file(f, &x, &y, &comp, STBI_rgb_alpha);
@ -338,8 +340,23 @@ public:
else else
fprintf(stderr, "Can't open template file %d\n", errno); fprintf(stderr, "Can't open template file %d\n", errno);
#endif #endif
if (data != nullptr && (x != printerWidth || comp != STBI_rgb_alpha))
{
ERROR_LOG(NAOMI, "Invalid printer template: width %d comp %d", x, comp);
stbi_image_free(data);
data = nullptr;
}
if (data != nullptr) if (data != nullptr)
{ {
if (lines > y)
{
u8 *newData = (u8 *)malloc(printerWidth * 4 * lines);
const u8 *end = newData + printerWidth * 4 * lines;
for (u8 *p = newData; p < end; p += printerWidth * 4 * y)
memcpy(p, data, std::min(printerWidth * 4 * y, (int)(end - p)));
stbi_image_free(data);
data = newData;
}
u32 *p = (u32 *)data; u32 *p = (u32 *)data;
for (u8 b : page) for (u8 b : page)
{ {

View file

@ -370,7 +370,7 @@ void SetNaomiNetworkConfig(int node)
{ {
configure_maxspeed_flash(node != -1, node == 0); configure_maxspeed_flash(node != -1, node == 0);
} }
else if (gameId == "F355 CHALLENGE JAPAN") else if (gameId == "F355 CHALLENGE JAPAN" && settings.content.fileName != "f355")
{ {
write_naomi_flash(0x230, node == -1 ? 0 : node == 0 ? 1 : 2); write_naomi_flash(0x230, node == -1 ? 0 : node == 0 ? 1 : 2);
if (node != -1) if (node != -1)
@ -394,8 +394,8 @@ bool NaomiNetworkSupported()
}; };
if (!config::NetworkEnable) if (!config::NetworkEnable)
return false; return false;
if (settings.content.fileName.substr(0, 6) == "clubkp") if (settings.content.fileName.substr(0, 6) == "clubkp" || settings.content.fileName == "f355")
// Club Kart Prize doesn't support networking // Club Kart Prize and F355 (vanilla) don't support networking
return false; return false;
for (auto game : games) for (auto game : games)
if (settings.content.gameId == game) if (settings.content.gameId == game)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 891 KiB

After

Width:  |  Height:  |  Size: 890 KiB

Before After
Before After