diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-08-02 14:51:05 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-08-02 14:51:05 +0200 |
commit | f1893f9681ea82e146fdf3d2e9d3bba7b667f8fb (patch) | |
tree | 2cb1066ce40ae9b5730cdeec4e5885c5c43ae6f6 /ecp5/resource/embed.cc | |
parent | fc882d73d6511be4325a7b9c16d6833263c06b10 (diff) | |
download | nextpnr-f1893f9681ea82e146fdf3d2e9d3bba7b667f8fb.tar.gz nextpnr-f1893f9681ea82e146fdf3d2e9d3bba7b667f8fb.tar.bz2 nextpnr-f1893f9681ea82e146fdf3d2e9d3bba7b667f8fb.zip |
Add missing files and missing includes for MSVC
Diffstat (limited to 'ecp5/resource/embed.cc')
-rw-r--r-- | ecp5/resource/embed.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ecp5/resource/embed.cc b/ecp5/resource/embed.cc new file mode 100644 index 00000000..adbb7781 --- /dev/null +++ b/ecp5/resource/embed.cc @@ -0,0 +1,28 @@ +#include <cstdio> +#include <windows.h> +#include "nextpnr.h" +#include "resource.h" + +NEXTPNR_NAMESPACE_BEGIN + +const char *chipdb_blob_25k; +const char *chipdb_blob_45k; +const char *chipdb_blob_85k; + +const char *LoadFileInResource(int name, int type, DWORD &size) +{ + HMODULE handle = ::GetModuleHandle(NULL); + HRSRC rc = ::FindResource(handle, MAKEINTRESOURCE(name), MAKEINTRESOURCE(type)); + HGLOBAL rcData = ::LoadResource(handle, rc); + size = ::SizeofResource(handle, rc); + return static_cast<const char *>(::LockResource(rcData)); +} +void load_chipdb() +{ + DWORD size = 0; + chipdb_blob_25k = LoadFileInResource(IDR_CHIPDB_25K, BINARYFILE, size); + chipdb_blob_45k = LoadFileInResource(IDR_CHIPDB_45K, BINARYFILE, size); + chipdb_blob_85k = LoadFileInResource(IDR_CHIPDB_85K, BINARYFILE, size); +} + +NEXTPNR_NAMESPACE_END
\ No newline at end of file |