| 5338 | } |
| 5339 | |
| 5340 | static void floppybridge_init2(struct uae_prefs *p) |
| 5341 | { |
| 5342 | static const TCHAR *floppybridgeprofile = _T("FloppyBridge:"); |
| 5343 | bool needbridge = false; |
| 5344 | |
| 5345 | floppybridge_init3(); |
| 5346 | for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) { |
| 5347 | TCHAR *profile = p->floppyslots[i].dfxprofile; |
| 5348 | int type = p->floppyslots[i].dfxtype; |
| 5349 | if (type >= DRV_FB || !_tcsncmp(profile, floppybridgeprofile, _tcslen(floppybridgeprofile))) { |
| 5350 | needbridge = true; |
| 5351 | } |
| 5352 | } |
| 5353 | if (!needbridge) { |
| 5354 | for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { |
| 5355 | floppy[dr].bridge = NULL; |
| 5356 | if (bridges[dr]) { |
| 5357 | delete bridges[dr]; |
| 5358 | bridges[dr] = NULL; |
| 5359 | } |
| 5360 | } |
| 5361 | return; |
| 5362 | } |
| 5363 | for (int dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) { |
| 5364 | TCHAR *profile = p->floppyslots[dr].dfxprofile; |
| 5365 | if (!_tcsncmp(profile, floppybridgeprofile, _tcslen(floppybridgeprofile))) { |
| 5366 | profile += _tcslen(floppybridgeprofile); |
| 5367 | if (p->floppyslots[dr].dfxtype != DRV_FB) { |
| 5368 | p->floppyslots[dr].dfxtype = DRV_FB; |
| 5369 | changed_prefs.floppyslots[dr].dfxtype = DRV_FB; |
| 5370 | } |
| 5371 | } |
| 5372 | int type = p->floppyslots[dr].dfxtype; |
| 5373 | if (type == DRV_FB) { |
| 5374 | if (floppy[dr].bridge == NULL || type != bridge_type[dr]) { |
| 5375 | if (bridges[dr]) { |
| 5376 | bridges[dr]->shutdown(); |
| 5377 | delete bridges[dr]; |
| 5378 | bridges[dr] = NULL; |
| 5379 | } |
| 5380 | floppy[dr].bridge = NULL; |
| 5381 | bridge_driver[dr] = NULL; |
| 5382 | bridge_type[dr] = type; |
| 5383 | FloppyBridgeAPI *bridge = NULL; |
| 5384 | if (profile[0]) { |
| 5385 | char *a = ua(profile); |
| 5386 | bridge = FloppyBridgeAPI::createDriverFromString(a); |
| 5387 | if (!bridge) { |
| 5388 | write_log(_T("FB profile '%s' failed\n"), profile); |
| 5389 | } |
| 5390 | xfree(a); |
| 5391 | } |
| 5392 | if (!bridge) { |
| 5393 | const TCHAR *name = _tcschr(p->floppyslots[dr].dfxsubtypeid, ':'); |
| 5394 | if (name) { |
| 5395 | int id = _tstol(p->floppyslots[dr].dfxsubtypeid); |
| 5396 | name++; |
| 5397 | for (int i = 0; i < bridgeprofiles.size(); i++) { |
no test coverage detected