Here is code for loading:
Code: Select all
static void load_egbb_library() {
	 HMODULE hmod;
	 __PLOAD_EGBB __load_egbb;
	 const char* main_path = option_get("Bitbase Path");
	 uint32_t egbb_cache_size = option_get_int("Bitbase Cache Size");
	 char path[256];
	 strcpy(path, main_path);
	 strcat(path, EGBB_NAME);
	 if (hmod)
		FreeLibrary(hmod);
	 if(hmod = LoadLibrary(path)) {
		__load_egbb = (__PLOAD_EGBB) GetProcAddress(hmod,"load_egbb_xmen");
		__probe_egbb = (__PROBE_EGBB) GetProcAddress(hmod,"probe_egbb_xmen");
		__load_egbb(main_path, egbb_cache_size, egbb_load_type);
		egbb_is_loaded = 1;
		printf("Bitbase loaded\n");
	 } else {
		//printf( "%d\n",GetLastError());
		egbb_is_loaded = 0;
		printf("Bitbase not loaded\n");
	 }
}Code: Select all
    if (egbb_is_loaded && (mat_info->flags & MatBitbaseFlag) != 0) {
        const sq_t *ptr;
        int32_t from;
        int32_t score;
		for (from=0; from < 64; ++from) {
			if (board->square[SQUARE_FROM_64(from)] == Empty) continue;
			
			switch (board->square[SQUARE_FROM_64(from)]) {
				case WP: ADD_PIECE(WPawn); break;
				case BP: ADD_PIECE(BPawn); break;
				case WN: ADD_PIECE(WKnight); break;
				case BN: ADD_PIECE(BKnight); break;
				case WB: ADD_PIECE(WBishop); break;
				case BB: ADD_PIECE(BBishop); break;
				case WR: ADD_PIECE(WRook); break;
				case BR: ADD_PIECE(BRook); break;
				case WQ: ADD_PIECE(WQueen); break;
				case BQ: ADD_PIECE(BQueen); break;
				case WK: egbb_square[0] = from; break;
				case BK: egbb_square[1] = from; break;
				default: break;
			}
			
		}
        ++tbhits;
        score = __probe_egbb(player, egbb_piece, egbb_square);
		if(score != NotFound) {
			if (score == 0) {
				return ValueDraw;
			} else {
				return score;
			}
		}
	}Code: Select all
score = __probe_egbb(player, egbb_piece, egbb_square);