#include <iostream>
#include <vector>
#include <string>
#include <fstream>

using namespace std;

int main() {
	vector <string> games;
	ifstream f("driverlist.h");
	bool valid = true;
	while(!f.eof()) {
		char line[2048];
		for(int i = 0; i < 2048; i++) line[i] = '\0';
		f.getline(line, 2048);
		string t = line;
		if(t == "#undef DRV") {
			break;
		}
		if(t == "#if defined FBA_DEBUG") {
			valid = false;
		}
		else if (t == "#endif") {
			valid = true;
		}
		else {
			if(valid) {
				if(t[0] == 'D' && t[1] == 'R' && t[2] == 'V') {
					games.push_back(t);
					games.push_back("\n");
				}
			}
		}

	}
	f.close();
		
	ofstream save("driverlist.txt");
	for(int i = 0; i < games.size(); i++) {
		save.write(games[i].c_str(), games[i].length());
	}
	save.close();

	//int n;
	//cin >> n;
	return 0;
}