Skip to content

Commit

Permalink
C2DUIRomList: use std::vector for files
Browse files Browse the repository at this point in the history
C2DUIRomList: fix invalid ptr
C2DUINXVideo: fix clear buffer
Io: use std::string for params
  • Loading branch information
Cpasjuste committed Jun 27, 2018
1 parent 47939f3 commit b347921
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/c2dui_romlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace c2dui {
std::vector<Rom *> list;
std::vector<Hardware> *hardwareList;
std::vector<std::string> *paths;
std::vector<std::string> files[C2DUI_ROMS_PATHS_MAX];
std::vector<std::vector<std::string>> files;
char icon_path[1024];
char text_str[512];
float time_start = 0;
Expand Down
12 changes: 6 additions & 6 deletions source/c2dui_romlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ C2DUIRomList::C2DUIRomList(C2DUIGuiMain *_ui, const std::string &emuVersion) {

for (unsigned int i = 0; i < paths->size(); i++) {
//printf("C2DUIRomList: path: `%s`\n", paths->at(i).c_str());
if (!paths[i].empty()) {
files[i] = ui->getIo()->getDirList(paths->at(i).c_str());
if (!paths->at(i).empty()) {
//printf("C2DUIRomList: getDirList(%s) - (path=%i)\n", paths->at(i).c_str(), (int) paths->at(i).size());
files.emplace_back(ui->getIo()->getDirList(paths->at(i)));
//printf("C2DUIRomList: found %i files in `%s`\n", (int) files[i].size(), paths->at(i).c_str());
} else {
files.emplace_back(std::vector<std::string>());
}
}
printf("C2DUIRomList()\n");
}

void C2DUIRomList::build() {
Expand All @@ -87,15 +91,11 @@ C2DUIRomList::~C2DUIRomList() {

printf("~C2DUIRomList()\n");

files->clear();

for (auto &rom : list) {
if (!rom->parent && rom->icon) {
delete (rom->icon);
rom->icon = nullptr;
}
delete (rom);
}

list.clear();
}
3 changes: 1 addition & 2 deletions source/c2dui_video_nx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ void C2DUINXVideo::clear() {

gfxFlushBuffers();
gfxSwapBuffers();
gfxWaitForVsync();
}

gfxWaitForVsync();
}

void C2DUINXVideo::draw(c2d::Transform &transform) {
Expand Down

0 comments on commit b347921

Please sign in to comment.