breaking-bad-ds/source/card.hpp
William cd9753f5f6
Fix line endings, bug, text & sound fixes (#8)
* Fix wrong line endings

* Fixup launch tasks

* Fixup nflib lib dir

* Fixup debugger, improve dialogue save tracking

* Fixup typo

* Improve stability of game end logic

* Dialogue text fixes

* Fix SFX bug on Hank's mineral screen

* Bump to 1.0.6

* Add SFX to cracking minigame
2023-11-22 01:04:19 +00:00

36 lines
776 B
C++

// This file is licensed under the GNU GPL 3.0
//
// Created by cervi on 28/09/2022.
//
#pragma once
#include <nds.h>
#include <cstdio>
#include <fat.h>
u8 cardCommand(u8 command, bool hold);
u8 cardTransfer(u8 data);
void cardWaitInProgress();
void cardReadBytes(u8* dst, u32 addr, u16 size);
void cardWriteBytes(u8* src, u32 addr, u16 size);
class CardBuffer {
public:
void open(const char* mode);
void close();
void read(void* data, size_t size);
void write(void* src, size_t size);
int tell() const;
void seek(s32 offset, u8 mode);
~CardBuffer() {close();}
private:
bool _running_in_fat;
int _pos = 0;
FILE* _fatFile = nullptr;
bool _opened = false;
};
extern CardBuffer fCard;
extern bool cardRead;
extern bool saveFailed;