diff --git a/CMake/Modules/FindDirectX.cmake b/CMake/Modules/FindDirectX.cmake index 3628508098..348b28a604 100644 --- a/CMake/Modules/FindDirectX.cmake +++ b/CMake/Modules/FindDirectX.cmake @@ -13,12 +13,10 @@ if(NOT EXISTS "$ENV{DXSDK_DIR}") endif() set(DIRECTX_INCLUDE_SEARCH_PATHS - # TODO: Do not be limited to x86 in the future. "$ENV{DXSDK_DIR}/Include") set(DIRECTX_LIBRARY_SEARCH_PATHS - # TODO: Do not be limited to x86 in the future. - "$ENV{DXSDK_DIR}/Lib/x86") + "$ENV{DXSDK_DIR}/Lib/${SM_WIN32_ARCH}") find_path(DIRECTX_INCLUDE_DIR NAMES "DxErr.h" diff --git a/StepmaniaCore.cmake b/StepmaniaCore.cmake index 502085ac96..c51f169c06 100644 --- a/StepmaniaCore.cmake +++ b/StepmaniaCore.cmake @@ -156,6 +156,14 @@ check_type_size(pid_t SIZEOF_PID_T) check_type_size(size_t SIZEOF_SIZE_T) check_type_size(ssize_t SIZEOF_SSIZE_T) +if(WIN32) + if(SIZEOF_INTPTR_T EQUAL 8) + set(SM_WIN32_ARCH "x64") + else() + set(SM_WIN32_ARCH "x86") + endif() +endif() + include(TestBigEndian) test_big_endian(BIGENDIAN) if(${BIGENDIAN}) @@ -283,27 +291,38 @@ if(WIN32) # FFMPEG...it can be evil. find_library(LIB_SWSCALE NAMES "swscale" - PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" + PATHS "${SM_EXTERN_DIR}/ffmpeg/${SM_WIN32_ARCH}/lib" NO_DEFAULT_PATH) get_filename_component(LIB_SWSCALE ${LIB_SWSCALE} NAME) find_library(LIB_AVCODEC NAMES "avcodec" - PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" + PATHS "${SM_EXTERN_DIR}/ffmpeg/${SM_WIN32_ARCH}/lib" NO_DEFAULT_PATH) get_filename_component(LIB_AVCODEC ${LIB_AVCODEC} NAME) find_library(LIB_AVFORMAT NAMES "avformat" - PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" + PATHS "${SM_EXTERN_DIR}/ffmpeg/${SM_WIN32_ARCH}/lib" NO_DEFAULT_PATH) get_filename_component(LIB_AVFORMAT ${LIB_AVFORMAT} NAME) find_library(LIB_AVUTIL NAMES "avutil" - PATHS "${SM_EXTERN_DIR}/ffmpeg/lib" + PATHS "${SM_EXTERN_DIR}/ffmpeg/${SM_WIN32_ARCH}/lib" NO_DEFAULT_PATH) get_filename_component(LIB_AVUTIL ${LIB_AVUTIL} NAME) + + list(APPEND SM_FFMPEG_WIN32_DLLS + "avcodec-55.dll" + "avformat-55.dll" + "avutil-52.dll" + "swscale-2.dll" + ) + foreach(dll ${SM_FFMPEG_WIN32_DLLS}) + file(REMOVE "${SM_PROGRAM_DIR}/${dll}") + file(COPY "${SM_EXTERN_DIR}/ffmpeg/${SM_WIN32_ARCH}/bin/${dll}" DESTINATION "${SM_PROGRAM_DIR}/") + endforeach() endif() elseif(MACOSX) if(WITH_FFMPEG AND NOT WITH_SYSTEM_FFMPEG) diff --git a/extern/CMakeProject-mad.cmake b/extern/CMakeProject-mad.cmake index 4072d7f1bd..34277ef93a 100644 --- a/extern/CMakeProject-mad.cmake +++ b/extern/CMakeProject-mad.cmake @@ -62,9 +62,15 @@ else() # first glance. sm_add_compile_definition("mad" ASO_ZEROCHECK) sm_add_compile_definition("mad" $<$:FPM_DEFAULT>) - sm_add_compile_definition("mad" $<$:FPM_INTEL>) - sm_add_compile_definition("mad" $<$:FPM_INTEL>) - sm_add_compile_definition("mad" $<$:FPM_INTEL>) + if(SM_WIN32_ARCH MATCHES "x64") + sm_add_compile_definition("mad" $<$:FPM_64BIT>) + sm_add_compile_definition("mad" $<$:FPM_64BIT>) + sm_add_compile_definition("mad" $<$:FPM_64BIT>) + else() + sm_add_compile_definition("mad" $<$:FPM_INTEL>) + sm_add_compile_definition("mad" $<$:FPM_INTEL>) + sm_add_compile_definition("mad" $<$:FPM_INTEL>) + endif() # TODO: Provide a proper define for inline. sm_add_compile_definition("mad" inline=__inline) elseif(APPLE OR UNIX) diff --git a/extern/ffmpeg/x64/bin/avcodec-55.dll b/extern/ffmpeg/x64/bin/avcodec-55.dll new file mode 100644 index 0000000000..4d19dce2c3 Binary files /dev/null and b/extern/ffmpeg/x64/bin/avcodec-55.dll differ diff --git a/extern/ffmpeg/x64/bin/avformat-55.dll b/extern/ffmpeg/x64/bin/avformat-55.dll new file mode 100644 index 0000000000..c0afc4ac09 Binary files /dev/null and b/extern/ffmpeg/x64/bin/avformat-55.dll differ diff --git a/extern/ffmpeg/x64/bin/avutil-52.dll b/extern/ffmpeg/x64/bin/avutil-52.dll new file mode 100644 index 0000000000..bf6bf52931 Binary files /dev/null and b/extern/ffmpeg/x64/bin/avutil-52.dll differ diff --git a/extern/ffmpeg/x64/bin/swscale-2.dll b/extern/ffmpeg/x64/bin/swscale-2.dll new file mode 100644 index 0000000000..6fd326360c Binary files /dev/null and b/extern/ffmpeg/x64/bin/swscale-2.dll differ diff --git a/extern/ffmpeg/x64/lib/avcodec-55.def b/extern/ffmpeg/x64/lib/avcodec-55.def new file mode 100644 index 0000000000..4d964046f6 --- /dev/null +++ b/extern/ffmpeg/x64/lib/avcodec-55.def @@ -0,0 +1,281 @@ +EXPORTS + audio_resample + audio_resample_close + av_audio_convert + av_audio_convert_alloc + av_audio_convert_free + av_audio_resample_init + av_bitstream_filter_close + av_bitstream_filter_filter + av_bitstream_filter_init + av_bitstream_filter_next + av_codec_get_codec_descriptor + av_codec_get_lowres + av_codec_get_max_lowres + av_codec_get_pkt_timebase + av_codec_get_seek_preroll + av_codec_is_decoder + av_codec_is_encoder + av_codec_next + av_codec_set_codec_descriptor + av_codec_set_lowres + av_codec_set_pkt_timebase + av_codec_set_seek_preroll + av_copy_packet + av_copy_packet_side_data + av_dct_calc + av_dct_end + av_dct_init + av_destruct_packet + av_dup_packet + av_fast_malloc + av_fast_padded_malloc + av_fast_padded_mallocz + av_fast_realloc + av_fft_calc + av_fft_end + av_fft_init + av_fft_permute + av_free_packet + av_get_audio_frame_duration + av_get_bits_per_sample + av_get_codec_tag_string + av_get_exact_bits_per_sample + av_get_pcm_codec + av_get_profile_name + av_grow_packet + av_hwaccel_next + av_imdct_calc + av_imdct_half + av_init_packet + av_lockmgr_register + av_log_ask_for_sample + av_log_missing_feature + av_mdct_calc + av_mdct_end + av_mdct_init + av_new_packet + av_packet_copy_props + av_packet_free_side_data + av_packet_from_data + av_packet_get_side_data + av_packet_merge_side_data + av_packet_move_ref + av_packet_new_side_data + av_packet_ref + av_packet_shrink_side_data + av_packet_split_side_data + av_packet_unref + av_parser_change + av_parser_close + av_parser_init + av_parser_next + av_parser_parse2 + av_picture_copy + av_picture_crop + av_picture_pad + av_rdft_calc + av_rdft_end + av_rdft_init + av_register_bitstream_filter + av_register_codec_parser + av_register_hwaccel + av_resample + av_resample_close + av_resample_compensate + av_resample_init + av_shrink_packet + av_xiphlacing + available_bits + avcodec_align_dimensions + avcodec_align_dimensions2 + avcodec_alloc_context3 + avcodec_alloc_frame + avcodec_chroma_pos_to_enum + avcodec_close + avcodec_configuration + avcodec_copy_context + avcodec_decode_audio3 + avcodec_decode_audio4 + avcodec_decode_subtitle2 + avcodec_decode_video2 + avcodec_default_execute + avcodec_default_execute2 + avcodec_default_get_buffer + avcodec_default_get_buffer2 + avcodec_default_get_format + avcodec_default_reget_buffer + avcodec_default_release_buffer + avcodec_descriptor_get + avcodec_descriptor_get_by_name + avcodec_descriptor_next + avcodec_encode_audio + avcodec_encode_audio2 + avcodec_encode_subtitle + avcodec_encode_video + avcodec_encode_video2 + avcodec_enum_to_chroma_pos + avcodec_fill_audio_frame + avcodec_find_best_pix_fmt2 + avcodec_find_best_pix_fmt_of_2 + avcodec_find_best_pix_fmt_of_list + avcodec_find_decoder + avcodec_find_decoder_by_name + avcodec_find_encoder + avcodec_find_encoder_by_name + avcodec_flush_buffers + avcodec_free_frame + avcodec_get_chroma_sub_sample + avcodec_get_class + avcodec_get_context_defaults3 + avcodec_get_edge_width + avcodec_get_frame_class + avcodec_get_frame_defaults + avcodec_get_name + avcodec_get_pix_fmt_loss + avcodec_get_subtitle_rect_class + avcodec_get_type + avcodec_is_open + avcodec_license + avcodec_open2 + avcodec_pix_fmt_to_codec_tag + avcodec_register + avcodec_register_all + avcodec_set_dimensions + avcodec_string + avcodec_version + aver_isf_history + avpicture_alloc + avpicture_deinterlace + avpicture_fill + avpicture_free + avpicture_get_size + avpicture_layout + avpriv_aac_parse_header + avpriv_ac3_channel_layout_tab DATA + avpriv_ac3_parse_header + avpriv_adx_decode_header + avpriv_align_put_bits + avpriv_bprint_to_extradata + avpriv_color_frame + avpriv_copy_bits + avpriv_copy_pce_data + avpriv_dca_sample_rates DATA + avpriv_dirac_parse_sequence_header + avpriv_dnxhd_get_frame_size + avpriv_dsputil_init + avpriv_dv_codec_profile + avpriv_dv_frame_profile + avpriv_dv_frame_profile2 + avpriv_find_pix_fmt + avpriv_find_start_code + avpriv_flac_is_extradata_valid + avpriv_flac_parse_block_header + avpriv_flac_parse_streaminfo + avpriv_h264_has_num_reorder_frames + avpriv_lock_avformat + avpriv_mjpeg_bits_ac_chrominance DATA + avpriv_mjpeg_bits_ac_luminance DATA + avpriv_mjpeg_bits_dc_chrominance DATA + avpriv_mjpeg_bits_dc_luminance DATA + avpriv_mjpeg_val_ac_chrominance DATA + avpriv_mjpeg_val_ac_luminance DATA + avpriv_mjpeg_val_dc DATA + avpriv_mpa_bitrate_tab DATA + avpriv_mpa_decode_header + avpriv_mpa_freq_tab DATA + avpriv_mpeg4audio_get_config + avpriv_mpeg4audio_sample_rates DATA + avpriv_mpegaudio_decode_header + avpriv_put_string + avpriv_split_xiph_headers + avpriv_tak_parse_streaminfo + avpriv_toupper4 + avpriv_unlock_avformat + avpriv_vorbis_parse_extradata + avpriv_vorbis_parse_frame + avpriv_vorbis_parse_reset + avsubtitle_free + dsputil_init + ff_aanscales DATA + ff_dct32_fixed + ff_dct32_float + ff_dct32_float_avx DATA + ff_dct32_float_sse DATA + ff_dct32_float_sse2 DATA + ff_dct_common_init + ff_dct_encode_init + ff_dct_encode_init_x86 + ff_dct_end + ff_dct_init + ff_dct_init_x86 + ff_dct_quantize_c + ff_dnxhd_cid_table DATA + ff_dnxhd_get_cid_table + ff_dsputil_init + ff_faandct + ff_faandct248 + ff_faanidct + ff_faanidct_add + ff_faanidct_put + ff_fdct248_islow_10 + ff_fdct248_islow_8 + ff_fdct_ifast + ff_fdct_ifast248 + ff_fdct_mmx + ff_fdct_mmxext + ff_fdct_sse2 + ff_fft_calc_avx DATA + ff_fft_calc_sse DATA + ff_fft_end + ff_fft_end_fixed + ff_fft_end_fixed_32 + ff_fft_init + ff_fft_init_fixed + ff_fft_init_fixed_32 + ff_fft_init_x86 + ff_fft_lut_init + ff_fft_permute_sse DATA + ff_idct_xvid_mmx + ff_idct_xvid_mmx_add + ff_idct_xvid_mmx_put + ff_idct_xvid_mmxext + ff_idct_xvid_mmxext_add + ff_idct_xvid_mmxext_put + ff_idct_xvid_sse2 + ff_idct_xvid_sse2_add + ff_idct_xvid_sse2_put + ff_jpeg_fdct_islow_10 + ff_jpeg_fdct_islow_8 + ff_mdct_calc_c + ff_mdct_calc_c_fixed + ff_mdct_calc_c_fixed_32 + ff_mdct_calcw_c + ff_mdct_end + ff_mdct_end_fixed + ff_mdct_end_fixed_32 + ff_mdct_init + ff_mdct_init_fixed + ff_mdct_init_fixed_32 + ff_mdct_win_fixed DATA + ff_mdct_win_float DATA + ff_prores_idct_put_10_sse2 DATA + ff_raw_pix_fmt_tags DATA + ff_rdft_end + ff_rdft_init + ff_simple_idct248_put + ff_simple_idct44_add + ff_simple_idct48_add + ff_simple_idct84_add + ff_simple_idct_10 + ff_simple_idct_12 + ff_simple_idct_8 + ff_simple_idct_add_10 + ff_simple_idct_add_12 + ff_simple_idct_add_8 + ff_simple_idct_add_mmx + ff_simple_idct_mmx + ff_simple_idct_put_10 + ff_simple_idct_put_12 + ff_simple_idct_put_8 + ff_simple_idct_put_mmx diff --git a/extern/ffmpeg/x64/lib/avcodec.lib b/extern/ffmpeg/x64/lib/avcodec.lib new file mode 100644 index 0000000000..bcb7dd7e34 Binary files /dev/null and b/extern/ffmpeg/x64/lib/avcodec.lib differ diff --git a/extern/ffmpeg/lib/avdevice-55.def b/extern/ffmpeg/x64/lib/avdevice-55.def similarity index 100% rename from extern/ffmpeg/lib/avdevice-55.def rename to extern/ffmpeg/x64/lib/avdevice-55.def diff --git a/extern/ffmpeg/x64/lib/avdevice.lib b/extern/ffmpeg/x64/lib/avdevice.lib new file mode 100644 index 0000000000..cd0b0d4dc8 Binary files /dev/null and b/extern/ffmpeg/x64/lib/avdevice.lib differ diff --git a/extern/ffmpeg/lib/avfilter-3.def b/extern/ffmpeg/x64/lib/avfilter-3.def similarity index 100% rename from extern/ffmpeg/lib/avfilter-3.def rename to extern/ffmpeg/x64/lib/avfilter-3.def diff --git a/extern/ffmpeg/x64/lib/avfilter.lib b/extern/ffmpeg/x64/lib/avfilter.lib new file mode 100644 index 0000000000..7787a482fe Binary files /dev/null and b/extern/ffmpeg/x64/lib/avfilter.lib differ diff --git a/extern/ffmpeg/lib/avformat-55.def b/extern/ffmpeg/x64/lib/avformat-55.def similarity index 100% rename from extern/ffmpeg/lib/avformat-55.def rename to extern/ffmpeg/x64/lib/avformat-55.def diff --git a/extern/ffmpeg/x64/lib/avformat.lib b/extern/ffmpeg/x64/lib/avformat.lib new file mode 100644 index 0000000000..e1a8dba43b Binary files /dev/null and b/extern/ffmpeg/x64/lib/avformat.lib differ diff --git a/extern/ffmpeg/x64/lib/avutil-52.def b/extern/ffmpeg/x64/lib/avutil-52.def new file mode 100644 index 0000000000..e355c8157f --- /dev/null +++ b/extern/ffmpeg/x64/lib/avutil-52.def @@ -0,0 +1,418 @@ +EXPORTS + av_add_q + av_adler32_update + av_aes_alloc + av_aes_crypt + av_aes_init + av_aes_size DATA + av_asprintf + av_audio_fifo_alloc + av_audio_fifo_drain + av_audio_fifo_free + av_audio_fifo_read + av_audio_fifo_realloc + av_audio_fifo_reset + av_audio_fifo_size + av_audio_fifo_space + av_audio_fifo_write + av_base64_decode + av_base64_encode + av_basename + av_blowfish_crypt + av_blowfish_crypt_ecb + av_blowfish_init + av_bmg_get + av_bprint_append_data + av_bprint_channel_layout + av_bprint_chars + av_bprint_clear + av_bprint_escape + av_bprint_finalize + av_bprint_get_buffer + av_bprint_init + av_bprint_init_for_buffer + av_bprint_strftime + av_bprintf + av_buffer_alloc + av_buffer_allocz + av_buffer_create + av_buffer_default_free + av_buffer_get_opaque + av_buffer_get_ref_count + av_buffer_is_writable + av_buffer_make_writable + av_buffer_pool_get + av_buffer_pool_init + av_buffer_pool_uninit + av_buffer_realloc + av_buffer_ref + av_buffer_unref + av_calloc + av_channel_layout_extract_channel + av_compare_mod + av_compare_ts + av_cpu_count + av_crc + av_crc_get_table + av_crc_init + av_ctz + av_d2q + av_d2str + av_dbl2ext + av_dbl2int + av_default_get_category + av_default_item_name + av_des_crypt + av_des_init + av_des_mac + av_dict_copy + av_dict_count + av_dict_free + av_dict_get + av_dict_parse_string + av_dict_set + av_dirname + av_div_q + av_dynarray2_add + av_dynarray_add + av_escape + av_evaluate_lls + av_expr_eval + av_expr_free + av_expr_parse + av_expr_parse_and_eval + av_ext2dbl + av_fifo_alloc + av_fifo_drain + av_fifo_free + av_fifo_generic_read + av_fifo_generic_write + av_fifo_grow + av_fifo_realloc2 + av_fifo_reset + av_fifo_size + av_fifo_space + av_file_map + av_file_unmap + av_find_info_tag + av_find_nearest_q_idx + av_find_opt + av_flt2int + av_force_cpu_flags + av_frame_alloc + av_frame_clone + av_frame_copy_props + av_frame_free + av_frame_get_best_effort_timestamp + av_frame_get_buffer + av_frame_get_channel_layout + av_frame_get_channels + av_frame_get_color_range + av_frame_get_colorspace + av_frame_get_decode_error_flags + av_frame_get_metadata + av_frame_get_pkt_duration + av_frame_get_pkt_pos + av_frame_get_pkt_size + av_frame_get_plane_buffer + av_frame_get_qp_table + av_frame_get_sample_rate + av_frame_get_side_data + av_frame_is_writable + av_frame_make_writable + av_frame_move_ref + av_frame_new_side_data + av_frame_ref + av_frame_set_best_effort_timestamp + av_frame_set_channel_layout + av_frame_set_channels + av_frame_set_color_range + av_frame_set_colorspace + av_frame_set_decode_error_flags + av_frame_set_metadata + av_frame_set_pkt_duration + av_frame_set_pkt_pos + av_frame_set_pkt_size + av_frame_set_qp_table + av_frame_set_sample_rate + av_frame_unref + av_free + av_freep + av_gcd + av_get_alt_sample_fmt + av_get_bits_per_pixel + av_get_bits_per_sample_fmt + av_get_bytes_per_sample + av_get_channel_description + av_get_channel_layout + av_get_channel_layout_channel_index + av_get_channel_layout_nb_channels + av_get_channel_layout_string + av_get_channel_name + av_get_colorspace_name + av_get_cpu_flags + av_get_default_channel_layout + av_get_double + av_get_int + av_get_known_color_name + av_get_media_type_string + av_get_packed_sample_fmt + av_get_padded_bits_per_pixel + av_get_picture_type_char + av_get_pix_fmt + av_get_pix_fmt_name + av_get_pix_fmt_string + av_get_planar_sample_fmt + av_get_q + av_get_random_seed + av_get_sample_fmt + av_get_sample_fmt_name + av_get_sample_fmt_string + av_get_standard_channel_layout + av_get_string + av_get_token + av_gettime + av_hash_alloc + av_hash_final + av_hash_freep + av_hash_get_name + av_hash_get_size + av_hash_init + av_hash_names + av_hash_update + av_hmac_alloc + av_hmac_calc + av_hmac_final + av_hmac_free + av_hmac_init + av_hmac_update + av_image_alloc + av_image_check_size + av_image_copy + av_image_copy_plane + av_image_copy_to_buffer + av_image_fill_arrays + av_image_fill_linesizes + av_image_fill_max_pixsteps + av_image_fill_pointers + av_image_get_buffer_size + av_image_get_linesize + av_init_lls + av_int2dbl + av_int2flt + av_int_list_length_for_size + av_isdigit + av_isgraph + av_isspace + av_isxdigit + av_lfg_init + av_log + av_log2 + av_log2_16bit + av_log_default_callback + av_log_format_line + av_log_get_level + av_log_set_callback + av_log_set_flags + av_log_set_level + av_lzo1x_decode + av_malloc + av_mallocz + av_max_alloc + av_md5_alloc + av_md5_final + av_md5_init + av_md5_size DATA + av_md5_sum + av_md5_update + av_memcpy_backptr + av_memdup + av_mul_q + av_murmur3_alloc + av_murmur3_final + av_murmur3_init + av_murmur3_init_seeded + av_murmur3_update + av_nearer_q + av_next_option + av_opt_child_class_next + av_opt_child_next + av_opt_eval_double + av_opt_eval_flags + av_opt_eval_float + av_opt_eval_int + av_opt_eval_int64 + av_opt_eval_q + av_opt_find + av_opt_find2 + av_opt_flag_is_set + av_opt_free + av_opt_freep_ranges + av_opt_get + av_opt_get_channel_layout + av_opt_get_double + av_opt_get_image_size + av_opt_get_int + av_opt_get_key_value + av_opt_get_pixel_fmt + av_opt_get_q + av_opt_get_sample_fmt + av_opt_get_video_rate + av_opt_next + av_opt_ptr + av_opt_query_ranges + av_opt_query_ranges_default + av_opt_set + av_opt_set_bin + av_opt_set_channel_layout + av_opt_set_defaults + av_opt_set_defaults2 + av_opt_set_dict + av_opt_set_double + av_opt_set_from_string + av_opt_set_image_size + av_opt_set_int + av_opt_set_pixel_fmt + av_opt_set_q + av_opt_set_sample_fmt + av_opt_set_video_rate + av_opt_show2 + av_parse_color + av_parse_cpu_caps + av_parse_cpu_flags + av_parse_ratio + av_parse_time + av_parse_video_rate + av_parse_video_size + av_pix_fmt_count_planes + av_pix_fmt_desc_get + av_pix_fmt_desc_get_id + av_pix_fmt_desc_next + av_pix_fmt_descriptors DATA + av_pix_fmt_get_chroma_sub_sample + av_pix_fmt_swap_endianness + av_rc4_crypt + av_rc4_init + av_read_image_line + av_realloc + av_realloc_array + av_realloc_f + av_reallocp + av_reallocp_array + av_reduce + av_rescale + av_rescale_delta + av_rescale_q + av_rescale_q_rnd + av_rescale_rnd + av_reverse DATA + av_ripemd_alloc + av_ripemd_final + av_ripemd_init + av_ripemd_size DATA + av_ripemd_update + av_sample_fmt_is_planar + av_samples_alloc + av_samples_alloc_array_and_samples + av_samples_copy + av_samples_fill_arrays + av_samples_get_buffer_size + av_samples_set_silence + av_set_cpu_flags_mask + av_set_double + av_set_int + av_set_options_string + av_set_q + av_set_string3 + av_sha512_alloc + av_sha512_final + av_sha512_init + av_sha512_size DATA + av_sha512_update + av_sha_alloc + av_sha_final + av_sha_init + av_sha_size DATA + av_sha_update + av_small_strptime + av_solve_lls + av_strcasecmp + av_strdup + av_strerror + av_stristart + av_stristr + av_strlcat + av_strlcatf + av_strlcpy + av_strncasecmp + av_strnstr + av_strstart + av_strtod + av_strtok + av_sub_q + av_tempfile + av_timecode_adjust_ntsc_framenum2 + av_timecode_check_frame_rate + av_timecode_get_smpte_from_framenum + av_timecode_init + av_timecode_init_from_string + av_timecode_make_mpeg_tc_string + av_timecode_make_smpte_tc_string + av_timecode_make_string + av_timegm + av_tree_destroy + av_tree_enumerate + av_tree_find + av_tree_insert + av_tree_node_alloc + av_tree_node_size DATA + av_update_lls + av_usleep + av_vbprintf + av_vlog + av_write_image_line + av_xtea_crypt + av_xtea_init + avpriv_cga_font DATA + avpriv_emms_yasm DATA + avpriv_evaluate_lls + avpriv_float_dsp_init + avpriv_frame_get_metadatap + avpriv_init_lls + avpriv_init_lls2 + avpriv_open + avpriv_report_missing_feature + avpriv_request_sample + avpriv_scalarproduct_float_c + avpriv_set_systematic_pal2 + avpriv_solve_lls + avpriv_solve_lls2 + avpriv_update_lls + avpriv_vga16_font DATA + avutil_configuration + avutil_license + avutil_version + ff_butterflies_float_sse DATA + ff_check_pixfmt_descriptors + ff_cpu_cpuid DATA + ff_cpu_xgetbv DATA + ff_evaluate_lls_sse2 DATA + ff_float_dsp_init_x86 + ff_get_channel_layout + ff_get_cpu_flags_x86 + ff_init_lls_x86 + ff_log2_tab DATA + ff_scalarproduct_float_sse DATA + ff_update_lls_avx DATA + ff_update_lls_sse2 DATA + ff_vector_dmul_scalar_avx DATA + ff_vector_dmul_scalar_sse2 DATA + ff_vector_fmac_scalar_avx DATA + ff_vector_fmac_scalar_sse DATA + ff_vector_fmul_add_avx DATA + ff_vector_fmul_add_sse DATA + ff_vector_fmul_avx DATA + ff_vector_fmul_reverse_avx DATA + ff_vector_fmul_reverse_sse DATA + ff_vector_fmul_scalar_sse DATA + ff_vector_fmul_sse DATA diff --git a/extern/ffmpeg/x64/lib/avutil.lib b/extern/ffmpeg/x64/lib/avutil.lib new file mode 100644 index 0000000000..49f694ab7f Binary files /dev/null and b/extern/ffmpeg/x64/lib/avutil.lib differ diff --git a/extern/ffmpeg/x64/lib/libavcodec.dll.a b/extern/ffmpeg/x64/lib/libavcodec.dll.a new file mode 100644 index 0000000000..492bf7a74b Binary files /dev/null and b/extern/ffmpeg/x64/lib/libavcodec.dll.a differ diff --git a/extern/ffmpeg/x64/lib/libavdevice.dll.a b/extern/ffmpeg/x64/lib/libavdevice.dll.a new file mode 100644 index 0000000000..774224d52b Binary files /dev/null and b/extern/ffmpeg/x64/lib/libavdevice.dll.a differ diff --git a/extern/ffmpeg/x64/lib/libavfilter.dll.a b/extern/ffmpeg/x64/lib/libavfilter.dll.a new file mode 100644 index 0000000000..a355177a97 Binary files /dev/null and b/extern/ffmpeg/x64/lib/libavfilter.dll.a differ diff --git a/extern/ffmpeg/x64/lib/libavformat.dll.a b/extern/ffmpeg/x64/lib/libavformat.dll.a new file mode 100644 index 0000000000..01a6d29017 Binary files /dev/null and b/extern/ffmpeg/x64/lib/libavformat.dll.a differ diff --git a/extern/ffmpeg/x64/lib/libavutil.dll.a b/extern/ffmpeg/x64/lib/libavutil.dll.a new file mode 100644 index 0000000000..5f913f6108 Binary files /dev/null and b/extern/ffmpeg/x64/lib/libavutil.dll.a differ diff --git a/extern/ffmpeg/x64/lib/libpostproc.dll.a b/extern/ffmpeg/x64/lib/libpostproc.dll.a new file mode 100644 index 0000000000..31d988eece Binary files /dev/null and b/extern/ffmpeg/x64/lib/libpostproc.dll.a differ diff --git a/extern/ffmpeg/x64/lib/libswresample.dll.a b/extern/ffmpeg/x64/lib/libswresample.dll.a new file mode 100644 index 0000000000..867b8e2130 Binary files /dev/null and b/extern/ffmpeg/x64/lib/libswresample.dll.a differ diff --git a/extern/ffmpeg/x64/lib/libswscale.dll.a b/extern/ffmpeg/x64/lib/libswscale.dll.a new file mode 100644 index 0000000000..367d6d0e69 Binary files /dev/null and b/extern/ffmpeg/x64/lib/libswscale.dll.a differ diff --git a/extern/ffmpeg/lib/postproc-52.def b/extern/ffmpeg/x64/lib/postproc-52.def similarity index 100% rename from extern/ffmpeg/lib/postproc-52.def rename to extern/ffmpeg/x64/lib/postproc-52.def diff --git a/extern/ffmpeg/x64/lib/postproc.lib b/extern/ffmpeg/x64/lib/postproc.lib new file mode 100644 index 0000000000..b2d51f5a65 Binary files /dev/null and b/extern/ffmpeg/x64/lib/postproc.lib differ diff --git a/extern/ffmpeg/lib/swresample-0.def b/extern/ffmpeg/x64/lib/swresample-0.def similarity index 100% rename from extern/ffmpeg/lib/swresample-0.def rename to extern/ffmpeg/x64/lib/swresample-0.def diff --git a/extern/ffmpeg/x64/lib/swresample.lib b/extern/ffmpeg/x64/lib/swresample.lib new file mode 100644 index 0000000000..9b5ddd9972 Binary files /dev/null and b/extern/ffmpeg/x64/lib/swresample.lib differ diff --git a/extern/ffmpeg/lib/swscale-2.def b/extern/ffmpeg/x64/lib/swscale-2.def similarity index 100% rename from extern/ffmpeg/lib/swscale-2.def rename to extern/ffmpeg/x64/lib/swscale-2.def diff --git a/extern/ffmpeg/x64/lib/swscale.lib b/extern/ffmpeg/x64/lib/swscale.lib new file mode 100644 index 0000000000..461823911e Binary files /dev/null and b/extern/ffmpeg/x64/lib/swscale.lib differ diff --git a/Program/avcodec-55.dll b/extern/ffmpeg/x86/bin/avcodec-55.dll similarity index 100% rename from Program/avcodec-55.dll rename to extern/ffmpeg/x86/bin/avcodec-55.dll diff --git a/Program/avformat-55.dll b/extern/ffmpeg/x86/bin/avformat-55.dll similarity index 100% rename from Program/avformat-55.dll rename to extern/ffmpeg/x86/bin/avformat-55.dll diff --git a/Program/avutil-52.dll b/extern/ffmpeg/x86/bin/avutil-52.dll similarity index 100% rename from Program/avutil-52.dll rename to extern/ffmpeg/x86/bin/avutil-52.dll diff --git a/Program/swscale-2.dll b/extern/ffmpeg/x86/bin/swscale-2.dll similarity index 100% rename from Program/swscale-2.dll rename to extern/ffmpeg/x86/bin/swscale-2.dll diff --git a/extern/ffmpeg/lib/avcodec-55.def b/extern/ffmpeg/x86/lib/avcodec-55.def similarity index 100% rename from extern/ffmpeg/lib/avcodec-55.def rename to extern/ffmpeg/x86/lib/avcodec-55.def diff --git a/extern/ffmpeg/lib/avcodec.lib b/extern/ffmpeg/x86/lib/avcodec.lib similarity index 100% rename from extern/ffmpeg/lib/avcodec.lib rename to extern/ffmpeg/x86/lib/avcodec.lib diff --git a/extern/ffmpeg/x86/lib/avdevice-55.def b/extern/ffmpeg/x86/lib/avdevice-55.def new file mode 100644 index 0000000000..7fa3953f0b --- /dev/null +++ b/extern/ffmpeg/x86/lib/avdevice-55.def @@ -0,0 +1,5 @@ +EXPORTS + avdevice_configuration + avdevice_license + avdevice_register_all + avdevice_version diff --git a/extern/ffmpeg/lib/avdevice.lib b/extern/ffmpeg/x86/lib/avdevice.lib similarity index 100% rename from extern/ffmpeg/lib/avdevice.lib rename to extern/ffmpeg/x86/lib/avdevice.lib diff --git a/extern/ffmpeg/x86/lib/avfilter-3.def b/extern/ffmpeg/x86/lib/avfilter-3.def new file mode 100644 index 0000000000..63e0823e13 --- /dev/null +++ b/extern/ffmpeg/x86/lib/avfilter-3.def @@ -0,0 +1,261 @@ +EXPORTS + av_2_vs_pixel_format + av_abuffersink_params_alloc + av_buffersink_get_buffer_ref + av_buffersink_get_frame + av_buffersink_get_frame_flags + av_buffersink_get_frame_rate + av_buffersink_get_samples + av_buffersink_params_alloc + av_buffersink_poll_frame + av_buffersink_read + av_buffersink_read_samples + av_buffersink_set_frame_size + av_buffersrc_add_frame + av_buffersrc_add_frame_flags + av_buffersrc_add_ref + av_buffersrc_buffer + av_buffersrc_get_nb_failed_requests + av_buffersrc_write_frame + av_filter_next + avfilter_add_matrix + avfilter_af_aconvert DATA + avfilter_af_adelay DATA + avfilter_af_aecho DATA + avfilter_af_afade DATA + avfilter_af_afifo DATA + avfilter_af_aformat DATA + avfilter_af_ainterleave DATA + avfilter_af_allpass DATA + avfilter_af_amerge DATA + avfilter_af_amix DATA + avfilter_af_anull DATA + avfilter_af_apad DATA + avfilter_af_aperms DATA + avfilter_af_aphaser DATA + avfilter_af_aresample DATA + avfilter_af_aselect DATA + avfilter_af_asendcmd DATA + avfilter_af_asetnsamples DATA + avfilter_af_asetpts DATA + avfilter_af_asetrate DATA + avfilter_af_asettb DATA + avfilter_af_ashowinfo DATA + avfilter_af_asplit DATA + avfilter_af_astats DATA + avfilter_af_astreamsync DATA + avfilter_af_atempo DATA + avfilter_af_atrim DATA + avfilter_af_bandpass DATA + avfilter_af_bandreject DATA + avfilter_af_bass DATA + avfilter_af_biquad DATA + avfilter_af_channelmap DATA + avfilter_af_channelsplit DATA + avfilter_af_compand DATA + avfilter_af_earwax DATA + avfilter_af_ebur128 DATA + avfilter_af_equalizer DATA + avfilter_af_highpass DATA + avfilter_af_join DATA + avfilter_af_lowpass DATA + avfilter_af_pan DATA + avfilter_af_replaygain DATA + avfilter_af_silencedetect DATA + avfilter_af_treble DATA + avfilter_af_volume DATA + avfilter_af_volumedetect DATA + avfilter_all_channel_layouts DATA + avfilter_asink_abuffer DATA + avfilter_asink_anullsink DATA + avfilter_asink_ffabuffersink DATA + avfilter_asrc_abuffer DATA + avfilter_asrc_aevalsrc DATA + avfilter_asrc_anullsrc DATA + avfilter_asrc_sine DATA + avfilter_avf_avectorscope DATA + avfilter_avf_concat DATA + avfilter_avf_showspectrum DATA + avfilter_avf_showwaves DATA + avfilter_avsrc_amovie DATA + avfilter_avsrc_movie DATA + avfilter_config_links + avfilter_configuration + avfilter_copy_buf_props + avfilter_copy_buffer_ref_props + avfilter_copy_frame_props + avfilter_fill_frame_from_audio_buffer_ref + avfilter_fill_frame_from_buffer_ref + avfilter_fill_frame_from_video_buffer_ref + avfilter_free + avfilter_get_audio_buffer_ref_from_arrays + avfilter_get_audio_buffer_ref_from_arrays_channels + avfilter_get_audio_buffer_ref_from_frame + avfilter_get_buffer_ref_from_frame + avfilter_get_by_name + avfilter_get_class + avfilter_get_matrix + avfilter_get_video_buffer_ref_from_arrays + avfilter_get_video_buffer_ref_from_frame + avfilter_graph_add_filter + avfilter_graph_alloc + avfilter_graph_alloc_filter + avfilter_graph_config + avfilter_graph_create_filter + avfilter_graph_dump + avfilter_graph_free + avfilter_graph_get_filter + avfilter_graph_parse + avfilter_graph_parse2 + avfilter_graph_parse_ptr + avfilter_graph_queue_command + avfilter_graph_request_oldest + avfilter_graph_send_command + avfilter_graph_set_auto_convert + avfilter_init_dict + avfilter_init_filter + avfilter_init_str + avfilter_inout_alloc + avfilter_inout_free + avfilter_insert_filter + avfilter_license + avfilter_link + avfilter_link_free + avfilter_link_get_channels + avfilter_link_set_closed + avfilter_make_format64_list + avfilter_mul_matrix + avfilter_next + avfilter_open + avfilter_pad_count + avfilter_pad_get_name + avfilter_pad_get_type + avfilter_process_command + avfilter_ref_buffer + avfilter_ref_get_channels + avfilter_register + avfilter_register_all + avfilter_sub_matrix + avfilter_transform + avfilter_uninit + avfilter_unref_buffer + avfilter_unref_bufferp + avfilter_version + avfilter_vf_alphaextract DATA + avfilter_vf_alphamerge DATA + avfilter_vf_ass DATA + avfilter_vf_bbox DATA + avfilter_vf_blackdetect DATA + avfilter_vf_blackframe DATA + avfilter_vf_blend DATA + avfilter_vf_boxblur DATA + avfilter_vf_colorbalance DATA + avfilter_vf_colorchannelmixer DATA + avfilter_vf_colormatrix DATA + avfilter_vf_copy DATA + avfilter_vf_crop DATA + avfilter_vf_cropdetect DATA + avfilter_vf_curves DATA + avfilter_vf_dctdnoiz DATA + avfilter_vf_decimate DATA + avfilter_vf_delogo DATA + avfilter_vf_deshake DATA + avfilter_vf_drawbox DATA + avfilter_vf_drawgrid DATA + avfilter_vf_drawtext DATA + avfilter_vf_edgedetect DATA + avfilter_vf_extractplanes DATA + avfilter_vf_fade DATA + avfilter_vf_field DATA + avfilter_vf_fieldmatch DATA + avfilter_vf_fieldorder DATA + avfilter_vf_fifo DATA + avfilter_vf_format DATA + avfilter_vf_fps DATA + avfilter_vf_framestep DATA + avfilter_vf_frei0r DATA + avfilter_vf_geq DATA + avfilter_vf_gradfun DATA + avfilter_vf_haldclut DATA + avfilter_vf_hflip DATA + avfilter_vf_histeq DATA + avfilter_vf_histogram DATA + avfilter_vf_hqdn3d DATA + avfilter_vf_hue DATA + avfilter_vf_idet DATA + avfilter_vf_il DATA + avfilter_vf_interlace DATA + avfilter_vf_interleave DATA + avfilter_vf_kerndeint DATA + avfilter_vf_lut DATA + avfilter_vf_lut3d DATA + avfilter_vf_lutrgb DATA + avfilter_vf_lutyuv DATA + avfilter_vf_mcdeint DATA + avfilter_vf_mergeplanes DATA + avfilter_vf_mp DATA + avfilter_vf_mpdecimate DATA + avfilter_vf_negate DATA + avfilter_vf_noformat DATA + avfilter_vf_noise DATA + avfilter_vf_null DATA + avfilter_vf_overlay DATA + avfilter_vf_owdenoise DATA + avfilter_vf_pad DATA + avfilter_vf_perms DATA + avfilter_vf_perspective DATA + avfilter_vf_phase DATA + avfilter_vf_pixdesctest DATA + avfilter_vf_pp DATA + avfilter_vf_psnr DATA + avfilter_vf_pullup DATA + avfilter_vf_removelogo DATA + avfilter_vf_rotate DATA + avfilter_vf_sab DATA + avfilter_vf_scale DATA + avfilter_vf_select DATA + avfilter_vf_sendcmd DATA + avfilter_vf_separatefields DATA + avfilter_vf_setdar DATA + avfilter_vf_setfield DATA + avfilter_vf_setpts DATA + avfilter_vf_setsar DATA + avfilter_vf_settb DATA + avfilter_vf_showinfo DATA + avfilter_vf_smartblur DATA + avfilter_vf_split DATA + avfilter_vf_spp DATA + avfilter_vf_stereo3d DATA + avfilter_vf_subtitles DATA + avfilter_vf_super2xsai DATA + avfilter_vf_swapuv DATA + avfilter_vf_telecine DATA + avfilter_vf_thumbnail DATA + avfilter_vf_tile DATA + avfilter_vf_tinterlace DATA + avfilter_vf_transpose DATA + avfilter_vf_trim DATA + avfilter_vf_unsharp DATA + avfilter_vf_vflip DATA + avfilter_vf_vidstabdetect DATA + avfilter_vf_vidstabtransform DATA + avfilter_vf_vignette DATA + avfilter_vf_w3fdif DATA + avfilter_vf_yadif DATA + avfilter_vsink_buffer DATA + avfilter_vsink_ffbuffersink DATA + avfilter_vsink_nullsink DATA + avfilter_vsrc_buffer DATA + avfilter_vsrc_cellauto DATA + avfilter_vsrc_color DATA + avfilter_vsrc_frei0r_src DATA + avfilter_vsrc_haldclutsrc DATA + avfilter_vsrc_life DATA + avfilter_vsrc_mandelbrot DATA + avfilter_vsrc_mptestsrc DATA + avfilter_vsrc_nullsrc DATA + avfilter_vsrc_rgbtestsrc DATA + avfilter_vsrc_smptebars DATA + avfilter_vsrc_smptehdbars DATA + avfilter_vsrc_testsrc DATA + ff_default_query_formats diff --git a/extern/ffmpeg/lib/avfilter.lib b/extern/ffmpeg/x86/lib/avfilter.lib similarity index 100% rename from extern/ffmpeg/lib/avfilter.lib rename to extern/ffmpeg/x86/lib/avfilter.lib diff --git a/extern/ffmpeg/x86/lib/avformat-55.def b/extern/ffmpeg/x86/lib/avformat-55.def new file mode 100644 index 0000000000..da8f81ee66 --- /dev/null +++ b/extern/ffmpeg/x86/lib/avformat-55.def @@ -0,0 +1,152 @@ +EXPORTS + av_add_index_entry + av_append_packet + av_close_input_file + av_codec_get_id + av_codec_get_tag + av_codec_get_tag2 + av_convert_lang_to + av_demuxer_open + av_dump_format + av_filename_number_test + av_find_best_stream + av_find_default_stream_index + av_find_input_format + av_find_program_from_stream + av_find_stream_info + av_fmt_ctx_get_duration_estimation_method + av_format_get_audio_codec + av_format_get_probe_score + av_format_get_subtitle_codec + av_format_get_video_codec + av_format_set_audio_codec + av_format_set_subtitle_codec + av_format_set_video_codec + av_get_frame_filename + av_get_output_timestamp + av_get_packet + av_guess_codec + av_guess_format + av_guess_frame_rate + av_guess_sample_aspect_ratio + av_hex_dump + av_hex_dump_log + av_iformat_next + av_index_search_timestamp + av_interleaved_write_frame + av_match_ext + av_new_program + av_new_stream + av_oformat_next + av_pkt_dump2 + av_pkt_dump_log2 + av_probe_input_buffer + av_probe_input_buffer2 + av_probe_input_format + av_probe_input_format2 + av_probe_input_format3 + av_read_frame + av_read_packet + av_read_pause + av_read_play + av_register_all + av_register_input_format + av_register_output_format + av_register_rdt_dynamic_payload_handlers + av_register_rtp_dynamic_payload_handlers + av_sdp_create + av_seek_frame + av_set_pts_info + av_stream_get_r_frame_rate + av_stream_set_r_frame_rate + av_url_split + av_write_frame + av_write_trailer + avformat_alloc_context + avformat_alloc_output_context + avformat_alloc_output_context2 + avformat_close_input + avformat_configuration + avformat_find_stream_info + avformat_free_context + avformat_get_class + avformat_get_riff_audio_tags + avformat_get_riff_video_tags + avformat_license + avformat_match_stream_specifier + avformat_network_deinit + avformat_network_init + avformat_new_stream + avformat_open_input + avformat_query_codec + avformat_queue_attached_pictures + avformat_seek_file + avformat_version + avformat_write_header + avio_alloc_context + avio_check + avio_close + avio_close_dyn_buf + avio_closep + avio_enum_protocols + avio_flush + avio_get_str + avio_get_str16be + avio_get_str16le + avio_open + avio_open2 + avio_open_dyn_buf + avio_pause + avio_printf + avio_put_str + avio_put_str16le + avio_r8 + avio_rb16 + avio_rb24 + avio_rb32 + avio_rb64 + avio_read + avio_rl16 + avio_rl24 + avio_rl32 + avio_rl64 + avio_seek + avio_seek_time + avio_size + avio_skip + avio_w8 + avio_wb16 + avio_wb24 + avio_wb32 + avio_wb64 + avio_wl16 + avio_wl24 + avio_wl32 + avio_wl64 + avio_write + avpriv_dv_get_packet + avpriv_dv_init_demux + avpriv_dv_produce_packet + avpriv_new_chapter + avpriv_set_pts_info + ff_codec_get_id + ff_inet_aton + ff_mpegts_parse_close + ff_mpegts_parse_open + ff_mpegts_parse_packet + ff_rtp_get_local_rtcp_port + ff_rtp_get_local_rtp_port + ff_rtsp_parse_line + ff_socket_nonblock + ffio_open_dyn_packet_buf + ffio_set_buf_size + ffurl_close + ffurl_open + ffurl_protocol_next + ffurl_read_complete + ffurl_seek + ffurl_size + ffurl_write + get_crc_table + get_extension + url_feof diff --git a/extern/ffmpeg/lib/avformat.lib b/extern/ffmpeg/x86/lib/avformat.lib similarity index 100% rename from extern/ffmpeg/lib/avformat.lib rename to extern/ffmpeg/x86/lib/avformat.lib diff --git a/extern/ffmpeg/lib/avutil-52.def b/extern/ffmpeg/x86/lib/avutil-52.def similarity index 100% rename from extern/ffmpeg/lib/avutil-52.def rename to extern/ffmpeg/x86/lib/avutil-52.def diff --git a/extern/ffmpeg/lib/avutil.lib b/extern/ffmpeg/x86/lib/avutil.lib similarity index 100% rename from extern/ffmpeg/lib/avutil.lib rename to extern/ffmpeg/x86/lib/avutil.lib diff --git a/extern/ffmpeg/lib/libavcodec.dll.a b/extern/ffmpeg/x86/lib/libavcodec.dll.a similarity index 100% rename from extern/ffmpeg/lib/libavcodec.dll.a rename to extern/ffmpeg/x86/lib/libavcodec.dll.a diff --git a/extern/ffmpeg/lib/libavdevice.dll.a b/extern/ffmpeg/x86/lib/libavdevice.dll.a similarity index 100% rename from extern/ffmpeg/lib/libavdevice.dll.a rename to extern/ffmpeg/x86/lib/libavdevice.dll.a diff --git a/extern/ffmpeg/lib/libavfilter.dll.a b/extern/ffmpeg/x86/lib/libavfilter.dll.a similarity index 100% rename from extern/ffmpeg/lib/libavfilter.dll.a rename to extern/ffmpeg/x86/lib/libavfilter.dll.a diff --git a/extern/ffmpeg/lib/libavformat.dll.a b/extern/ffmpeg/x86/lib/libavformat.dll.a similarity index 100% rename from extern/ffmpeg/lib/libavformat.dll.a rename to extern/ffmpeg/x86/lib/libavformat.dll.a diff --git a/extern/ffmpeg/lib/libavutil.dll.a b/extern/ffmpeg/x86/lib/libavutil.dll.a similarity index 100% rename from extern/ffmpeg/lib/libavutil.dll.a rename to extern/ffmpeg/x86/lib/libavutil.dll.a diff --git a/extern/ffmpeg/lib/libpostproc.dll.a b/extern/ffmpeg/x86/lib/libpostproc.dll.a similarity index 100% rename from extern/ffmpeg/lib/libpostproc.dll.a rename to extern/ffmpeg/x86/lib/libpostproc.dll.a diff --git a/extern/ffmpeg/lib/libswresample.dll.a b/extern/ffmpeg/x86/lib/libswresample.dll.a similarity index 100% rename from extern/ffmpeg/lib/libswresample.dll.a rename to extern/ffmpeg/x86/lib/libswresample.dll.a diff --git a/extern/ffmpeg/lib/libswscale.dll.a b/extern/ffmpeg/x86/lib/libswscale.dll.a similarity index 100% rename from extern/ffmpeg/lib/libswscale.dll.a rename to extern/ffmpeg/x86/lib/libswscale.dll.a diff --git a/extern/ffmpeg/x86/lib/postproc-52.def b/extern/ffmpeg/x86/lib/postproc-52.def new file mode 100644 index 0000000000..4d8bbb4b3e --- /dev/null +++ b/extern/ffmpeg/x86/lib/postproc-52.def @@ -0,0 +1,10 @@ +EXPORTS + postproc_configuration + postproc_license + postproc_version + pp_free_context + pp_free_mode + pp_get_context + pp_get_mode_by_name_and_quality + pp_help DATA + pp_postprocess diff --git a/extern/ffmpeg/lib/postproc.lib b/extern/ffmpeg/x86/lib/postproc.lib similarity index 100% rename from extern/ffmpeg/lib/postproc.lib rename to extern/ffmpeg/x86/lib/postproc.lib diff --git a/extern/ffmpeg/x86/lib/swresample-0.def b/extern/ffmpeg/x86/lib/swresample-0.def new file mode 100644 index 0000000000..91b4c64a2e --- /dev/null +++ b/extern/ffmpeg/x86/lib/swresample-0.def @@ -0,0 +1,105 @@ +EXPORTS + ff_float_to_int16_a_sse2 DATA + ff_float_to_int16_u_sse2 DATA + ff_float_to_int32_a_sse2 DATA + ff_float_to_int32_u_sse2 DATA + ff_int16_to_float_a_sse2 DATA + ff_int16_to_float_u_sse2 DATA + ff_int16_to_int32_a_mmx DATA + ff_int16_to_int32_a_sse2 DATA + ff_int16_to_int32_u_mmx DATA + ff_int16_to_int32_u_sse2 DATA + ff_int32_to_float_a_avx DATA + ff_int32_to_float_a_sse2 DATA + ff_int32_to_float_u_avx DATA + ff_int32_to_float_u_sse2 DATA + ff_int32_to_int16_a_mmx DATA + ff_int32_to_int16_a_sse2 DATA + ff_int32_to_int16_u_mmx DATA + ff_int32_to_int16_u_sse2 DATA + ff_log2_tab DATA + ff_mix_1_1_a_float_avx DATA + ff_mix_1_1_a_float_sse DATA + ff_mix_1_1_a_int16_mmx DATA + ff_mix_1_1_a_int16_sse2 DATA + ff_mix_1_1_u_float_avx DATA + ff_mix_1_1_u_float_sse DATA + ff_mix_1_1_u_int16_mmx DATA + ff_mix_1_1_u_int16_sse2 DATA + ff_mix_2_1_a_float_avx DATA + ff_mix_2_1_a_float_sse DATA + ff_mix_2_1_a_int16_mmx DATA + ff_mix_2_1_a_int16_sse2 DATA + ff_mix_2_1_u_float_avx DATA + ff_mix_2_1_u_float_sse DATA + ff_mix_2_1_u_int16_mmx DATA + ff_mix_2_1_u_int16_sse2 DATA + ff_pack_2ch_float_to_int16_a_sse2 DATA + ff_pack_2ch_float_to_int16_u_sse2 DATA + ff_pack_2ch_float_to_int32_a_sse2 DATA + ff_pack_2ch_float_to_int32_u_sse2 DATA + ff_pack_2ch_int16_to_float_a_sse2 DATA + ff_pack_2ch_int16_to_float_u_sse2 DATA + ff_pack_2ch_int16_to_int16_a_sse2 DATA + ff_pack_2ch_int16_to_int16_u_sse2 DATA + ff_pack_2ch_int16_to_int32_a_sse2 DATA + ff_pack_2ch_int16_to_int32_u_sse2 DATA + ff_pack_2ch_int32_to_float_a_sse2 DATA + ff_pack_2ch_int32_to_float_u_sse2 DATA + ff_pack_2ch_int32_to_int16_a_sse2 DATA + ff_pack_2ch_int32_to_int16_u_sse2 DATA + ff_pack_2ch_int32_to_int32_a_sse2 DATA + ff_pack_2ch_int32_to_int32_u_sse2 DATA + ff_pack_6ch_float_to_float_a_avx DATA + ff_pack_6ch_float_to_float_a_mmx DATA + ff_pack_6ch_float_to_float_a_sse4 DATA + ff_pack_6ch_float_to_float_u_avx DATA + ff_pack_6ch_float_to_float_u_mmx DATA + ff_pack_6ch_float_to_float_u_sse4 DATA + ff_pack_6ch_float_to_int32_a_avx DATA + ff_pack_6ch_float_to_int32_a_sse4 DATA + ff_pack_6ch_float_to_int32_u_avx DATA + ff_pack_6ch_float_to_int32_u_sse4 DATA + ff_pack_6ch_int32_to_float_a_avx DATA + ff_pack_6ch_int32_to_float_a_sse4 DATA + ff_pack_6ch_int32_to_float_u_avx DATA + ff_pack_6ch_int32_to_float_u_sse4 DATA + ff_resample_int16_rounder DATA + ff_unpack_2ch_float_to_int16_a_sse2 DATA + ff_unpack_2ch_float_to_int16_u_sse2 DATA + ff_unpack_2ch_float_to_int32_a_sse2 DATA + ff_unpack_2ch_float_to_int32_u_sse2 DATA + ff_unpack_2ch_int16_to_float_a_sse2 DATA + ff_unpack_2ch_int16_to_float_a_ssse3 DATA + ff_unpack_2ch_int16_to_float_u_sse2 DATA + ff_unpack_2ch_int16_to_float_u_ssse3 DATA + ff_unpack_2ch_int16_to_int16_a_sse2 DATA + ff_unpack_2ch_int16_to_int16_a_ssse3 DATA + ff_unpack_2ch_int16_to_int16_u_sse2 DATA + ff_unpack_2ch_int16_to_int16_u_ssse3 DATA + ff_unpack_2ch_int16_to_int32_a_sse2 DATA + ff_unpack_2ch_int16_to_int32_a_ssse3 DATA + ff_unpack_2ch_int16_to_int32_u_sse2 DATA + ff_unpack_2ch_int16_to_int32_u_ssse3 DATA + ff_unpack_2ch_int32_to_float_a_sse2 DATA + ff_unpack_2ch_int32_to_float_u_sse2 DATA + ff_unpack_2ch_int32_to_int16_a_sse2 DATA + ff_unpack_2ch_int32_to_int16_u_sse2 DATA + ff_unpack_2ch_int32_to_int32_a_sse2 DATA + ff_unpack_2ch_int32_to_int32_u_sse2 DATA + swr_alloc + swr_alloc_set_opts + swr_convert + swr_drop_output + swr_free + swr_get_class + swr_get_delay + swr_init + swr_inject_silence + swr_next_pts + swr_set_channel_mapping + swr_set_compensation + swr_set_matrix + swresample_configuration + swresample_license + swresample_version diff --git a/extern/ffmpeg/lib/swresample.lib b/extern/ffmpeg/x86/lib/swresample.lib similarity index 100% rename from extern/ffmpeg/lib/swresample.lib rename to extern/ffmpeg/x86/lib/swresample.lib diff --git a/extern/ffmpeg/x86/lib/swscale-2.def b/extern/ffmpeg/x86/lib/swscale-2.def new file mode 100644 index 0000000000..d828ee38e9 --- /dev/null +++ b/extern/ffmpeg/x86/lib/swscale-2.def @@ -0,0 +1,37 @@ +EXPORTS + sws_addVec + sws_allocVec + sws_alloc_context + sws_cloneVec + sws_context_class DATA + sws_convVec + sws_convertPalette8ToPacked24 + sws_convertPalette8ToPacked32 + sws_format_name + sws_freeContext + sws_freeFilter + sws_freeVec + sws_getCachedContext + sws_getCoefficients + sws_getColorspaceDetails + sws_getConstVec + sws_getContext + sws_getDefaultFilter + sws_getGaussianVec + sws_getIdentityVec + sws_get_class + sws_init_context + sws_isSupportedEndiannessConversion + sws_isSupportedInput + sws_isSupportedOutput + sws_normalizeVec + sws_printVec2 + sws_rgb2rgb_init + sws_scale + sws_scaleVec + sws_setColorspaceDetails + sws_shiftVec + sws_subVec + swscale_configuration + swscale_license + swscale_version diff --git a/extern/ffmpeg/lib/swscale.lib b/extern/ffmpeg/x86/lib/swscale.lib similarity index 100% rename from extern/ffmpeg/lib/swscale.lib rename to extern/ffmpeg/x86/lib/swscale.lib diff --git a/extern/mad-0.15.1b/mad.h b/extern/mad-0.15.1b/mad.h index 9ef6cc8f70..e7ba33c47f 100644 --- a/extern/mad-0.15.1b/mad.h +++ b/extern/mad-0.15.1b/mad.h @@ -24,9 +24,11 @@ extern "C" { # endif +# if _WIN64 +# define FPM_64BIT +# else # define FPM_INTEL - - +# endif # define SIZEOF_INT 4 # define SIZEOF_LONG 4 diff --git a/src/ActorFrame.cpp b/src/ActorFrame.cpp index c9b62767f1..97b9433306 100644 --- a/src/ActorFrame.cpp +++ b/src/ActorFrame.cpp @@ -146,7 +146,7 @@ void ActorFrame::AddChild( Actor *pActor ) #endif ASSERT( pActor != nullptr ); - ASSERT( (void*)pActor != (void*)0xC0000005 ); + ASSERT( reinterpret_cast(pActor) != static_cast(0xC0000005) ); m_SubActors.push_back( pActor ); pActor->SetParent( this ); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index da33e8f4b3..dd837b2014 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,744 +1,746 @@ -file(MAKE_DIRECTORY "${SM_SRC_DIR}/generated") - -if(MSVC) - # Add the mapconv program of the past to allow for debugging information. - include("CMakeProject-mapconv.cmake") - if(WITH_IRC_POST_HOOK) - include("CMakeProject-irc.cmake") - endif() - if(WITH_TEXTURE_GENERATOR OR WITH_FULL_RELEASE) - include("CMakeProject-texture.cmake") - endif() -endif() - -# Keep the module path local for easier grabbing. -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) - -# Main project is below. - -include(CMakeData-arch.cmake) -include(CMakeData-rage.cmake) -include(CMakeData-os.cmake) -include(CMakeData-actor.cmake) -include(CMakeData-screen.cmake) -include(CMakeData-data.cmake) -include(CMakeData-gtk.cmake) -include(CMakeData-file-types.cmake) -include(CMakeData-globals.cmake) -include(CMakeData-singletons.cmake) - -list(APPEND SMDATA_ALL_FILES_SRC - ${SMDATA_GLOBAL_FILES_SRC} - ${SMDATA_GLOBAL_SINGLETON_SRC} - ${SMDATA_ALL_ACTORS_SRC} - ${SMDATA_ALL_ARCH_SRC} - ${SMDATA_ALL_DATA_SRC} - ${SMDATA_ALL_RAGE_SRC} - ${SMDATA_ALL_SCREENS_SRC} - ${SMDATA_OS_SRC} - ${SMDATA_FILE_TYPES_SRC}) -list(APPEND SMDATA_ALL_FILES_HPP - ${SMDATA_GLOBAL_FILES_HPP} - ${SMDATA_GLOBAL_SINGLETON_HPP} - ${SMDATA_ALL_ACTORS_HPP} - ${SMDATA_ALL_ARCH_HPP} - ${SMDATA_ALL_DATA_HPP} - ${SMDATA_ALL_RAGE_HPP} - ${SMDATA_ALL_SCREENS_HPP} - ${SMDATA_OS_HPP} - ${SMDATA_FILE_TYPES_HPP}) - -if(NOT APPLE) - list(APPEND SMDATA_ALL_FILES_SRC "Main.cpp") - source_group("" FILES "Main.cpp") -endif() - -if(MSVC OR APPLE) - set(SM_NAME_RELEASE "StepMania") - set(SM_NAME_DEBUG "StepMania-debug") - set(SM_NAME_MINSIZEREL "StepMania-min-size") - set(SM_NAME_RELWITHDEBINFO "StepMania-release-symbols") -else() - set(SM_NAME_RELEASE "stepmania") - set(SM_NAME_DEBUG "stepmania-debug") - set(SM_NAME_MINSIZEREL "stepmania-min-size") - set(SM_NAME_RELWITHDEBINFO "stepmania-release-symbols") -endif() - -# Configure generated files here. -configure_file("${SM_XCODE_DIR}/Info.plist.in.xml" - "${SM_XCODE_DIR}/Info.StepMania.plist") -configure_file("${SM_XCODE_DIR}/plistHelper.in.hpp" - "${SM_XCODE_DIR}/plistHelper.hpp") - -# TODO: Make this actually be data and not an executable. -if(APPLE) - set(MACOSX_BUNDLE_BUNDLE_NAME ${SM_EXE_NAME}) - add_executable("${SM_EXE_NAME}" - MACOSX_BUNDLE - ${SMDATA_ALL_FILES_SRC} - ${SMDATA_ALL_FILES_HPP}) - set_target_properties("${SM_EXE_NAME}" PROPERTIES MACOSX_BUNDLE TRUE) -else() - if(MSVC) - foreach(sm_src_file ${SMDATA_ALL_FILES_SRC}) - get_filename_component(sm_src_raw "${sm_src_file}" NAME_WE) - if(${sm_src_raw} MATCHES "global") - set_source_files_properties("${sm_src_raw}.cpp" - PROPERTIES - COMPILE_FLAGS - "/Ycglobal.h") - elseif(NOT (${sm_src_raw} MATCHES "verstub")) - set_source_files_properties("${sm_src_raw}.cpp" - PROPERTIES - COMPILE_FLAGS - "/Yuglobal.h") - endif() - endforeach() - endif() - add_executable("${SM_EXE_NAME}" ${SMDATA_ALL_FILES_SRC} - ${SMDATA_ALL_FILES_HPP}) -endif() - -set_target_properties("${SM_EXE_NAME}" - PROPERTIES OUTPUT_NAME - "${SM_NAME_RELEASE}" - RELEASE_OUTPUT_NAME - "${SM_NAME_RELEASE}" - DEBUG_OUTPUT_NAME - "${SM_NAME_DEBUG}" - MINSIZEREL_OUTPUT_NAME - "${SM_NAME_MINSIZEREL}" - RELWITHDEBINFO_OUTPUT_NAME - "${SM_NAME_RELWITHDEBINFO}") - -if(WITH_PORTABLE_TOMCRYPT) - sm_add_compile_definition("${SM_EXE_NAME}" LTC_NO_ASM) -endif() -if(WITH_NO_ROLC_TOMCRYPT) - sm_add_compile_definition("${SM_EXE_NAME}" LTC_NO_ROLC) -endif() - -sm_add_compile_definition("${SM_EXE_NAME}" CMAKE_POWERED) - -if(NOT WITH_NETWORKING) - sm_add_compile_definition("${SM_EXE_NAME}" WITHOUT_NETWORKING) -endif() - -# Compilation flags per project here. -sm_add_compile_definition("${SM_EXE_NAME}" $<$:DEBUG>) -sm_add_compile_definition("${SM_EXE_NAME}" $<$:RELEASE>) -sm_add_compile_definition("${SM_EXE_NAME}" $<$:MINSIZEREL>) -sm_add_compile_definition("${SM_EXE_NAME}" - $<$:RELWITHDEBINFO>) - -set(SM_COMPILE_FLAGS "") - -if(WITH_SSE2) - if(MSVC) - set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} /arch:SSE2") - else() - set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} -msse2") - endif() -endif() - -if(WITH_LTO) - if(MSVC) - set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} /GL") - else() - set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} -flto") - endif() -endif() - -if(MSVC) - # TODO: Find a way to do this cleanly for non MSVC users. - set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} /MP2") -endif() - -set_target_properties("${SM_EXE_NAME}" - PROPERTIES COMPILE_FLAGS "${SM_COMPILE_FLAGS}") - -set_target_properties("${SM_EXE_NAME}" - PROPERTIES OUTPUT_NAME_DEBUG - "${SM_NAME_DEBUG}" - OUTPUT_NAME_MINSIZEREL - "${SM_NAME_MINSIZEREL}" - OUTPUT_NAME_RELWITHDEBINFO - "${SM_NAME_RELWITHDEBINFO}") - -list(APPEND SM_WINDOWS_PROGRAM_DLLS - "${SM_PROGRAM_DIR}/avcodec-55.dll" - "${SM_PROGRAM_DIR}/avformat-55.dll" - "${SM_PROGRAM_DIR}/avutil-52.dll" - "${SM_PROGRAM_DIR}/parallel_lights_io.dll" - "${SM_PROGRAM_DIR}/swscale-2.dll") - -if(WIN32) - sm_add_compile_definition("${SM_EXE_NAME}" WINDOWS) - sm_add_compile_definition("${SM_EXE_NAME}" _WINDOWS) # TODO: Remove this - # potential duplicate. - sm_add_compile_definition("${SM_EXE_NAME}" _CRT_SECURE_NO_WARNINGS) - sm_add_compile_definition("${SM_EXE_NAME}" _WINSOCK_DEPRECATED_NO_WARNINGS) - sm_add_compile_definition("${SM_EXE_NAME}" GLEW_STATIC) - - set_target_properties("${SM_EXE_NAME}" - PROPERTIES RUNTIME_OUTPUT_DIRECTORY - "${SM_PROGRAM_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELEASE - "${SM_PROGRAM_DIR}" - RUNTIME_OUTPUT_DIRECTORY_DEBUG - "${SM_PROGRAM_DIR}" - RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL - "${SM_PROGRAM_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO - "${SM_PROGRAM_DIR}") - - if(MSVC) - # Allow for getting a virtualdub stack trace. - add_custom_command( - TARGET "${SM_EXE_NAME}" POST_BUILD - COMMAND - "mapconv" - "${SM_PROGRAM_DIR}/$<$:${SM_NAME_DEBUG}>$<$:${SM_NAME_MINSIZEREL}>$<$:${SM_NAME_RELWITHDEBINFO}>$<$:${SM_NAME_RELEASE}>.map" - "${SM_PROGRAM_DIR}/$<$:${SM_NAME_DEBUG}>$<$:${SM_NAME_MINSIZEREL}>$<$:${SM_NAME_RELWITHDEBINFO}>$<$:${SM_NAME_RELEASE}>.vdi" - COMMENT "Generating file to allow for easier stack traces.") - endif() -elseif(APPLE) - sm_add_compile_definition("${SM_EXE_NAME}" BACKTRACE_METHOD_X86_DARWIN) - sm_add_compile_definition("${SM_EXE_NAME}" MACOSX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 -stdlib=libc++") - set_target_properties( - "${SM_EXE_NAME}" - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY - "${SM_ROOT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELEASE - "${SM_ROOT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_DEBUG - "${SM_ROOT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL - "${SM_ROOT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO - "${SM_ROOT_DIR}" - MACOSX_BUNDLE_INFO_PLIST - "${SM_XCODE_DIR}/Info.StepMania.plist" - XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD - "${SM_CPP_STANDARD}" - XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY - "libc++" - XCODE_ATTRIBUTE_INFOPLIST_FILE - "${SM_XCODE_DIR}/Info.StepMania.plist" - XCODE_ATTRIBUTE_INFOPLIST_PREPROCESS - "YES" - XCODE_ATTRIBUTE_INFOPLIST_PREPROCESSOR_DEFINITIONS[variant=Release] - "RELEASE" - XCODE_ATTRIBUTE_INFOPLIST_PREPROCESSOR_DEFINITIONS[variant=Debug] - "DEBUG" - XCODE_ATTRIBUTE_INFOPLIST_PREPROCESSOR_DEFINITIONS[variant=MinSizeRel] - "MINSIZEREL" - XCODE_ATTRIBUTE_INFOPLIST_PREPROCESSOR_DEFINITIONS[variant=RelWithDebInfo] - "RELWITHDEBINFO" - XCODE_ATTRIBUTE_INFOPLIST_PREFIX_HEADER - "${SM_XCODE_DIR}/plistHelper.hpp" - XCODE_ATTRIBUTE_GCC_PREFIX_HEADER - "${CMAKE_CURRENT_SOURCE_DIR}/archutils/Darwin/StepMania.pch" - XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS - "NO" - XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS - "${SM_XCODE_DIR}/Libraries") - - sm_add_compile_definition("${SM_EXE_NAME}" _XOPEN_SOURCE) - - if(${HAS_FFMPEG}) - sm_add_compile_definition("${SM_EXE_NAME}" HAVE_FFMPEG) - endif() - - if(CMAKE_BUILD_TYPE EQUAL "Debug") - set(SM_APP_RELEASE_NAME "${SM_NAME_DEBUG}") - elseif(CMAKE_BUILD_TYPE EQUAL "MinSizeRel") - set(SM_APP_RELEASE_NAME "${SM_NAME_MINSIZEREL}") - elseif(CMAKE_BUILD_TYPE EQUAL "RelWithDebInfo") - set(SM_APP_RELEASE_NAME "${SM_NAME_RELWITHDEBINFO}") - else() - set(SM_APP_RELEASE_NAME "${SM_NAME_RELEASE}") - endif() - if(WITH_FULL_RELEASE) - string(CONCAT SM_NAME_VERSION - "${SM_EXE_NAME}" - "-" - "${SM_VERSION_TRADITIONAL}") - set(SM_DMG_VERSION "${SM_VERSION_TRADITIONAL}") - else() - string(CONCAT SM_NAME_VERSION - "${SM_EXE_NAME}" - "-" - "${SM_VERSION_FULL}") - set(SM_DMG_VERSION "${SM_VERSION_FULL}") - endif() - set(SM_DMG_RELEASE_NAME "${SM_NAME_VERSION}-mac.dmg") - - add_custom_target(dmg - COMMAND pushd ${SM_ROOT_DIR}\; mkdir -p dmgtmpdir\; cd - dmgtmpdir\; mkdir -p ${SM_NAME_VERSION}\; cd - ${SM_NAME_VERSION}\; mkdir -p ${SM_NAME_VERSION}\; cd - ${SM_NAME_VERSION}\; cp -R - "${SM_ROOT_DIR}/Announcers" .\; cp -R - "${SM_ROOT_DIR}/BackgroundEffects" .\; cp -R - "${SM_ROOT_DIR}/BackgroundTransitions" .\; cp -R - "${SM_ROOT_DIR}/BGAnimations" .\; cp -R - "${SM_ROOT_DIR}/Characters" .\; cp -R - "${SM_ROOT_DIR}/Courses" .\; cp -R - "${SM_ROOT_DIR}/Data" .\; cp -R - "${SM_ROOT_DIR}/Docs" .\; cp -R - "${SM_ROOT_DIR}/Manual" .\; cp -R - "${SM_ROOT_DIR}/NoteSkins" .\; cp -R - "${SM_ROOT_DIR}/Scripts" .\; cp -R - "${SM_ROOT_DIR}/Songs" .\; cp -R - "${SM_ROOT_DIR}/Themes" .\; cp -R - "${SM_ROOT_DIR}/${SM_APP_RELEASE_NAME}.app" .\; cd - ${SM_ROOT_DIR}\; hdiutil create - "${SM_DMG_RELEASE_NAME}" -VOLNAME - "StepMania ${SM_DMG_VERSION}" -SRCFOLDER - "dmgtmpdir/${SM_NAME_VERSION}/" -OV\; rm -fR - dmgtmpdir\; popd\;) - - # Add the ability to copy the resource file. - add_custom_command(TARGET "${SM_EXE_NAME}" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory - "$/../Resources" - COMMAND ${CMAKE_COMMAND} -E copy - "${SM_XCODE_DIR}/smicon.icns" - "$/../Resources/" - COMMAND ${CMAKE_COMMAND} -E copy - "${SM_XCODE_DIR}/Hardware.plist" - "$/../Resources/") -else() # Linux - set_target_properties("${SM_EXE_NAME}" - PROPERTIES RUNTIME_OUTPUT_DIRECTORY - "${SM_ROOT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELEASE - "${SM_ROOT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_DEBUG - "${SM_ROOT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL - "${SM_ROOT_DIR}" - RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO - "${SM_ROOT_DIR}") - - if(${WITH_CRASH_HANDLER}) - sm_add_compile_definition("${SM_EXE_NAME}" CRASH_HANDLER) - if(LINUX) - # used only in the ArchHooks_Unix.cpp file - sm_add_compile_definition("${SM_EXE_NAME}" BACKTRACE_METHOD_X86_LINUX) - sm_add_compile_definition("${SM_EXE_NAME}" - BACKTRACE_METHOD_TEXT="x86 custom backtrace") - sm_add_compile_definition( - "${SM_EXE_NAME}" BACKTRACE_LOOKUP_METHOD_TEXT="backtrace_symbols") - if(${DL_FOUND}) - sm_add_compile_definition("${SM_EXE_NAME}" - BACKTRACE_LOOKUP_METHOD_DLADDR) - else() - sm_add_compile_definition("${SM_EXE_NAME}" - BACKTRACE_LOOKUP_METHOD_BACKTRACE_SYMBOLS) - endif() - endif() - endif() - if(${HAS_PTHREAD}) - sm_add_compile_definition("${SM_EXE_NAME}" HAVE_LIBPTHREAD) - - message("Host processor is ${CMAKE_SYSTEM_PROCESSOR}") - if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") - message("Host processor is 64bit") - sm_add_compile_definition("${SM_EXE_NAME}" CPU_X86_64) - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86" - OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686") - message("Host processor is 32bit") - sm_add_compile_definition("${SM_EXE_NAME}" CPU_X86) - else() - message("Unrecognized host processor type") - endif() - endif() - if(${HAS_FFMPEG}) - sm_add_compile_definition("${SM_EXE_NAME}" HAVE_FFMPEG) - endif() - if(${HAS_XRANDR}) - sm_add_compile_definition("${SM_EXE_NAME}" HAVE_XRANDR) - endif() - if(${HAS_XINERAMA}) - sm_add_compile_definition("${SM_EXE_NAME}" HAVE_XINERAMA) - endif() - - if(BSD) - sm_add_compile_definition("${SM_EXE_NAME}" BSD) - endif() - - if(GTK2_FOUND) - sm_add_compile_definition("${SM_EXE_NAME}" HAVE_GTK) - endif() - - sm_add_compile_definition("${SM_EXE_NAME}" UNIX) - if("${CMAKE_SYSTEM}" MATCHES "Linux") - sm_add_compile_definition("${SM_EXE_NAME}" LINUX) - endif() - - sm_add_compile_flag("${SM_EXE_NAME}" "-std=${SM_CPP_STANDARD}") - if(CMAKE_CXX_COMPILER MATCHES "clang") - sm_add_compile_flag("${SM_EXE_NAME}" "-stdlib=libc++") - set_target_properties("${SM_EXE_NAME}" - PROPERTIES LINK_FLAGS "-stdlib=libc++") - sm_add_compile_flag("jsoncpp" "-stdlib=libc++") - endif() -endif() - -set_property(TARGET "${SM_EXE_NAME}" PROPERTY FOLDER "Internal Libraries") - -list(APPEND SMDATA_LINK_LIB "lua-5.1") -include(../extern/CMakeProject-mmmagic.cmake) - -if(HAS_MP3) - if(WITH_SYSTEM_MAD) - list(APPEND SMDATA_LINK_LIB ${LIBMAD_LIBRARY}) - else() - list(APPEND SMDATA_LINK_LIB "mad") - endif() -endif() - -if(WITH_SYSTEM_PCRE) - list(APPEND SMDATA_LINK_LIB ${PCRE_LIBRARY}) -else() - list(APPEND SMDATA_LINK_LIB "pcre") -endif() - -if(WITH_SYSTEM_GLEW) - list(APPEND SMDATA_LINK_LIB ${GLEW_LIBRARIES} ${GLEW_LIBRARY_RELEASE}) - list(APPEND SM_INCLUDE_DIRS ${GLEW_INCLUDE_DIRS}) -else() - list(APPEND SMDATA_LINK_LIB "glew") -endif() - -if(WITH_SYSTEM_TOMCRYPT) - list(APPEND SMDATA_LINK_LIB ${TOMCRYPT_LIBRARY}) -else() - list(APPEND SMDATA_LINK_LIB "tomcrypt") -endif() - -if(WITH_SYSTEM_TOMMATH) - list(APPEND SMDATA_LINK_LIB ${TOMMATH_LIBRARY}) -else() - list(APPEND SMDATA_LINK_LIB "tommath") -endif() - -if(WITH_SYSTEM_JPEG) - sm_add_compile_definition("${SM_EXE_NAME}" SYSTEM_JPEGLIB) - list(APPEND SMDATA_LINK_LIB ${JPEG_LIBRARIES}) -else() - list(APPEND SMDATA_LINK_LIB "jpeg") -endif() - -if(WITH_SYSTEM_ZLIB) - list(APPEND SMDATA_LINK_LIB ${ZLIB_LIBRARIES} ${ZLIB_LIBRARY_RELEASE}) -else() - list(APPEND SMDATA_LINK_LIB "zlib") -endif() - -if(WITH_SYSTEM_PNG) - sm_add_compile_definition("${SM_EXE_NAME}" SYSTEM_PNG) - list(APPEND SMDATA_LINK_LIB ${PNG_LIBRARIES}) -else() - list(APPEND SMDATA_LINK_LIB "png") -endif() - -if(WITH_SYSTEM_JSONCPP) - list(APPEND SMDATA_LINK_LIB ${JSONCPP_LIBRARY}) -else() - list(APPEND SMDATA_LINK_LIB "jsoncpp") -endif() - -if(WITH_OGG) - if(WITH_SYSTEM_OGG) - list(APPEND SMDATA_LINK_LIB - "${VORBISFILE_LIBRARY}" - "${VORBIS_LIBRARY}" - "${OGG_LIBRARY}") - else() - list(APPEND SMDATA_LINK_LIB - "vorbisfile" - "vorbis" - "ogg") - endif() -endif() - -if(WIN32) - list(APPEND SMDATA_LINK_LIB - # The misc libraries are here. - "${LIB_SWSCALE}" - "${LIB_AVCODEC}" - "${LIB_AVFORMAT}" - "${LIB_AVUTIL}") - - list(APPEND SMDATA_LINK_LIB - "dbghelp.lib" - "setupapi.lib" - "hid.lib") - - sm_add_link_flag("${SM_EXE_NAME}" "/LIBPATH:\"${SM_EXTERN_DIR}/ffmpeg/lib\"") - sm_add_link_flag("${SM_EXE_NAME}" - "/LIBPATH:\"${SM_SRC_DIR}/archutils/Win32/ddk\"") - sm_add_link_flag("${SM_EXE_NAME}" "/ERRORREPORT:SEND") - sm_add_link_flag("${SM_EXE_NAME}" "/MAPINFO:EXPORTS") - sm_add_link_flag("${SM_EXE_NAME}" "/SAFESEH:NO") - sm_add_link_flag("${SM_EXE_NAME}" "/NOLOGO") - sm_add_link_flag("${SM_EXE_NAME}" "/MAP") - sm_add_link_flag("${SM_EXE_NAME}" "/NODEFAULTLIB:wininet.lib") - sm_add_link_flag("${SM_EXE_NAME}" "/NODEFAULTLIB:msimg32.lib") - sm_add_link_flag("${SM_EXE_NAME}" "/NODEFAULTLIB:libci.lib") - set_target_properties("${SM_EXE_NAME}" - PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB:msvcrt.lib") - set_target_properties("${SM_EXE_NAME}" - PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") - set_target_properties("${SM_EXE_NAME}" - PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS") - -elseif(APPLE) - # The following were removed from SMDATA_LINK_LIB to "match" StepMania's - # pbxproj. ${MAC_FRAME_APPKIT} ${MAC_FRAME_FOUNDATION} "ffmpeg" - - list(INSERT SMDATA_LINK_LIB - 0 - ${MAC_FRAME_ACCELERATE} - ${MAC_FRAME_CARBON} - ${MAC_FRAME_COCOA} - ${MAC_FRAME_IOKIT} - ${MAC_FRAME_OPENGL} - ${MAC_FRAME_COREFOUNDATION} - ${MAC_FRAME_AUDIOTOOLBOX} - ${MAC_FRAME_AUDIOUNIT} - ${MAC_FRAME_COREAUDIO} - ${MAC_FRAME_CORESERVICES} - ${MAC_FRAME_SYSTEM}) - list(APPEND SMDATA_LINK_LIB - "${BZIP2_LIBRARY_RELEASE}" - "${ICONV_LIBRARIES}") - - if(HAS_FFMPEG) - list(APPEND SMDATA_LINK_LIB - "${SM_FFMPEG_ROOT}/libavformat/libavformat.a" - "${SM_FFMPEG_ROOT}/libavcodec/libavcodec.a" - "${SM_FFMPEG_ROOT}/libswscale/libswscale.a" - "${SM_FFMPEG_ROOT}/libavutil/libavutil.a") - endif() -else() # Unix / Linux TODO: Remember to find and locate the zip archive files. - if(HAS_FFMPEG) - if(WITH_SYSTEM_FFMPEG) - list(APPEND SMDATA_LINK_LIB - "${FFMPEG_avformat_LIBRARY}" - "${FFMPEG_avcodec_LIBRARY}" - "${FFMPEG_swscale_LIBRARY}" - "${FFMPEG_avutil_LIBRARY}") - else() - list(APPEND SMDATA_LINK_LIB - "${SM_FFMPEG_ROOT}/libavformat/libavformat.a" - "${SM_FFMPEG_ROOT}/libavcodec/libavcodec.a" - "${SM_FFMPEG_ROOT}/libswscale/libswscale.a" - "${SM_FFMPEG_ROOT}/libavutil/libavutil.a") - endif() - - if(NOT WITH_SYSTEM_ZLIB) - list(REMOVE_ITEM SMDATA_LINK_LIB "zlib") - list(APPEND SMDATA_LINK_LIB "zlib") - endif() - - if(VA_FOUND) - list(APPEND SMDATA_LINK_LIB ${VA_LIBRARY}) - endif() - endif() - - if(${DL_FOUND}) - list(APPEND SMDATA_LINK_LIB ${DL_LIBRARIES}) - endif() - - list(APPEND SMDATA_LINK_LIB "${OPENGL_LIBRARY}") - - if(GTK2_FOUND) - list(APPEND SMDATA_LINK_LIB "${GTK2_LIBRARIES}") - endif() - - list(APPEND SMDATA_LINK_LIB "${BZIP2_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") - - if(HAS_ALSA) - list(APPEND SMDATA_LINK_LIB ${ALSA_LIBRARIES}) - endif() - - if(HAS_JACK) - list(APPEND SMDATA_LINK_LIB ${JACK_LIBRARIES}) - endif() - - if(HAS_OSS) - # No mention of OSS libraries. - sm_add_compile_definition("${SM_EXE_NAME}" "HAVE_OSS_VERSION=1") - endif() - - if(HAS_PULSE) - list(APPEND SMDATA_LINK_LIB ${PULSEAUDIO_LIBRARY}) - # PACKAGE_NAME and PACKAGE_VERSION are only used in this scenario. Why is - # not clear. TODO: Remove this silliness. - sm_add_compile_definition("${SM_EXE_NAME}" PACKAGE_NAME="StepMania") - set(PACKAGE_VERSION "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}") - sm_add_compile_definition("${SM_EXE_NAME}" - PACKAGE_VERSION="${PACKAGE_VERSION}") - endif() - - if(X11_FOUND) - list(APPEND SMDATA_LINK_LIB ${X11_LIBRARIES}) - endif() - - if(SDL2_FOUND) - list(APPEND SMDATA_LINK_LIB ${SDL2_LIBRARY}) - sm_add_compile_definition("${SM_EXE_NAME}" HAVE_SDL) - endif() - - if(PCRE_FOUND) - list(APPEND SMDATA_LINK_LIB ${PCRE_LIBRARY}) - endif() - - list(APPEND SMDATA_LINK_LIB ${XRANDR_LIBRARIES} ${XINERAMA_LIBRARIES}) - - list(REMOVE_DUPLICATES SMDATA_LINK_LIB) -endif() - -target_link_libraries("${SM_EXE_NAME}" ${SMDATA_LINK_LIB}) - -list(APPEND SM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} - "${SM_SRC_DIR}/generated") -list(APPEND SM_INCLUDE_DIRS "${JPEG_INCLUDE_DIR}") -if(NOT APPLE) - list(APPEND SM_INCLUDE_DIRS - "${SM_EXTERN_DIR}/glew-1.5.8/include" - "${SM_EXTERN_DIR}/jsoncpp/include" - "${SM_EXTERN_DIR}/zlib") - if(MSVC) - if(WITH_OGG) - list(APPEND SM_INCLUDE_DIRS - "${SM_EXTERN_DIR}/newogg/include" - "${SM_EXTERN_DIR}/newvorbis/lib" - "${SM_EXTERN_DIR}/newvorbis/include") - endif() - list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/ffmpeg/include") - else() - if(WITH_OGG) - list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/vorbis") - endif() - if(HAS_FFMPEG) - if(WITH_SYSTEM_FFMPEG) - list(APPEND SM_INCLUDE_DIRS "${FFMPEG_INCLUDE_DIR}") - else() - add_dependencies("${SM_EXE_NAME}" "ffmpeg") - list(APPEND SM_INCLUDE_DIRS "${SM_FFMPEG_SRC_DIR}" "${SM_FFMPEG_ROOT}") - endif() - endif() - if(HAS_GTK2) - list(APPEND SM_INCLUDE_DIRS "${GTK2_INCLUDE_DIRS}") - endif() - if(X11_FOUND) - list(APPEND SM_INCLUDE_DIRS "${X11_INCLUDE_DIR}") - endif() - if(PCRE_FOUND) - list(APPEND SM_INCLUDE_DIRS "${PCRE_INCLUDE_DIR}") - endif() - if(DL_FOUND) - list(APPEND SM_INCLUDE_DIRS "${DL_INCLUDE_DIR}") - endif() - endif() -else() - if(WITH_OGG) - list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/newogg/include" - "${SM_EXTERN_DIR}/newvorbis/include") - endif() - list(APPEND SM_INCLUDE_DIRS "archutils/Unix") - if(HAS_FFMPEG) - add_dependencies("${SM_EXE_NAME}" "ffmpeg") - list(APPEND SM_INCLUDE_DIRS "${SM_FFMPEG_SRC_DIR}" "${SM_FFMPEG_ROOT}") - endif() -endif() - -if(WIN32) - # FIXME: This makes no sense... - #list(APPEND SM_INCLUDE_DIRS ${DIRECTX_INCLUDE_DIR}) -else() - list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/libpng/include") -endif() - - -target_include_directories("${SM_EXE_NAME}" PUBLIC ${SM_INCLUDE_DIRS}) - -if(WIN32) - set(SM_INSTALL_DESTINATION ".") -else() - set(SM_INSTALL_DESTINATION "stepmania-5.1") -endif() - -if(NOT APPLE) - if(WIN32) - set(SM_FULL_INSTALLATION_PATH_LIST "${SM_INSTALL_DESTINATION}" "Program") - sm_join("${SM_FULL_INSTALLATION_PATH_LIST}" "/" SM_FULL_INSTALLATION_PATH) - # Hardcoding the values for now since the foreach loop is not working as - # intended. - install(TARGETS "${SM_EXE_NAME}" DESTINATION "${SM_FULL_INSTALLATION_PATH}") - if(WITH_FULL_RELEASE OR WITH_TEXTURE_GENERATOR) - install(FILES "${SM_PROGRAM_DIR}/Texture Font Generator.exe" - DESTINATION "${SM_FULL_INSTALLATION_PATH}") - endif() - install(FILES "${SM_PROGRAM_DIR}/avcodec-55.dll" - DESTINATION "${SM_FULL_INSTALLATION_PATH}") - install(FILES "${SM_PROGRAM_DIR}/avformat-55.dll" - DESTINATION "${SM_FULL_INSTALLATION_PATH}") - install(FILES "${SM_PROGRAM_DIR}/avutil-52.dll" - DESTINATION "${SM_FULL_INSTALLATION_PATH}") - install(FILES "${SM_PROGRAM_DIR}/parallel_lights_io.dll" - DESTINATION "${SM_FULL_INSTALLATION_PATH}") - install(FILES "${SM_PROGRAM_DIR}/swscale-2.dll" - DESTINATION "${SM_FULL_INSTALLATION_PATH}") - install(FILES "${SM_PROGRAM_DIR}/StepMania.vdi" - DESTINATION "${SM_FULL_INSTALLATION_PATH}") - - # foreach(SM_WINDOW_DLL "${SM_WINDOWS_PROGRAM_DLLS}") install(FILES - # "${SM_WINDOW_DLL}" DESTINATION "${SM_INSTALL_DESTINATION}") endforeach() - else() - install(TARGETS "${SM_EXE_NAME}" DESTINATION "${SM_INSTALL_DESTINATION}") - endif() - if(UNIX OR LINUX) - install(FILES "${SM_ROOT_DIR}/GtkModule.so" - LIBRARY DESTINATION "${SM_INSTALL_DESTINATION}" OPTIONAL) - endif() - install(DIRECTORY "${SM_ROOT_DIR}/Announcers" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/BGAnimations" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/Themes" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/Characters" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/Scripts" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/Courses" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/BackgroundEffects" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/Data" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/BackgroundTransitions" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/Docs" - DESTINATION "${SM_INSTALL_DESTINATION}") - install(DIRECTORY "${SM_ROOT_DIR}/NoteSkins" - DESTINATION "${SM_INSTALL_DESTINATION}") - if(NOT SM_INSTALL_DESTINATION) - install(DIRECTORY "${SM_ROOT_DIR}/Songs/StepMania 5" DESTINATION "Songs") - install(FILES "${SM_ROOT_DIR}/Songs/instructions.txt" DESTINATION "Songs") - else() - install(DIRECTORY "${SM_ROOT_DIR}/Songs/StepMania 5" - DESTINATION "${SM_INSTALL_DESTINATION}/Songs") - install(FILES "${SM_ROOT_DIR}/Songs/instructions.txt" - DESTINATION "${SM_INSTALL_DESTINATION}/Songs") - endif() -endif() +file(MAKE_DIRECTORY "${SM_SRC_DIR}/generated") + +if(MSVC) + # Add the mapconv program of the past to allow for debugging information. + include("CMakeProject-mapconv.cmake") + if(WITH_IRC_POST_HOOK) + include("CMakeProject-irc.cmake") + endif() + if(WITH_TEXTURE_GENERATOR OR WITH_FULL_RELEASE) + include("CMakeProject-texture.cmake") + endif() +endif() + +# Keep the module path local for easier grabbing. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +# Main project is below. + +include(CMakeData-arch.cmake) +include(CMakeData-rage.cmake) +include(CMakeData-os.cmake) +include(CMakeData-actor.cmake) +include(CMakeData-screen.cmake) +include(CMakeData-data.cmake) +include(CMakeData-gtk.cmake) +include(CMakeData-file-types.cmake) +include(CMakeData-globals.cmake) +include(CMakeData-singletons.cmake) + +list(APPEND SMDATA_ALL_FILES_SRC + ${SMDATA_GLOBAL_FILES_SRC} + ${SMDATA_GLOBAL_SINGLETON_SRC} + ${SMDATA_ALL_ACTORS_SRC} + ${SMDATA_ALL_ARCH_SRC} + ${SMDATA_ALL_DATA_SRC} + ${SMDATA_ALL_RAGE_SRC} + ${SMDATA_ALL_SCREENS_SRC} + ${SMDATA_OS_SRC} + ${SMDATA_FILE_TYPES_SRC}) +list(APPEND SMDATA_ALL_FILES_HPP + ${SMDATA_GLOBAL_FILES_HPP} + ${SMDATA_GLOBAL_SINGLETON_HPP} + ${SMDATA_ALL_ACTORS_HPP} + ${SMDATA_ALL_ARCH_HPP} + ${SMDATA_ALL_DATA_HPP} + ${SMDATA_ALL_RAGE_HPP} + ${SMDATA_ALL_SCREENS_HPP} + ${SMDATA_OS_HPP} + ${SMDATA_FILE_TYPES_HPP}) + +if(NOT APPLE) + list(APPEND SMDATA_ALL_FILES_SRC "Main.cpp") + source_group("" FILES "Main.cpp") +endif() + +if(MSVC OR APPLE) + set(SM_NAME_RELEASE "StepMania") + set(SM_NAME_DEBUG "StepMania-debug") + set(SM_NAME_MINSIZEREL "StepMania-min-size") + set(SM_NAME_RELWITHDEBINFO "StepMania-release-symbols") +else() + set(SM_NAME_RELEASE "stepmania") + set(SM_NAME_DEBUG "stepmania-debug") + set(SM_NAME_MINSIZEREL "stepmania-min-size") + set(SM_NAME_RELWITHDEBINFO "stepmania-release-symbols") +endif() + +# Configure generated files here. +configure_file("${SM_XCODE_DIR}/Info.plist.in.xml" + "${SM_XCODE_DIR}/Info.StepMania.plist") +configure_file("${SM_XCODE_DIR}/plistHelper.in.hpp" + "${SM_XCODE_DIR}/plistHelper.hpp") + +# TODO: Make this actually be data and not an executable. +if(APPLE) + set(MACOSX_BUNDLE_BUNDLE_NAME ${SM_EXE_NAME}) + add_executable("${SM_EXE_NAME}" + MACOSX_BUNDLE + ${SMDATA_ALL_FILES_SRC} + ${SMDATA_ALL_FILES_HPP}) + set_target_properties("${SM_EXE_NAME}" PROPERTIES MACOSX_BUNDLE TRUE) +else() + if(MSVC) + foreach(sm_src_file ${SMDATA_ALL_FILES_SRC}) + get_filename_component(sm_src_raw "${sm_src_file}" NAME_WE) + if(${sm_src_raw} MATCHES "global") + set_source_files_properties("${sm_src_raw}.cpp" + PROPERTIES + COMPILE_FLAGS + "/Ycglobal.h") + elseif(NOT (${sm_src_raw} MATCHES "verstub")) + set_source_files_properties("${sm_src_raw}.cpp" + PROPERTIES + COMPILE_FLAGS + "/Yuglobal.h") + endif() + endforeach() + endif() + add_executable("${SM_EXE_NAME}" ${SMDATA_ALL_FILES_SRC} + ${SMDATA_ALL_FILES_HPP}) +endif() + +set_target_properties("${SM_EXE_NAME}" + PROPERTIES OUTPUT_NAME + "${SM_NAME_RELEASE}" + RELEASE_OUTPUT_NAME + "${SM_NAME_RELEASE}" + DEBUG_OUTPUT_NAME + "${SM_NAME_DEBUG}" + MINSIZEREL_OUTPUT_NAME + "${SM_NAME_MINSIZEREL}" + RELWITHDEBINFO_OUTPUT_NAME + "${SM_NAME_RELWITHDEBINFO}") + +if(WITH_PORTABLE_TOMCRYPT) + sm_add_compile_definition("${SM_EXE_NAME}" LTC_NO_ASM) +endif() +if(WITH_NO_ROLC_TOMCRYPT) + sm_add_compile_definition("${SM_EXE_NAME}" LTC_NO_ROLC) +endif() + +sm_add_compile_definition("${SM_EXE_NAME}" CMAKE_POWERED) + +if(NOT WITH_NETWORKING) + sm_add_compile_definition("${SM_EXE_NAME}" WITHOUT_NETWORKING) +endif() + +# Compilation flags per project here. +sm_add_compile_definition("${SM_EXE_NAME}" $<$:DEBUG>) +sm_add_compile_definition("${SM_EXE_NAME}" $<$:RELEASE>) +sm_add_compile_definition("${SM_EXE_NAME}" $<$:MINSIZEREL>) +sm_add_compile_definition("${SM_EXE_NAME}" + $<$:RELWITHDEBINFO>) + +set(SM_COMPILE_FLAGS "") + +if(WITH_SSE2) + if(MSVC) + if(SM_WIN32_ARCH MATCHES "x86") + set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} /arch:SSE2") + endif() + else() + set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} -msse2") + endif() +endif() + +if(WITH_LTO) + if(MSVC) + set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} /GL") + else() + set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} -flto") + endif() +endif() + +if(MSVC) + # TODO: Find a way to do this cleanly for non MSVC users. + set(SM_COMPILE_FLAGS "${SM_COMPILE_FLAGS} /MP2") +endif() + +set_target_properties("${SM_EXE_NAME}" + PROPERTIES COMPILE_FLAGS "${SM_COMPILE_FLAGS}") + +set_target_properties("${SM_EXE_NAME}" + PROPERTIES OUTPUT_NAME_DEBUG + "${SM_NAME_DEBUG}" + OUTPUT_NAME_MINSIZEREL + "${SM_NAME_MINSIZEREL}" + OUTPUT_NAME_RELWITHDEBINFO + "${SM_NAME_RELWITHDEBINFO}") + +list(APPEND SM_WINDOWS_PROGRAM_DLLS + "${SM_PROGRAM_DIR}/avcodec-55.dll" + "${SM_PROGRAM_DIR}/avformat-55.dll" + "${SM_PROGRAM_DIR}/avutil-52.dll" + "${SM_PROGRAM_DIR}/parallel_lights_io.dll" + "${SM_PROGRAM_DIR}/swscale-2.dll") + +if(WIN32) + sm_add_compile_definition("${SM_EXE_NAME}" WINDOWS) + sm_add_compile_definition("${SM_EXE_NAME}" _WINDOWS) # TODO: Remove this + # potential duplicate. + sm_add_compile_definition("${SM_EXE_NAME}" _CRT_SECURE_NO_WARNINGS) + sm_add_compile_definition("${SM_EXE_NAME}" _WINSOCK_DEPRECATED_NO_WARNINGS) + sm_add_compile_definition("${SM_EXE_NAME}" GLEW_STATIC) + + set_target_properties("${SM_EXE_NAME}" + PROPERTIES RUNTIME_OUTPUT_DIRECTORY + "${SM_PROGRAM_DIR}" + RUNTIME_OUTPUT_DIRECTORY_RELEASE + "${SM_PROGRAM_DIR}" + RUNTIME_OUTPUT_DIRECTORY_DEBUG + "${SM_PROGRAM_DIR}" + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL + "${SM_PROGRAM_DIR}" + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO + "${SM_PROGRAM_DIR}") + + if(MSVC) + # Allow for getting a virtualdub stack trace. + add_custom_command( + TARGET "${SM_EXE_NAME}" POST_BUILD + COMMAND + "mapconv" + "${SM_PROGRAM_DIR}/$<$:${SM_NAME_DEBUG}>$<$:${SM_NAME_MINSIZEREL}>$<$:${SM_NAME_RELWITHDEBINFO}>$<$:${SM_NAME_RELEASE}>.map" + "${SM_PROGRAM_DIR}/$<$:${SM_NAME_DEBUG}>$<$:${SM_NAME_MINSIZEREL}>$<$:${SM_NAME_RELWITHDEBINFO}>$<$:${SM_NAME_RELEASE}>.vdi" + COMMENT "Generating file to allow for easier stack traces.") + endif() +elseif(APPLE) + sm_add_compile_definition("${SM_EXE_NAME}" BACKTRACE_METHOD_X86_DARWIN) + sm_add_compile_definition("${SM_EXE_NAME}" MACOSX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 -stdlib=libc++") + set_target_properties( + "${SM_EXE_NAME}" + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY + "${SM_ROOT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_RELEASE + "${SM_ROOT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_DEBUG + "${SM_ROOT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL + "${SM_ROOT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO + "${SM_ROOT_DIR}" + MACOSX_BUNDLE_INFO_PLIST + "${SM_XCODE_DIR}/Info.StepMania.plist" + XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD + "${SM_CPP_STANDARD}" + XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY + "libc++" + XCODE_ATTRIBUTE_INFOPLIST_FILE + "${SM_XCODE_DIR}/Info.StepMania.plist" + XCODE_ATTRIBUTE_INFOPLIST_PREPROCESS + "YES" + XCODE_ATTRIBUTE_INFOPLIST_PREPROCESSOR_DEFINITIONS[variant=Release] + "RELEASE" + XCODE_ATTRIBUTE_INFOPLIST_PREPROCESSOR_DEFINITIONS[variant=Debug] + "DEBUG" + XCODE_ATTRIBUTE_INFOPLIST_PREPROCESSOR_DEFINITIONS[variant=MinSizeRel] + "MINSIZEREL" + XCODE_ATTRIBUTE_INFOPLIST_PREPROCESSOR_DEFINITIONS[variant=RelWithDebInfo] + "RELWITHDEBINFO" + XCODE_ATTRIBUTE_INFOPLIST_PREFIX_HEADER + "${SM_XCODE_DIR}/plistHelper.hpp" + XCODE_ATTRIBUTE_GCC_PREFIX_HEADER + "${CMAKE_CURRENT_SOURCE_DIR}/archutils/Darwin/StepMania.pch" + XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS + "NO" + XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS + "${SM_XCODE_DIR}/Libraries") + + sm_add_compile_definition("${SM_EXE_NAME}" _XOPEN_SOURCE) + + if(${HAS_FFMPEG}) + sm_add_compile_definition("${SM_EXE_NAME}" HAVE_FFMPEG) + endif() + + if(CMAKE_BUILD_TYPE EQUAL "Debug") + set(SM_APP_RELEASE_NAME "${SM_NAME_DEBUG}") + elseif(CMAKE_BUILD_TYPE EQUAL "MinSizeRel") + set(SM_APP_RELEASE_NAME "${SM_NAME_MINSIZEREL}") + elseif(CMAKE_BUILD_TYPE EQUAL "RelWithDebInfo") + set(SM_APP_RELEASE_NAME "${SM_NAME_RELWITHDEBINFO}") + else() + set(SM_APP_RELEASE_NAME "${SM_NAME_RELEASE}") + endif() + if(WITH_FULL_RELEASE) + string(CONCAT SM_NAME_VERSION + "${SM_EXE_NAME}" + "-" + "${SM_VERSION_TRADITIONAL}") + set(SM_DMG_VERSION "${SM_VERSION_TRADITIONAL}") + else() + string(CONCAT SM_NAME_VERSION + "${SM_EXE_NAME}" + "-" + "${SM_VERSION_FULL}") + set(SM_DMG_VERSION "${SM_VERSION_FULL}") + endif() + set(SM_DMG_RELEASE_NAME "${SM_NAME_VERSION}-mac.dmg") + + add_custom_target(dmg + COMMAND pushd ${SM_ROOT_DIR}\; mkdir -p dmgtmpdir\; cd + dmgtmpdir\; mkdir -p ${SM_NAME_VERSION}\; cd + ${SM_NAME_VERSION}\; mkdir -p ${SM_NAME_VERSION}\; cd + ${SM_NAME_VERSION}\; cp -R + "${SM_ROOT_DIR}/Announcers" .\; cp -R + "${SM_ROOT_DIR}/BackgroundEffects" .\; cp -R + "${SM_ROOT_DIR}/BackgroundTransitions" .\; cp -R + "${SM_ROOT_DIR}/BGAnimations" .\; cp -R + "${SM_ROOT_DIR}/Characters" .\; cp -R + "${SM_ROOT_DIR}/Courses" .\; cp -R + "${SM_ROOT_DIR}/Data" .\; cp -R + "${SM_ROOT_DIR}/Docs" .\; cp -R + "${SM_ROOT_DIR}/Manual" .\; cp -R + "${SM_ROOT_DIR}/NoteSkins" .\; cp -R + "${SM_ROOT_DIR}/Scripts" .\; cp -R + "${SM_ROOT_DIR}/Songs" .\; cp -R + "${SM_ROOT_DIR}/Themes" .\; cp -R + "${SM_ROOT_DIR}/${SM_APP_RELEASE_NAME}.app" .\; cd + ${SM_ROOT_DIR}\; hdiutil create + "${SM_DMG_RELEASE_NAME}" -VOLNAME + "StepMania ${SM_DMG_VERSION}" -SRCFOLDER + "dmgtmpdir/${SM_NAME_VERSION}/" -OV\; rm -fR + dmgtmpdir\; popd\;) + + # Add the ability to copy the resource file. + add_custom_command(TARGET "${SM_EXE_NAME}" POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + "$/../Resources" + COMMAND ${CMAKE_COMMAND} -E copy + "${SM_XCODE_DIR}/smicon.icns" + "$/../Resources/" + COMMAND ${CMAKE_COMMAND} -E copy + "${SM_XCODE_DIR}/Hardware.plist" + "$/../Resources/") +else() # Linux + set_target_properties("${SM_EXE_NAME}" + PROPERTIES RUNTIME_OUTPUT_DIRECTORY + "${SM_ROOT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_RELEASE + "${SM_ROOT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_DEBUG + "${SM_ROOT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL + "${SM_ROOT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO + "${SM_ROOT_DIR}") + + if(${WITH_CRASH_HANDLER}) + sm_add_compile_definition("${SM_EXE_NAME}" CRASH_HANDLER) + if(LINUX) + # used only in the ArchHooks_Unix.cpp file + sm_add_compile_definition("${SM_EXE_NAME}" BACKTRACE_METHOD_X86_LINUX) + sm_add_compile_definition("${SM_EXE_NAME}" + BACKTRACE_METHOD_TEXT="x86 custom backtrace") + sm_add_compile_definition( + "${SM_EXE_NAME}" BACKTRACE_LOOKUP_METHOD_TEXT="backtrace_symbols") + if(${DL_FOUND}) + sm_add_compile_definition("${SM_EXE_NAME}" + BACKTRACE_LOOKUP_METHOD_DLADDR) + else() + sm_add_compile_definition("${SM_EXE_NAME}" + BACKTRACE_LOOKUP_METHOD_BACKTRACE_SYMBOLS) + endif() + endif() + endif() + if(${HAS_PTHREAD}) + sm_add_compile_definition("${SM_EXE_NAME}" HAVE_LIBPTHREAD) + + message("Host processor is ${CMAKE_SYSTEM_PROCESSOR}") + if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + message("Host processor is 64bit") + sm_add_compile_definition("${SM_EXE_NAME}" CPU_X86_64) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86" + OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686") + message("Host processor is 32bit") + sm_add_compile_definition("${SM_EXE_NAME}" CPU_X86) + else() + message("Unrecognized host processor type") + endif() + endif() + if(${HAS_FFMPEG}) + sm_add_compile_definition("${SM_EXE_NAME}" HAVE_FFMPEG) + endif() + if(${HAS_XRANDR}) + sm_add_compile_definition("${SM_EXE_NAME}" HAVE_XRANDR) + endif() + if(${HAS_XINERAMA}) + sm_add_compile_definition("${SM_EXE_NAME}" HAVE_XINERAMA) + endif() + + if(BSD) + sm_add_compile_definition("${SM_EXE_NAME}" BSD) + endif() + + if(GTK2_FOUND) + sm_add_compile_definition("${SM_EXE_NAME}" HAVE_GTK) + endif() + + sm_add_compile_definition("${SM_EXE_NAME}" UNIX) + if("${CMAKE_SYSTEM}" MATCHES "Linux") + sm_add_compile_definition("${SM_EXE_NAME}" LINUX) + endif() + + sm_add_compile_flag("${SM_EXE_NAME}" "-std=${SM_CPP_STANDARD}") + if(CMAKE_CXX_COMPILER MATCHES "clang") + sm_add_compile_flag("${SM_EXE_NAME}" "-stdlib=libc++") + set_target_properties("${SM_EXE_NAME}" + PROPERTIES LINK_FLAGS "-stdlib=libc++") + sm_add_compile_flag("jsoncpp" "-stdlib=libc++") + endif() +endif() + +set_property(TARGET "${SM_EXE_NAME}" PROPERTY FOLDER "Internal Libraries") + +list(APPEND SMDATA_LINK_LIB "lua-5.1") +include(../extern/CMakeProject-mmmagic.cmake) + +if(HAS_MP3) + if(WITH_SYSTEM_MAD) + list(APPEND SMDATA_LINK_LIB ${LIBMAD_LIBRARY}) + else() + list(APPEND SMDATA_LINK_LIB "mad") + endif() +endif() + +if(WITH_SYSTEM_PCRE) + list(APPEND SMDATA_LINK_LIB ${PCRE_LIBRARY}) +else() + list(APPEND SMDATA_LINK_LIB "pcre") +endif() + +if(WITH_SYSTEM_GLEW) + list(APPEND SMDATA_LINK_LIB ${GLEW_LIBRARIES} ${GLEW_LIBRARY_RELEASE}) + list(APPEND SM_INCLUDE_DIRS ${GLEW_INCLUDE_DIRS}) +else() + list(APPEND SMDATA_LINK_LIB "glew") +endif() + +if(WITH_SYSTEM_TOMCRYPT) + list(APPEND SMDATA_LINK_LIB ${TOMCRYPT_LIBRARY}) +else() + list(APPEND SMDATA_LINK_LIB "tomcrypt") +endif() + +if(WITH_SYSTEM_TOMMATH) + list(APPEND SMDATA_LINK_LIB ${TOMMATH_LIBRARY}) +else() + list(APPEND SMDATA_LINK_LIB "tommath") +endif() + +if(WITH_SYSTEM_JPEG) + sm_add_compile_definition("${SM_EXE_NAME}" SYSTEM_JPEGLIB) + list(APPEND SMDATA_LINK_LIB ${JPEG_LIBRARIES}) +else() + list(APPEND SMDATA_LINK_LIB "jpeg") +endif() + +if(WITH_SYSTEM_ZLIB) + list(APPEND SMDATA_LINK_LIB ${ZLIB_LIBRARIES} ${ZLIB_LIBRARY_RELEASE}) +else() + list(APPEND SMDATA_LINK_LIB "zlib") +endif() + +if(WITH_SYSTEM_PNG) + sm_add_compile_definition("${SM_EXE_NAME}" SYSTEM_PNG) + list(APPEND SMDATA_LINK_LIB ${PNG_LIBRARIES}) +else() + list(APPEND SMDATA_LINK_LIB "png") +endif() + +if(WITH_SYSTEM_JSONCPP) + list(APPEND SMDATA_LINK_LIB ${JSONCPP_LIBRARY}) +else() + list(APPEND SMDATA_LINK_LIB "jsoncpp") +endif() + +if(WITH_OGG) + if(WITH_SYSTEM_OGG) + list(APPEND SMDATA_LINK_LIB + "${VORBISFILE_LIBRARY}" + "${VORBIS_LIBRARY}" + "${OGG_LIBRARY}") + else() + list(APPEND SMDATA_LINK_LIB + "vorbisfile" + "vorbis" + "ogg") + endif() +endif() + +if(WIN32) + list(APPEND SMDATA_LINK_LIB + # The misc libraries are here. + "${LIB_SWSCALE}" + "${LIB_AVCODEC}" + "${LIB_AVFORMAT}" + "${LIB_AVUTIL}") + + list(APPEND SMDATA_LINK_LIB + "dbghelp.lib" + "setupapi.lib" + "hid.lib") + + sm_add_link_flag("${SM_EXE_NAME}" "/LIBPATH:\"${SM_EXTERN_DIR}/ffmpeg/${SM_WIN32_ARCH}/lib\"") + sm_add_link_flag("${SM_EXE_NAME}" + "/LIBPATH:\"${SM_SRC_DIR}/archutils/Win32/ddk/${SM_WIN32_ARCH}\"") + sm_add_link_flag("${SM_EXE_NAME}" "/ERRORREPORT:SEND") + sm_add_link_flag("${SM_EXE_NAME}" "/MAPINFO:EXPORTS") + sm_add_link_flag("${SM_EXE_NAME}" "/SAFESEH:NO") + sm_add_link_flag("${SM_EXE_NAME}" "/NOLOGO") + sm_add_link_flag("${SM_EXE_NAME}" "/MAP") + sm_add_link_flag("${SM_EXE_NAME}" "/NODEFAULTLIB:wininet.lib") + sm_add_link_flag("${SM_EXE_NAME}" "/NODEFAULTLIB:msimg32.lib") + sm_add_link_flag("${SM_EXE_NAME}" "/NODEFAULTLIB:libci.lib") + set_target_properties("${SM_EXE_NAME}" + PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB:msvcrt.lib") + set_target_properties("${SM_EXE_NAME}" + PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") + set_target_properties("${SM_EXE_NAME}" + PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS") + +elseif(APPLE) + # The following were removed from SMDATA_LINK_LIB to "match" StepMania's + # pbxproj. ${MAC_FRAME_APPKIT} ${MAC_FRAME_FOUNDATION} "ffmpeg" + + list(INSERT SMDATA_LINK_LIB + 0 + ${MAC_FRAME_ACCELERATE} + ${MAC_FRAME_CARBON} + ${MAC_FRAME_COCOA} + ${MAC_FRAME_IOKIT} + ${MAC_FRAME_OPENGL} + ${MAC_FRAME_COREFOUNDATION} + ${MAC_FRAME_AUDIOTOOLBOX} + ${MAC_FRAME_AUDIOUNIT} + ${MAC_FRAME_COREAUDIO} + ${MAC_FRAME_CORESERVICES} + ${MAC_FRAME_SYSTEM}) + list(APPEND SMDATA_LINK_LIB + "${BZIP2_LIBRARY_RELEASE}" + "${ICONV_LIBRARIES}") + + if(HAS_FFMPEG) + list(APPEND SMDATA_LINK_LIB + "${SM_FFMPEG_ROOT}/libavformat/libavformat.a" + "${SM_FFMPEG_ROOT}/libavcodec/libavcodec.a" + "${SM_FFMPEG_ROOT}/libswscale/libswscale.a" + "${SM_FFMPEG_ROOT}/libavutil/libavutil.a") + endif() +else() # Unix / Linux TODO: Remember to find and locate the zip archive files. + if(HAS_FFMPEG) + if(WITH_SYSTEM_FFMPEG) + list(APPEND SMDATA_LINK_LIB + "${FFMPEG_avformat_LIBRARY}" + "${FFMPEG_avcodec_LIBRARY}" + "${FFMPEG_swscale_LIBRARY}" + "${FFMPEG_avutil_LIBRARY}") + else() + list(APPEND SMDATA_LINK_LIB + "${SM_FFMPEG_ROOT}/libavformat/libavformat.a" + "${SM_FFMPEG_ROOT}/libavcodec/libavcodec.a" + "${SM_FFMPEG_ROOT}/libswscale/libswscale.a" + "${SM_FFMPEG_ROOT}/libavutil/libavutil.a") + endif() + + if(NOT WITH_SYSTEM_ZLIB) + list(REMOVE_ITEM SMDATA_LINK_LIB "zlib") + list(APPEND SMDATA_LINK_LIB "zlib") + endif() + + if(VA_FOUND) + list(APPEND SMDATA_LINK_LIB ${VA_LIBRARY}) + endif() + endif() + + if(${DL_FOUND}) + list(APPEND SMDATA_LINK_LIB ${DL_LIBRARIES}) + endif() + + list(APPEND SMDATA_LINK_LIB "${OPENGL_LIBRARY}") + + if(GTK2_FOUND) + list(APPEND SMDATA_LINK_LIB "${GTK2_LIBRARIES}") + endif() + + list(APPEND SMDATA_LINK_LIB "${BZIP2_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") + + if(HAS_ALSA) + list(APPEND SMDATA_LINK_LIB ${ALSA_LIBRARIES}) + endif() + + if(HAS_JACK) + list(APPEND SMDATA_LINK_LIB ${JACK_LIBRARIES}) + endif() + + if(HAS_OSS) + # No mention of OSS libraries. + sm_add_compile_definition("${SM_EXE_NAME}" "HAVE_OSS_VERSION=1") + endif() + + if(HAS_PULSE) + list(APPEND SMDATA_LINK_LIB ${PULSEAUDIO_LIBRARY}) + # PACKAGE_NAME and PACKAGE_VERSION are only used in this scenario. Why is + # not clear. TODO: Remove this silliness. + sm_add_compile_definition("${SM_EXE_NAME}" PACKAGE_NAME="StepMania") + set(PACKAGE_VERSION "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}") + sm_add_compile_definition("${SM_EXE_NAME}" + PACKAGE_VERSION="${PACKAGE_VERSION}") + endif() + + if(X11_FOUND) + list(APPEND SMDATA_LINK_LIB ${X11_LIBRARIES}) + endif() + + if(SDL2_FOUND) + list(APPEND SMDATA_LINK_LIB ${SDL2_LIBRARY}) + sm_add_compile_definition("${SM_EXE_NAME}" HAVE_SDL) + endif() + + if(PCRE_FOUND) + list(APPEND SMDATA_LINK_LIB ${PCRE_LIBRARY}) + endif() + + list(APPEND SMDATA_LINK_LIB ${XRANDR_LIBRARIES} ${XINERAMA_LIBRARIES}) + + list(REMOVE_DUPLICATES SMDATA_LINK_LIB) +endif() + +target_link_libraries("${SM_EXE_NAME}" ${SMDATA_LINK_LIB}) + +list(APPEND SM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} + "${SM_SRC_DIR}/generated") +list(APPEND SM_INCLUDE_DIRS "${JPEG_INCLUDE_DIR}") +if(NOT APPLE) + list(APPEND SM_INCLUDE_DIRS + "${SM_EXTERN_DIR}/glew-1.5.8/include" + "${SM_EXTERN_DIR}/jsoncpp/include" + "${SM_EXTERN_DIR}/zlib") + if(MSVC) + if(WITH_OGG) + list(APPEND SM_INCLUDE_DIRS + "${SM_EXTERN_DIR}/newogg/include" + "${SM_EXTERN_DIR}/newvorbis/lib" + "${SM_EXTERN_DIR}/newvorbis/include") + endif() + list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/ffmpeg/include") + else() + if(WITH_OGG) + list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/vorbis") + endif() + if(HAS_FFMPEG) + if(WITH_SYSTEM_FFMPEG) + list(APPEND SM_INCLUDE_DIRS "${FFMPEG_INCLUDE_DIR}") + else() + add_dependencies("${SM_EXE_NAME}" "ffmpeg") + list(APPEND SM_INCLUDE_DIRS "${SM_FFMPEG_SRC_DIR}" "${SM_FFMPEG_ROOT}") + endif() + endif() + if(HAS_GTK2) + list(APPEND SM_INCLUDE_DIRS "${GTK2_INCLUDE_DIRS}") + endif() + if(X11_FOUND) + list(APPEND SM_INCLUDE_DIRS "${X11_INCLUDE_DIR}") + endif() + if(PCRE_FOUND) + list(APPEND SM_INCLUDE_DIRS "${PCRE_INCLUDE_DIR}") + endif() + if(DL_FOUND) + list(APPEND SM_INCLUDE_DIRS "${DL_INCLUDE_DIR}") + endif() + endif() +else() + if(WITH_OGG) + list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/newogg/include" + "${SM_EXTERN_DIR}/newvorbis/include") + endif() + list(APPEND SM_INCLUDE_DIRS "archutils/Unix") + if(HAS_FFMPEG) + add_dependencies("${SM_EXE_NAME}" "ffmpeg") + list(APPEND SM_INCLUDE_DIRS "${SM_FFMPEG_SRC_DIR}" "${SM_FFMPEG_ROOT}") + endif() +endif() + +if(WIN32) + # FIXME: This makes no sense... + #list(APPEND SM_INCLUDE_DIRS ${DIRECTX_INCLUDE_DIR}) +else() + list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/libpng/include") +endif() + + +target_include_directories("${SM_EXE_NAME}" PUBLIC ${SM_INCLUDE_DIRS}) + +if(WIN32) + set(SM_INSTALL_DESTINATION ".") +else() + set(SM_INSTALL_DESTINATION "stepmania-5.1") +endif() + +if(NOT APPLE) + if(WIN32) + set(SM_FULL_INSTALLATION_PATH_LIST "${SM_INSTALL_DESTINATION}" "Program") + sm_join("${SM_FULL_INSTALLATION_PATH_LIST}" "/" SM_FULL_INSTALLATION_PATH) + # Hardcoding the values for now since the foreach loop is not working as + # intended. + install(TARGETS "${SM_EXE_NAME}" DESTINATION "${SM_FULL_INSTALLATION_PATH}") + if(WITH_FULL_RELEASE OR WITH_TEXTURE_GENERATOR) + install(FILES "${SM_PROGRAM_DIR}/Texture Font Generator.exe" + DESTINATION "${SM_FULL_INSTALLATION_PATH}") + endif() + install(FILES "${SM_PROGRAM_DIR}/avcodec-55.dll" + DESTINATION "${SM_FULL_INSTALLATION_PATH}") + install(FILES "${SM_PROGRAM_DIR}/avformat-55.dll" + DESTINATION "${SM_FULL_INSTALLATION_PATH}") + install(FILES "${SM_PROGRAM_DIR}/avutil-52.dll" + DESTINATION "${SM_FULL_INSTALLATION_PATH}") + install(FILES "${SM_PROGRAM_DIR}/parallel_lights_io.dll" + DESTINATION "${SM_FULL_INSTALLATION_PATH}") + install(FILES "${SM_PROGRAM_DIR}/swscale-2.dll" + DESTINATION "${SM_FULL_INSTALLATION_PATH}") + install(FILES "${SM_PROGRAM_DIR}/StepMania.vdi" + DESTINATION "${SM_FULL_INSTALLATION_PATH}") + + # foreach(SM_WINDOW_DLL "${SM_WINDOWS_PROGRAM_DLLS}") install(FILES + # "${SM_WINDOW_DLL}" DESTINATION "${SM_INSTALL_DESTINATION}") endforeach() + else() + install(TARGETS "${SM_EXE_NAME}" DESTINATION "${SM_INSTALL_DESTINATION}") + endif() + if(UNIX OR LINUX) + install(FILES "${SM_ROOT_DIR}/GtkModule.so" + LIBRARY DESTINATION "${SM_INSTALL_DESTINATION}" OPTIONAL) + endif() + install(DIRECTORY "${SM_ROOT_DIR}/Announcers" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/BGAnimations" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/Themes" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/Characters" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/Scripts" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/Courses" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/BackgroundEffects" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/Data" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/BackgroundTransitions" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/Docs" + DESTINATION "${SM_INSTALL_DESTINATION}") + install(DIRECTORY "${SM_ROOT_DIR}/NoteSkins" + DESTINATION "${SM_INSTALL_DESTINATION}") + if(NOT SM_INSTALL_DESTINATION) + install(DIRECTORY "${SM_ROOT_DIR}/Songs/StepMania 5" DESTINATION "Songs") + install(FILES "${SM_ROOT_DIR}/Songs/instructions.txt" DESTINATION "Songs") + else() + install(DIRECTORY "${SM_ROOT_DIR}/Songs/StepMania 5" + DESTINATION "${SM_INSTALL_DESTINATION}/Songs") + install(FILES "${SM_ROOT_DIR}/Songs/instructions.txt" + DESTINATION "${SM_INSTALL_DESTINATION}/Songs") + endif() +endif() diff --git a/src/ImageCache.cpp b/src/ImageCache.cpp index 0469d90a78..d3d5b6c5e1 100644 --- a/src/ImageCache.cpp +++ b/src/ImageCache.cpp @@ -186,8 +186,8 @@ void ImageCache::ReadFromDisk() struct ImageTexture: public RageTexture { - unsigned m_uTexHandle; - unsigned GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay + uintptr_t m_uTexHandle; + uintptr_t GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay /* This is a reference to a pointer in g_ImagePathToImage. */ RageSurface *&m_pImage; int m_iWidth, m_iHeight; diff --git a/src/LuaManager.cpp b/src/LuaManager.cpp index 2c57145d0b..691aa7ef57 100644 --- a/src/LuaManager.cpp +++ b/src/LuaManager.cpp @@ -84,6 +84,7 @@ namespace LuaHelpers template<> void Push( lua_State *L, const double &Object ) { lua_pushnumber( L, Object ); } template<> void Push( lua_State *L, const int &Object ) { lua_pushinteger( L, Object ); } template<> void Push( lua_State *L, const unsigned int &Object ) { lua_pushnumber( L, double(Object) ); } + template<> void Push( lua_State *L, const unsigned long long &Object ) { lua_pushnumber( L, double(Object) ); } template<> void Push( lua_State *L, const RString &Object ) { lua_pushlstring( L, Object.data(), Object.size() ); } template<> void Push( lua_State *L, std::string const& object ) { lua_pushlstring( L, object.data(), object.size() ); } diff --git a/src/LuaManager.h b/src/LuaManager.h index 0b352b5ae6..b69d24e865 100644 --- a/src/LuaManager.h +++ b/src/LuaManager.h @@ -224,8 +224,7 @@ inline bool MyLua_checkintboolean( lua_State *L, int iArg ) int iType = lua_type( L, iArg ); if( iType == LUA_TNUMBER ) { - int iValue = lua_tointeger( L, iArg ); - return iValue != 0; + return lua_tointeger(L, iArg) != 0; } return MyLua_checkboolean( L, iArg ); diff --git a/src/RageBitmapTexture.h b/src/RageBitmapTexture.h index 49356c7351..74153d52ae 100644 --- a/src/RageBitmapTexture.h +++ b/src/RageBitmapTexture.h @@ -13,12 +13,12 @@ public: /* only called by RageTextureManager::InvalidateTextures */ virtual void Invalidate() { m_uTexHandle = 0; /* don't Destroy() */} virtual void Reload(); - virtual unsigned GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay + virtual uintptr_t GetTexHandle() const { return m_uTexHandle; }; // accessed by RageDisplay private: void Create(); // called by constructor and Reload void Destroy(); - unsigned m_uTexHandle; // treat as unsigned in OpenGL, ID3D8Texture* for D3D + uintptr_t m_uTexHandle; // treat as unsigned in OpenGL, IDirect3DTexture9* for D3D }; #endif diff --git a/src/RageDisplay.h b/src/RageDisplay.h index 7f6b37db2c..3d46ead273 100644 --- a/src/RageDisplay.h +++ b/src/RageDisplay.h @@ -205,7 +205,7 @@ struct RageTextureLock /* Given a surface with a format and no pixel data, lock the texture into the * surface. The data is write-only. */ - virtual void Lock( unsigned iTexHandle, RageSurface *pSurface ) = 0; + virtual void Lock( uintptr_t iTexHandle, RageSurface *pSurface ) = 0; /* Unlock and update the texture. If bChanged is false, the texture update * may be omitted. */ @@ -261,23 +261,23 @@ public: /* return 0 if failed or internal texture resource handle * (unsigned in OpenGL, texture pointer in D3D) */ - virtual unsigned CreateTexture( + virtual uintptr_t CreateTexture( RagePixelFormat pixfmt, // format of img and of texture in video mem RageSurface* img, // must be in pixfmt bool bGenerateMipMaps ) = 0; virtual void UpdateTexture( - unsigned iTexHandle, + uintptr_t iTexHandle, RageSurface* img, int xoffset, int yoffset, int width, int height ) = 0; - virtual void DeleteTexture( unsigned iTexHandle ) = 0; + virtual void DeleteTexture( uintptr_t iTexHandle ) = 0; /* Return an object to lock pixels for streaming. If not supported, returns nullptr. * Delete the object normally. */ virtual RageTextureLock *CreateTextureLock() { return nullptr; } virtual void ClearAllTextures() = 0; virtual int GetNumTextureUnits() = 0; - virtual void SetTexture( TextureUnit, unsigned /* iTexture */ ) = 0; + virtual void SetTexture( TextureUnit, uintptr_t /* iTexture */ ) = 0; virtual void SetTextureMode( TextureUnit, TextureMode ) = 0; virtual void SetTextureWrapping( TextureUnit, bool ) = 0; virtual int GetMaxTextureSize() const = 0; @@ -293,9 +293,9 @@ public: * DeleteTexture. (UpdateTexture is not permitted.) Returns 0 if render-to- * texture is unsupported. */ - virtual unsigned CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; } + virtual uintptr_t CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; } - virtual unsigned GetRenderTarget() { return 0; } + virtual uintptr_t GetRenderTarget() { return 0; } /* Set the render target, or 0 to resume rendering to the framebuffer. An active render * target may not be used as a texture. If bPreserveTexture is true, the contents @@ -303,7 +303,7 @@ public: * bPreserveTexture is true the first time a render target is used, behave as if * bPreserveTexture was false. */ - virtual void SetRenderTarget( unsigned /* iHandle */, bool /* bPreserveTexture */ = true ) { } + virtual void SetRenderTarget( uintptr_t /* iHandle */, bool /* bPreserveTexture */ = true ) { } virtual bool IsZTestEnabled() const = 0; virtual bool IsZWriteEnabled() const = 0; @@ -364,9 +364,9 @@ public: }; bool SaveScreenshot( RString sPath, GraphicsFileFormat format ); - virtual RString GetTextureDiagnostics( unsigned /* id */ ) const { return RString(); } + virtual RString GetTextureDiagnostics( uintptr_t /* id */ ) const { return RString(); } virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it. - virtual RageSurface *GetTexture( unsigned /* iTexture */ ) { return nullptr; } // allocates a surface. Caller must delete it. + virtual RageSurface *GetTexture( uintptr_t /* iTexture */ ) { return nullptr; } // allocates a surface. Caller must delete it. protected: virtual void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) = 0; diff --git a/src/RageDisplay_D3D.cpp b/src/RageDisplay_D3D.cpp index 2f044b9021..d415ab8b70 100644 --- a/src/RageDisplay_D3D.cpp +++ b/src/RageDisplay_D3D.cpp @@ -44,13 +44,13 @@ const D3DFORMAT g_DefaultAdapterFormat = D3DFMT_X8R8G8B8; /* Direct3D doesn't associate a palette with textures. Instead, we load a * palette into a slot. We need to keep track of which texture's palette is * stored in what slot. */ -map g_TexResourceToPaletteIndex; -list g_PaletteIndex; +std::map g_TexResourceToPaletteIndex; +std::list g_PaletteIndex; struct TexturePalette { PALETTEENTRY p[256]; }; -map g_TexResourceToTexturePalette; +std::map g_TexResourceToTexturePalette; // Load the palette, if any, for the given texture into a palette slot, and make it current. -static void SetPalette( unsigned TexResource ) +static void SetPalette( uintptr_t TexResource ) { // If the texture isn't paletted, we have nothing to do. if( g_TexResourceToTexturePalette.find(TexResource) == g_TexResourceToTexturePalette.end() ) @@ -60,10 +60,10 @@ static void SetPalette( unsigned TexResource ) if( g_TexResourceToPaletteIndex.find(TexResource) == g_TexResourceToPaletteIndex.end() ) { // It's not. Grab the least recently used slot. - int iPalIndex = g_PaletteIndex.front(); + UINT iPalIndex = static_cast(g_PaletteIndex.front()); // If any other texture is currently using this slot, mark that palette unloaded. - for( map::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i ) + for( std::map::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i ) { if( i->second != iPalIndex ) continue; @@ -81,7 +81,7 @@ static void SetPalette( unsigned TexResource ) const int iPalIndex = g_TexResourceToPaletteIndex[TexResource]; // Find this palette index in the least-recently-used queue and move it to the end. - for(list::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i) + for(std::list::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i) { if( *i != iPalIndex ) continue; @@ -327,7 +327,7 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP) } // Test each back buffer format until we find something that works. - for( unsigned i=0; i < vBackBufferFormats.size(); i++ ) + for( size_t i=0; i < vBackBufferFormats.size(); i++ ) { D3DFORMAT fmtBackBuffer = vBackBufferFormats[i]; @@ -782,18 +782,18 @@ public: } void Change( const vector &vMeshes ) { - for( unsigned i=0; i &Vertices = mesh.Vertices; const vector &Triangles = mesh.Triangles; - for( unsigned j=0; j vIndices; - unsigned uOldSize = vIndices.size(); - unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices); + size_t uOldSize = vIndices.size(); + size_t uNewSize = max(uOldSize, static_cast(iNumIndices)); vIndices.resize( uNewSize ); for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ ) { @@ -887,8 +887,8 @@ void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu // make a temporary index buffer static vector vIndices; - unsigned uOldSize = vIndices.size(); - unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices); + size_t uOldSize = vIndices.size(); + size_t uNewSize = max(uOldSize, static_cast(iNumIndices)); vIndices.resize( uNewSize ); for( uint16_t i=(uint16_t)uOldSize/6; i<(uint16_t)iNumQuads; i++ ) { @@ -922,8 +922,8 @@ void RageDisplay_D3D::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[] // make a temporary index buffer static vector vIndices; - unsigned uOldSize = vIndices.size(); - unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices); + size_t uOldSize = vIndices.size(); + size_t uNewSize = max(uOldSize, static_cast(iNumIndices)); vIndices.resize( uNewSize ); for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ ) { @@ -1048,7 +1048,7 @@ int RageDisplay_D3D::GetNumTextureUnits() return g_DeviceCaps.MaxSimultaneousTextures; } -void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture ) +void RageDisplay_D3D::SetTexture( TextureUnit tu, uintptr_t iTexture ) { // g_DeviceCaps.MaxSimultaneousTextures = 1; if( tu >= (int) g_DeviceCaps.MaxSimultaneousTextures ) // not supported @@ -1065,7 +1065,7 @@ void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture ) } else { - IDirect3DTexture9* pTex = (IDirect3DTexture9*) iTexture; + IDirect3DTexture9* pTex = reinterpret_cast(iTexture); g_pd3dDevice->SetTexture( tu, pTex ); /* Intentionally commented out. Don't mess with texture stage state @@ -1356,12 +1356,12 @@ void RageDisplay_D3D::SetCullMode( CullMode mode ) } } -void RageDisplay_D3D::DeleteTexture( unsigned iTexHandle ) +void RageDisplay_D3D::DeleteTexture( uintptr_t iTexHandle ) { if( iTexHandle == 0 ) return; - IDirect3DTexture9* pTex = (IDirect3DTexture9*) iTexHandle; + IDirect3DTexture9* pTex = reinterpret_cast(iTexHandle); pTex->Release(); // Delete palette (if any) @@ -1372,7 +1372,7 @@ void RageDisplay_D3D::DeleteTexture( unsigned iTexHandle ) } -unsigned RageDisplay_D3D::CreateTexture( +uintptr_t RageDisplay_D3D::CreateTexture( RagePixelFormat pixfmt, RageSurface* img, bool bGenerateMipMaps ) @@ -1385,7 +1385,7 @@ unsigned RageDisplay_D3D::CreateTexture( RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s", img->w, img->h, RagePixelFormatToString(pixfmt).c_str(), GetErrorString(hr).c_str() ); - unsigned uTexHandle = (unsigned)pTex; + uintptr_t uTexHandle = reinterpret_cast(pTex); if( pixfmt == RagePixelFormat_PAL ) { @@ -1411,11 +1411,11 @@ unsigned RageDisplay_D3D::CreateTexture( } void RageDisplay_D3D::UpdateTexture( - unsigned uTexHandle, + uintptr_t uTexHandle, RageSurface* img, int xoffset, int yoffset, int width, int height ) { - IDirect3DTexture9* pTex = (IDirect3DTexture9*)uTexHandle; + IDirect3DTexture9* pTex = reinterpret_cast(uTexHandle); ASSERT( pTex != nullptr ); RECT rect; diff --git a/src/RageDisplay_D3D.h b/src/RageDisplay_D3D.h index 6821fcfd8a..8a56441aeb 100644 --- a/src/RageDisplay_D3D.h +++ b/src/RageDisplay_D3D.h @@ -22,19 +22,19 @@ public: bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false ); bool SupportsThreadedRendering(); bool SupportsPerVertexMatrixScale() { return false; } - unsigned CreateTexture( + uintptr_t CreateTexture( RagePixelFormat pixfmt, RageSurface* img, bool bGenerateMipMaps ); void UpdateTexture( - unsigned iTexHandle, + uintptr_t iTexHandle, RageSurface* img, int xoffset, int yoffset, int width, int height ); - void DeleteTexture( unsigned iTexHandle ); + void DeleteTexture( uintptr_t iTexHandle ); void ClearAllTextures(); int GetNumTextureUnits(); - void SetTexture( TextureUnit tu, unsigned iTexture ); + void SetTexture( TextureUnit tu, uintptr_t iTexture ); void SetTextureMode( TextureUnit tu, TextureMode tm ); void SetTextureWrapping( TextureUnit tu, bool b ); int GetMaxTextureSize() const; diff --git a/src/RageDisplay_GLES2.cpp b/src/RageDisplay_GLES2.cpp index 66ec4e5b5c..354397fa37 100644 --- a/src/RageDisplay_GLES2.cpp +++ b/src/RageDisplay_GLES2.cpp @@ -559,7 +559,7 @@ RageDisplay_GLES2::SupportsPerVertexMatrixScale() return true; } -unsigned +uintptr_t RageDisplay_GLES2::CreateTexture( RagePixelFormat pixfmt, RageSurface* img, @@ -572,7 +572,7 @@ RageDisplay_GLES2::CreateTexture( void RageDisplay_GLES2::UpdateTexture( - unsigned iTexHandle, + uintptr_t iTexHandle, RageSurface* img, int xoffset, int yoffset, int width, int height ) @@ -581,7 +581,7 @@ RageDisplay_GLES2::UpdateTexture( } void -RageDisplay_GLES2::DeleteTexture( unsigned iTexHandle ) +RageDisplay_GLES2::DeleteTexture( uintptr_t iTexHandle ) { // TODO } @@ -613,7 +613,7 @@ SetTextureUnit( TextureUnit tu ) } void -RageDisplay_GLES2::SetTexture( TextureUnit tu, unsigned iTexture ) +RageDisplay_GLES2::SetTexture( TextureUnit tu, uintptr_t iTexture ) { if (!SetTextureUnit( tu )) return; @@ -621,7 +621,7 @@ RageDisplay_GLES2::SetTexture( TextureUnit tu, unsigned iTexture ) if (iTexture) { glEnable( GL_TEXTURE_2D ); - glBindTexture( GL_TEXTURE_2D, iTexture ); + glBindTexture( GL_TEXTURE_2D, static_cast(iTexture) ); } else { diff --git a/src/RageDisplay_GLES2.h b/src/RageDisplay_GLES2.h index 36b52408bd..29a46d79d1 100644 --- a/src/RageDisplay_GLES2.h +++ b/src/RageDisplay_GLES2.h @@ -18,18 +18,18 @@ public: void SetBlendMode( BlendMode mode ); bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false ); bool SupportsPerVertexMatrixScale(); - unsigned CreateTexture( + uintptr_t CreateTexture( RagePixelFormat pixfmt, RageSurface* img, bool bGenerateMipMaps ); void UpdateTexture( - unsigned iTexHandle, + uintptr_t iTexHandle, RageSurface* img, int xoffset, int yoffset, int width, int height ); - void DeleteTexture( unsigned iTexHandle ); + void DeleteTexture( uintptr_t iTexHandle ); void ClearAllTextures(); int GetNumTextureUnits(); - void SetTexture( TextureUnit tu, unsigned iTexture ); + void SetTexture( TextureUnit tu, uintptr_t iTexture ); void SetTextureMode( TextureUnit tu, TextureMode tm ); void SetTextureWrapping( TextureUnit tu, bool b ); int GetMaxTextureSize() const; diff --git a/src/RageDisplay_Null.h b/src/RageDisplay_Null.h index e08548e71c..dd1c9806d0 100644 --- a/src/RageDisplay_Null.h +++ b/src/RageDisplay_Null.h @@ -19,19 +19,19 @@ public: void SetBlendMode( BlendMode ) { } bool SupportsTextureFormat( RagePixelFormat, bool /* realtime */ =false ) { return true; } bool SupportsPerVertexMatrixScale() { return false; } - unsigned CreateTexture( + uintptr_t CreateTexture( RagePixelFormat, RageSurface* /* img */, bool /* bGenerateMipMaps */ ) { return 1; } void UpdateTexture( - unsigned /* iTexHandle */, + uintptr_t /* iTexHandle */, RageSurface* /* img */, int /* xoffset */, int /* yoffset */, int /* width */, int /* height */ ) { } - void DeleteTexture( unsigned /* iTexHandle */ ) { } + void DeleteTexture( uintptr_t /* iTexHandle */ ) { } void ClearAllTextures() { } int GetNumTextureUnits() { return 1; } - void SetTexture( TextureUnit, unsigned /* iTexture */ ) { } + void SetTexture( TextureUnit, uintptr_t /* iTexture */ ) { } void SetTextureMode( TextureUnit, TextureMode ) { } void SetTextureWrapping( TextureUnit, bool ) { } int GetMaxTextureSize() const { return 2048; } diff --git a/src/RageDisplay_OGL.cpp b/src/RageDisplay_OGL.cpp index aeb989da90..a5fa91385b 100644 --- a/src/RageDisplay_OGL.cpp +++ b/src/RageDisplay_OGL.cpp @@ -62,7 +62,7 @@ static const GLenum RageSpriteVertexFormat = GL_T2F_C4F_N3F_V3F; /* If we support texture matrix scaling, a handle to the vertex program: */ static GLhandleARB g_bTextureMatrixShader = 0; -static std::map g_mapRenderTargets; +static std::map g_mapRenderTargets; static RenderTarget *g_pCurrentRenderTarget = nullptr; static LowLevelWindow *g_pWind; @@ -795,7 +795,7 @@ RString RageDisplay_Legacy::TryVideoMode( const VideoModeParams &p, bool &bNewDe /* Delete all render targets. They may have associated resources other than * the texture itself. */ - for (std::pair &rt : g_mapRenderTargets) + for (std::pair &rt : g_mapRenderTargets) delete rt.second; g_mapRenderTargets.clear(); @@ -922,14 +922,14 @@ RageSurface* RageDisplay_Legacy::CreateScreenshot() return image; } -RageSurface *RageDisplay_Legacy::GetTexture( unsigned iTexture ) +RageSurface *RageDisplay_Legacy::GetTexture( uintptr_t iTexture ) { if (iTexture == 0) return nullptr; // XXX FlushGLErrors(); - glBindTexture( GL_TEXTURE_2D, iTexture ); + glBindTexture( GL_TEXTURE_2D, static_cast(iTexture) ); GLint iHeight, iWidth, iAlphaBits; glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &iHeight ); glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &iWidth ); @@ -1677,7 +1677,7 @@ int RageDisplay_Legacy::GetNumTextureUnits() return g_iMaxTextureUnits; } -void RageDisplay_Legacy::SetTexture( TextureUnit tu, unsigned iTexture ) +void RageDisplay_Legacy::SetTexture( TextureUnit tu, uintptr_t iTexture ) { if (!SetTextureUnit( tu )) return; @@ -1685,7 +1685,7 @@ void RageDisplay_Legacy::SetTexture( TextureUnit tu, unsigned iTexture ) if (iTexture) { glEnable( GL_TEXTURE_2D ); - glBindTexture( GL_TEXTURE_2D, iTexture ); + glBindTexture( GL_TEXTURE_2D, static_cast(iTexture) ); } else { @@ -2104,7 +2104,7 @@ void RageDisplay_Legacy::EndConcurrentRendering() g_pWind->EndConcurrentRendering(); } -void RageDisplay_Legacy::DeleteTexture( unsigned iTexture ) +void RageDisplay_Legacy::DeleteTexture( uintptr_t iTexture ) { if (iTexture == 0) return; @@ -2189,7 +2189,7 @@ void SetPixelMapForSurface( int glImageFormat, int glTexFormat, const RageSurfac DebugAssertNoGLError(); } -unsigned RageDisplay_Legacy::CreateTexture( +uintptr_t RageDisplay_Legacy::CreateTexture( RagePixelFormat pixfmt, RageSurface* pImg, bool bGenerateMipMaps ) @@ -2234,11 +2234,11 @@ unsigned RageDisplay_Legacy::CreateTexture( SetTextureUnit( TextureUnit_1 ); // allocate OpenGL texture resource - unsigned int iTexHandle; + uintptr_t iTexHandle; glGenTextures( 1, reinterpret_cast(&iTexHandle) ); ASSERT( iTexHandle != 0 ); - glBindTexture( GL_TEXTURE_2D, iTexHandle ); + glBindTexture( GL_TEXTURE_2D, static_cast(iTexHandle) ); if (g_pWind->GetActualVideoModeParams().bAnisotropicFiltering && GLEW_EXT_texture_filter_anisotropic ) @@ -2350,7 +2350,7 @@ public: m_iTexHandle = 0; } - void Lock( unsigned iTexHandle, RageSurface *pSurface ) + void Lock( uintptr_t iTexHandle, RageSurface *pSurface ) { ASSERT( m_iTexHandle == 0 ); ASSERT( pSurface->pixels == nullptr ); @@ -2396,7 +2396,7 @@ private: GLuint m_iBuffer; - unsigned m_iTexHandle; + uintptr_t m_iTexHandle; }; RageTextureLock *RageDisplay_Legacy::CreateTextureLock() @@ -2408,11 +2408,11 @@ RageTextureLock *RageDisplay_Legacy::CreateTextureLock() } void RageDisplay_Legacy::UpdateTexture( - unsigned iTexHandle, + uintptr_t iTexHandle, RageSurface* pImg, int iXOffset, int iYOffset, int iWidth, int iHeight ) { - glBindTexture( GL_TEXTURE_2D, iTexHandle ); + glBindTexture( GL_TEXTURE_2D, static_cast(iTexHandle) ); bool bFreeImg; RagePixelFormat SurfacePixFmt = GetImgPixelFormat( pImg, bFreeImg, iWidth, iHeight, false ); @@ -2450,16 +2450,16 @@ public: RenderTarget_FramebufferObject(); ~RenderTarget_FramebufferObject(); void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ); - unsigned GetTexture() const { return m_iTexHandle; } + uintptr_t GetTexture() const { return m_iTexHandle; } void StartRenderingTo(); void FinishRenderingTo(); virtual bool InvertY() const { return true; } private: - unsigned int m_iFrameBufferHandle; - unsigned int m_iTexHandle; - unsigned int m_iDepthBufferHandle; + uintptr_t m_iFrameBufferHandle; + uintptr_t m_iTexHandle; + uintptr_t m_iDepthBufferHandle; }; RenderTarget_FramebufferObject::RenderTarget_FramebufferObject() @@ -2495,7 +2495,7 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int iTextureWidthOut = iTextureWidth; iTextureHeightOut = iTextureHeight; - glBindTexture( GL_TEXTURE_2D, m_iTexHandle ); + glBindTexture( GL_TEXTURE_2D, static_cast(m_iTexHandle) ); GLenum internalformat; GLenum type = param.bWithAlpha? GL_RGBA:GL_RGB; if (param.bFloat && GLEW_ARB_texture_float) @@ -2517,8 +2517,8 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int ASSERT( m_iFrameBufferHandle != 0 ); /* Attach the texture to it. */ - glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_iFrameBufferHandle ); - glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_iTexHandle, 0 ); + glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, static_cast(m_iFrameBufferHandle) ); + glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, static_cast(m_iTexHandle), 0 ); DebugAssertNoGLError(); /* Attach a depth buffer, if requested. */ @@ -2527,9 +2527,9 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int glGenRenderbuffersEXT( 1, reinterpret_cast(&m_iDepthBufferHandle) ); ASSERT( m_iDepthBufferHandle != 0 ); - glBindRenderbufferEXT( GL_RENDERBUFFER, m_iDepthBufferHandle ); + glBindRenderbufferEXT( GL_RENDERBUFFER, static_cast(m_iDepthBufferHandle) ); glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, iTextureWidth, iTextureHeight ); - glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_iDepthBufferHandle ); + glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, static_cast(m_iDepthBufferHandle) ); } GLenum status = glCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT ); @@ -2555,7 +2555,7 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam ¶m, int void RenderTarget_FramebufferObject::StartRenderingTo() { - glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_iFrameBufferHandle ); + glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, static_cast(m_iFrameBufferHandle) ); } void RenderTarget_FramebufferObject::FinishRenderingTo() @@ -2582,7 +2582,7 @@ bool RageDisplay_Legacy::SupportsFullscreenBorderlessWindow() const * particularly GeForce 2, but is simpler and faster when available. */ -unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ) +uintptr_t RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ) { RenderTarget *pTarget; if (GLEW_EXT_framebuffer_object) @@ -2592,22 +2592,22 @@ unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam ¶m, pTarget->Create( param, iTextureWidthOut, iTextureHeightOut ); - unsigned iTexture = pTarget->GetTexture(); + uintptr_t iTexture = pTarget->GetTexture(); ASSERT( g_mapRenderTargets.find(iTexture) == g_mapRenderTargets.end() ); g_mapRenderTargets[iTexture] = pTarget; return iTexture; } -unsigned RageDisplay_Legacy::GetRenderTarget( ) +uintptr_t RageDisplay_Legacy::GetRenderTarget() { - for( map::const_iterator it = g_mapRenderTargets.begin( ); it != g_mapRenderTargets.end( ); ++it ) + for( map::const_iterator it = g_mapRenderTargets.begin(); it != g_mapRenderTargets.end(); ++it ) if( it->second == g_pCurrentRenderTarget ) return it->first; return 0; } -void RageDisplay_Legacy::SetRenderTarget( unsigned iTexture, bool bPreserveTexture ) +void RageDisplay_Legacy::SetRenderTarget( uintptr_t iTexture, bool bPreserveTexture ) { if (iTexture == 0) { diff --git a/src/RageDisplay_OGL.h b/src/RageDisplay_OGL.h index 5bb6277017..a54c51aeb5 100644 --- a/src/RageDisplay_OGL.h +++ b/src/RageDisplay_OGL.h @@ -53,23 +53,23 @@ public: void SetBlendMode( BlendMode mode ); bool SupportsTextureFormat( RagePixelFormat pixfmt, bool realtime=false ); bool SupportsPerVertexMatrixScale(); - unsigned CreateTexture( + uintptr_t CreateTexture( RagePixelFormat pixfmt, RageSurface* img, bool bGenerateMipMaps ); void UpdateTexture( - unsigned iTexHandle, + uintptr_t iTexHandle, RageSurface* img, int xoffset, int yoffset, int width, int height ); - void DeleteTexture( unsigned iTexHandle ); + void DeleteTexture( uintptr_t iTexHandle ); bool UseOffscreenRenderTarget(); - RageSurface *GetTexture( unsigned iTexture ); + RageSurface *GetTexture( uintptr_t iTexture ); RageTextureLock *CreateTextureLock(); void ClearAllTextures(); int GetNumTextureUnits(); - void SetTexture( TextureUnit tu, unsigned iTexture ); + void SetTexture( TextureUnit tu, uintptr_t iTexture ); void SetTextureMode( TextureUnit tu, TextureMode tm ); void SetTextureWrapping( TextureUnit tu, bool b ); int GetMaxTextureSize() const; @@ -78,9 +78,9 @@ public: bool IsEffectModeSupported( EffectMode effect ); bool SupportsRenderToTexture() const; bool SupportsFullscreenBorderlessWindow() const; - unsigned CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ); - unsigned GetRenderTarget(); - void SetRenderTarget( unsigned iHandle, bool bPreserveTexture ); + uintptr_t CreateRenderTarget( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ); + uintptr_t GetRenderTarget(); + void SetRenderTarget( uintptr_t iHandle, bool bPreserveTexture ); bool IsZWriteEnabled() const; bool IsZTestEnabled() const; void SetZWrite( bool b ); diff --git a/src/RageDisplay_OGL_Helpers.h b/src/RageDisplay_OGL_Helpers.h index 7ae9afa733..34fd20a433 100644 --- a/src/RageDisplay_OGL_Helpers.h +++ b/src/RageDisplay_OGL_Helpers.h @@ -28,7 +28,7 @@ public: virtual ~RenderTarget() { } virtual void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ) = 0; - virtual unsigned GetTexture() const = 0; + virtual uintptr_t GetTexture() const = 0; /* Render to this RenderTarget. */ virtual void StartRenderingTo() = 0; diff --git a/src/RageTexture.h b/src/RageTexture.h index 043cf03a7f..d299e297f3 100644 --- a/src/RageTexture.h +++ b/src/RageTexture.h @@ -15,7 +15,7 @@ public: virtual void Update( float /* fDeltaTime */ ) {} virtual void Reload() {} virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */ - virtual unsigned GetTexHandle() const = 0; // accessed by RageDisplay + virtual uintptr_t GetTexHandle() const = 0; // accessed by RageDisplay // movie texture/animated texture stuff virtual void SetPosition( float /* fSeconds */ ) {} // seek diff --git a/src/RageTextureManager.cpp b/src/RageTextureManager.cpp index fe28442a63..1363c59929 100644 --- a/src/RageTextureManager.cpp +++ b/src/RageTextureManager.cpp @@ -132,10 +132,10 @@ public: m_iImageWidth = m_iImageHeight = 1; CreateFrameRects(); } - unsigned GetTexHandle() const { return m_uTexHandle; } + uintptr_t GetTexHandle() const { return m_uTexHandle; } private: - unsigned m_uTexHandle; + uintptr_t m_uTexHandle; }; // Load and unload textures from disk. diff --git a/src/RageTextureRenderTarget.h b/src/RageTextureRenderTarget.h index 2932637013..088d80df24 100644 --- a/src/RageTextureRenderTarget.h +++ b/src/RageTextureRenderTarget.h @@ -14,7 +14,7 @@ public: virtual ~RageTextureRenderTarget(); virtual void Invalidate() { m_iTexHandle = 0; /* don't Destroy() */ } virtual void Reload(); - virtual unsigned GetTexHandle() const { return m_iTexHandle; } + virtual uintptr_t GetTexHandle() const { return m_iTexHandle; } void BeginRenderingTo( bool bPreserveTexture = true ); void FinishRenderingTo(); @@ -26,8 +26,8 @@ private: void Create(); void Destroy(); - unsigned m_iTexHandle; - unsigned m_iPreviousRenderTarget; + uintptr_t m_iTexHandle; + uintptr_t m_iPreviousRenderTarget; }; #endif diff --git a/src/RageUtil.h b/src/RageUtil.h index 85836d0234..a909259f65 100644 --- a/src/RageUtil.h +++ b/src/RageUtil.h @@ -31,8 +31,10 @@ inline float max( float a, int b ) { return a > b? a:b; } inline float max( int a, float b ) { return a > b? a:b; } inline unsigned long min( unsigned int a, unsigned long b ) { return a < b? a:b; } inline unsigned long min( unsigned long a, unsigned int b ) { return a < b? a:b; } +inline unsigned long long min( unsigned int a, unsigned long long b ) { return a < b? a:b; } inline unsigned long max( unsigned int a, unsigned long b ) { return a > b? a:b; } inline unsigned long max( unsigned long a, unsigned int b ) { return a > b? a:b; } +inline unsigned long long max( unsigned int a, unsigned long long b ) { return a > b? a:b; } /** @brief If outside the range from low to high, bring it within range. */ #define clamp(val,low,high) ( max( (low), min((val),(high)) ) ) diff --git a/src/arch/Dialog/DialogDriver_Win32.cpp b/src/arch/Dialog/DialogDriver_Win32.cpp index 4a744b6b84..865bc712f7 100644 --- a/src/arch/Dialog/DialogDriver_Win32.cpp +++ b/src/arch/Dialog/DialogDriver_Win32.cpp @@ -29,7 +29,7 @@ static RString g_sMessage; static bool g_bAllowHush; #if !defined(SMPACKAGE) -static BOOL CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) +static INT_PTR CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { switch( msg ) { @@ -139,7 +139,7 @@ Dialog::Result DialogDriver_Win32::OKCancel( RString sMessage, RString sID ) #if !defined(SMPACKAGE) static RString g_sErrorString; -static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) +static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { switch( msg ) { @@ -208,7 +208,7 @@ static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP } // TODO: Return a different brush if the default is not desired - return (BOOL)hbr; + return reinterpret_cast(hbr); } } return FALSE; diff --git a/src/arch/InputHandler/InputHandler_Win32_MIDI.cpp b/src/arch/InputHandler/InputHandler_Win32_MIDI.cpp index f2ee13fb82..75578a50d4 100644 --- a/src/arch/InputHandler/InputHandler_Win32_MIDI.cpp +++ b/src/arch/InputHandler/InputHandler_Win32_MIDI.cpp @@ -11,7 +11,7 @@ REGISTER_INPUT_HANDLER_CLASS2( MIDI, Win32_MIDI ); static HMIDIIN g_device; -static void CALLBACK midiCallback(HMIDIIN g_device, UINT status, DWORD instancePtr, DWORD data, DWORD timestamp); +static void CALLBACK midiCallback(HMIDIIN g_device, UINT status, DWORD_PTR instancePtr, DWORD_PTR data, DWORD_PTR timestamp); static RString GetMidiError( MMRESULT result ) { @@ -33,7 +33,7 @@ InputHandler_Win32_MIDI::InputHandler_Win32_MIDI() } m_bFoundDevice = true; - MMRESULT result = midiInOpen( &g_device, device_id, (DWORD) &midiCallback, (DWORD) this, CALLBACK_FUNCTION ); + MMRESULT result = midiInOpen( &g_device, device_id, reinterpret_cast(&midiCallback), reinterpret_cast(this), CALLBACK_FUNCTION ); if( result != MMSYSERR_NOERROR ) { LOG->Warn( "Error opening MIDI device: %s", GetMidiError(result).c_str() ); @@ -75,7 +75,7 @@ void InputHandler_Win32_MIDI::GetDevicesAndDescriptions( vector } } -static void CALLBACK midiCallback( HMIDIIN device, UINT status, DWORD instancePtr, DWORD data, DWORD timestamp ) +static void CALLBACK midiCallback( HMIDIIN device, UINT status, DWORD_PTR instancePtr, DWORD_PTR data, DWORD_PTR timestamp ) { if( status == MIM_DATA ) { @@ -91,7 +91,7 @@ static void CALLBACK midiCallback( HMIDIIN device, UINT status, DWORD instancePt { DeviceInput di = DeviceInput( DEVICE_MIDI, enum_add2(MIDI_FIRST, iChannel), iValue > 0 ); di.ts.Touch(); - ((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di ); + (reinterpret_cast(instancePtr))->SetDev( di ); } } } diff --git a/src/arch/LoadingWindow/LoadingWindow_Win32.cpp b/src/arch/LoadingWindow/LoadingWindow_Win32.cpp index 76a739f61a..aac16e3225 100644 --- a/src/arch/LoadingWindow/LoadingWindow_Win32.cpp +++ b/src/arch/LoadingWindow/LoadingWindow_Win32.cpp @@ -81,7 +81,7 @@ static HBITMAP LoadWin32Surface( RString sFile, HWND hWnd ) return ret; } -BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) +INT_PTR CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { switch( msg ) { @@ -118,8 +118,7 @@ void LoadingWindow_Win32::SetIcon( const RageSurface *pIcon ) m_hIcon = IconFromSurface( pIcon ); if( m_hIcon != nullptr ) - // XXX: GCL_HICON isn't available on x86-64 Windows - SetClassLong( hwnd, GCL_HICON, (LONG) m_hIcon ); + SetClassLongPtrA( hwnd, GCLP_HICON, reinterpret_cast(m_hIcon) ); } void LoadingWindow_Win32::SetSplash( const RageSurface *pSplash ) diff --git a/src/arch/LoadingWindow/LoadingWindow_Win32.h b/src/arch/LoadingWindow/LoadingWindow_Win32.h index bce72a4de4..e6593aa597 100644 --- a/src/arch/LoadingWindow/LoadingWindow_Win32.h +++ b/src/arch/LoadingWindow/LoadingWindow_Win32.h @@ -27,7 +27,7 @@ private: RString text[3]; HICON m_hIcon; - static BOOL CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); + static INT_PTR CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); }; #define USE_LOADING_WINDOW_WIN32 diff --git a/src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm b/src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm index fc203b61f8..d3675cf92f 100644 --- a/src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm +++ b/src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm @@ -188,7 +188,7 @@ public: RenderTarget_MacOSX( id shareContext ); ~RenderTarget_MacOSX(); void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ); - unsigned GetTexture() const { return m_iTexHandle; } + uintptr_t GetTexture() const { return static_cast(m_iTexHandle); } void StartRenderingTo(); void FinishRenderingTo(); diff --git a/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp b/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp index 35d23415bf..06517027af 100644 --- a/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp +++ b/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp @@ -323,7 +323,7 @@ public: virtual ~RenderTarget_Win32(); void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ); - unsigned int GetTexture() const { return m_texHandle; } + uintptr_t GetTexture() const { return static_cast(m_texHandle); } void StartRenderingTo(); void FinishRenderingTo(); diff --git a/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index 6ccfa1c363..25eb8a69d0 100644 --- a/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -758,7 +758,7 @@ public: ~RenderTarget_X11(); void Create( const RenderTargetParam ¶m, int &iTextureWidthOut, int &iTextureHeightOut ); - unsigned GetTexture() const { return m_iTexHandle; } + uintptr_t GetTexture() const { return static_cast(m_iTexHandle); } void StartRenderingTo(); void FinishRenderingTo(); @@ -770,7 +770,7 @@ private: LowLevelWindow_X11 *m_pWind; GLXPbuffer m_iPbuffer; GLXContext m_pPbufferContext; - unsigned int m_iTexHandle; + GLuint m_iTexHandle; GLXContext m_pOldContext; GLXDrawable m_pOldDrawable; diff --git a/src/arch/MovieTexture/MovieTexture_Generic.cpp b/src/arch/MovieTexture/MovieTexture_Generic.cpp index a23fd43bfd..0d30f7be78 100644 --- a/src/arch/MovieTexture/MovieTexture_Generic.cpp +++ b/src/arch/MovieTexture/MovieTexture_Generic.cpp @@ -145,7 +145,7 @@ public: virtual void Invalidate() { m_uTexHandle = 0; } virtual void Reload() { } - virtual unsigned GetTexHandle() const + virtual uintptr_t GetTexHandle() const { return m_uTexHandle; } @@ -168,7 +168,7 @@ private: delete pSurface; } - unsigned m_uTexHandle; + uintptr_t m_uTexHandle; RageSurfaceFormat m_SurfaceFormat; RagePixelFormat m_PixFmt; }; @@ -449,7 +449,7 @@ void MovieTexture_Generic::UpdateFrame() if( m_pTextureLock != nullptr ) { - int iHandle = m_pTextureIntermediate != nullptr? m_pTextureIntermediate->GetTexHandle(): this->GetTexHandle(); + uintptr_t iHandle = m_pTextureIntermediate != nullptr? m_pTextureIntermediate->GetTexHandle(): this->GetTexHandle(); m_pTextureLock->Lock( iHandle, m_pSurface ); } @@ -518,7 +518,7 @@ void MovieTexture_Generic::SetPosition( float fSeconds ) m_bWantRewind = true; } -unsigned MovieTexture_Generic::GetTexHandle() const +uintptr_t MovieTexture_Generic::GetTexHandle() const { if( m_pRenderTarget != nullptr ) return m_pRenderTarget->GetTexHandle(); diff --git a/src/arch/MovieTexture/MovieTexture_Generic.h b/src/arch/MovieTexture/MovieTexture_Generic.h index 2967ddac7e..8d0537b1f6 100644 --- a/src/arch/MovieTexture/MovieTexture_Generic.h +++ b/src/arch/MovieTexture/MovieTexture_Generic.h @@ -93,7 +93,7 @@ public: virtual void DecodeSeconds( float fSeconds ); virtual void SetPlaybackRate( float fRate ) { m_fRate = fRate; } void SetLooping( bool bLooping=true ) { m_bLoop = bLooping; } - unsigned GetTexHandle() const; + uintptr_t GetTexHandle() const; static EffectMode GetEffectMode( MovieDecoderPixelFormatYCbCr fmt ); @@ -110,7 +110,7 @@ private: enum State { DECODER_QUIT, DECODER_RUNNING } m_State; - unsigned m_uTexHandle; + uintptr_t m_uTexHandle; RageTextureRenderTarget *m_pRenderTarget; RageTexture *m_pTextureIntermediate; Sprite *m_pSprite; diff --git a/src/arch/MovieTexture/MovieTexture_Null.cpp b/src/arch/MovieTexture/MovieTexture_Null.cpp index 6777aa88cf..6ff52fcc4d 100644 --- a/src/arch/MovieTexture/MovieTexture_Null.cpp +++ b/src/arch/MovieTexture/MovieTexture_Null.cpp @@ -11,7 +11,7 @@ public: MovieTexture_Null(RageTextureID ID); virtual ~MovieTexture_Null(); void Invalidate() { texHandle = 0; } - unsigned GetTexHandle() const { return texHandle; } + uintptr_t GetTexHandle() const { return texHandle; } void Update(float /* delta */) { } void Reload() { } void SetPosition(float /* seconds */) { } @@ -21,7 +21,7 @@ public: private: bool playing; bool loop; - unsigned texHandle; + uintptr_t texHandle; }; MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID) diff --git a/src/archutils/Win32/Crash.cpp b/src/archutils/Win32/Crash.cpp index ca46fae0f7..9ff63b4de1 100644 --- a/src/archutils/Win32/Crash.cpp +++ b/src/archutils/Win32/Crash.cpp @@ -85,7 +85,7 @@ void WriteToChild( HANDLE hPipe, const void *pData, size_t iSize ) while( iSize ) { DWORD iActual; - if( !WriteFile(hPipe, pData, iSize, &iActual, nullptr) ) + if( !WriteFile(hPipe, pData, static_cast(iSize), &iActual, nullptr) ) return; iSize -= iActual; } @@ -114,7 +114,7 @@ bool StartChild( HANDLE &hProcess, HANDLE &hToStdin, HANDLE &hFromStdout ) SetHandleInformation( hFromStdout, HANDLE_FLAG_INHERIT, 0 ); } - char szBuf[256] = ""; + char szBuf[MAX_PATH] = ""; GetModuleFileName( nullptr, szBuf, MAX_PATH ); strcat( szBuf, " " ); strcat( szBuf, CHILD_MAGIC_PARAMETER ); @@ -144,6 +144,7 @@ bool StartChild( HANDLE &hProcess, HANDLE &hToStdin, HANDLE &hFromStdout ) } hProcess = pi.hProcess; + CloseHandle(pi.hThread); return true; } @@ -209,13 +210,13 @@ void RunChild() // 2. Write info. const TCHAR *p = RageLog::GetInfo(); - int iSize = strlen( p ); + int iSize = static_cast(strlen( p )); WriteToChild( hToStdin, &iSize, sizeof(iSize) ); WriteToChild( hToStdin, p, iSize ); // 3. Write AdditionalLog. p = RageLog::GetAdditionalLog(); - iSize = strlen( p ); + iSize = static_cast(strlen( p )); WriteToChild( hToStdin, &iSize, sizeof(iSize) ); WriteToChild( hToStdin, p, iSize ); @@ -228,7 +229,7 @@ void RunChild() WriteToChild(hToStdin, &cnt, sizeof(cnt)); for( int i = 0; i < cnt; ++i ) { - iSize = strlen(ps[i])+1; + iSize = static_cast(strlen(ps[i])) + 1; WriteToChild( hToStdin, &iSize, sizeof(iSize) ); WriteToChild( hToStdin, ps[i], iSize ); } @@ -236,13 +237,13 @@ void RunChild() // 5. Write CHECKPOINTs. static TCHAR buf[1024*32]; Checkpoints::GetLogs( buf, sizeof(buf), "$$" ); - iSize = strlen( buf )+1; + iSize = static_cast(strlen( buf )) + 1; WriteToChild( hToStdin, &iSize, sizeof(iSize) ); WriteToChild( hToStdin, buf, iSize ); // 6. Write the crashed thread's name. p = RageThread::GetCurrentThreadName(); - iSize = strlen( p )+1; + iSize = static_cast(strlen( p )) + 1; WriteToChild( hToStdin, &iSize, sizeof(iSize) ); WriteToChild( hToStdin, p, iSize ); @@ -260,13 +261,13 @@ void RunChild() TCHAR szName[MAX_PATH]; if( !CrashGetModuleBaseName(hMod, szName) ) strcpy( szName, "???" ); - iSize = strlen( szName ); + iSize = static_cast(strlen( szName )); WriteToChild( hToStdin, &iSize, sizeof(iSize) ); WriteToChild( hToStdin, szName, iSize ); } } -static long MainExceptionHandler( EXCEPTION_POINTERS *pExc ) +static DWORD WINAPI MainExceptionHandler( LPVOID lpParameter ) { // Flush the log so it isn't cut off at the end. /* 1. We can't do regular file access in the crash handler. @@ -283,6 +284,7 @@ static long MainExceptionHandler( EXCEPTION_POINTERS *pExc ) * does this exception occur, and we never unmask it. * However, once in a while some driver or library turns evil and unmasks an * exception flag on us. If this happens, re-mask it and continue execution. */ + PEXCEPTION_POINTERS pExc = reinterpret_cast(lpParameter); switch( pExc->ExceptionRecord->ExceptionCode ) { case EXCEPTION_FLT_INVALID_OPERATION: @@ -291,7 +293,11 @@ static long MainExceptionHandler( EXCEPTION_POINTERS *pExc ) case EXCEPTION_FLT_OVERFLOW: case EXCEPTION_FLT_UNDERFLOW: case EXCEPTION_FLT_INEXACT_RESULT: +#if _WIN64 + pExc->ContextRecord->FltSave.ControlWord |= 0x3F; +#else pExc->ContextRecord->FloatSave.ControlWord |= 0x3F; +#endif return EXCEPTION_CONTINUE_EXECUTION; } @@ -361,20 +367,19 @@ long __stdcall CrashHandler::ExceptionHandler( EXCEPTION_POINTERS *pExc ) /* If the stack overflowed, we have a very limited amount of stack space. * Allocate a new stack, and run the exception handler in it, to increase * the chances of success. */ - int iSize = 1024*32; - char *pStack = (char *) VirtualAlloc( nullptr, iSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE ); - pStack += iSize; - // FIXME: This will probably explode on x86-64 -#if defined(_MSC_VER) - _asm mov esp, pStack; -#elif defined(__GNUC__) - asm volatile ("movl %%esp, %0\n\t" - : - : "r" (pStack) - ); -#endif + HANDLE hExceptionHandler = CreateThread(nullptr, 1024 * 32, MainExceptionHandler, reinterpret_cast(pExc), 0, nullptr); + if (hExceptionHandler == NULL) + { + TerminateProcess(GetCurrentProcess(), 0); + return EXCEPTION_EXECUTE_HANDLER; + } + WaitForSingleObject(hExceptionHandler, INFINITE); - return MainExceptionHandler( pExc ); + DWORD ret; + GetExitCodeThread(hExceptionHandler, &ret); + CloseHandle(hExceptionHandler); + + return static_cast(ret); } ////////////////////////////////////////////////////////////////////////////// @@ -449,7 +454,7 @@ static bool IsExecutableProtection(DWORD dwProtect) { return false; } -static bool PointsToValidCall( unsigned long ptr ) +static bool PointsToValidCall( ULONG_PTR ptr ) { char buf[7]; int len = 7; @@ -473,9 +478,15 @@ void CrashHandler::do_backtrace( const void **buf, size_t size, * due to stack corruption, we might not be able to get any frames from the * stack. Pull it out of pContext->Eip, which is always valid, and then * discard the first stack frame if it's the same. */ +#if _WIN64 + if( buf+1 != pLast && pContext->Rip != 0 ) + { + *buf = (void *) pContext->Rip; +#else if( buf+1 != pLast && pContext->Eip != 0 ) { *buf = (void *) pContext->Eip; +#endif ++buf; } @@ -489,15 +500,21 @@ void CrashHandler::do_backtrace( const void **buf, size_t size, return; } - const NT_TIB *tib = (NT_TIB *) ((sel.HighWord.Bits.BaseHi<<24)+(sel.HighWord.Bits.BaseMid<<16)+sel.BaseLow); + const NT_TIB *tib = reinterpret_cast(((static_cast(sel.HighWord.Bits.BaseHi) << 24) + (static_cast(sel.HighWord.Bits.BaseMid) << 16) + sel.BaseLow)); const NT_TIB *pTib = tib->Self; pStackBase = (char *)pTib->StackBase; } // Walk up the stack. +#if _WIN64 + const char *lpAddr = (const char *)pContext->Rsp; + + const void *data = (void *) pContext->Rip; +#else const char *lpAddr = (const char *)pContext->Esp; const void *data = (void *) pContext->Eip; +#endif do { if( buf == pLast ) break; @@ -506,7 +523,11 @@ void CrashHandler::do_backtrace( const void **buf, size_t size, /* The first entry is usually EIP. We already logged it; skip it, so we don't always * show the first frame twice. */ +#if _WIN64 + if( bFirst && data == (void *) pContext->Rip ) +#else if( bFirst && data == (void *) pContext->Eip ) +#endif fValid = false; bFirst = false; @@ -518,7 +539,11 @@ void CrashHandler::do_backtrace( const void **buf, size_t size, if (!IsExecutableProtection(meminfo.Protect) || meminfo.State!=MEM_COMMIT) fValid = false; - if ( data != (void *) pContext->Eip && !PointsToValidCall((unsigned long)data) ) +#if _WIN64 + if ( data != (void *) pContext->Rip && !PointsToValidCall(reinterpret_cast(data)) ) +#else + if ( data != (void *) pContext->Eip && !PointsToValidCall(reinterpret_cast(data)) ) +#endif fValid = false; } @@ -589,7 +614,7 @@ void CrashHandler::ForceDeadlock( RString reason, uint64_t iID ) context.ContextFlags = CONTEXT_FULL; if( !GetThreadContext( hThread, &context ) ) wsprintf( g_CrashInfo.m_CrashReason + strlen(g_CrashInfo.m_CrashReason), - "; GetThreadContext(%x) failed", (int) hThread ); + "; GetThreadContext(%Ix) failed", reinterpret_cast(hThread) ); else { static const void *BacktracePointers[BACKTRACE_MAX_SIZE]; diff --git a/src/archutils/Win32/CrashHandlerChild.cpp b/src/archutils/Win32/CrashHandlerChild.cpp index fe8d8f1bed..fda6982306 100644 --- a/src/archutils/Win32/CrashHandlerChild.cpp +++ b/src/archutils/Win32/CrashHandlerChild.cpp @@ -36,6 +36,12 @@ // XXX: What happens when we *don't* have version info? Does that ever actually happen? #include "ver.h" +#if _WIN64 +#define ADDRESS_ZEROS "016" +#else +#define ADDRESS_ZEROS "08" +#endif + // VDI symbol lookup: namespace VDDebugInfo { @@ -48,10 +54,10 @@ namespace VDDebugInfo int nBuildNumber; const unsigned char *pRVAHeap; - unsigned nFirstRVA; + uintptr_t nFirstRVA; const char *pFuncNameHeap; - const unsigned long (*pSegments)[2]; + const uintptr_t (*pSegments)[2]; int nSegments; char sFilename[1024]; RString sError; @@ -98,13 +104,18 @@ namespace VDDebugInfo // Extract fields src += 64; + const int* pVer = reinterpret_cast(src); + const size_t* pRVASize = reinterpret_cast(src + sizeof(int)); + const size_t* pFNamSize = reinterpret_cast(src + sizeof(int) + sizeof(size_t)); + const int* pSegCnt = reinterpret_cast(src + sizeof(int) + 2 * sizeof(size_t)); + src += 2 * (sizeof(int) + sizeof(size_t)); - pctx->nBuildNumber = *(int *)src; - pctx->pRVAHeap = (const unsigned char *)(src + 20); - pctx->nFirstRVA = *(const long *)(src + 16); - pctx->pFuncNameHeap = (const char *)pctx->pRVAHeap - 4 + *(const long *)(src + 4); - pctx->pSegments = (unsigned long (*)[2])(pctx->pFuncNameHeap + *(const long *)(src + 8)); - pctx->nSegments = *(const long *)(src + 12); + pctx->nBuildNumber = *pVer; + pctx->pRVAHeap = reinterpret_cast(src + sizeof(uintptr_t)); + pctx->nFirstRVA = *reinterpret_cast(src); + pctx->pFuncNameHeap = reinterpret_cast(src + *pRVASize); + pctx->pSegments = reinterpret_cast(src + *pRVASize + *pFNamSize); + pctx->nSegments = *pSegCnt; return true; } @@ -137,7 +148,7 @@ namespace VDDebugInfo if( dwFileSize == INVALID_FILE_SIZE ) break; - char *buffer = new char[dwFileSize + 1]; + char *buffer = new char[static_cast(dwFileSize) + 1]; std::fill(buffer, buffer + dwFileSize + 1, '\0' ); DWORD dwActual; @@ -157,7 +168,7 @@ namespace VDDebugInfo return false; } - static bool PointerIsInAnySegment( const Context *pctx, unsigned rva ) + static bool PointerIsInAnySegment( const Context *pctx, uintptr_t rva ) { for( int i=0; inSegments; ++i ) { @@ -168,7 +179,7 @@ namespace VDDebugInfo return false; } - static const char *GetNameFromHeap(const char *heap, int idx) + static const char *GetNameFromHeap(const char *heap, size_t idx) { while(idx--) while(*heap++); @@ -176,25 +187,25 @@ namespace VDDebugInfo return heap; } - long VDDebugInfoLookupRVA( const Context *pctx, unsigned rva, char *buf, int buflen ) + intptr_t VDDebugInfoLookupRVA( const Context *pctx, uintptr_t rva, char *buf, int buflen ) { if( !PointerIsInAnySegment(pctx, rva) ) return -1; const unsigned char *pr = pctx->pRVAHeap; const unsigned char *pr_limit = (const unsigned char *)pctx->pFuncNameHeap; - int idx = 0; + size_t idx = 0; // Linearly unpack RVA deltas and find lower_bound rva -= pctx->nFirstRVA; - if( (signed)rva < 0 ) + if( static_cast(rva) < 0 ) return -1; while( pr < pr_limit ) { unsigned char c; - unsigned diff = 0; + uintptr_t diff = 0; do { @@ -205,7 +216,7 @@ namespace VDDebugInfo rva -= diff; - if ((signed)rva < 0) { + if (static_cast(rva) < 0) { rva += diff; break; } @@ -224,7 +235,7 @@ namespace VDDebugInfo strncpy( buf, fn_name, buflen ); buf[buflen-1] = 0; - return rva; + return static_cast(rva); } } @@ -234,7 +245,7 @@ bool ReadFromParent( int fd, void *p, int size ) int got = 0; while( got < size ) { - int ret = read( fd, buf+got, size-got ); + int ret = _read( fd, buf+got, size-got ); if( ret == -1 ) { if( errno == EINTR ) @@ -277,7 +288,7 @@ namespace SymbolLookup return true; } - SYMBOL_INFO *GetSym( unsigned long ptr, DWORD64 &disp ) + SYMBOL_INFO *GetSym( uintptr_t ptr, DWORD64 &disp ) { InitDbghelp(); @@ -322,16 +333,16 @@ namespace SymbolLookup RString CrashChildGetModuleBaseName( HMODULE hMod ) { - write( _fileno(stdout), &hMod, sizeof(hMod) ); + _write( _fileno(stdout), &hMod, sizeof(hMod) ); - int iFD = fileno(stdin); + int iFD = _fileno(stdin); int iSize; if (!ReadFromParent(iFD, &iSize, sizeof(iSize))) { return "???"; } RString sName; - char *buffer = new char[iSize + 1]; + char *buffer = new char[static_cast(iSize) + 1]; std::fill(buffer, buffer + iSize + 1, '\0'); if (!ReadFromParent(iFD, buffer, iSize)) { @@ -357,12 +368,12 @@ namespace SymbolLookup VirtualQueryEx( g_hParent, ptr, &meminfo, sizeof meminfo ); char tmp[512]; - long iAddress = VDDebugInfo::VDDebugInfoLookupRVA(pctx, (unsigned int)ptr, tmp, sizeof(tmp)); + intptr_t iAddress = VDDebugInfo::VDDebugInfoLookupRVA(pctx, reinterpret_cast(ptr), tmp, sizeof(tmp)); if( iAddress >= 0 ) { - wsprintf( buf, "%08x: %s [%08lx+%lx+%lx]", ptr, Demangle(tmp), + wsprintf( buf, "%" ADDRESS_ZEROS "Ix: %s [%" ADDRESS_ZEROS "Ix+%Ix+%Ix]", reinterpret_cast(ptr), Demangle(tmp), pctx->nFirstRVA, - ((unsigned int) ptr) - pctx->nFirstRVA - iAddress, + reinterpret_cast(ptr) - pctx->nFirstRVA - iAddress, iAddress ); return; } @@ -370,21 +381,21 @@ namespace SymbolLookup RString sName = CrashChildGetModuleBaseName( (HMODULE)meminfo.AllocationBase ); DWORD64 disp; - SYMBOL_INFO *pSymbol = GetSym( (unsigned int)ptr, disp ); + SYMBOL_INFO *pSymbol = GetSym( reinterpret_cast(ptr), disp ); if( pSymbol ) { - wsprintf( buf, "%08lx: %s!%s [%08lx+%lx+%lx]", - (unsigned long) ptr, sName.c_str(), pSymbol->Name, - (unsigned long) meminfo.AllocationBase, - (unsigned long) (pSymbol->Address) - (unsigned long) (meminfo.AllocationBase), - (unsigned long) disp); + wsprintf( buf, "%" ADDRESS_ZEROS "Ix: %s!%s [%" ADDRESS_ZEROS "Ix+%Ix+%Ix]", + reinterpret_cast(ptr), sName.c_str(), pSymbol->Name, + reinterpret_cast(meminfo.AllocationBase), + static_cast(pSymbol->Address) - reinterpret_cast(meminfo.AllocationBase), + static_cast(disp)); return; } - wsprintf( buf, "%08lx: %s!%08lx", - (unsigned long) ptr, sName.c_str(), - (unsigned long) meminfo.AllocationBase ); + wsprintf( buf, "%" ADDRESS_ZEROS "Ix: %s!%" ADDRESS_ZEROS "Ix", + reinterpret_cast(ptr), sName.c_str(), + reinterpret_cast(meminfo.AllocationBase) ); } } @@ -518,7 +529,7 @@ bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data ) if( !ReadFromParent(iFD, &iSize, sizeof(iSize)) ) return false; - char *buffer = new char[iSize + 1]; + char *buffer = new char[static_cast(iSize) + 1]; std::fill(buffer, buffer + iSize + 1, '\0'); bool wasReadSuccessful = ReadFromParent(iFD, buffer, iSize); RString tmp = buffer; @@ -643,7 +654,7 @@ public: ~CrashDialog(); protected: - virtual BOOL HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ); + virtual INT_PTR HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ); private: void SetDialogInitial(); @@ -677,7 +688,7 @@ void CrashDialog::SetDialogInitial() ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true ); } -BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) +INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) { HWND hDlg = GetHwnd(); @@ -706,7 +717,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) } // TODO: Return a different brush if the default is not desired - return (BOOL)hbr; + return reinterpret_cast(hbr); } case WM_COMMAND: @@ -861,7 +872,7 @@ void ChildProcess() { // Read the crash data from the crashed parent. CompleteCrashData Data; - ReadCrashDataFromParent( fileno(stdin), Data ); + ReadCrashDataFromParent( _fileno(stdin), Data ); RString sCrashReport; VDDebugInfo::VDDebugInfoInitFromFile( &g_debugInfo ); diff --git a/src/archutils/Win32/GotoURL.cpp b/src/archutils/Win32/GotoURL.cpp index 93092f0b12..1208d57824 100644 --- a/src/archutils/Win32/GotoURL.cpp +++ b/src/archutils/Win32/GotoURL.cpp @@ -25,7 +25,7 @@ static LONG GetRegKey( HKEY key, RString subkey, LPTSTR retdata ) bool GotoURL( RString sUrl ) { // First try ShellExecute() - int iRet = (int) ShellExecute( nullptr, "open", sUrl, nullptr, nullptr, SW_SHOWDEFAULT ); + intptr_t iRet = reinterpret_cast(ShellExecute( nullptr, "open", sUrl, nullptr, nullptr, SW_SHOWDEFAULT )); // If it failed, get the .htm regkey and lookup the program if( iRet > 32 ) diff --git a/src/archutils/Win32/GraphicsWindow.cpp b/src/archutils/Win32/GraphicsWindow.cpp index ea8bf10210..8838171bec 100644 --- a/src/archutils/Win32/GraphicsWindow.cpp +++ b/src/archutils/Win32/GraphicsWindow.cpp @@ -321,13 +321,13 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce // Update the window icon. if( g_hIcon != nullptr ) { - SetClassLong( g_hWndMain, GCL_HICON, (LONG) LoadIcon(nullptr,IDI_APPLICATION) ); + SetClassLongPtrA( g_hWndMain, GCLP_HICON, reinterpret_cast(LoadIcon(nullptr,IDI_APPLICATION)) ); DestroyIcon( g_hIcon ); g_hIcon = nullptr; } g_hIcon = IconFromFile( p.sIconFile ); if( g_hIcon != nullptr ) - SetClassLong( g_hWndMain, GCL_HICON, (LONG) g_hIcon ); + SetClassLongPtrA( g_hWndMain, GCLP_HICON, reinterpret_cast(g_hIcon) ); /* The window style may change as a result of switching to or from fullscreen; * apply it. Don't change the WS_VISIBLE bit. */ diff --git a/src/archutils/Win32/WindowsDialogBox.cpp b/src/archutils/Win32/WindowsDialogBox.cpp index 40f6621769..755d034eaf 100644 --- a/src/archutils/Win32/WindowsDialogBox.cpp +++ b/src/archutils/Win32/WindowsDialogBox.cpp @@ -15,7 +15,7 @@ void WindowsDialogBox::Run( int iDialog ) DialogBoxParam( hHandle, MAKEINTRESOURCE(iDialog), nullptr, DlgProc, (LPARAM) this ); } -BOOL APIENTRY WindowsDialogBox::DlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) +INT_PTR APIENTRY WindowsDialogBox::DlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) { if( msg == WM_INITDIALOG ) SetProp( hDlg, "WindowsDialogBox", (HANDLE) lParam ); diff --git a/src/archutils/Win32/WindowsDialogBox.h b/src/archutils/Win32/WindowsDialogBox.h index 4616928aab..efa52cba32 100644 --- a/src/archutils/Win32/WindowsDialogBox.h +++ b/src/archutils/Win32/WindowsDialogBox.h @@ -15,10 +15,10 @@ public: HWND GetHwnd() { return m_hWnd; } protected: - virtual BOOL HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) { return false; } + virtual INT_PTR HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) { return false; } private: - static BOOL APIENTRY DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR APIENTRY DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); HWND m_hWnd; }; diff --git a/src/archutils/Win32/ddk/x64/dbghelp.lib b/src/archutils/Win32/ddk/x64/dbghelp.lib new file mode 100644 index 0000000000..07608792d4 Binary files /dev/null and b/src/archutils/Win32/ddk/x64/dbghelp.lib differ diff --git a/src/archutils/Win32/ddk/x64/hid.lib b/src/archutils/Win32/ddk/x64/hid.lib new file mode 100644 index 0000000000..302cf5a5b5 Binary files /dev/null and b/src/archutils/Win32/ddk/x64/hid.lib differ diff --git a/src/archutils/Win32/ddk/x64/setupapi.lib b/src/archutils/Win32/ddk/x64/setupapi.lib new file mode 100644 index 0000000000..02f2981a24 Binary files /dev/null and b/src/archutils/Win32/ddk/x64/setupapi.lib differ diff --git a/src/archutils/Win32/ddk/dbghelp.lib b/src/archutils/Win32/ddk/x86/dbghelp.lib similarity index 100% rename from src/archutils/Win32/ddk/dbghelp.lib rename to src/archutils/Win32/ddk/x86/dbghelp.lib diff --git a/src/archutils/Win32/ddk/hid.lib b/src/archutils/Win32/ddk/x86/hid.lib similarity index 100% rename from src/archutils/Win32/ddk/hid.lib rename to src/archutils/Win32/ddk/x86/hid.lib diff --git a/src/archutils/Win32/ddk/setupapi.lib b/src/archutils/Win32/ddk/x86/setupapi.lib similarity index 100% rename from src/archutils/Win32/ddk/setupapi.lib rename to src/archutils/Win32/ddk/x86/setupapi.lib diff --git a/src/archutils/Win32/mapconv.cpp b/src/archutils/Win32/mapconv.cpp index 3a5e142592..8d7efd5b05 100644 --- a/src/archutils/Win32/mapconv.cpp +++ b/src/archutils/Win32/mapconv.cpp @@ -3,6 +3,8 @@ #include #include +#include +#include #include #include #include @@ -13,7 +15,7 @@ #define MAX_GROUPS (64) struct RVAEnt { - long rva; + uintptr_t rva; char *line; }; @@ -22,10 +24,10 @@ std::vector rvabuf; char fnambuf[MAX_FNAMBUF]; char *fnamptr = fnambuf; -long segbuf[MAX_SEGMENTS][2]; -int segcnt=0; -int seggrp[MAX_SEGMENTS]; -long grpstart[MAX_GROUPS]; +uintptr_t segbuf[MAX_SEGMENTS][2]; +int segcnt = 0; +uint16_t seggrp[MAX_SEGMENTS]; +uintptr_t grpstart[MAX_GROUPS]; char line[8192]; long codeseg_flags = 0; @@ -91,7 +93,7 @@ void RemoveAnonymousNamespaces( char *p ) } -void parsename(long rva, char *func_name) { +void parsename(uintptr_t rva, char *func_name) { RemoveAnonymousNamespaces( func_name ); fnamptr = strtack(fnamptr, func_name, fnambuf+MAX_FNAMBUF); @@ -106,16 +108,13 @@ struct RVASorter { }; int main(int argc, char **argv) { - int i; - long load_addr; - - if (argc<3) { + if (argc < 3) { printf("mapconv \n"); return 0; } // TODO: Choose a better default for the vdi file. - int ver = 20151002; + int ver = 20191004; if (!(f=fopen(argv[1], "r"))) { printf("can't open listing file \"%s\"\n", argv[1]); @@ -139,19 +138,21 @@ int main(int argc, char **argv) { // printf("Reading in segment list.\n"); - while(readline()) { - long grp, start, len; + while (readline()) { + uint16_t grp; + uint32_t start; + uint32_t len; - if (3!=sscanf(line, "%lx:%lx %lx", &grp, &start, &len)) + if (sscanf(line, "%" SCNx16 ":%" SCNx32 " %" SCNx32, &grp, &start, &len) != 3) break; - if (strstr(line+49, "CODE")) { -// printf("%04x:%08lx %08lx type code\n", grp, start, len); + if (strstr(line + 49, "CODE")) { +// printf("%04" PRIx16 ":%08" PRIx32 " %08" PRIx32 " type code\n", grp, start, len); - codeseg_flags |= 1<(start); + segbuf[segcnt][1] = static_cast(len); seggrp[segcnt] = grp; ++segcnt; } @@ -166,22 +167,27 @@ int main(int argc, char **argv) { // printf("Found public symbol list.\n"); - while(readline()) { - long grp, start, rva; + while (readline()) { + uint16_t grp; + uint32_t start; + uintptr_t rva; char symname[2048]; - int i; - if (4!=sscanf(line, "%lx:%lx %s %lx", &grp, &start, symname, &rva)) + if (sscanf(line, "%" SCNx16 ":%" SCNx32 " %s %" SCNxPTR, &grp, &start, symname, &rva) != 4) break; - if (!(codeseg_flags & (1<(start); parsename(rva, symname); } // printf("Processing segment entries...\n"); - for(i=0; i(segbuf[i][0]), reinterpret_cast(segbuf[i][0] + segbuf[i][1] - 1)); } /* printf("Raw statistics:\n"); - printf("\tRVA bytes: %ld\n", rvabuf.size()*4); - printf("\tFunc name bytes: %ld\n", fnamptr - fnambuf); + printf("\tRVA bytes: %zu\n", rvabuf.size() * 4); + printf("\tFunc name bytes: %" PRIdPTR "\n", static_cast(fnamptr - fnambuf)); printf("\nPacking RVA data..."); fflush(stdout); */ std::vector::iterator itRVA = rvabuf.begin(), itRVAEnd = rvabuf.end(); std::vector rvaout; - long firstrva = (*itRVA++).rva; - long lastrva = firstrva; + uintptr_t firstrva = (*itRVA++).rva; + uintptr_t lastrva = firstrva; for(; itRVA != itRVAEnd; ++itRVA) { - long rvadiff = (*itRVA).rva - lastrva; + ptrdiff_t rvadiff = (*itRVA).rva - lastrva; lastrva += rvadiff; - if (rvadiff & 0xF0000000) rvaout.push_back((char)(0x80 | ((rvadiff>>28) & 0x7F))); - if (rvadiff & 0xFFE00000) rvaout.push_back((char)(0x80 | ((rvadiff>>21) & 0x7F))); - if (rvadiff & 0xFFFFC000) rvaout.push_back((char)(0x80 | ((rvadiff>>14) & 0x7F))); - if (rvadiff & 0xFFFFFF80) rvaout.push_back((char)(0x80 | ((rvadiff>> 7) & 0x7F))); +#if _WIN64 + if (rvadiff & 0x8000000000000000) rvaout.push_back((char)(0x80 | ((rvadiff >> 63) & 0x7F))); + if (rvadiff & 0xFF00000000000000) rvaout.push_back((char)(0x80 | ((rvadiff >> 56) & 0x7F))); + if (rvadiff & 0xFFFE000000000000) rvaout.push_back((char)(0x80 | ((rvadiff >> 49) & 0x7F))); + if (rvadiff & 0xFFFFFC0000000000) rvaout.push_back((char)(0x80 | ((rvadiff >> 42) & 0x7F))); + if (rvadiff & 0xFFFFFFF800000000) rvaout.push_back((char)(0x80 | ((rvadiff >> 35) & 0x7F))); + if (rvadiff & 0xFFFFFFFFF0000000) rvaout.push_back((char)(0x80 | ((rvadiff >> 28) & 0x7F))); + if (rvadiff & 0xFFFFFFFFFFE00000) rvaout.push_back((char)(0x80 | ((rvadiff >> 21) & 0x7F))); + if (rvadiff & 0xFFFFFFFFFFFFC000) rvaout.push_back((char)(0x80 | ((rvadiff >> 14) & 0x7F))); + if (rvadiff & 0xFFFFFFFFFFFFFF80) rvaout.push_back((char)(0x80 | ((rvadiff >> 7) & 0x7F))); +#else + if (rvadiff & 0xF0000000) rvaout.push_back((char)(0x80 | ((rvadiff >> 28) & 0x7F))); + if (rvadiff & 0xFFE00000) rvaout.push_back((char)(0x80 | ((rvadiff >> 21) & 0x7F))); + if (rvadiff & 0xFFFFC000) rvaout.push_back((char)(0x80 | ((rvadiff >> 14) & 0x7F))); + if (rvadiff & 0xFFFFFF80) rvaout.push_back((char)(0x80 | ((rvadiff >> 7) & 0x7F))); +#endif rvaout.push_back((char)(rvadiff & 0x7F)); } -// printf("%ld bytes\n", rvaout.size()); +// printf("%zu bytes\n", rvaout.size()); // dump data - static const char header[64]="symbolic debug information\r\n\x1A"; + static const char header[64] = "symbolic debug information\r\n\x1A"; fwrite(header, 64, 1, fo); - long t; + size_t t; - t = ver; - fwrite(&t, 4, 1, fo); + fwrite(&ver, sizeof ver, 1, fo); - t = rvaout.size() + 4; - fwrite(&t, 4, 1, fo); + t = rvaout.size() + sizeof firstrva; + fwrite(&t, sizeof t, 1, fo); t = fnamptr - fnambuf; - fwrite(&t, 4, 1, fo); + fwrite(&t, sizeof t, 1, fo); - t = segcnt; - fwrite(&t, 4, 1, fo); + fwrite(&segcnt, sizeof segcnt, 1, fo); - fwrite(&firstrva, 4, 1, fo); + fwrite(&firstrva, sizeof firstrva, 1, fo); fwrite(&rvaout[0], rvaout.size(), 1, fo); fwrite(fnambuf, fnamptr - fnambuf, 1, fo); - fwrite(segbuf, segcnt*8, 1, fo); + fwrite(segbuf, segcnt * 2 * sizeof(uintptr_t), 1, fo); // really all done if (fclose(fo)) throw "output file close failed"; - } catch(const char *s) { + } catch (const char *s) { fprintf(stderr, "%s: %s\n", argv[1], s); } diff --git a/src/ezsockets.cpp b/src/ezsockets.cpp index a665febb51..92bbbad819 100644 --- a/src/ezsockets.cpp +++ b/src/ezsockets.cpp @@ -60,7 +60,7 @@ namespace #endif int MAXCON; - int sock; + uintptr_t sock; struct sockaddr_in addr; struct sockaddr_in fromAddr; @@ -439,7 +439,7 @@ int EzSockets::ReadPack(char *data, unsigned int max) int size = PeekPack(data, max); if (size != -1) - inBuffer = inBuffer.substr(size+4); + inBuffer = inBuffer.substr(static_cast(size) + 4); return size; } @@ -466,10 +466,10 @@ int EzSockets::PeekPack(char *data, unsigned int max) size = ntohl(size); if (blocking) - while (inBuffer.length()<(size+4) && !IsError()) + while (inBuffer.length()<(static_cast(size) + 4) && !IsError()) pUpdateRead(); else - if (inBuffer.length()<(size+4) || inBuffer.length()<=4) + if (inBuffer.length()<(static_cast(size) + 4) || inBuffer.length()<=4) return -1; if (IsError()) diff --git a/src/global.cpp b/src/global.cpp index f9b6bef8d2..b06af3a350 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -10,6 +10,9 @@ # include "windows.h" # include "archutils/Win32/Crash.h" # endif +# if defined(_MSC_VER) +# include +# endif #elif defined(MACOSX) # include "archutils/Darwin/Crash.h" # include @@ -46,7 +49,7 @@ void NORETURN sm_crash( const char *reason ) /* Do something after the above, so the call/return isn't optimized to a jmp; that * way, this function will appear in backtrace stack traces. */ #if defined(_MSC_VER) - _asm nop; + __nop(); #elif defined(__GNUC__) // MinGW or similar asm("nop"); #endif